Commit for development environment setup

This commit is contained in:
2023-06-19 16:12:33 -04:00
parent be72063a3c
commit bbce2ad0a6
2209 changed files with 1171775 additions and 625 deletions

BIN
PROMS/Sync/7zip/7z.dll Normal file

Binary file not shown.

BIN
PROMS/Sync/7zip/7z64.dll Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -1,11 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sync", "Sync\Sync.csproj", "{400F2DAC-E405-4C1B-A388-5120FCF59DF0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SyncMany", "SyncMany\SyncMany.csproj", "{256A41AF-440F-42FE-A9B1-2CE36F1261A2}"
EndProject
Global
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 3
SccLocalPath0 = .
SccProjectUniqueName1 = Sync\\Sync.csproj
SccLocalPath1 = Sync
SccProjectUniqueName2 = SyncMany\\SyncMany.csproj
SccProjectName2 = \u0022$/PROMS/Sync/SyncMany\u0022,\u0020LEEAAAAA
SccLocalPath2 = SyncMany
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU

BIN
PROMS/Sync/Sync/7z64.dll Normal file

Binary file not shown.

View File

@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace Sync
{
class FileCompare
{
private FileInfo _Developement;
private FileInfo _SourceSafe;
private bool _ToProcess = false;
public bool ToProcess
{
get { return _ToProcess; }
set { _ToProcess = value; }
}
public string FileName
{
get { return _Developement.FullName; }
}
public Nullable<DateTime> DevModified
{
get
{
if (_Developement.Exists)
return _Developement.LastWriteTime;
return null;
}
}
public Nullable<DateTime> SSModified
{
get
{
if(_SourceSafe.Exists)
return _SourceSafe.LastWriteTime;
return null;
}
}
private bool _Different;
public bool Different
{
get { return _Different; }
}
public string SSFileName
{
get { return _SourceSafe.FullName; }
}
public FileCompare(FileInfo development, FileInfo sourceSafe)
{
_Developement = development;
_SourceSafe = sourceSafe;
_Different = DifferentContents(development, sourceSafe);
_ToProcess = _Different;
}
public static bool DifferentContents(FileInfo development, FileInfo sourceSafe)
{
string strDev =ReadFile(development);
string strSS = ReadFile(sourceSafe);
return strDev != strSS;
}
private static string ReadFile(FileInfo fi)
{
if (fi.Exists == false) return "";
TextReader tr = fi.OpenText();
string retval = tr.ReadToEnd();
tr.Close();
return retval;
}
public void MoveToDevelopment()
{
//if (_Developement.Attributes & FileAttributes.ReadOnly == FileAttributes.ReadOnly)
if (_Developement.Exists) _Developement.Attributes &= (_Developement.Attributes ^ FileAttributes.ReadOnly);
BuildFolder(_Developement.Directory);
if(_SourceSafe.Exists)_SourceSafe.CopyTo(_Developement.FullName , true);
}
public void MoveDevToMailBox(string devFolder, string mailboxFolder)
{
if (ToProcess)
{
FileInfo fi1 = new FileInfo(_Developement.FullName.Replace(devFolder, mailboxFolder));
BuildFolder(fi1.Directory);
if(_Developement.Exists)_Developement.CopyTo(fi1.FullName,true);
}
}
public void MoveMailBoxToDev(string devFolder, string mailboxFolder)
{
if (ToProcess)
{
FileInfo fi1 = new FileInfo(_Developement.FullName.Replace(devFolder, mailboxFolder));
BuildFolder(_Developement.Directory);
fi1.CopyTo(_Developement.FullName, true);
}
}
public void MoveSSToMailBox(string SSFolder, string mailboxFolder)
{
if (ToProcess)
{
FileInfo fi1 = new FileInfo(_SourceSafe.FullName.Replace(SSFolder, mailboxFolder));
BuildFolder(fi1.Directory);
if(_SourceSafe.Exists) _SourceSafe.CopyTo(fi1.FullName, true);
}
}
public void MoveMailBoxToSS(string SSFolder, string mailboxFolder)
{
if (ToProcess)
{
FileInfo fi1 = new FileInfo(_SourceSafe.FullName.Replace(SSFolder, mailboxFolder));
BuildFolder(fi1.Directory);
if(fi1.Exists)fi1.CopyTo(_SourceSafe.FullName, true);
}
}
private static void BuildFolder(DirectoryInfo directoryInfo)
{
if (!directoryInfo.Exists)
{
BuildFolder(directoryInfo.Parent);
directoryInfo.Create();
}
}
}
}

View File

@@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -10,6 +11,17 @@
<RootNamespace>Sync</RootNamespace>
<AssemblyName>Sync</AssemblyName>
<ApplicationIcon>Resources\iSync.ico</ApplicationIcon>
<SccProjectName>"%24/PROMS/Sync/Sync", KEEAAAAA</SccProjectName>
<SccLocalPath>.</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>MSSCCI:Microsoft Visual SourceSafe</SccProvider>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -29,6 +41,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="SevenZipSharp, Version=0.64.3890.29348, Culture=neutral, PublicKeyToken=20de82c62b055c88, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
@@ -92,6 +107,9 @@
<ItemGroup>
<None Include="Resources\iSync.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="SevenZipSharp.dll" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -0,0 +1,430 @@
namespace Sync
{
partial class frmSync
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSync));
this.panel1 = new System.Windows.Forms.Panel();
this.btnBrwsSSMail = new System.Windows.Forms.Button();
this.tbSSMailBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.btnBrwsMail = new System.Windows.Forms.Button();
this.tbMailBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.btnBrwsSS = new System.Windows.Forms.Button();
this.tbSourceSafe = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.btnBrwsDev = new System.Windows.Forms.Button();
this.tbDevelopment = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.fbd = new System.Windows.Forms.FolderBrowserDialog();
this.dgv = new System.Windows.Forms.DataGridView();
this.cms = new System.Windows.Forms.ContextMenuStrip(this.components);
this.compareToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mailboxToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buildToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.findToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.checkedOutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.differentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contentDifferentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sourceSafeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreUnchangedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreSelectedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
this.cms.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.btnBrwsSSMail);
this.panel1.Controls.Add(this.tbSSMailBox);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.btnBrwsMail);
this.panel1.Controls.Add(this.tbMailBox);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.btnBrwsSS);
this.panel1.Controls.Add(this.tbSourceSafe);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.btnBrwsDev);
this.panel1.Controls.Add(this.tbDevelopment);
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 24);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(759, 117);
this.panel1.TabIndex = 1;
//
// btnBrwsSSMail
//
this.btnBrwsSSMail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrwsSSMail.Location = new System.Drawing.Point(672, 86);
this.btnBrwsSSMail.Name = "btnBrwsSSMail";
this.btnBrwsSSMail.Size = new System.Drawing.Size(75, 23);
this.btnBrwsSSMail.TabIndex = 14;
this.btnBrwsSSMail.Text = "Browse...";
this.btnBrwsSSMail.UseVisualStyleBackColor = true;
this.btnBrwsSSMail.Click += new System.EventHandler(this.btnBrowse_Click);
//
// tbSSMailBox
//
this.tbSSMailBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbSSMailBox.Location = new System.Drawing.Point(120, 88);
this.tbSSMailBox.Name = "tbSSMailBox";
this.tbSSMailBox.Size = new System.Drawing.Size(546, 20);
this.tbSSMailBox.TabIndex = 13;
this.tbSSMailBox.Text = "E:\\Mailbox\\SourceSafe\\Proms";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 91);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(92, 13);
this.label4.TabIndex = 12;
this.label4.Text = "SS Mailbox Folder";
//
// btnBrwsMail
//
this.btnBrwsMail.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrwsMail.Location = new System.Drawing.Point(672, 60);
this.btnBrwsMail.Name = "btnBrwsMail";
this.btnBrwsMail.Size = new System.Drawing.Size(75, 23);
this.btnBrwsMail.TabIndex = 8;
this.btnBrwsMail.Text = "Browse...";
this.btnBrwsMail.UseVisualStyleBackColor = true;
this.btnBrwsMail.Click += new System.EventHandler(this.btnBrowse_Click);
//
// tbMailBox
//
this.tbMailBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbMailBox.Location = new System.Drawing.Point(120, 62);
this.tbMailBox.Name = "tbMailBox";
this.tbMailBox.Size = new System.Drawing.Size(546, 20);
this.tbMailBox.TabIndex = 7;
this.tbMailBox.Text = "E:\\Mailbox\\Proms";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 65);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(75, 13);
this.label3.TabIndex = 6;
this.label3.Text = "Mailbox Folder";
//
// btnBrwsSS
//
this.btnBrwsSS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrwsSS.Location = new System.Drawing.Point(672, 34);
this.btnBrwsSS.Name = "btnBrwsSS";
this.btnBrwsSS.Size = new System.Drawing.Size(75, 23);
this.btnBrwsSS.TabIndex = 5;
this.btnBrwsSS.Text = "Browse...";
this.btnBrwsSS.UseVisualStyleBackColor = true;
this.btnBrwsSS.Click += new System.EventHandler(this.btnBrowse_Click);
//
// tbSourceSafe
//
this.tbSourceSafe.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbSourceSafe.Location = new System.Drawing.Point(120, 36);
this.tbSourceSafe.Name = "tbSourceSafe";
this.tbSourceSafe.Size = new System.Drawing.Size(546, 20);
this.tbSourceSafe.TabIndex = 4;
this.tbSourceSafe.Text = "E:\\SourceSafe\\Proms";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 39);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(98, 13);
this.label2.TabIndex = 3;
this.label2.Text = "Source Safe Folder";
//
// btnBrwsDev
//
this.btnBrwsDev.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnBrwsDev.Location = new System.Drawing.Point(672, 8);
this.btnBrwsDev.Name = "btnBrwsDev";
this.btnBrwsDev.Size = new System.Drawing.Size(75, 23);
this.btnBrwsDev.TabIndex = 2;
this.btnBrwsDev.Text = "Browse...";
this.btnBrwsDev.UseVisualStyleBackColor = true;
this.btnBrwsDev.Click += new System.EventHandler(this.btnBrowse_Click);
//
// tbDevelopment
//
this.tbDevelopment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tbDevelopment.Location = new System.Drawing.Point(120, 10);
this.tbDevelopment.Name = "tbDevelopment";
this.tbDevelopment.Size = new System.Drawing.Size(546, 20);
this.tbDevelopment.TabIndex = 1;
this.tbDevelopment.Text = "E:\\Proms";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(102, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Development Folder";
//
// dgv
//
this.dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgv.ContextMenuStrip = this.cms;
this.dgv.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgv.Location = new System.Drawing.Point(0, 141);
this.dgv.Name = "dgv";
this.dgv.Size = new System.Drawing.Size(759, 283);
this.dgv.TabIndex = 2;
this.dgv.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dgv_ColumnWidthChanged);
//
// cms
//
this.cms.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.compareToolStripMenuItem,
this.restoreToolStripMenuItem});
this.cms.Name = "cms";
this.cms.Size = new System.Drawing.Size(124, 48);
//
// compareToolStripMenuItem
//
this.compareToolStripMenuItem.Name = "compareToolStripMenuItem";
this.compareToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.compareToolStripMenuItem.Text = "Compare";
this.compareToolStripMenuItem.Click += new System.EventHandler(this.compareToolStripMenuItem_Click);
//
// restoreToolStripMenuItem
//
this.restoreToolStripMenuItem.Name = "restoreToolStripMenuItem";
this.restoreToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.restoreToolStripMenuItem.Text = "Restore";
this.restoreToolStripMenuItem.Click += new System.EventHandler(this.restoreToolStripMenuItem_Click);
//
// statusStrip1
//
this.statusStrip1.Location = new System.Drawing.Point(0, 424);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(759, 22);
this.statusStrip1.TabIndex = 3;
this.statusStrip1.Text = "statusStrip1";
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.mailboxToolStripMenuItem,
this.findToolStripMenuItem,
this.sourceSafeToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(759, 24);
this.menuStrip1.TabIndex = 4;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File";
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// mailboxToolStripMenuItem
//
this.mailboxToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.clearToolStripMenuItem,
this.buildToolStripMenuItem});
this.mailboxToolStripMenuItem.Name = "mailboxToolStripMenuItem";
this.mailboxToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.mailboxToolStripMenuItem.Text = "Mailbox";
//
// clearToolStripMenuItem
//
this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
this.clearToolStripMenuItem.Size = new System.Drawing.Size(101, 22);
this.clearToolStripMenuItem.Text = "Clear";
this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
//
// buildToolStripMenuItem
//
this.buildToolStripMenuItem.Name = "buildToolStripMenuItem";
this.buildToolStripMenuItem.Size = new System.Drawing.Size(101, 22);
this.buildToolStripMenuItem.Text = "Build";
this.buildToolStripMenuItem.Click += new System.EventHandler(this.buildToolStripMenuItem_Click);
//
// findToolStripMenuItem
//
this.findToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.checkedOutToolStripMenuItem,
this.differentToolStripMenuItem,
this.contentDifferentToolStripMenuItem});
this.findToolStripMenuItem.Name = "findToolStripMenuItem";
this.findToolStripMenuItem.Size = new System.Drawing.Size(42, 20);
this.findToolStripMenuItem.Text = "Find";
//
// checkedOutToolStripMenuItem
//
this.checkedOutToolStripMenuItem.Name = "checkedOutToolStripMenuItem";
this.checkedOutToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
this.checkedOutToolStripMenuItem.Text = "Checked-Out";
this.checkedOutToolStripMenuItem.Click += new System.EventHandler(this.checkedOutToolStripMenuItem_Click);
//
// differentToolStripMenuItem
//
this.differentToolStripMenuItem.Name = "differentToolStripMenuItem";
this.differentToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
this.differentToolStripMenuItem.Text = "Different";
this.differentToolStripMenuItem.Click += new System.EventHandler(this.differentToolStripMenuItem_Click);
//
// contentDifferentToolStripMenuItem
//
this.contentDifferentToolStripMenuItem.Name = "contentDifferentToolStripMenuItem";
this.contentDifferentToolStripMenuItem.Size = new System.Drawing.Size(166, 22);
this.contentDifferentToolStripMenuItem.Text = "Content Different";
this.contentDifferentToolStripMenuItem.Click += new System.EventHandler(this.contentDifferentToolStripMenuItem_Click);
//
// sourceSafeToolStripMenuItem
//
this.sourceSafeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.restoreUnchangedToolStripMenuItem,
this.restoreSelectedToolStripMenuItem,
this.restoreAllToolStripMenuItem});
this.sourceSafeToolStripMenuItem.Name = "sourceSafeToolStripMenuItem";
this.sourceSafeToolStripMenuItem.Size = new System.Drawing.Size(80, 20);
this.sourceSafeToolStripMenuItem.Text = "Source Safe";
//
// restoreUnchangedToolStripMenuItem
//
this.restoreUnchangedToolStripMenuItem.Name = "restoreUnchangedToolStripMenuItem";
this.restoreUnchangedToolStripMenuItem.Size = new System.Drawing.Size(228, 22);
this.restoreUnchangedToolStripMenuItem.Text = "Restore Unchanged";
this.restoreUnchangedToolStripMenuItem.Click += new System.EventHandler(this.restoreUnchangedToolStripMenuItem_Click);
//
// restoreSelectedToolStripMenuItem
//
this.restoreSelectedToolStripMenuItem.Name = "restoreSelectedToolStripMenuItem";
this.restoreSelectedToolStripMenuItem.Size = new System.Drawing.Size(228, 22);
this.restoreSelectedToolStripMenuItem.Text = "Restore Selected (To Process)";
this.restoreSelectedToolStripMenuItem.Click += new System.EventHandler(this.restoreSelectedToolStripMenuItem_Click);
//
// restoreAllToolStripMenuItem
//
this.restoreAllToolStripMenuItem.Name = "restoreAllToolStripMenuItem";
this.restoreAllToolStripMenuItem.Size = new System.Drawing.Size(228, 22);
this.restoreAllToolStripMenuItem.Text = "Restore All";
this.restoreAllToolStripMenuItem.Click += new System.EventHandler(this.restoreAllToolStripMenuItem_Click);
//
// frmSync
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(759, 446);
this.Controls.Add(this.dgv);
this.Controls.Add(this.panel1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "frmSync";
this.Text = "Volian Sync";
this.Load += new System.EventHandler(this.frmSync_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmSync_FormClosing);
this.LocationChanged += new System.EventHandler(this.frmSync_LocationChanged);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit();
this.cms.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnBrwsDev;
private System.Windows.Forms.TextBox tbDevelopment;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnBrwsMail;
private System.Windows.Forms.TextBox tbMailBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnBrwsSS;
private System.Windows.Forms.TextBox tbSourceSafe;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.FolderBrowserDialog fbd;
private System.Windows.Forms.DataGridView dgv;
private System.Windows.Forms.Button btnBrwsSSMail;
private System.Windows.Forms.TextBox tbSSMailBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mailboxToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem buildToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem checkedOutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem differentToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem sourceSafeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem restoreUnchangedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem restoreSelectedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem restoreAllToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip cms;
private System.Windows.Forms.ToolStripMenuItem compareToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem restoreToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem contentDifferentToolStripMenuItem;
}
}

View File

@@ -0,0 +1,321 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Sync
{
public partial class frmSync : Form
{
private List<FileCompare> _CheckedOut;
private bool IsLoading = false;
public frmSync()
{
InitializeComponent();
}
private void LoadSettings()
{
if (Properties.Settings.Default["Location"] != null)
Location = Properties.Settings.Default.Location;
if (Properties.Settings.Default["Size"] != null)
Size = Properties.Settings.Default.Size;
if (Properties.Settings.Default.DevelopmentFolder != "")
tbDevelopment.Text = Properties.Settings.Default.DevelopmentFolder;
if (Properties.Settings.Default.SourceSafeFolder != "")
tbSourceSafe.Text = Properties.Settings.Default.SourceSafeFolder;
if(Properties.Settings.Default.MailBoxDevelopmentFolder != "")
tbMailBox.Text = Properties.Settings.Default.MailBoxDevelopmentFolder;
if (Properties.Settings.Default.MailBoxSourceSafeFolder != "")
tbSSMailBox.Text = Properties.Settings.Default.MailBoxSourceSafeFolder;
}
private void frmSync_Load(object sender, EventArgs e)
{
LoadSettings();
Setup();
}
private void Setup()
{
// Setup Browse Buttons
btnBrwsDev.Tag = this.tbDevelopment;
btnBrwsSS.Tag = this.tbSourceSafe;
btnBrwsMail.Tag = this.tbMailBox;
btnBrwsSSMail.Tag = this.tbSSMailBox;
}
private void btnBrowse_Click(object sender, EventArgs e)
{
TextBox tb = (TextBox)((Button)sender).Tag;
fbd.SelectedPath = tb.Text;
if (fbd.ShowDialog() == DialogResult.OK)
tb.Text = fbd.SelectedPath;
}
private void ClearResults()
{
_CheckedOut = new List<FileCompare>();
}
private void FindCheckedOut(DirectoryInfo di)
{
FindCheckedOut(di.GetFiles());
FindCheckedOut(di.GetDirectories());
}
private void FindCheckedOut(DirectoryInfo[] directoryInfoList)
{
foreach (DirectoryInfo di in directoryInfoList)
FindCheckedOut(di);
}
private void FindCheckedOut(FileInfo[] fileInfoList)
{
foreach (FileInfo fi in fileInfoList)
FindCheckedOut(fi);
}
private void FindCheckedOut(FileInfo fi)
{
if (fi.Name.ToLower().EndsWith("scc")) return;
if (fi.Name.ToLower().EndsWith("sln")) return;
if (fi.Name.ToLower().EndsWith("csproj")) return;
if (fi.Name.ToLower().EndsWith("licx")) return;
FileInfo fi1 = new FileInfo(fi.FullName.Replace(tbSourceSafe.Text, tbDevelopment.Text));
if ((fi1.Attributes & FileAttributes.ReadOnly) != FileAttributes.ReadOnly)
AddToResults(fi, fi1);
}
private void AddToResults(FileInfo fiSS,FileInfo fiDev)
{
FileCompare fc = new FileCompare(fiDev, fiSS);
if(!_OnlyContentDifferent || (fc.Different && (fc.DevModified != null)))
_CheckedOut.Add(fc);
//if (tbResults.Text == "") tbResults.Text = "Found:";
//tbResults.Text += "\r\n" + fiDev.FullName + " - " + ((fiDev.Attributes & FileAttributes.ReadOnly) != FileAttributes.ReadOnly ? "" : "ReadOnly");
}
private void ClearMailBox()
{
DeleteFolder(new DirectoryInfo(tbMailBox.Text));
DeleteFolder(new DirectoryInfo(tbSSMailBox.Text));
}
private void DeleteFolder(DirectoryInfo directoryInfo)
{
if (directoryInfo.Exists)
{
AdjustAttributes(directoryInfo);
directoryInfo.Delete(true);
}
}
private void AdjustAttributes(DirectoryInfo directoryInfo)
{
foreach (DirectoryInfo di in directoryInfo.GetDirectories())
AdjustAttributes(di);
foreach (FileInfo fi in directoryInfo.GetFiles())
AdjustAttribute(fi);
}
private void AdjustAttribute(FileInfo fi)
{
if ((fi.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
fi.Attributes = fi.Attributes ^ FileAttributes.ReadOnly;
}
private void frmSync_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.Location = Location;
Properties.Settings.Default.Size = Size;
Properties.Settings.Default.DevelopmentFolder = tbDevelopment.Text;
Properties.Settings.Default.SourceSafeFolder = tbSourceSafe.Text;
Properties.Settings.Default.MailBoxDevelopmentFolder = tbMailBox.Text;
Properties.Settings.Default.MailBoxSourceSafeFolder = tbSSMailBox.Text;
Properties.Settings.Default.Save();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void clearToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearMailBox();
}
private void buildToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
ClearMailBox();
if (_CheckedOut == null)
checkedOutToolStripMenuItem_Click(sender, e);
foreach (FileCompare fc in _CheckedOut)
{
if (fc.ToProcess)
{
fc.MoveDevToMailBox(tbDevelopment.Text, tbMailBox.Text);
fc.MoveSSToMailBox(tbSourceSafe.Text, tbSSMailBox.Text);
}
}
}
private void checkedOutToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearResults();
// Walk though Source Safe and check to see if the files in the Development folder are read-only
FindCheckedOut(new DirectoryInfo(tbSourceSafe.Text));
dgv.DataSource = _CheckedOut;
SetColumnWidth();
}
private void syncAllToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
foreach (FileCompare fc in _CheckedOut)
{
fc.MoveToDevelopment();
}
}
private void restoreUnchangedToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
foreach (FileCompare fc in _CheckedOut)
{
if(!fc.Different || fc.DevModified == null)
fc.MoveToDevelopment();
}
}
private void restoreSelectedToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
foreach (FileCompare fc in _CheckedOut)
{
if (fc.ToProcess) fc.MoveToDevelopment();
}
}
private void restoreAllToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
foreach (FileCompare fc in _CheckedOut)
{
fc.MoveToDevelopment();
}
}
private List<FileCompare> SelectedList
{
get
{
dgv.EndEdit();
List<FileCompare> fcList = new List<FileCompare>();
foreach (DataGridViewCell dgc in dgv.SelectedCells)
{
FileCompare fc = dgv.Rows[dgc.RowIndex].DataBoundItem as FileCompare;
if (fc != null && fcList.Contains(fc) == false)
fcList.Add(fc);
}
return fcList;
}
}
private void compareToolStripMenuItem_Click(object sender, EventArgs e)
{
// This should launch UltraCompare with the two files
// Which Item am I on
List<FileCompare> fcList = SelectedList;
foreach (FileCompare fc in fcList)
{
Console.WriteLine("Compare {0} and {1}", fc.FileName, fc.SSFileName);
string cmd = string.Format("\"C:\\Program Files\\IDM Computer Solutions\\UltraCompare\\UC.exe\" -t \"{0}\" \"{1}\"", fc.FileName, fc.SSFileName);
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@"C:\Program Files\IDM Computer Solutions\UltraCompare\UC.exe",
string.Format(@" -t ""{0}"" ""{1}""", fc.FileName, fc.SSFileName));
System.Diagnostics.Process prc = System.Diagnostics.Process.Start(psi);
}
}
private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
{
List<FileCompare> fcList = SelectedList;
foreach (FileCompare fc in fcList)
{
fc.MoveToDevelopment();
}
}
private void differentToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearResults();
// Walk though Source Safe and check to see if the files in the Development folder are read-only
FindDifferent(new DirectoryInfo(tbSourceSafe.Text));
dgv.DataSource = _CheckedOut;
SetColumnWidth();
}
private void SetColumnWidth()
{
IsLoading = true;
if (Properties.Settings.Default["Widths"] == null)
{
dgv.Columns[0].Width = 60;
dgv.Columns[1].Visible = false;
dgv.Columns[2].Width = 125;
dgv.Columns[3].Width = 125;
dgv.Columns[4].Width = 50;
dgv.Columns[5].Width = 500;
}
else
{
for (int i = 0; i < Properties.Settings.Default.Widths.Count; i++)
{
string sWidth = Properties.Settings.Default.Widths[i];
if (sWidth == "Invisible")
dgv.Columns[i].Visible = false;
else
dgv.Columns[i].Width = int.Parse(sWidth);
}
}
dgv.Columns[1].Visible = false;
IsLoading = false;
}
private void FindDifferent(DirectoryInfo di)
{
FindDifferent(di.GetFiles());
FindDifferent(di.GetDirectories());
}
private void FindDifferent(DirectoryInfo[] directoryInfoList)
{
foreach (DirectoryInfo di in directoryInfoList)
FindDifferent(di);
}
private void FindDifferent(FileInfo[] fileInfoList)
{
foreach (FileInfo fi in fileInfoList)
FindDifferent(fi);
}
private void FindDifferent(FileInfo fi)
{
if (fi.Name.ToLower().EndsWith("scc")) return;
if (fi.Name.ToLower().EndsWith("sln")) return;
if (fi.Name.ToLower().EndsWith("csproj")) return;
if (fi.Name.ToLower().EndsWith("licx")) return;
FileInfo fiD = new FileInfo(fi.FullName.Replace(tbSourceSafe.Text, tbDevelopment.Text));
FileInfo fiS = fi;
// Only check Read-Only flag, other attributes are unimportant
if (fiS.LastWriteTimeUtc != fiD.LastWriteTimeUtc || (fiS.Attributes & FileAttributes.ReadOnly ) != (fiD.Attributes & FileAttributes.ReadOnly ))
AddToResults(fi, fiD);
}
private void dgv_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
{
if (!IsLoading)
{
System.Collections.Specialized.StringCollection widths = new System.Collections.Specialized.StringCollection();
foreach (DataGridViewColumn col in dgv.Columns)
widths.Add(col.Visible ? col.Width.ToString() : "Invisible");
Properties.Settings.Default.Widths = widths;
Properties.Settings.Default.Save();
}
}
private bool _OnlyContentDifferent = false;
private void contentDifferentToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearResults();
_OnlyContentDifferent = true;
// Walk though Source Safe and check to see if the files in the Development folder are read-only
FindDifferent(new DirectoryInfo(tbSourceSafe.Text));
_OnlyContentDifferent = false;
dgv.DataSource = _CheckedOut;
SetColumnWidth();
}
private void frmSync_LocationChanged(object sender, EventArgs e)
{
Rectangle rec = Screen.GetWorkingArea(this);
if (Math.Abs(Left - rec.X) < 10) Left = rec.X;
if (Math.Abs(Top - rec.Y) < 10) Top = rec.Y;
if (Math.Abs(rec.X + rec.Width - Right) < 10) Left = rec.X + rec.Width - Width;
if (Math.Abs(rec.Y + rec.Height - Bottom) < 10) Top = rec.Y + rec.Height - Height;
}
}
}

View File

@@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -10,6 +11,16 @@
<RootNamespace>SyncMany</RootNamespace>
<AssemblyName>SyncMany</AssemblyName>
<ApplicationIcon>sync.ico</ApplicationIcon>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -69,6 +80,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\DataSources\CompareItems.datasource" />

View File

@@ -6,5 +6,5 @@
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

Binary file not shown.

BIN
PROMS/Sync/Thumbs.db Normal file

Binary file not shown.

535
PROMS/Sync/frmSync.cs Normal file
View File

@@ -0,0 +1,535 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using SevenZip;
namespace Sync
{
public partial class frmSync : Form
{
private List<FileCompare> _CheckedOut;
private bool IsLoading = false;
public frmSync()
{
InitializeComponent();
}
private void LoadSettings()
{
if (Properties.Settings.Default["Location"] != null)
Location = Properties.Settings.Default.Location;
if (Properties.Settings.Default["Size"] != null)
Size = Properties.Settings.Default.Size;
if (Properties.Settings.Default.DevelopmentFolder != "")
tbDevelopment.Text = Properties.Settings.Default.DevelopmentFolder;
if (Properties.Settings.Default.SourceSafeFolder != "")
tbSourceSafe.Text = Properties.Settings.Default.SourceSafeFolder;
if(Properties.Settings.Default.MailBoxDevelopmentFolder != "")
tbMailBox.Text = Properties.Settings.Default.MailBoxDevelopmentFolder;
if (Properties.Settings.Default.MailBoxSourceSafeFolder != "")
tbSSMailBox.Text = Properties.Settings.Default.MailBoxSourceSafeFolder;
}
private void frmSync_Load(object sender, EventArgs e)
{
LoadSettings();
Setup();
}
private void Setup()
{
// Setup Browse Buttons
btnBrwsDev.Tag = this.tbDevelopment;
btnBrwsSS.Tag = this.tbSourceSafe;
btnBrwsMail.Tag = this.tbMailBox;
btnBrwsSSMail.Tag = this.tbSSMailBox;
}
private void btnBrowse_Click(object sender, EventArgs e)
{
TextBox tb = (TextBox)((Button)sender).Tag;
fbd.SelectedPath = tb.Text;
if (fbd.ShowDialog() == DialogResult.OK)
tb.Text = fbd.SelectedPath;
}
private void ClearResults()
{
_CheckedOut = new List<FileCompare>();
dgv.DataSource = null;
Application.DoEvents();
}
private void FindCheckedOut(DirectoryInfo di)
{
FindCheckedOut(di.GetFiles());
FindCheckedOut(di.GetDirectories());
}
private void FindCheckedOut(DirectoryInfo[] directoryInfoList)
{
foreach (DirectoryInfo di in directoryInfoList)
FindCheckedOut(di);
}
private void FindCheckedOut(FileInfo[] fileInfoList)
{
foreach (FileInfo fi in fileInfoList)
FindCheckedOut(fi);
}
private void FindCheckedOut(FileInfo fi)
{
if (fi.Name.ToLower().EndsWith("scc")) return;
if (fi.Name.ToLower().EndsWith("sln")) return;
if (fi.Name.ToLower().EndsWith("csproj"))
{
// Find files that have been added to the new Project
List<string> compileList = GetCompileList(fi.FullName);
FileInfo fi1csproj = new FileInfo(fi.FullName.Replace(tbSourceSafe.Text, tbDevelopment.Text));
if (fi1csproj.Exists)
{
List<string> compileList1 = GetCompileList(fi1csproj.FullName);
CompareLists(compileList, compileList1, fi, fi1csproj);
}
return;
}
if (fi.Name.ToLower().EndsWith("licx")) return;
FileInfo fi1 = new FileInfo(fi.FullName.Replace(tbSourceSafe.Text, tbDevelopment.Text));
if ((fi1.Attributes & FileAttributes.ReadOnly) != FileAttributes.ReadOnly)
AddToResults(fi, fi1);
}
private void CompareLists(List<string> compileList, List<string> compileList1, FileInfo fi, FileInfo fi1)
{
// If anything is in compileList1 and not in CompileList add it to the results
foreach (string filename in compileList1)
if (!compileList.Contains(filename))
AddToResults(fi, fi1, filename);
}
private void AddToResults(FileInfo fi, FileInfo fi1, string filename)
{
FileInfo newfi = new FileInfo(fi.DirectoryName + "/" + filename);
FileInfo newfi1 = new FileInfo(fi1.DirectoryName + "/" + filename);
if(!newfi.Exists)AddToResults(newfi, newfi1); // Only add if the file does not exist
}
private List<string> GetCompileList(string fileName)
{
List<string> retval = new List<string>();
XmlDocument doc = new XmlDocument();
doc.Load(fileName);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
foreach (XmlAttribute attrib in doc.DocumentElement.Attributes)
if (attrib.Name == "xmlns")
nsmgr.AddNamespace("ns", attrib.Value);
XmlNodeList xl = doc.DocumentElement.SelectNodes(@"//ns:Compile/@Include",nsmgr);
foreach (XmlAttribute xa in xl)
retval.Add(xa.Value);
xl = doc.DocumentElement.SelectNodes(@"//ns:None/@Include", nsmgr);
foreach (XmlAttribute xa in xl)
if(xa.Value.ToUpper().EndsWith("SQL"))
retval.Add(xa.Value);
xl = doc.DocumentElement.SelectNodes(@"//ns:Content/@Include", nsmgr);
foreach (XmlAttribute xa in xl)
if (xa.Value.ToUpper().EndsWith("DLL"))
retval.Add(xa.Value);
xl = doc.DocumentElement.SelectNodes(@"//ns:Content/@Include", nsmgr);
foreach (XmlAttribute xa in xl)
if (xa.Value.ToUpper().EndsWith("XML"))
retval.Add(xa.Value);
xl = doc.DocumentElement.SelectNodes(@"//ns:EmbeddedResource/@Include", nsmgr);
foreach (XmlAttribute xa in xl)
if (!xa.Value.ToUpper().EndsWith("LICX"))
retval.Add(xa.Value);
return retval;
}
private void AddToResults(FileInfo fiSS,FileInfo fiDev)
{
FileCompare fc = new FileCompare(fiDev, fiSS);
//if(!_OnlyContentDifferent || (fc.Different && (fc.DevModified != null)))
if (!_OnlyContentDifferent || (fc.Different))
_CheckedOut.Add(fc);
//if (tbResults.Text == "") tbResults.Text = "Found:";
//tbResults.Text += "\r\n" + fiDev.FullName + " - " + ((fiDev.Attributes & FileAttributes.ReadOnly) != FileAttributes.ReadOnly ? "" : "ReadOnly");
}
private void ClearMailBox()
{
DeleteFolder(new DirectoryInfo(tbMailBox.Text));
DeleteFolder(new DirectoryInfo(tbSSMailBox.Text));
}
private void DeleteFolder(DirectoryInfo directoryInfo)
{
if (directoryInfo.Exists)
{
AdjustAttributes(directoryInfo);
directoryInfo.Delete(true);
}
}
private void AdjustAttributes(DirectoryInfo directoryInfo)
{
foreach (DirectoryInfo di in directoryInfo.GetDirectories())
AdjustAttributes(di);
foreach (FileInfo fi in directoryInfo.GetFiles())
AdjustAttribute(fi);
}
private void AdjustAttribute(FileInfo fi)
{
fi.Attributes &= (fi.Attributes ^ FileAttributes.ReadOnly);// Turn-Off ReadOnly Attribute
fi.Attributes &= (fi.Attributes ^ FileAttributes.Hidden);// Turn-Off Hidden Attribute
}
private void frmSync_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.Location = Location;
Properties.Settings.Default.Size = Size;
Properties.Settings.Default.DevelopmentFolder = tbDevelopment.Text;
Properties.Settings.Default.SourceSafeFolder = tbSourceSafe.Text;
Properties.Settings.Default.MailBoxDevelopmentFolder = tbMailBox.Text;
Properties.Settings.Default.MailBoxSourceSafeFolder = tbSSMailBox.Text;
Properties.Settings.Default.Save();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void clearToolStripMenuItem_Click(object sender, EventArgs e)
{
ClearMailBox();
}
private void buildToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
ClearMailBox();
if (_CheckedOut == null)
checkedOutToolStripMenuItem_Click(sender, e);
foreach (FileCompare fc in _CheckedOut)
{
if (fc.ToProcess)
{
fc.MoveDevToMailBox(tbDevelopment.Text, tbMailBox.Text);
fc.MoveSSToMailBox(tbSourceSafe.Text, tbSSMailBox.Text);
}
}
BuildZipOfMailBox(tbMailBox.Text);
}
private void BuildZipOfMailBox(string mailbox)
{
SevenZipCompressor.SetLibraryPath(Application.StartupPath + @"\7z.dll");
SevenZipCompressor cmpr = new SevenZipCompressor();
cmpr.PreserveDirectoryRoot = true;
string zipName = string.Format("{0} To SS {1}.7z", mailbox, DateTime.Now.ToString("yyyyMMdd HHmm"));
cmpr.CompressDirectory(mailbox, zipName, "*.*", true);
MessageBox.Show(string.Format("{0} created!", zipName), "Mailbox Zip Created", MessageBoxButtons.OK, MessageBoxIcon.Information);
//if (System.IO.File.Exists(@"c:\program files\7-zip\7z.exe"))
//{
// string args = string.Format(@"a -t7z ""{0} To SS {1}.7z"" ""{0}\*.*"" -r", mailbox, DateTime.Now.ToString("yyyyMMdd HHmm"));
// System.Diagnostics.Process p = System.Diagnostics.Process.Start(@"c:\program files\7-zip\7z", args);
// p.WaitForExit();
//}
//"c:\program files\7-zip\7z" a -t7z "C:\Development\MailBox\Proms To SS 20120424 1850.7z" "C:\Development\MailBox\Proms\*.*" -r
}
private void checkedOutToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
ClearResults();
// Walk though Source Safe and check to see if the files in the Development folder are read-only
FindCheckedOut(new DirectoryInfo(tbSourceSafe.Text));
dgv.DataSource = _CheckedOut;
SetColumnWidth();
}
private void syncAllToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
foreach (FileCompare fc in _CheckedOut)
{
fc.MoveToDevelopment();
}
}
private void restoreUnchangedToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
foreach (FileCompare fc in _CheckedOut)
{
if(!fc.Different || fc.DevModified == null)
fc.MoveToDevelopment();
}
}
private void restoreSelectedToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
foreach (FileCompare fc in _CheckedOut)
{
if (fc.ToProcess) fc.MoveToDevelopment();
}
}
private void restoreAllToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
foreach (FileCompare fc in _CheckedOut)
{
fc.MoveToDevelopment();
}
}
private List<FileCompare> SelectedList
{
get
{
dgv.EndEdit();
List<FileCompare> fcList = new List<FileCompare>();
foreach (DataGridViewCell dgc in dgv.SelectedCells)
{
FileCompare fc = dgv.Rows[dgc.RowIndex].DataBoundItem as FileCompare;
if (fc != null && fcList.Contains(fc) == false)
fcList.Add(fc);
}
return fcList;
}
}
private void compareToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
// This should launch UltraCompare with the two files
// Which Item am I on
List<FileCompare> fcList = SelectedList;
foreach (FileCompare fc in fcList)
{
CompareOneFile(fc.FileName, fc.SSFileName);
}
}
private static void CompareOneFile(string fileDev, string fileSS)
{
Console.WriteLine("Compare {0} and {1}", fileDev, fileSS);
string progname = string.Empty;
if (System.IO.File.Exists(@"C:\Program Files\IDM Computer Solutions\UltraCompare\UC.exe"))
progname = @"C:\Program Files\IDM Computer Solutions\UltraCompare\UC.exe";
if (System.IO.File.Exists(@"C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\UC.exe"))
progname = @"C:\Program Files (x86)\IDM Computer Solutions\UltraCompare\UC.exe";
// string cmd = string.Format("\"{0}\" -t \"{1}\" \"{2}\"", progname, fc.FileName, fc.SSFileName);
System.Diagnostics.ProcessStartInfo psi =
new System.Diagnostics.ProcessStartInfo(progname, string.Format(@" -t ""{0}"" ""{1}""", fileDev, fileSS));
System.Diagnostics.Process prc = System.Diagnostics.Process.Start(psi);
}
private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
List<FileCompare> fcList = SelectedList;
foreach (FileCompare fc in fcList)
{
fc.MoveToDevelopment();
}
}
private void differentToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
ClearResults();
// Walk though Source Safe and check to see if the files in the Development folder are read-only
FindDifferent(new DirectoryInfo(tbSourceSafe.Text));
dgv.DataSource = _CheckedOut;
SetColumnWidth();
}
private void SetColumnWidth()
{
IsLoading = true;
if (Properties.Settings.Default["Widths"] == null)
{
dgv.Columns[0].Width = 60;
dgv.Columns[1].Visible = false;
dgv.Columns[2].Width = 125;
dgv.Columns[3].Width = 125;
dgv.Columns[4].Width = 50;
dgv.Columns[5].Width = 500;
}
else
{
for (int i = 0; i < Properties.Settings.Default.Widths.Count; i++)
{
string sWidth = Properties.Settings.Default.Widths[i];
if (sWidth == "Invisible")
dgv.Columns[i].Visible = false;
else
dgv.Columns[i].Width = int.Parse(sWidth);
}
}
dgv.Columns[1].Visible = false;
IsLoading = false;
}
private void FindDifferent(DirectoryInfo di)
{
FindDifferent(di.GetFiles());
FindDifferent(di.GetDirectories());
}
private void FindDifferent(DirectoryInfo[] directoryInfoList)
{
foreach (DirectoryInfo di in directoryInfoList)
FindDifferent(di);
}
private void FindDifferent(FileInfo[] fileInfoList)
{
foreach (FileInfo fi in fileInfoList)
FindDifferent(fi);
}
private void FindDifferent(FileInfo fi)
{
if (fi.Name.ToLower().EndsWith("scc")) return;
if (fi.Name.ToLower().EndsWith("sln")) return;
if (fi.Name.ToLower().EndsWith("csproj"))
{
// Find files that have been added to the new Project
List<string> compileList = GetCompileList(fi.FullName);
FileInfo fi1csproj = new FileInfo(fi.FullName.Replace(tbSourceSafe.Text, tbDevelopment.Text));
if (fi1csproj.Exists)
{
List<string> compileList1 = GetCompileList(fi1csproj.FullName);
CompareLists(compileList, compileList1, fi, fi1csproj);
}
return;
}
if (fi.Name.ToLower().EndsWith("licx")) return;
FileInfo fiD = new FileInfo(fi.FullName.Replace(tbSourceSafe.Text, tbDevelopment.Text));
FileInfo fiS = fi;
// Only check Read-Only flag, other attributes are unimportant
if (fiS.LastWriteTimeUtc != fiD.LastWriteTimeUtc || (fiS.Attributes & FileAttributes.ReadOnly ) != (fiD.Attributes & FileAttributes.ReadOnly ))
AddToResults(fi, fiD);
}
private void dgv_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
{
if (!IsLoading)
{
System.Collections.Specialized.StringCollection widths = new System.Collections.Specialized.StringCollection();
foreach (DataGridViewColumn col in dgv.Columns)
widths.Add(col.Visible ? col.Width.ToString() : "Invisible");
Properties.Settings.Default.Widths = widths;
Properties.Settings.Default.Save();
}
}
private bool _OnlyContentDifferent = false;
private void contentDifferentToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
ClearResults();
_OnlyContentDifferent = true;
// Walk though Source Safe and check to see if the files in the Development folder are read-only
FindDifferent(new DirectoryInfo(tbSourceSafe.Text));
_OnlyContentDifferent = false;
dgv.DataSource = _CheckedOut;
SetColumnWidth();
}
private void frmSync_LocationChanged(object sender, EventArgs e)
{
Rectangle rec = Screen.GetWorkingArea(this);
int newLeft = Left;
int newTop = Top;
if (Math.Abs(Left - rec.X) < 10) newLeft = rec.X;
if (Math.Abs(Top - rec.Y) < 10) newTop = rec.Y;
if (Math.Abs(rec.X + rec.Width - Right) < 10) newLeft = rec.X + rec.Width - Width;
if (Math.Abs(rec.Y + rec.Height - Bottom) < 10) newTop = rec.Y + rec.Height - Height;
if (newTop != Top || newLeft != Left)
Location = new Point(newLeft, newTop);
}
private void restoreReadOnlyToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
foreach (FileCompare fc in _CheckedOut)
{
if (fc.ReadOnly) fc.MoveToDevelopment();
}
}
private void listToClipboardToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv.EndEdit();
StringBuilder sb = new StringBuilder();
int lenFolder = tbDevelopment.Text.Length;
string lastFolder = "";
foreach (FileCompare fc in _CheckedOut)
{
if (fc.ToProcess)
{
FileInfo fi = new FileInfo(fc.FileName);
FileInfo fis = new FileInfo(fc.SSFileName);
string folder = fi.Directory.FullName.Substring(lenFolder + 1);
if (folder != lastFolder)
{
sb.Append(folder + ":\r\n");
lastFolder = folder;
}
sb.Append((fis.Exists ? "" : " =>NEW") + "\t" + fi.Name + "\r\n");
}
}
try
{
sb.Append("\r\nInternal Release:\r\n");
sb.Append("\r\nExternal Release:\r\n");
sb.Append("\r\nTesting Performed:\r\n");
sb.Append("\r\nTesting Requirements:\r\n");
Clipboard.Clear();
Clipboard.SetText(sb.ToString());
MessageBox.Show(sb.ToString(), "Copied to Clipboard", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
StringBuilder sb2 = new StringBuilder();
string prefix = "";
while (ex != null)
{
sb2.AppendLine(string.Format("{0}{1} - {2}",prefix, ex.GetType().Name, ex.Message));
prefix += " ";
}
MessageBox.Show(sb2.ToString(), "Error saving Clipboard", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void dgv_MouseDown(object sender, MouseEventArgs e)
{
dgv.ClearSelection();
DataGridView.HitTestInfo info = dgv.HitTest(e.X, e.Y);
if (info.RowIndex < 0) return;
dgv.CurrentCell = dgv[0, info.RowIndex];
dgv.Rows[info.RowIndex].Selected = true;
}
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
{
if (_CheckedOut == null || _CheckedOut.Count == 0)
{
MessageBox.Show("Don't you really think you should get a list first!", "Hey Moron!", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop);
return;
}
foreach (FileCompare fc in _CheckedOut) fc.ToProcess = true;
dgv.Refresh();
}
private void selectNoneToolStripMenuItem_Click(object sender, EventArgs e)
{
if (_CheckedOut == null || _CheckedOut.Count == 0)
{
MessageBox.Show("Don't you really think you should get a list first!", "Hey Moron!", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop);
return;
}
foreach (FileCompare fc in _CheckedOut) fc.ToProcess = false;
dgv.Refresh();
}
private void compareSourceSafeToolStripMenuItem_Click(object sender, EventArgs e)
{
// Compare SS version with SS version from Mailbox
dgv.EndEdit();
// This should launch UltraCompare with the two files
// Which Item am I on
List<FileCompare> fcList = SelectedList;
foreach (FileCompare fc in fcList)
{
CompareOneFile(fc.SSFileName, fc.SSFileName.Replace(tbSourceSafe.Text, tbSSMailBox.Text));
}
}
private void compareMailboxToolStripMenuItem_Click(object sender, EventArgs e)
{
// Compare MailBox version with Mailbox Source Safe version
dgv.EndEdit();
// This should launch UltraCompare with the two files
// Which Item am I on
List<FileCompare> fcList = SelectedList;
foreach (FileCompare fc in fcList)
{
CompareOneFile(fc.FileName, fc.FileName.Replace(tbDevelopment.Text, tbSSMailBox.Text));
}
}
}
}