CCNetConfig

Continuous Integration, Simplified Configuration

Home | Wiki | About | Login | Contact |
subscribeSubscribe
Subscribe
CCNetConfig
Releases
Beta Releases
Stable Releases
Work Items
Discussions
CPRP
Releases
Beta Releases
Stable Releases
RSS Builds Publisher
Releases
Beta Releases
Stable Releases
Current Release
0.5.0.120
Sun, Jan 20 2008 at 10:02 PM
All Releases
CCNetConfig Build Status
  • Build StatusSuccess
  • Label0.6.420.32915
  • Last Build4/28/2008 6:43 AM
  • Next Build7/24/2008 12:00 AM
Recent Work Items
  • Automated: Unhandled exceptio…
  • Automated: Object reference n…
  • support for SvnRevisionLabell…
  • Automated: Uncommon behaviour…
  • Automated: create a new confi…
  • Copying and pasting a task do…
  • Automated: Invalid URI: The U…
  • Automated: Cannot import a nu…
  • Remove support for plugins in…
  • Show splash screen on initial…
Legend: Proposed Active Fixed Closed
Tag Cloud
  • A Little Class
  • Automation
  • C#
  • CCNet
  • CCNetConfig
  • codeplex
  • CodePlexAPI
  • Continuous Integration
  • CruiseControl.NET
  • feedburner
  • google
  • JSON
  • LOLCode
  • MSBuild
  • RssBuildsPublisher
  • Sandcastle
  • subtext
  • subversion
  • SvnLabeller
  • tfs
  • twitter
  • Visual Studio
  • Wix
  • XML
  • xna
more tags...
Archives
  • July, 2008 (2)
  • May, 2008 (3)
  • April, 2008 (5)
  • March, 2008 (8)
  • February, 2008 (6)
  • January, 2008 (7)
  • December, 2007 (11)
  • November, 2007 (7)
  • October, 2007 (5)
  • September, 2007 (8)
  • August, 2007 (5)
  • June, 2007 (7)
  • May, 2007 (5)
  • April, 2007 (23)
  • March, 2007 (27)
  • February, 2007 (12)
  • January, 2007 (9)
  • December, 2006 (2)
  • November, 2006 (12)
  • October, 2006 (17)
  • September, 2006 (8)
  • August, 2006 (30)
 
Image Galleries
  • Screenshots
  • A Little Class
Post Categories
  • Announcements
  • Automation
  • Beta
  • Beta Marker
  • C#
  • CCNetConfig
  • CCNetConfig.BugTracking
  • CCnetConfig.CCNet
  • CCNetConfig.Core
  • CCNetConfig.GUI
  • CCNetConfig.Updater
  • CCNetConfig.Updater.Core
  • CodePlex
  • CodePlex Release Publisher
  • CodePlexAPI
  • Continuous Integration
  • CruiseControl.NET
  • Extending CCNetConfig
  • MSBuild
  • MsBuild Extended Tasks
  • News
  • Nightly
  • Orcas
  • Project Extension
  • Rant
  • Reflector
  • Release
  • RssBuildsPublisher
  • Sandcastle
  • SubText
  • SubVersion
  • TFS
  • TFS Plugin
  • Tools
  • TortiseSVN
  • Vista
  • Visual Studio
  • Wiki
  • Wix
  • XAML
  • Xbox Live
  • Zune
 

Blog Statistics
  • Posts219
  • Articles0
  • Comments36
  • Trackbacks5
Home
Download
Screenshots
Support
License
Source

September 2007 Entries

A Little Class (System.Xml.Serialization.XmlSerializer)
This weeks Little Class is the System.Xml.Serialization.XmlSerializer. The XmlSerializer class generates an XmlDocument from .NET types. It can also load that XmlDocument in to create the object as well. One thing that is important when serializing a type is the use of the Xml Serialization Attributes. You will see in the comments in the code below how the comments determine the way the Xml is created and read back in.

1using System; 2using System.Collections.Generic; 3using System.Text; 4using System.Xml.Serialization; 5using System.IO; 6 7namespace ALittleClass ...{ 8 class Program ...{ 9 static void Main ( string[ ] args ) ...{ 10 // create the XmlSerializerFactor 11 XmlSerializerFactory factory = new XmlSerializerFactory ( ); 12 // Create the memory stream that will be used to store the serialized data 13 MemoryStream ms = new MemoryStream ( ); 14 // create the serializer 15 XmlSerializer serializer = factory.CreateSerializer ( typeof ( Settings ) ); 16 using ( ms ) ...{ 17 // create the settings class 18 Settings settings = new Settings ( ); 19 // set some values. 20 settings.Name = "Ryan"; 21 settings.ShowName = false; 22 settings.Friends.Add ( "Nick" ); 23 settings.Friends.Add ( "Scott" ); 24 settings.Friends.Add ( "Kevin" ); 25 settings.Friends.Add ( "Jeff" ); 26 settings.Friends.Add ( "Jon" ); 27 // display when the settings class was created 28 Console.WriteLine ( "Settings Created at {0}\n", settings.TimeStamp.ToString ( ) ); 29 // serialize the settings 30 serializer.Serialize ( ms, settings ); 31 32 // reset the position of the memory stream 33 ms.Position = 0; 34 // create a stream reader to read the xml 35 StreamReader sr = new StreamReader ( ms ); 36 using ( sr ) ...{ 37 // output the xml 38 while ( !sr.EndOfStream ) 39 Console.WriteLine ( sr.ReadLine ( ) ); 40 // reset the position again so the xml can be deserialized 41 ms.Position = 0; 42 Console.WriteLine ( "-------" ); 43 // sleep for 5 seconds so we can see that the setting class was recreated again at a later time 44 System.Threading.Thread.Sleep ( 5000 ); 45 // create an xml text reader so we can check that it can be deserialized 46 System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader ( ms ); 47 using ( reader ) ...{ 48 // destroy our original settings object 49 settings = null; 50 // check that we can deserialize 51 if ( serializer.CanDeserialize ( reader ) ) ...{ 52 // deserialize the xml to a Settings object 53 settings = serializer.Deserialize ( reader ) as Settings; 54 // ouput the values in the settings object 55 Console.WriteLine ( "Name: {0}", settings.Name ); 56 Console.WriteLine ( "ShowName: {0}", settings.ShowName ); 57 Console.WriteLine ( "Friends:" ); 58 foreach ( string friend in settings.Friends ) ...{ 59 Console.WriteLine ( "\t{0}", friend ); 60 } 61 // display when this settings object was created... should be 5 seconds after the first one 62 Console.WriteLine ( "Settings Created at {0}", settings.TimeStamp.ToString ( ) ); 63 } else // we had a problem 64 Console.WriteLine ( "Unable to load in settings xml" ); 65 } 66 } 67 } 68 // wait for enter 69 Console.ReadLine ( ); 70 } 71 } 72 73 74 // This attribute sets what the expected root element name will be. 75 [XmlRoot ( "MySettings" )] 76 public class Settings ...{ 77 private string _name; 78 private bool _showName = true; 79 private List<string> _friends; 80 private DateTime _creationTime = DateTime.MinValue; 81 public Settings ( ) ...{ 82 _friends = new List<string> ( ); 83 this.TimeStamp = DateTime.Now; 84 } 85 // This attribute sets that all the items in the collection will be contained in an element named Friends 86 [XmlArray ( "Friends" ), 87 // This attribute sets that each item in the collection will have its own element named Friend 88 XmlArrayItem ( "Friend" )] 89 public List<string> Friends ...{ 90 get ...{ return _friends; } 91 set ...{ _friends = value; } 92 } 93 // This attribute sets that this property will be an attribute of the root element 94 [XmlAttribute ( "ShowName" )] 95 public bool ShowName ...{ 96 get ...{ return _showName; } 97 set ...{ _showName = value; } 98 } 99 100 // This attribute sets that this property will be an element named Name 101 [XmlElement ( "Name" )] 102 public string Name ...{ 103 get ...{ return _name; } 104 set ...{ _name = value; } 105 } 106 // This attribute sets that this property will not be serialized. 107 [XmlIgnore] 108 public DateTime TimeStamp ...{ 109 get ...{ return this._creationTime; } 110 set ...{ this._creationTime = value; } 111 } 112 } 113} 114


Settings Created at 9/28/2007 7:06:29 PM

<?xml version="1.0"?>
<MySettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ShowName="false">
<Friends>
<Friend>Nick</Friend>
<Friend>Scott</Friend>
<Friend>Kevin</Friend>
<Friend>Jeff</Friend>
<Friend>Jon</Friend>
</Friends>
<Name>Ryan</Name>
</MySettings>
-------
Name: Ryan
ShowName: False
Friends:
Nick
Scott
Kevin
Jeff
Jon
Settings Created at 9/28/2007 7:06:34 PM
Technorati Tags:[ System.Xml.Serialization.XmlSerializer ] [ A Little Class ] [ C# ]
Filed Under [ C# ]
Ryan Conrad posted @ Friday, September 28, 2007 7:12 PM | Comments (0)
DotNetKicks Deploy Aplha JSON Services
DotNetKicks announced a set of alpha JSON services that allow developers to get popular stories, upcoming stories, and information about the DotNetKicks system and service. DotNetKicks is now an open source project hosted on Google Code.

There is also a test page provided so you can try out the services. A full list of supported calls can also be seen on the test page.
Technorati Tags:[ DotNetKicks ] [ JSON ]
Filed Under [ Tools ]
Ryan Conrad posted @ Tuesday, September 25, 2007 5:42 PM | Comments (0)
Source Browser Now Available
I have put up the first version of the source browser. This allows access to view the latest source that CCNet has used for building a release. Since the source browser uses the files that are used in building, the source browser will not be available when CruiseControl is checking for modifications or building.

For viewing purposes, there is a toolbar with buttons to hide the file treeview and the information panel on the right. This gives almost 100% of the width of the screen for viewing the source code. The initial load of the page may be slow because currently the entire tree is loaded. The next version will dynamically load child nodes when they are expanded.
Technorati Tags:[ C# ] [ Source Browser ]
Filed Under [ Announcements ]
Ryan Conrad posted @ Sunday, September 23, 2007 1:22 PM | Comments (0)
A Little Class (System.TimeZone)
This is a reoccurring topic that I am starting where I will pick a class in the .NET framework and describe what it is and give some example code for using it. This will be a weekly post and I am starting off with the System.TimeZone class.

The System.TimeZone class represents a timezone is a geographical region in which the same standard time is used. This class does not have any public constructors, instead you use the static CurrentTimeZone property to get an instance of the CurrentSystemTimeZone.

Example

1using System;
2using System.Globalization;
3
4namespace ALittleClass ...{
5 class Program ...{
6 static void Main ( string[] args ) ...{
7 // Get the Current System TimeZone
8 TimeZone timezone = TimeZone.CurrentTimeZone;
9 Console.WriteLine ( "Standard Name: {0}", timezone.StandardName );
10 Console.WriteLine ( "Daylight Name: {0}", timezone.DaylightName );
11 // Get if currently in DLS
12 Console.WriteLine ( "Is {1} in daylight savings time? {0}", timezone.IsDaylightSavingTime ( DateTime.Now ), DateTime.Now);
13
14 Console.WriteLine ( "Daylight Saving time for {0}", DateTime.Now.Year );
15 // Gets when Daylight savings changes
16 DaylightTime daylightTime = timezone.GetDaylightChanges ( DateTime.Now.Year );
17 Console.WriteLine ( "DaylightTime Starts on {0}", daylightTime.Start.ToString ( ) );
18 Console.WriteLine ( "DaylightTime Ends on {0}", daylightTime.End.ToString ( ) );
19
20 Console.WriteLine ( "Delta: {0}", daylightTime.Delta );
21
22 // Get UTC Offset
23 Console.WriteLine ( "UTC offset: {0}", timezone.GetUtcOffset ( DateTime.Now ) );
24