Switch to full style
Project under GPL source codes are posted here
Post a reply

BatchRebuilder

Fri Nov 07, 2008 12:55 pm

 Project Name:   BatchRebuilder-Batch rebuilder for your Visual Studio .NET Projects
 Programmer:   Mauricio Ritter
 Type:   Application
 Technology:  C#
 IDE:   NONE
 Description:   A while ago, I was developing a project with a large number of components. The problem was that each time we need to compile the entire project, we need to download each individual component project from our source control tool, change the projects to release build configuration and compile them. It's an easy task, but it can become very time consuming if you have to compile about 10 components a day. The other problem I faced was that each project has its own target folder configuration, and I wanted to compile all the projects to the same target folder. To solve this problem, I created this handy little tool. It'll search all C# or VB.NET projects in a specified folder and rebuild them. There are some options available in the tool


batchrebuilder.jpg
batchrebuilder.jpg (32.11 KiB) Viewed 3929 times



Attachments
batchrebuilder_src.zip
(10.25 KiB) Downloaded 829 times
batchrebuilder_demo.zip
(9.13 KiB) Downloaded 780 times

Re: BatchRebuilder

Sun Jan 20, 2013 9:05 pm

code sample
csharp code
using System;
using System.Drawing;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Threading;
using System.Xml;
using Microsoft.Win32;

namespace BatchRebuilder
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class frmRebuilder : System.Windows.Forms.Form
{
internal System.Windows.Forms.TextBox txtOutput;
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.Label Label1;
internal System.Windows.Forms.Button btnRebuild;
private System.Windows.Forms.Button btnProjectFolder;
private System.Windows.Forms.Button btnCopyAssemblyFolder;
private System.Windows.Forms.Button btnCopyContentFolder;
internal System.Windows.Forms.TextBox txtContentTargetPath;
internal System.Windows.Forms.TextBox txtAssemblysTargetPath;
internal System.Windows.Forms.TextBox txtProjectsPath;
internal System.Windows.Forms.CheckBox chkCopyContents;
internal System.Windows.Forms.CheckBox chkCopyAssemblys;

protected bool bCancel = false;
internal System.Windows.Forms.ComboBox cboVersion;
internal System.Windows.Forms.Button btnCancel;
internal System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnLogPathFolder;
internal System.Windows.Forms.TextBox txtLogPath;
internal System.Windows.Forms.CheckBox chkLogOnlyOnFail;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
internal System.Windows.Forms.Label label4;
internal System.Windows.Forms.ComboBox cboProjectType;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

private string sDevEnvPath;

public frmRebuilder()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <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.chkCopyContents = new System.Windows.Forms.CheckBox();
this.chkCopyAssemblys = new System.Windows.Forms.CheckBox();
this.txtContentTargetPath = new System.Windows.Forms.TextBox();
this.txtAssemblysTargetPath = new System.Windows.Forms.TextBox();
this.txtOutput = new System.Windows.Forms.TextBox();
this.txtProjectsPath = new System.Windows.Forms.TextBox();
this.cboVersion = new System.Windows.Forms.ComboBox();
this.Label2 = new System.Windows.Forms.Label();
this.Label1 = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.btnRebuild = new System.Windows.Forms.Button();
this.btnProjectFolder = new System.Windows.Forms.Button();
this.btnCopyAssemblyFolder = new System.Windows.Forms.Button();
this.btnCopyContentFolder = new System.Windows.Forms.Button();
this.txtLogPath = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.btnLogPathFolder = new System.Windows.Forms.Button();
this.chkLogOnlyOnFail = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.cboProjectType = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// chkCopyContents
//
this.chkCopyContents.Location = new System.Drawing.Point(8, 64);
this.chkCopyContents.Name = "chkCopyContents";
this.chkCopyContents.Size = new System.Drawing.Size(320, 16);
this.chkCopyContents.TabIndex = 23;
this.chkCopyContents.Text =
"Copy content files (.aspx, .htm, etc.) to the following folder:";
this.chkCopyContents.CheckedChanged += new System.EventHandler(this.chkCopyContents_CheckedChanged);
//
// chkCopyAssemblys
//
this.chkCopyAssemblys.Location = new System.Drawing.Point(8, 24);
this.chkCopyAssemblys.Name = "chkCopyAssemblys";
this.chkCopyAssemblys.Size = new System.Drawing.Size(320, 16);
this.chkCopyAssemblys.TabIndex = 20;
this.chkCopyAssemblys.Text = "Copy assembly files to the following folder:";
this.chkCopyAssemblys.CheckedChanged += new System.EventHandler(this.chkCopyAssemblys_CheckedChanged);
//
// txtContentTargetPath
//
this.txtContentTargetPath.Enabled = false;
this.txtContentTargetPath.Location = new System.Drawing.Point(8, 80);
this.txtContentTargetPath.Name = "txtContentTargetPath";
this.txtContentTargetPath.Size = new System.Drawing.Size(296, 20);
this.txtContentTargetPath.TabIndex = 19;
this.txtContentTargetPath.Text = "";
//
// txtAssemblysTargetPath
//
this.txtAssemblysTargetPath.Enabled = false;
this.txtAssemblysTargetPath.Location = new System.Drawing.Point(8, 40);
this.txtAssemblysTargetPath.Name = "txtAssemblysTargetPath";
this.txtAssemblysTargetPath.Size = new System.Drawing.Size(296, 20);
this.txtAssemblysTargetPath.TabIndex = 18;
this.txtAssemblysTargetPath.Text = "";
//
// txtOutput
//
this.txtOutput.Font =

new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtOutput.Location = new System.Drawing.Point(8, 360);
this.txtOutput.Multiline = true;
this.txtOutput.Name = "txtOutput";
this.txtOutput.ReadOnly = true;
this.txtOutput.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txtOutput.Size = new System.Drawing.Size(336, 64);
this.txtOutput.TabIndex = 15;
this.txtOutput.Text = "";
this.txtOutput.WordWrap = false;
//
// txtProjectsPath
//
this.txtProjectsPath.Location = new System.Drawing.Point(8, 64);
this.txtProjectsPath.Name = "txtProjectsPath";
this.txtProjectsPath.Size = new System.Drawing.Size(168, 20);
this.txtProjectsPath.TabIndex = 13;
this.txtProjectsPath.Text = "";
//
// cboVersion
//
this.cboVersion.DropDownStyle =

System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboVersion.Items.AddRange(new object[] {
"Release",
"Debug"});
this.cboVersion.Location = new System.Drawing.Point(208, 64);
this.cboVersion.Name = "cboVersion";
this.cboVersion.Size = new System.Drawing.Size(120, 21);
this.cboVersion.TabIndex = 22;
//
// Label2
//
this.Label2.Location = new System.Drawing.Point(208, 48);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(48, 16);
this.Label2.TabIndex = 21;
this.Label2.Text = "Version:";
//
// Label1
//
this.Label1.Location = new System.Drawing.Point(8, 48);
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(168, 16);
this.Label1.TabIndex = 17;
this.Label1.Text = "Projects Path:";
//
// btnCancel
//
this.btnCancel.Enabled = false;
this.btnCancel.Location = new System.Drawing.Point(184, 328);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 16;
this.btnCancel.Text = "Cancel";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnRebuild
//
this.btnRebuild.Location = new System.Drawing.Point(104, 328);
this.btnRebuild.Name = "btnRebuild";
this.btnRebuild.TabIndex = 14;
this.btnRebuild.Text = "Rebuild";
this.btnRebuild.Click += new System.EventHandler(this.btnRebuild_Click);
//
// btnProjectFolder
//
this.btnProjectFolder.Location = new System.Drawing.Point(176, 64);
this.btnProjectFolder.Name = "btnProjectFolder";
this.btnProjectFolder.Size = new System.Drawing.Size(24, 20);
this.btnProjectFolder.TabIndex = 24;
this.btnProjectFolder.Text = "...";
this.btnProjectFolder.Click += new System.EventHandler(this.btnProjectFolder_Click);
//
// btnCopyAssemblyFolder
//
this.btnCopyAssemblyFolder.Location = new System.Drawing.Point(304, 40);
this.btnCopyAssemblyFolder.Name = "btnCopyAssemblyFolder";
this.btnCopyAssemblyFolder.Size = new System.Drawing.Size(24, 20);
this.btnCopyAssemblyFolder.TabIndex = 25;
this.btnCopyAssemblyFolder.Text = "...";
this.btnCopyAssemblyFolder.Click += new System.EventHandler(this.btnCopyAssemblyFolder_Click);
//
// btnCopyContentFolder
//
this.btnCopyContentFolder.Location = new System.Drawing.Point(304, 80);
this.btnCopyContentFolder.Name = "btnCopyContentFolder";
this.btnCopyContentFolder.Size = new System.Drawing.Size(24, 20);
this.btnCopyContentFolder.TabIndex = 26;
this.btnCopyContentFolder.Text = "...";
this.btnCopyContentFolder.Click +=

new System.EventHandler(this.btnCopyContentFolder_Click);
//
// txtLogPath
//
this.txtLogPath.Location = new System.Drawing.Point(8, 40);
this.txtLogPath.Name = "txtLogPath";
this.txtLogPath.Size = new System.Drawing.Size(296, 20);
this.txtLogPath.TabIndex = 27;
this.txtLogPath.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(168, 16);
this.label3.TabIndex = 28;
this.label3.Text = "Log Path:";
//
// btnLogPathFolder
//
this.btnLogPathFolder.Location = new System.Drawing.Point(304, 40);
this.btnLogPathFolder.Name = "btnLogPathFolder";
this.btnLogPathFolder.Size = new System.Drawing.Size(24, 20);
this.btnLogPathFolder.TabIndex = 29;
this.btnLogPathFolder.Text = "...";
this.btnLogPathFolder.Click +=

new System.EventHandler(this.btnLogPathFolder_Click);
//
// chkLogOnlyOnFail
//
this.chkLogOnlyOnFail.Checked = true;
this.chkLogOnlyOnFail.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkLogOnlyOnFail.Location = new System.Drawing.Point(8, 64);
this.chkLogOnlyOnFail.Name = "chkLogOnlyOnFail";
this.chkLogOnlyOnFail.Size = new System.Drawing.Size(304, 16);
this.chkLogOnlyOnFail.TabIndex = 30;
this.chkLogOnlyOnFail.Text = "Save the log file only when compilation fails";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.cboProjectType);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.btnProjectFolder);
this.groupBox1.Controls.Add(this.Label2);
this.groupBox1.Controls.Add(this.cboVersion);
this.groupBox1.Controls.Add(this.txtProjectsPath);
this.groupBox1.Controls.Add(this.Label1);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(336, 96);
this.groupBox1.TabIndex = 31;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Projects";
//
// cboProjectType
//
this.cboProjectType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;

this.cboProjectType.Items.
AddRange(new object[] {"Visual C# Projects", "Visual Basic.NET Projects"});
this.cboProjectType.Location = new System.Drawing.Point(80, 20);
this.cboProjectType.Name = "cboProjectType";
this.cboProjectType.Size = new System.Drawing.Size(248, 21);
this.cboProjectType.TabIndex = 26;
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 16);
this.label4.TabIndex = 25;
this.label4.Text = "Project Type:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.btnCopyContentFolder);
this.groupBox2.Controls.Add(this.chkCopyContents);
this.groupBox2.Controls.Add(this.btnCopyAssemblyFolder);
this.groupBox2.Controls.Add(this.txtAssemblysTargetPath);
this.groupBox2.Controls.Add(this.txtContentTargetPath);
this.groupBox2.Controls.Add(this.chkCopyAssemblys);
this.groupBox2.Location = new System.Drawing.Point(8, 112);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(336, 112);
this.groupBox2.TabIndex = 32;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Destination";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.btnLogPathFolder);
this.groupBox3.Controls.Add(this.txtLogPath);
this.groupBox3.Controls.Add(this.label3);
this.groupBox3.Controls.Add(this.chkLogOnlyOnFail);
this.groupBox3.Location = new System.Drawing.Point(8, 232);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(336, 88);
this.groupBox3.TabIndex = 33;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Logging";
//
// frmRebuilder
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(352, 429);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.txtOutput);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnRebuild);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "frmRebuilder";
this.Text = "Batch Rebuilder 1.0";
this.Load += new System.EventHandler(this.frmRebuilder_Load);
this.Closed += new System.EventHandler(this.frmRebuilder_Closed);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new frmRebuilder());
}


private void CopyFiles(string sProjectPath, string sExtension)
{

if(!txtContentTargetPath.Text.EndsWith("\\"))
{
txtContentTargetPath.Text += "\\";
}

if(Directory.Exists(sProjectPath))
{
foreach(string sContentFile in Directory.GetFiles(sProjectPath + "\\", "*." + sExtension))
{
File.Copy(sContentFile, txtContentTargetPath.Text + Path.GetFileName(sContentFile), true);
}

foreach(string sDir in Directory.GetDirectories(sProjectPath))
{
CopyFiles(sDir, sExtension);
}

}
}

private void frmRebuilder_Load(object sender, System.EventArgs e)
{

try
{
cboVersion.SelectedIndex = 0;
cboProjectType.SelectedIndex = 0;
RegistryKey oKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\BatchRebuilder", true);
if(oKey != null)
{
txtProjectsPath.Text = (string) oKey.GetValue("ProjectsPath");
txtAssemblysTargetPath.Text = (string)oKey.GetValue("AssemblysPath");
txtContentTargetPath.Text =(string) oKey.GetValue("ContentPath");
txtLogPath.Text =(string) oKey.GetValue("LogPath");

chkCopyContents.Checked = Convert.ToBoolean(oKey.GetValue("CopyContents"));
chkCopyAssemblys.Checked = Convert.ToBoolean(oKey.GetValue("CopyAssemblys"));
if(oKey.GetValue("LogOnlyOnFail") != null)
chkLogOnlyOnFail.Checked = Convert.ToBoolean(oKey.GetValue("LogOnlyOnFail"));


oKey.Close();

chkCopyAssemblys_CheckedChanged(null, null);
chkCopyContents_CheckedChanged(null, null);

}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}

try
{
RegistryKey oKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\VisualStudio\\7.1\\Setup\\VS", true);
sDevEnvPath = (string) oKey.GetValue("EnvironmentPath");
oKey.Close();
if(sDevEnvPath == null)
throw new Exception("Visual Studio not installed!");
}
catch
{
MessageBox.Show("DEVENV.EXE not found. Visual Studio 2003 not installed.", "Rebuilder", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
}

}

private void btnRebuild_Click(object sender, System.EventArgs e)
{
if(!Directory.Exists(txtProjectsPath.Text))
{
MessageBox.Show("Invalid 'Projetcs' path !", "Rebuilder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtProjectsPath.Focus();
return;
}

if(!Directory.Exists(txtProjectsPath.Text) && chkCopyAssemblys.Checked)
{
MessageBox.Show("Invalid 'Projetcs' path !", "Rebuilder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtProjectsPath.Focus();
return;
}

if(!Directory.Exists(txtProjectsPath.Text) && chkCopyContents.Checked)
{
MessageBox.Show("Invalid 'Projetcs' path !", "Rebuilder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtProjectsPath.Focus();
return;
}


bCancel = false;
btnRebuild.Enabled = false;
btnCancel.Enabled = true;
BuildDirectory(txtProjectsPath.Text);

if(chkCopyContents.Checked)
{
txtOutput.AppendText("Copying .ASPX files" + "\n");
CopyFiles(txtProjectsPath.Text, "aspx");
txtOutput.AppendText("Copying .js files" + "\n");
CopyFiles(txtProjectsPath.Text, "js");
txtOutput.AppendText("Copying .inc files" + "\n");
CopyFiles(txtProjectsPath.Text, "inc");
txtOutput.AppendText("Copying .htm files" + "\n");
CopyFiles(txtProjectsPath.Text, "htm");
txtOutput.AppendText("Copying .asp files" + "\n");
CopyFiles(txtProjectsPath.Text, "asp");
txtOutput.AppendText("Copying .css files" + "\n");
CopyFiles(txtProjectsPath.Text, "css");
}

MessageBox.Show ("Batch compilation completed !","Rebuilder", MessageBoxButtons.OK, MessageBoxIcon.Information);

btnRebuild.Enabled = true;
btnCancel.Enabled = false;
}

private void btnProjectFolder_Click(object sender, System.EventArgs e)
{
FolderBrowserDialog oDlg = new FolderBrowserDialog();
oDlg.ShowDialog();
txtProjectsPath.Text = oDlg.SelectedPath.ToString();
}

private void btnCopyAssemblyFolder_Click(object sender, System.EventArgs e)
{
FolderBrowserDialog oDlg = new FolderBrowserDialog();
oDlg.ShowDialog();
txtAssemblysTargetPath.Text = oDlg.SelectedPath.ToString();
}

private void btnCopyContentFolder_Click(object sender, System.EventArgs e)
{
FolderBrowserDialog oDlg = new FolderBrowserDialog();
oDlg.ShowDialog();
txtContentTargetPath.Text = oDlg.SelectedPath.ToString();
}

private void BuildDirectory(string sPath)
{
string sExtensions;
if(cboProjectType.SelectedIndex == 0)
sExtensions = "*.csproj";
else
sExtensions = "*.vbproj";

foreach(string sFile in Directory.GetFiles(sPath, sExtensions))
{

if(txtLogPath.Text.EndsWith("\\") == false)
{
txtLogPath.Text += "\\";
}

string sProjectName = Path.GetFileName(sFile);
sProjectName = sProjectName.Substring(0, sProjectName.Length-7);

Process oProcess = new Process();

txtOutput.AppendText("Compiling component " + sProjectName + "\n");
Application.DoEvents();

XmlDocument oPrjFile = new XmlDocument();
oPrjFile.Load(sFile);

XmlElement oNode =

(XmlElement) oPrjFile.SelectSingleNode("/VisualStudioProject/VisualBasic/Build/Settings/Config[@Name='" + cboVersion.SelectedItem.ToString() + "']");

if(chkCopyAssemblys.Checked)
{
oNode.Attributes["OutputPath"].Value = txtAssemblysTargetPath.Text;
}

oPrjFile.Save(sFile);


oProcess.StartInfo.FileName = sDevEnvPath;
if(cboVersion.SelectedIndex == 0)
oProcess.StartInfo.Arguments = "/rebuild RELEASE ";
else
oProcess.StartInfo.Arguments = "/rebuild DEBUG ";


oProcess.StartInfo.Arguments += " /out \"" + txtLogPath.Text + sProjectName + "_build.txt\" \"" + sFile + "\"";

oProcess.StartInfo.RedirectStandardOutput = true;
oProcess.StartInfo.UseShellExecute = false;
oProcess.Start();

string sLinha;

while(oProcess.HasExited == false)
{
sLinha = oProcess.StandardOutput.ReadLine();
while(sLinha != null)
{
txtOutput.AppendText(sLinha + "\n");
sLinha = oProcess.StandardOutput.ReadLine();
}
Application.DoEvents();
}

sLinha = oProcess.StandardOutput.ReadLine();
while( sLinha != null)
{
txtOutput.AppendText(sLinha + "\n");
sLinha = oProcess.StandardOutput.ReadLine();
}

if(oProcess.ExitCode != 0)
txtOutput.AppendText("** Error compiling project !! ** " + "\n");
else
{
if(chkLogOnlyOnFail.Checked)
System.IO.File.Delete(txtLogPath.Text + sProjectName + "_build.txt");
string sProjectPath = Path.GetDirectoryName(sFile);
}
txtOutput.SelectionStart = txtOutput.TextLength - 1;
txtOutput.Refresh();
Application.DoEvents();
}

if( bCancel )
return;

string[] sDirList = Directory.GetDirectories(sPath);
Array.Sort(sDirList);

foreach(string sSubDir in sDirList)
{
BuildDirectory(sSubDir);
if(bCancel)
return;
}

}

private void chkCopyAssemblys_CheckedChanged(object sender, System.EventArgs e)
{
txtAssemblysTargetPath.Enabled = chkCopyAssemblys.Checked;
btnCopyAssemblyFolder.Enabled = chkCopyAssemblys.Checked;
}

private void chkCopyContents_CheckedChanged(object sender, System.EventArgs e)
{
txtContentTargetPath.Enabled = chkCopyContents.Checked;
btnCopyContentFolder.Enabled = chkCopyContents.Checked;
}

private void frmRebuilder_Closed(object sender, System.EventArgs e)
{
try
{
RegistryKey oKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\BatchRebuilder", true);
if(oKey == null)
{
oKey = Registry.LocalMachine.CreateSubKey("SOFTWARE\\BatchRebuilder");
}
oKey.SetValue("ProjectsPath", txtProjectsPath.Text);
oKey.SetValue("AssemblysPath", txtAssemblysTargetPath.Text);
oKey.SetValue("ContentPath", txtContentTargetPath.Text);
oKey.SetValue("LogPath", txtLogPath.Text);
oKey.SetValue("CopyContents", chkCopyContents.Checked);
oKey.SetValue("CopyAssemblys", chkCopyAssemblys.Checked);
oKey.SetValue("LogOnlyOnFail", chkLogOnlyOnFail.Checked);


oKey.Close();
}
catch
{
}

}

private void btnLogPathFolder_Click(object sender, System.EventArgs e)
{
FolderBrowserDialog oDlg = new FolderBrowserDialog();
oDlg.ShowDialog();
txtLogPath.Text = oDlg.SelectedPath.ToString();
}

private void btnCancel_Click(object sender, System.EventArgs e)
{

}

}
}


Post a reply

Topic Tags

C# Projects