#region File Information
/// -------------------------------------------------------------------------------------------
/// <Author>Naveen Nayak</Author>
/// <CreatedOn>May 31, 2004</CreatedOn>
/// <ModifiedBy></ModifiedBy>
/// <ModifiedOn></ModifiedOn>
/// <Summary>
/// This class is responsible for providing user interface for Version Control.
/// </Summary>
/// <Reference>
/// </Reference>
/// <ReviewedBy></ReviewedBy>
/// <ReviewDate></ReviewDate>
/// -------------------------------------------------------------------------------------------
#endregion File Information
#region Namespace
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Collections.Specialized ;
using System.Configuration ;
using System.IO ;
using System.Xml ;
#endregion //Namespace
namespace GMSBU.NaveenNayak.VersionControl
{
/// <summary>
/// Form shows the GUI for Version Control - has all the bussiness logic methods
/// </summary>
internal class VersionControler : System.Windows.Forms.Form
{
#region compiler
private System.Windows.Forms.FolderBrowserDialog buildFolder;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox txtFolderPath;
private System.Windows.Forms.Button browseButton;
private System.Windows.Forms.Button btnVersion;
private System.Windows.Forms.DataGrid fileGrid;
private System.Windows.Forms.Label lblOldversion;
private System.Windows.Forms.Label lblNewVersion;
private System.Windows.Forms.Label lblCounter;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label totalfileLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.NumericUpDown Major;
private System.Windows.Forms.NumericUpDown Minor;
private System.Windows.Forms.RadioButton AutoIncreamenType;
private System.Windows.Forms.RadioButton ManualIncreamenType;
private System.Windows.Forms.NumericUpDown Build;
private System.Windows.Forms.NumericUpDown Revision;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buildFolder = new System.Windows.Forms.FolderBrowserDialog();
this.browseButton = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.ManualIncreamenType = new System.Windows.Forms.RadioButton();
this.AutoIncreamenType = new System.Windows.Forms.RadioButton();
this.Revision = new System.Windows.Forms.NumericUpDown();
this.Build = new System.Windows.Forms.NumericUpDown();
this.Minor = new System.Windows.Forms.NumericUpDown();
this.Major = new System.Windows.Forms.NumericUpDown();
this.btnVersion = new System.Windows.Forms.Button();
this.txtFolderPath = new System.Windows.Forms.TextBox();
this.fileGrid = new System.Windows.Forms.DataGrid();
this.lblOldversion = new System.Windows.Forms.Label();
this.lblNewVersion = new System.Windows.Forms.Label();
this.lblCounter = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.totalfileLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Revision)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Build)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Minor)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Major)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.fileGrid)).BeginInit();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// browseButton
//
this.browseButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.browseButton.ForeColor = System.Drawing.Color.White;
this.browseButton.Location = new System.Drawing.Point(656, 24);
this.browseButton.Name = "browseButton";
this.browseButton.Size = new System.Drawing.Size(80, 24);
this.browseButton.TabIndex = 0;
this.browseButton.Text = "Browse ...";
this.browseButton.Click += new System.EventHandler(this.browseButton_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.ManualIncreamenType);
this.groupBox1.Controls.Add(this.AutoIncreamenType);
this.groupBox1.Controls.Add(this.Revision);
this.groupBox1.Controls.Add(this.Build);
this.groupBox1.Controls.Add(this.Minor);
this.groupBox1.Controls.Add(this.Major);
this.groupBox1.Controls.Add(this.btnVersion);
this.groupBox1.Controls.Add(this.txtFolderPath);
this.groupBox1.Controls.Add(this.browseButton);
this.groupBox1.ForeColor = System.Drawing.Color.Yellow;
this.groupBox1.Location = new System.Drawing.Point(16, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(784, 160);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Version";
//
// label5
//
this.label5.AutoSize = true;
this.label5.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label5.Location = new System.Drawing.Point(368, 96);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(43, 16);
this.label5.TabIndex = 10;
this.label5.Text = "Version";
//
// label4
//
this.label4.AutoSize = true;
this.label4.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label4.Location = new System.Drawing.Point(320, 96);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(29, 16);
this.label4.TabIndex = 9;
this.label4.Text = "Build";
//
// label3
//
this.label3.AutoSize = true;
this.label3.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label3.Location = new System.Drawing.Point(248, 96);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(33, 16);
this.label3.TabIndex = 8;
this.label3.Text = "Minor";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.AutoSize = true;
this.label2.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label2.Location = new System.Drawing.Point(192, 96);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(33, 16);
this.label2.TabIndex = 7;
this.label2.Text = "Major";
//
// ManualIncreamenType
//
this.ManualIncreamenType.ForeColor = System.Drawing.Color.White;
this.ManualIncreamenType.Location = new System.Drawing.Point(16, 112);
this.ManualIncreamenType.Name = "ManualIncreamenType";
this.ManualIncreamenType.Size = new System.Drawing.Size(120, 16);
this.ManualIncreamenType.TabIndex = 1;
this.ManualIncreamenType.Text = "Manual Increment ";
//
// AutoIncreamenType
//
this.AutoIncreamenType.Checked = true;
this.AutoIncreamenType.ForeColor = System.Drawing.Color.White;
this.AutoIncreamenType.Location = new System.Drawing.Point(16, 64);
this.AutoIncreamenType.Name = "AutoIncreamenType";
this.AutoIncreamenType.Size = new System.Drawing.Size(136, 24);
this.AutoIncreamenType.TabIndex = 1;
this.AutoIncreamenType.TabStop = true;
this.AutoIncreamenType.Text = "Automatic Increment";
//
// Revision
//
this.Revision.Location = new System.Drawing.Point(304, 120);
this.Revision.Maximum = new System.Decimal(new int[] {
9999,
0,
0,
0});
this.Revision.Name = "Revision";
this.Revision.Size = new System.Drawing.Size(56, 20);
this.Revision.TabIndex = 6;
//
// Build
//
this.Build.Location = new System.Drawing.Point(368, 120);
this.Build.Maximum = new System.Decimal(new int[] {
999,
0,
0,
0});
this.Build.Name = "Build";
this.Build.Size = new System.Drawing.Size(48, 20);
this.Build.TabIndex = 5;
//
// Minor
//
this.Minor.Location = new System.Drawing.Point(240, 120);
this.Minor.Name = "Minor";
this.Minor.Size = new System.Drawing.Size(56, 20);
this.Minor.TabIndex = 4;
//
// Major
//
this.Major.Location = new System.Drawing.Point(184, 120);
this.Major.Minimum = new System.Decimal(new int[] {
1,
0,
0,
0});
this.Major.Name = "Major";
this.Major.Size = new System.Drawing.Size(48, 20);
this.Major.TabIndex = 3;
this.Major.Value = new System.Decimal(new int[] {
1,
0,
0,
0});
//
// btnVersion
//
this.btnVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.btnVersion.ForeColor = System.Drawing.Color.White;
this.btnVersion.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnVersion.Location = new System.Drawing.Point(616, 80);
this.btnVersion.Name = "btnVersion";
this.btnVersion.Size = new System.Drawing.Size(120, 32);
this.btnVersion.TabIndex = 2;
this.btnVersion.Text = "Change Version";
this.btnVersion.Click += new System.EventHandler(this.btnVersion_Click);
//
// txtFolderPath
//
this.txtFolderPath.BackColor = System.Drawing.Color.White;
this.txtFolderPath.Enabled = false;
this.txtFolderPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtFolderPath.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(64)), ((System.Byte)(0)));
this.txtFolderPath.Location = new System.Drawing.Point(8, 16);
this.txtFolderPath.Multiline = true;
this.txtFolderPath.Name = "txtFolderPath";
this.txtFolderPath.Size = new System.Drawing.Size(640, 32);
this.txtFolderPath.TabIndex = 1;
this.txtFolderPath.Text = "";
//
// fileGrid
//
this.fileGrid.AllowDrop = true;
this.fileGrid.AllowNavigation = false;
this.fileGrid.AlternatingBackColor = System.Drawing.Color.Silver;
this.fileGrid.BackColor = System.Drawing.Color.LightGray;
this.fileGrid.BackgroundColor = System.Drawing.SystemColors.ActiveCaptionText;
this.fileGrid.CaptionBackColor = System.Drawing.Color.Navy;
this.fileGrid.CaptionText = "List of Version Changed Files ";
this.fileGrid.DataMember = "";
this.fileGrid.HeaderBackColor = System.Drawing.SystemColors.ControlDark;
this.fileGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.fileGrid.Location = new System.Drawing.Point(12, 248);
this.fileGrid.Name = "fileGrid";
this.fileGrid.ParentRowsBackColor = System.Drawing.SystemColors.ControlDark;
this.fileGrid.PreferredColumnWidth = 370;
this.fileGrid.ReadOnly = true;
this.fileGrid.SelectionBackColor = System.Drawing.Color.DarkBlue;
this.fileGrid.SelectionForeColor = System.Drawing.SystemColors.Control;
this.fileGrid.Size = new System.Drawing.Size(784, 224);
this.fileGrid.TabIndex = 8;
//
// lblOldversion
//
this.lblOldversion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblOldversion.ForeColor = System.Drawing.Color.Maroon;
this.lblOldversion.Location = new System.Drawing.Point(128, 24);
this.lblOldversion.Name = "lblOldversion";
this.lblOldversion.Size = new System.Drawing.Size(168, 16);
this.lblOldversion.TabIndex = 3;
//
// lblNewVersion
//
this.lblNewVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblNewVersion.ForeColor = System.Drawing.Color.Maroon;
this.lblNewVersion.Location = new System.Drawing.Point(128, 48);
this.lblNewVersion.Name = "lblNewVersion";
this.lblNewVersion.Size = new System.Drawing.Size(168, 16);
this.lblNewVersion.TabIndex = 6;
//
// lblCounter
//
this.lblCounter.BackColor = System.Drawing.Color.Gray;
this.lblCounter.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblCounter.ForeColor = System.Drawing.Color.Maroon;
this.lblCounter.Location = new System.Drawing.Point(456, 24);
this.lblCounter.Name = "lblCounter";
this.lblCounter.Size = new System.Drawing.Size(48, 16);
this.lblCounter.TabIndex = 7;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.totalfileLabel);
this.groupBox2.Controls.Add(this.lblOldversion);
this.groupBox2.Controls.Add(this.lblNewVersion);
this.groupBox2.Controls.Add(this.lblCounter);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(128)));
this.groupBox2.Location = new System.Drawing.Point(16, 168);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(784, 72);
this.groupBox2.TabIndex = 9;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Version History";
//
// totalfileLabel
//
this.totalfileLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.totalfileLabel.ForeColor = System.Drawing.Color.White;
this.totalfileLabel.Location = new System.Drawing.Point(344, 24);
this.totalfileLabel.Name = "totalfileLabel";
this.totalfileLabel.Size = new System.Drawing.Size(112, 16);
this.totalfileLabel.TabIndex = 8;
this.totalfileLabel.Text = "Total Files Updated :";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(16, 48);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(74, 16);
this.label1.TabIndex = 4;
this.label1.Text = "New Version :";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label6.ForeColor = System.Drawing.Color.White;
this.label6.Location = new System.Drawing.Point(16, 24);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(106, 16);
this.label6.TabIndex = 5;
this.label6.Text = "Config File Version :";
//
// VersionControler
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.Gray;
this.ClientSize = new System.Drawing.Size(808, 493);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.fileGrid);
this.Controls.Add(this.groupBox1);
this.IsMdiContainer = true;
this.MaximizeBox = false;
this.Name = "VersionControler";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Version Control : ( Naveen Nayak )";
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Revision)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.Build)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.Minor)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.Major)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.fileGrid)).EndInit();
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new VersionControler());
}//Main
#endregion compiler
#region Constructor
public VersionControler()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
GetPreviousVersionNumber();
}//VersionControler(0
#endregion Constructor
#region Memeber variable
private int versionRevision;
private string versionMajorMinor;
private DataTable fileTable=null;
private DataRow newRow=null;
#endregion Memeber variable
#region Member methods
#region GetPreviousVersionNumber
///<Author>Naveen Nayak</Author>
///<CreatedOn>May 4,2005</CreatedOn>
///<ModifiedBy></ModifiedBy>
///<ModifiedOn></ModifiedOn>
///<summary>
///Purpose: reads the Previous version number from the Config file
///</summary>
///<exception></exception>
///<remarks></remarks>
private void GetPreviousVersionNumber()
{
XmlDocument doc=null;
XmlNodeList nodeList=null;
try
{
doc = new XmlDocument();
doc.Load(Application.ExecutablePath + VersionControlConstants.VersionFileExtension);
nodeList = doc.GetElementsByTagName(VersionControlConstants.VersionConfigSection);
if(nodeList.Count != 0 )
{
foreach(XmlNode xmlNode in nodeList[0].ChildNodes)
{
switch(xmlNode.Name )
{
case VersionControlConstants.TagMajorMinorBuild :
versionMajorMinor = xmlNode.Attributes[VersionControlConstants.TagAttributeValue].Value ;
break;
case VersionControlConstants.TagRevision :
versionRevision = int.Parse(xmlNode.Attributes[VersionControlConstants.TagAttributeValue].Value ) ;
break;
}//switch
}//foreach
}//if
lblOldversion.Text = versionMajorMinor + "."+versionRevision ;
}//try
catch(Exception exp)
{
MessageBox.Show(exp.Message ,VersionControlConstants.MessageBoxCaption,MessageBoxButtons.OK);
}//catch
finally
{
doc=null;
nodeList = null;
}//finally
}//GetVersionNumber()
#endregion GetPreviousVersionNumber
#region GetFilesList
///<Author>Naveen Nayak</Author>
///<CreatedOn>May 5,2005</CreatedOn>
///<ModifiedBy></ModifiedBy>
///<ModifiedOn></ModifiedOn>
///<summary>
///Purpose: populates all the Assemblyinfo file paths from the selected folder
///</summary>
///<exception></exception>
///<remarks></remarks>
private void GetFilesList(string folderName)
{
string[] searchedFiles;
string [] subDirectories;
try
{
searchedFiles = Directory.GetFiles(folderName, VersionControlConstants.VersionFileType);
if(searchedFiles.Length > 0 )
{
PopulateFileList(searchedFiles);
}//if
subDirectories = Directory.GetDirectories(folderName);
foreach(string subDirectory in subDirectories)
{
GetFilesList(subDirectory);
}
}//try
catch(Exception exp)
{
MessageBox.Show(exp.Message ,VersionControlConstants.MessageBoxCaption,MessageBoxButtons.OK);
}//catch
}//GetFilesList
#endregion GetFilesList
#region ChangeNewVersion
///<Author>Naveen Nayak</Author>
///<CreatedOn>May 4,2005</CreatedOn>
///<ModifiedBy></ModifiedBy>
///<ModifiedOn></ModifiedOn>
///<summary>
///Purpose: Changes the Version number in the config file
///</summary>
///<exception></exception>
///<remarks></remarks>
private bool ChangeNewVersion(string newAssemblyVersaion)
{
bool success= false;
string lineRead=null;
string newValue=null;
string newFile=null;
string fileName=null;
int count=0;
try
{
newValue= @"[assembly: AssemblyVersion(""" + newAssemblyVersaion + @""")] ";
count = 1 ;
foreach(DataRow row in fileTable.Rows)
{
string [] versionArray;
lblCounter.Text = count.ToString() ;
count = count + 1 ;
newFile = "";
fileName = row[VersionControlConstants.TableColFilePath].ToString();
FileStream stream = new FileStream(fileName,FileMode.Open,FileAccess.Read);
StreamReader reader = new StreamReader(stream);
while(reader.Peek() > -1 )
{
lineRead = reader.ReadLine().Trim() ;
if(lineRead.IndexOf(VersionControlConstants.SearchCriteriaString ) > 0 )
{
versionArray = lineRead.Split('"');
row[1] = versionArray[1].ToString();
newFile = newFile + newValue + Environment.NewLine ;
}
else
{
newFile = newFile + lineRead + Environment.NewLine ;
}//else
}//while
reader.Close();
stream.Close();
File.Delete(fileName);
StreamWriter writer = new StreamWriter(fileName,false);
writer.WriteLine(newFile);
writer.Close();
}//foreach
success = true;
}//try
catch(Exception exp)
{
MessageBox.Show(exp.Message ,VersionControlConstants.MessageBoxCaption,MessageBoxButtons.OK);
}//catch
return success;
}//ChangeNewVersion
#endregion ChangeNewVersion
#region UpdateConfigVersion
///<Author>Naveen Nayak</Author>
///<CreatedOn>May 4,2005</CreatedOn>
///<ModifiedBy></ModifiedBy>
///<ModifiedOn></ModifiedOn>
///<summary>
///Purpose: Updates the Version number in the Application config file
///</summary>
///<exception></exception>
///<remarks></remarks>
private void UpdateConfigVersion(string newVer,string tagName)
{
XmlDocument doc=null;
XmlNode node=null;
XmlAttribute xmlAttr=null;
XmlAttributeCollection attrColl=null;
XmlNodeList nodeList=null;
string filePth;
try
{
doc = new XmlDocument();
filePth = Application.ExecutablePath +VersionControlConstants.VersionFileExtension;
doc.Load(filePth);
nodeList = doc.GetElementsByTagName(tagName);
IEnumerator ienum = nodeList.GetEnumerator();
while (ienum.MoveNext())
{
node = (XmlNode) ienum.Current;
attrColl = node.Attributes ;
IEnumerator ienumAttr = attrColl.GetEnumerator();
while (ienumAttr.MoveNext())
{
xmlAttr = (XmlAttribute)ienumAttr.Current;
if(xmlAttr.Name ==VersionControlConstants.TagAttributeValue)
{
xmlAttr.Value = newVer;
break;
}
} //while
} //while ienum
doc.Save(filePth );
}//try
catch(Exception exp)
{
MessageBox.Show(exp.Message ,VersionControlConstants.MessageBoxCaption ,MessageBoxButtons.OK);
}//catch
}//UpdateConfigVersion
#endregion UpdateConfigVersion
#region PopulateFileList
///<Author>Naveen Nayak</Author>
///<CreatedOn>May 4,2005</CreatedOn>
///<ModifiedBy></ModifiedBy>
///<ModifiedOn></ModifiedOn>
///<summary>
///Purpose: populates all the Assemblyinfo file path in the datatable
///</summary>
///<exception></exception>
///<remarks></remarks>
private void PopulateFileList(string [] searchedFiles)
{
try
{
foreach(string fileName in searchedFiles)
{
newRow = fileTable.NewRow();
newRow[VersionControlConstants.TableColFilePath]= fileName;
fileTable.Rows.Add(newRow );
}//foreach
}//try
catch(Exception exp)
{
MessageBox.Show(exp.Message ,VersionControlConstants.MessageBoxCaption,MessageBoxButtons.OK);
}//catch
}//PopulateFileList
#endregion PopulateFileList
#endregion Member methods
#region Events
#region browseButton_Click
///<Author>Naveen Nayak</Author>
///<CreatedOn>May 4,2005</CreatedOn>
///<ModifiedBy></ModifiedBy>
///<ModifiedOn></ModifiedOn>
///<summary>
///Purpose: Browse button clicked
///</summary>
///<exception></exception>
///<remarks></remarks>
private void browseButton_Click(object sender, System.EventArgs e)
{
try
{
DialogResult result = buildFolder.ShowDialog();
if( result == DialogResult.OK )
{
txtFolderPath.Text = buildFolder.SelectedPath;
}//if
}//try
catch(Exception exp)
{
MessageBox.Show(exp.Message ,VersionControlConstants.MessageBoxCaption,MessageBoxButtons.OK);
}//catch
}//browseButton_Click
#endregion browseButton_Click
#region btnVersion_Click
///<Author>Naveen Nayak</Author>
///<CreatedOn>May 4,2005</CreatedOn>
///<ModifiedBy></ModifiedBy>
///<ModifiedOn></ModifiedOn>
///<summary>
///Purpose: Increments the version
///</summary>
///<exception></exception>
///<remarks></remarks>
private void btnVersion_Click(object sender, System.EventArgs e)
{
string newVersion=null;
try
{
if(txtFolderPath.Text.Trim() == null || txtFolderPath.Text.Trim() == "")
{
MessageBox.Show(VersionControlConstants.ErrorEmptyFolder ,VersionControlConstants.MessageBoxCaption,MessageBoxButtons.OK);
}//if
else
{
fileTable = new DataTable();
fileTable.Columns.Add(VersionControlConstants.TableColFilePath,typeof(string));
fileTable.Columns.Add(VersionControlConstants.TableColConfigVersion,typeof(string));
//get the Assemblyinfo file list
Cursor.Current = Cursors.WaitCursor ;
GetFilesList(txtFolderPath.Text);
Cursor.Current = Cursors.Default ;
if(fileTable != null && fileTable.Rows.Count > 0)
{
Cursor.Current = Cursors.WaitCursor ;
GetPreviousVersionNumber();
//if AutoIncreamented
if( AutoIncreamenType.Checked)
{
int nVersion = versionRevision + 1 ;
newVersion = versionMajorMinor + "." + nVersion ;
if( ChangeNewVersion(newVersion) )
{
UpdateConfigVersion( nVersion.ToString() , VersionControlConstants.TagRevision ) ;
}//if
}//if
else //manual Increament
{
newVersion = Major.Value + "." + Minor.Value + "." + Build.Value + "." + Revision.Value ;
if( ChangeNewVersion(newVersion))
{
UpdateConfigVersion(Revision.Value.ToString() ,VersionControlConstants.TagRevision ) ;
UpdateConfigVersion(Major.Value + "." + Minor.Value + "." + Build.Value,VersionControlConstants.TagMajorMinorBuild ) ;
}//if
}//else
Cursor.Current = Cursors.WaitCursor ;
fileGrid.DataSource = fileTable.DefaultView ;
lblNewVersion.Text = newVersion ;
}//if
else
{
fileGrid.DataSource = null;
fileGrid.Refresh();
MessageBox.Show(VersionControlConstants.ErrorEmptyFiles ,VersionControlConstants.MessageBoxCaption,MessageBoxButtons.OK);
}//else
}//else
}//try
catch(Exception exp)
{
MessageBox.Show(exp.Message ,VersionControlConstants.MessageBoxCaption,MessageBoxButtons.OK);
}//catch
}//btnVersion_Click
#endregion btnVersion_Click
#endregion Events
}// classVersionControler
}//namespace GMSBU.NaveenNayak.VersionControl