diff --git a/PROMS/Sync/Sync/7z.dll b/PROMS/Sync/Sync/7z.dll new file mode 100644 index 00000000..2bdaed6a Binary files /dev/null and b/PROMS/Sync/Sync/7z.dll differ diff --git a/PROMS/Sync/Sync/SevenZipSharp.dll b/PROMS/Sync/Sync/SevenZipSharp.dll new file mode 100644 index 00000000..f588f8a2 Binary files /dev/null and b/PROMS/Sync/Sync/SevenZipSharp.dll differ diff --git a/PROMS/Sync/Sync/frmSync.Designer.cs b/PROMS/Sync/Sync/frmSync.Designer.cs index 8bde95e7..b6249ccf 100644 --- a/PROMS/Sync/Sync/frmSync.Designer.cs +++ b/PROMS/Sync/Sync/frmSync.Designer.cs @@ -65,6 +65,9 @@ namespace Sync this.restoreAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.restoreReadOnlyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.listToClipboardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.selectNoneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit(); this.cms.SuspendLayout(); @@ -257,6 +260,7 @@ namespace Sync // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, + this.editToolStripMenuItem, this.mailboxToolStripMenuItem, this.findToolStripMenuItem, this.sourceSafeToolStripMenuItem, @@ -382,6 +386,29 @@ namespace Sync this.listToClipboardToolStripMenuItem.Text = "List toClipboard"; this.listToClipboardToolStripMenuItem.Click += new System.EventHandler(this.listToClipboardToolStripMenuItem_Click); // + // editToolStripMenuItem + // + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.selectAllToolStripMenuItem, + this.selectNoneToolStripMenuItem}); + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); + this.editToolStripMenuItem.Text = "&Edit"; + // + // selectAllToolStripMenuItem + // + this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; + this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.selectAllToolStripMenuItem.Text = "Select All"; + this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click); + // + // selectNoneToolStripMenuItem + // + this.selectNoneToolStripMenuItem.Name = "selectNoneToolStripMenuItem"; + this.selectNoneToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.selectNoneToolStripMenuItem.Text = "Select None"; + this.selectNoneToolStripMenuItem.Click += new System.EventHandler(this.selectNoneToolStripMenuItem_Click); + // // frmSync // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -446,6 +473,9 @@ namespace Sync private System.Windows.Forms.ToolStripMenuItem contentDifferentToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem restoreReadOnlyToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem listToClipboardToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem selectNoneToolStripMenuItem; } } diff --git a/PROMS/Sync/Sync/frmSync.cs b/PROMS/Sync/Sync/frmSync.cs index 6e78adb0..caf36ee4 100644 --- a/PROMS/Sync/Sync/frmSync.cs +++ b/PROMS/Sync/Sync/frmSync.cs @@ -7,7 +7,7 @@ using System.Text; using System.Windows.Forms; using System.IO; using System.Xml; - +using SevenZip; namespace Sync { @@ -127,7 +127,11 @@ namespace Sync foreach (XmlAttribute xa in xl) if(xa.Value.ToUpper().EndsWith("SQL")) retval.Add(xa.Value); - xl = doc.DocumentElement.SelectNodes(@"//ns:EmbeddedResource/@Include",nsmgr); + 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:EmbeddedResource/@Include", nsmgr); foreach (XmlAttribute xa in xl) if (!xa.Value.ToUpper().EndsWith("LICX")) retval.Add(xa.Value); @@ -199,6 +203,24 @@ namespace Sync 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) { @@ -427,9 +449,23 @@ namespace Sync sb.Append((fis.Exists ? "" : " =>NEW") + "\t" + fi.Name + "\r\n"); } } - Clipboard.Clear(); - Clipboard.SetText(sb.ToString()); - MessageBox.Show(sb.ToString(), "Copied to Clipboard", MessageBoxButtons.OK, MessageBoxIcon.Information); + try + { + 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) { @@ -439,5 +475,27 @@ namespace Sync 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(); + } } } \ No newline at end of file