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

View File

@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml.Serialization;
namespace SyncMany
{
[XmlRoot("SyncFile")]
public class SyncFile
{
private CompareItems _Items=new CompareItems();
[XmlElement("CompareItem")]
public CompareItems Items
{
get { return _Items; }
set { _Items = value; }
}
}
public partial class CompareItems : List<CompareItem>
{
}
public class CompareItem
{
private string _Source;
[XmlAttribute("Source")]
public string Source
{
get { return _Source; }
set { _Source = value; }
}
private string _Destination;
[XmlAttribute("Destination")]
public string DestinationItem
{
get { return _Destination; }
set { _Destination = value; }
}
public CompareItem()
{
}
public CompareItem(string source, string destination)
{
_Source = source;
_Destination = destination;
}
private FileInfo _SourceFile;
[XmlIgnore]
public FileInfo SourceFile
{
get
{
if (_SourceFile == null)
_SourceFile = new FileInfo(_Source);
return _SourceFile;
}
set { _SourceFile = value; }
}
private FileInfo _DestinationFile;
[XmlIgnore]
public FileInfo DestinationFile
{
get
{
if (_DestinationFile == null)
_DestinationFile = new FileInfo(_Destination);
return _DestinationFile;
}
set { _DestinationFile = value; }
}
public bool IsDifferent
{
get
{
string srcText = ReadFile(SourceFile);
string dstText = ReadFile(DestinationFile);
return srcText != dstText;
}
}
private string ReadFile(FileInfo myFile)
{
string retval;
using (StreamReader sr = myFile.OpenText())
{
retval = sr.ReadToEnd();
sr.Close();
}
return retval;
}
public void CopySourceToDestination()
{
_DestinationFile.IsReadOnly = false;
_SourceFile.CopyTo(_Destination,true);
}
public void CopyDestinationToSource()
{
_SourceFile.IsReadOnly = false;
_DestinationFile.CopyTo(Source,true);
}
}
}

View File

@@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace SyncMany
{
public static class ObjectSerializer<T> where T : class
{
public static string StringSerialize(T t)
{
string strOutput = string.Empty;
XmlSerializer xs = new XmlSerializer(typeof(T));
using (MemoryStream ms = new MemoryStream())
{
xs.Serialize(new NonXsiTextWriter(ms, Encoding.UTF8), t);
//xs.Serialize(ms, t);
ms.Position = 0;
StreamReader sr = new StreamReader(ms);
strOutput = sr.ReadToEnd();
ms.Close();
}
return strOutput;
}
public static T StringDeserialize(string s)
{
T t;
XmlSerializer xs = new XmlSerializer(typeof(T));
UTF8Encoding enc = new UTF8Encoding();
Byte[] arrBytData = enc.GetBytes(s);
using (MemoryStream ms = new MemoryStream(arrBytData))
{
t = (T)xs.Deserialize(ms);
}
return t;
}
public static void WriteFile(T t, string fileName)
{
string strOutput = string.Empty;
XmlSerializer xs = new XmlSerializer(typeof(T));
using (FileStream fs = new FileStream(fileName, FileMode.Create))
{
xs.Serialize(new NonXsiTextWriter(fs, Encoding.UTF8), t);
fs.Close();
}
}
public static T ReadFile(string fileName)
{
T t;
XmlSerializer xs = new XmlSerializer(typeof(T));
using (FileStream fs = new FileStream(fileName, FileMode.Open))
{
t = (T)xs.Deserialize(fs);
}
return t;
}
}
public class NonXsiTextWriter : XmlTextWriter
{
public NonXsiTextWriter(TextWriter w) : base(w) { }
public NonXsiTextWriter(Stream w, Encoding encoding)
: base(w, encoding)
{
this.Formatting = Formatting.Indented;
}
public NonXsiTextWriter(string filename, Encoding encoding) : base(filename, encoding) { }
bool _skip = false;
public override void WriteStartAttribute(string prefix, string localName, string ns)
{
if ((prefix == "xmlns" && (localName == "xsd" || localName == "xsi")) || // Omits XSD and XSI declarations.
ns == XmlSchema.InstanceNamespace) // Omits all XSI attributes.
{
_skip = true;
return;
}
if (localName == "xlink_href")
base.WriteStartAttribute(prefix, "xlink:href", ns);
else
base.WriteStartAttribute(prefix, localName, ns);
}
public override void WriteString(string text)
{
if (_skip) return;
base.WriteString(text);
}
public override void WriteEndAttribute()
{
if (_skip)
{ // Reset the flag, so we keep writing.
_skip = false;
return;
}
base.WriteEndAttribute();
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace SyncMany
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmSyncMany());
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SyncMany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SyncMany")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1d309448-e6cc-4ad8-97ca-15dd2d5c551a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="CompareItems" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>SyncMany.CompareItems, SyncMany, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SyncMany.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SyncMany.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,96 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SyncMany.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::System.Drawing.Size Size {
get {
return ((global::System.Drawing.Size)(this["Size"]));
}
set {
this["Size"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::System.Drawing.Point Location {
get {
return ((global::System.Drawing.Point)(this["Location"]));
}
set {
this["Location"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Windows.Forms.FormWindowState WindowState {
get {
return ((global::System.Windows.Forms.FormWindowState)(this["WindowState"]));
}
set {
this["WindowState"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string FileName {
get {
return ((string)(this["FileName"]));
}
set {
this["FileName"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string SourceFolder {
get {
return ((string)(this["SourceFolder"]));
}
set {
this["SourceFolder"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string DestinationFolder {
get {
return ((string)(this["DestinationFolder"]));
}
set {
this["DestinationFolder"] = value;
}
}
}
}

View File

@@ -0,0 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="SyncMany.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="Size" Type="System.Drawing.Size" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Location" Type="System.Drawing.Point" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="WindowState" Type="System.Windows.Forms.FormWindowState" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="FileName" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SourceFolder" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="DestinationFolder" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@@ -0,0 +1,108 @@
<?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>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{256A41AF-440F-42FE-A9B1-2CE36F1261A2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<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>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CompareItem.cs" />
<Compile Include="frmAddCompareItem.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmAddCompareItem.Designer.cs">
<DependentUpon>frmAddCompareItem.cs</DependentUpon>
</Compile>
<Compile Include="frmSyncMany.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSyncMany.Designer.cs">
<DependentUpon>frmSyncMany.cs</DependentUpon>
</Compile>
<Compile Include="GenericSerializer.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmAddCompareItem.resx">
<SubType>Designer</SubType>
<DependentUpon>frmAddCompareItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmSyncMany.resx">
<SubType>Designer</SubType>
<DependentUpon>frmSyncMany.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<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" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="sync.ico" />
</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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Binary file not shown.

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="SyncMany.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<SyncMany.Properties.Settings>
<setting name="WindowState" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="FileName" serializeAs="String">
<value />
</setting>
<setting name="SourceFolder" serializeAs="String">
<value />
</setting>
<setting name="DestinationFolder" serializeAs="String">
<value />
</setting>
</SyncMany.Properties.Settings>
</userSettings>
</configuration>

View File

@@ -0,0 +1,155 @@
namespace SyncMany
{
partial class frmAddCompareItem
{
/// <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.btnSource = new System.Windows.Forms.Button();
this.tbSource = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.tbDestination = new System.Windows.Forms.TextBox();
this.btnDestination = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.ofd = new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout();
//
// btnSource
//
this.btnSource.Location = new System.Drawing.Point(634, 11);
this.btnSource.Name = "btnSource";
this.btnSource.Size = new System.Drawing.Size(75, 23);
this.btnSource.TabIndex = 0;
this.btnSource.Text = "Browse...";
this.btnSource.UseVisualStyleBackColor = true;
this.btnSource.Click += new System.EventHandler(this.btnSource_Click);
//
// tbSource
//
this.tbSource.Location = new System.Drawing.Point(90, 13);
this.tbSource.Name = "tbSource";
this.tbSource.Size = new System.Drawing.Size(538, 20);
this.tbSource.TabIndex = 1;
this.tbSource.TextChanged += new System.EventHandler(this.tbText_TextChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Source";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(60, 13);
this.label2.TabIndex = 5;
this.label2.Text = "Destination";
//
// tbDestination
//
this.tbDestination.Location = new System.Drawing.Point(90, 39);
this.tbDestination.Name = "tbDestination";
this.tbDestination.Size = new System.Drawing.Size(538, 20);
this.tbDestination.TabIndex = 4;
this.tbDestination.TextChanged += new System.EventHandler(this.tbText_TextChanged);
//
// btnDestination
//
this.btnDestination.Location = new System.Drawing.Point(634, 37);
this.btnDestination.Name = "btnDestination";
this.btnDestination.Size = new System.Drawing.Size(75, 23);
this.btnDestination.TabIndex = 3;
this.btnDestination.Text = "Browse...";
this.btnDestination.UseVisualStyleBackColor = true;
this.btnDestination.Click += new System.EventHandler(this.btnDestination_Click);
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(553, 65);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 6;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Retry;
this.btnCancel.Location = new System.Drawing.Point(634, 65);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 7;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// ofd
//
this.ofd.Filter = "CSharp Files|*.cs|All Files|*.*";
//
// frmAddCompareItem
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(782, 145);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.label2);
this.Controls.Add(this.tbDestination);
this.Controls.Add(this.btnDestination);
this.Controls.Add(this.label1);
this.Controls.Add(this.tbSource);
this.Controls.Add(this.btnSource);
this.Name = "frmAddCompareItem";
this.Text = "frmAddCompareItem";
this.Resize += new System.EventHandler(this.frmAddCompareItem_Resize);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnSource;
private System.Windows.Forms.TextBox tbSource;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox tbDestination;
private System.Windows.Forms.Button btnDestination;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.OpenFileDialog ofd;
}
}

View File

@@ -0,0 +1,88 @@
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 SyncMany
{
public partial class frmAddCompareItem : Form
{
public string SourceName
{ get { return tbSource.Text; } }
public string DestinationName
{ get { return tbDestination.Text; } }
private string _SourceFolder;
public string SourceFolder
{
get { return _SourceFolder; }
set { _SourceFolder = value; }
}
private string _DestinationFolder;
public string DestinationFolder
{
get { return _DestinationFolder; }
set { _DestinationFolder = value; }
}
public frmAddCompareItem(string sourceFolder, string destinationFolder)
{
InitializeComponent();
SetupButtons();
SourceFolder = sourceFolder;
DestinationFolder = destinationFolder;
}
private void SetupButtons()
{
btnOK.Enabled = tbDestination.Text != null && tbSource != null;
}
private void frmAddCompareItem_Resize(object sender, EventArgs e)
{
if(Height != 131)
Height = 131;
}
private void tbText_TextChanged(object sender, EventArgs e)
{
SetupButtons();
}
private void btnSource_Click(object sender, EventArgs e)
{
if (tbSource.Text != "")
{
SourceFolder = SetupOpenFileDialog(tbSource.Text);
}
else
{
ofd.InitialDirectory = SourceFolder;
}
if (ofd.ShowDialog() != DialogResult.OK)
return;
tbSource.Text = ofd.FileName;
SourceFolder = SetupOpenFileDialog(ofd.FileName);
}
private string SetupOpenFileDialog(string fileName)
{
FileInfo fi = new FileInfo(fileName);
ofd.InitialDirectory = fi.Directory.FullName;
ofd.FileName = fi.Name;
return ofd.InitialDirectory;
}
private void btnDestination_Click(object sender, EventArgs e)
{
if (tbDestination.Text != "")
{
DestinationFolder = SetupOpenFileDialog(tbDestination.Text);
}
else
{
ofd.InitialDirectory = DestinationFolder;
}
if (ofd.ShowDialog() != DialogResult.OK)
return;
tbDestination.Text = ofd.FileName;
DestinationFolder = SetupOpenFileDialog(ofd.FileName);
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ofd.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,285 @@
namespace SyncMany
{
partial class frmSyncMany
{
/// <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(frmSyncMany));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ofd = new System.Windows.Forms.OpenFileDialog();
this.sfd = new System.Windows.Forms.SaveFileDialog();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.dgv = new System.Windows.Forms.DataGridView();
this.IsDifferent = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.sourceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.destinationItemDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cms = new System.Windows.Forms.ContextMenuStrip(this.components);
this.compareToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.copySourceToDestinationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyDestinationToSourceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.compareItemsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
this.cms.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.compareItemsBindingSource)).BeginInit();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.addToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(672, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openToolStripMenuItem,
this.saveToolStripMenuItem,
this.saveAsToolStripMenuItem,
this.toolStripMenuItem1,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.openToolStripMenuItem.Text = "&Open";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveToolStripMenuItem.Text = "&Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// saveAsToolStripMenuItem
//
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.saveAsToolStripMenuItem.Text = "Save&As";
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// addToolStripMenuItem
//
this.addToolStripMenuItem.Name = "addToolStripMenuItem";
this.addToolStripMenuItem.Size = new System.Drawing.Size(41, 20);
this.addToolStripMenuItem.Text = "Add";
this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click);
//
// ofd
//
this.ofd.FileName = "SyncList.xml";
this.ofd.Filter = "XML Files|*.xml";
this.ofd.FileOk += new System.ComponentModel.CancelEventHandler(this.ofd_FileOk);
//
// sfd
//
this.sfd.FileName = "SyncList.XML";
this.sfd.Filter = "XML Files|*.xml";
this.sfd.FileOk += new System.ComponentModel.CancelEventHandler(this.sfd_FileOk);
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsslStatus});
this.statusStrip1.Location = new System.Drawing.Point(0, 333);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(672, 22);
this.statusStrip1.TabIndex = 1;
this.statusStrip1.Text = "statusStrip1";
//
// tsslStatus
//
this.tsslStatus.Name = "tsslStatus";
this.tsslStatus.Size = new System.Drawing.Size(39, 17);
this.tsslStatus.Text = "Ready";
//
// dgv
//
this.dgv.AllowUserToAddRows = false;
this.dgv.AllowUserToDeleteRows = false;
this.dgv.AutoGenerateColumns = false;
this.dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.IsDifferent,
this.sourceDataGridViewTextBoxColumn,
this.destinationItemDataGridViewTextBoxColumn});
this.dgv.ContextMenuStrip = this.cms;
this.dgv.DataSource = this.compareItemsBindingSource;
this.dgv.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgv.Location = new System.Drawing.Point(0, 24);
this.dgv.Name = "dgv";
this.dgv.Size = new System.Drawing.Size(672, 309);
this.dgv.TabIndex = 2;
this.dgv.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgv_CellMouseDown);
//
// IsDifferent
//
this.IsDifferent.DataPropertyName = "IsDifferent";
this.IsDifferent.HeaderText = "IsDifferent";
this.IsDifferent.Name = "IsDifferent";
this.IsDifferent.ReadOnly = true;
//
// sourceDataGridViewTextBoxColumn
//
this.sourceDataGridViewTextBoxColumn.DataPropertyName = "Source";
this.sourceDataGridViewTextBoxColumn.HeaderText = "Source";
this.sourceDataGridViewTextBoxColumn.Name = "sourceDataGridViewTextBoxColumn";
//
// destinationItemDataGridViewTextBoxColumn
//
this.destinationItemDataGridViewTextBoxColumn.DataPropertyName = "DestinationItem";
this.destinationItemDataGridViewTextBoxColumn.HeaderText = "DestinationItem";
this.destinationItemDataGridViewTextBoxColumn.Name = "destinationItemDataGridViewTextBoxColumn";
//
// cms
//
this.cms.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.compareToolStripMenuItem1,
this.copySourceToDestinationToolStripMenuItem,
this.copyDestinationToSourceToolStripMenuItem,
this.removeToolStripMenuItem});
this.cms.Name = "cms";
this.cms.Size = new System.Drawing.Size(219, 92);
//
// compareToolStripMenuItem1
//
this.compareToolStripMenuItem1.Name = "compareToolStripMenuItem1";
this.compareToolStripMenuItem1.Size = new System.Drawing.Size(218, 22);
this.compareToolStripMenuItem1.Text = "Compare";
this.compareToolStripMenuItem1.Click += new System.EventHandler(this.compareToolStripMenuItem1_Click);
//
// copySourceToDestinationToolStripMenuItem
//
this.copySourceToDestinationToolStripMenuItem.Name = "copySourceToDestinationToolStripMenuItem";
this.copySourceToDestinationToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.copySourceToDestinationToolStripMenuItem.Text = "Copy Source to Destination";
this.copySourceToDestinationToolStripMenuItem.Click += new System.EventHandler(this.copySourceToDestinationToolStripMenuItem_Click);
//
// copyDestinationToSourceToolStripMenuItem
//
this.copyDestinationToSourceToolStripMenuItem.Name = "copyDestinationToSourceToolStripMenuItem";
this.copyDestinationToSourceToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.copyDestinationToSourceToolStripMenuItem.Text = "Copy Destination to Source";
this.copyDestinationToSourceToolStripMenuItem.Click += new System.EventHandler(this.copyDestinationToSourceToolStripMenuItem_Click);
//
// removeToolStripMenuItem
//
this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
this.removeToolStripMenuItem.Size = new System.Drawing.Size(218, 22);
this.removeToolStripMenuItem.Text = "Remove";
this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click);
//
// compareItemsBindingSource
//
this.compareItemsBindingSource.DataSource = typeof(SyncMany.CompareItem);
//
// frmSyncMany
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(672, 355);
this.Controls.Add(this.dgv);
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 = "frmSyncMany";
this.Text = "Sync Many";
this.Load += new System.EventHandler(this.frmSyncMany_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmSyncMany_FormClosing);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit();
this.cms.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.compareItemsBindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.OpenFileDialog ofd;
private System.Windows.Forms.SaveFileDialog sfd;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel tsslStatus;
private System.Windows.Forms.DataGridView dgv;
private System.Windows.Forms.BindingSource compareItemsBindingSource;
private System.Windows.Forms.ContextMenuStrip cms;
private System.Windows.Forms.ToolStripMenuItem compareToolStripMenuItem1;
private System.Windows.Forms.DataGridViewCheckBoxColumn IsDifferent;
private System.Windows.Forms.DataGridViewTextBoxColumn sourceDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn destinationItemDataGridViewTextBoxColumn;
private System.Windows.Forms.ToolStripMenuItem copySourceToDestinationToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyDestinationToSourceToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
}
}

View File

@@ -0,0 +1,269 @@
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 SyncMany
{
public partial class frmSyncMany : Form
{
public string MyStatus
{
get { return tsslStatus.Text; }
set { tsslStatus.Text = value; Application.DoEvents(); }
}
private string _MyFileName;
public string MyFileName
{
get { return _MyFileName; }
set { _MyFileName = value; ofd.FileName = value; sfd.FileName = value; }
}
SyncFile _MySyncFile = new SyncFile();
public SyncFile MySyncFile
{
get { return _MySyncFile; }
set
{
_MySyncFile = value;
ResetOriginalSync();
dgv.DataSource = value.Items;
dgv.AutoResizeColumns();
}
}
private void ResetOriginalSync()
{
_OriginalSync = ObjectSerializer<SyncFile>.StringSerialize(MySyncFile);
}
private string _SourceFolder;
public string SourceFolder
{
get { return _SourceFolder; }
set { _SourceFolder = value; }
}
private string _DestinationFolder;
public string DestinationFolder
{
get { return _DestinationFolder; }
set { _DestinationFolder = value; }
}
public frmSyncMany()
{
InitializeComponent();
compareItemsBindingSource.DataSource = MySyncFile.Items;
}
public string _OriginalSync = "";
public bool IsDirty
{
get
{
string tmp = ObjectSerializer<SyncFile>.StringSerialize(MySyncFile);
return tmp != _OriginalSync;
}
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ofd.ShowDialog() == DialogResult.OK)
{
MySyncFile = ObjectSerializer<SyncFile>.ReadFile(MyFileName);
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
if (MyFileName == null)
saveAsToolStripMenuItem_Click(sender, e);
else
{
ObjectSerializer<SyncFile>.WriteFile(MySyncFile, MyFileName);
ResetOriginalSync();
}
}
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
{
if (sfd.ShowDialog() == DialogResult.OK)
{
ObjectSerializer<SyncFile>.WriteFile(MySyncFile, MyFileName);
ResetOriginalSync();
}
}
private void ofd_FileOk(object sender, CancelEventArgs e)
{
MyFileName = ofd.FileName;
}
private void sfd_FileOk(object sender, CancelEventArgs e)
{
MyFileName = sfd.FileName;
}
private void addToolStripMenuItem_Click(object sender, EventArgs e)
{
frmAddCompareItem myCompareItem = new frmAddCompareItem(SourceFolder,DestinationFolder);
if (myCompareItem.ShowDialog() == DialogResult.OK)
{
SourceFolder = myCompareItem.SourceFolder;
DestinationFolder = myCompareItem.DestinationFolder;
MySyncFile.Items.Add(new CompareItem(myCompareItem.SourceName, myCompareItem.DestinationName));
//compareItemsBindingSource.Add(new CompareItem(myCompareItem.SourceName, myCompareItem.DestinationName));
compareItemsBindingSource.DataSource = null;
compareItemsBindingSource.DataSource = MySyncFile.Items;
dgv.DataSource = null;
dgv.DataSource = compareItemsBindingSource;
dgv.Refresh();
}
}
private void compareToolStripMenuItem1_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dgv.SelectedRows)
{
CompareItem item = row.DataBoundItem as CompareItem;
if (item != null)
{
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@"C:\Program Files\IDM Computer Solutions\UltraCompare\UC.exe",
string.Format(@" -t ""{0}"" ""{1}""", item.Source, item.DestinationItem));
System.Diagnostics.Process prc = System.Diagnostics.Process.Start(psi);
}
}
}
private void frmSyncMany_Load(object sender, EventArgs e)
{
LoadSettings();
this.Move +=new EventHandler(frmSyncMany_Move);
this.Resize +=new EventHandler(frmSyncMany_Resize);
FileInfo myInfo = new FileInfo(MyFileName);
if (myInfo.Exists)
MySyncFile = ObjectSerializer<SyncFile>.ReadFile(MyFileName);
else
MySyncFile = new SyncFile();
}
private void copySourceToDestinationToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dgv.SelectedRows)
{
CompareItem item = row.DataBoundItem as CompareItem;
if (item != null)
{
item.CopySourceToDestination();
}
dgv.Refresh();
}
}
private void copyDestinationToSourceToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dgv.SelectedRows)
{
CompareItem item = row.DataBoundItem as CompareItem;
if (item != null)
{
item.CopyDestinationToSource();
}
}
dgv.Refresh();
}
private void frmSyncMany_FormClosing(object sender, FormClosingEventArgs e)
{
if (IsDirty)
{
DialogResult result = MessageBox.Show("Do you want to Save changes?","Save Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
switch (result)
{
case DialogResult.Cancel:
// Don't close
e.Cancel = true;
return;
break;
case DialogResult.No:
// Don't do anything
break;
case DialogResult.Yes:
saveToolStripMenuItem_Click(this, e);
break;
}
}
SaveSettings();
}
private string GetPropertyString(string propertyName)
{
object prop = Properties.Settings.Default[propertyName];
return prop == null ? "" : prop.ToString();
}
private void LoadSettings()
{
string myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
if (GetPropertyString("Location") != "")
this.Location = Properties.Settings.Default.Location;
if ((Properties.Settings.Default["Size"] ?? "") != "")
this.Size = Properties.Settings.Default.Size;
this.WindowState = Properties.Settings.Default.WindowState;
string test = GetPropertyString("FileName");
if (GetPropertyString("FileName") != "")
MyFileName = Properties.Settings.Default.FileName;
else
MyFileName = myDocuments + @"\SyncList.XML";
SetupOpenFileDialog(MyFileName);
if (GetPropertyString("SourceFolder") != "")
SourceFolder = Properties.Settings.Default.SourceFolder;
else
SourceFolder = myDocuments;
if (GetPropertyString("DestinationFolder") != "")
DestinationFolder = Properties.Settings.Default.DestinationFolder;
else
DestinationFolder = myDocuments;
}
private string SetupOpenFileDialog(string fileName)
{
FileInfo fi = new FileInfo(fileName);
sfd.InitialDirectory = ofd.InitialDirectory = fi.Directory.FullName;
sfd.FileName = ofd.FileName = fi.Name;
return ofd.InitialDirectory;
}
private void SaveSettings()
{
Properties.Settings.Default.WindowState = this.WindowState;
Properties.Settings.Default.FileName = MyFileName;
Properties.Settings.Default.SourceFolder = SourceFolder;
Properties.Settings.Default.DestinationFolder = DestinationFolder;
Properties.Settings.Default.Save();
}
private void frmSyncMany_Move(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
{
Properties.Settings.Default.Location = this.Location;
Properties.Settings.Default.Size = this.Size;
}
}
private void frmSyncMany_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
{
Properties.Settings.Default.Location = this.Location;
Properties.Settings.Default.Size = this.Size;
}
}
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
{
int index = dgv.SelectedRows[0].Index;
dgv.Rows[index].Selected = false;
MySyncFile.Items.RemoveAt(index);
compareItemsBindingSource.DataSource = MySyncFile.Items;
dgv.DataSource = null;
dgv.DataSource = compareItemsBindingSource;
dgv.Refresh();
}
private void dgv_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.RowIndex >= 0)
{
dgv.Rows[e.RowIndex].Selected = true;
dgv.CurrentCell = dgv[0, e.RowIndex];
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB