├── LICENSE ├── README.md ├── doc ├── Classes.pdf ├── Comparator EN.pdf ├── Comparator_RU.pdf └── Классы.pdf ├── project ├── Common │ ├── Common.cs │ ├── Common.csproj │ ├── EncrDecr.cs │ ├── ExcelProc.cs │ ├── FormFlatData.Designer.cs │ ├── FormFlatData.cs │ ├── FormFlatData.resx │ ├── Loader.cs │ ├── Options.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── SendMail.cs │ └── Views.cs ├── Comparator.sln ├── Comparator.sln.DotSettings.user ├── Comparator.suo ├── Comparator.v12.suo ├── Comparator │ ├── Comparator.csproj │ ├── Comparator.csproj.user │ ├── FormCompare.Designer.cs │ ├── FormCompare.cs │ ├── FormCompare.resx │ ├── FormSelectPair.Designer.cs │ ├── FormSelectPair.cs │ ├── FormSelectPair.resx │ ├── FormView.Designer.cs │ ├── FormView.cs │ ├── FormView.resx │ ├── Log.cs │ ├── Loger.cs │ ├── Master.cs │ ├── Profile.cs │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── app.config │ ├── compare32.ico │ └── ico.rar ├── DSComparer │ ├── CompareResult.cs │ ├── DSComparer.cs │ ├── DSComparer.csproj │ ├── DSComparer.sln │ ├── DSComparer.suo │ ├── FormResult.Designer.cs │ ├── FormResult.cs │ ├── FormResult.resx │ ├── GridResult.Designer.cs │ ├── GridResult.cs │ ├── GridResult.resx │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ └── ico.rar ├── FastColoredTextBox │ └── FastColoredTextBox.dll ├── Sources │ ├── CsvContent.cs │ ├── DbContent.cs │ ├── ExcelContent.cs │ ├── FormXml.cs │ ├── FormXml.designer.cs │ ├── FormXml.resx │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── Source.cs │ ├── SourceContent.cs │ ├── SourcePanel.Designer.cs │ ├── SourcePanel.cs │ ├── SourcePanel.resx │ ├── Sources.csproj │ ├── XmlContent.cs │ ├── XmlController.cs │ └── ico.rar ├── SqlSource │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── SqlController.cs │ ├── SqlSource.csproj │ ├── SqlView.Designer.cs │ ├── SqlView.cs │ ├── SqlView.resx │ └── ico.rar └── readme.txt └── release ├── Common.dll ├── Comparator.exe ├── Comparator.xml ├── DSComparer.dll ├── FastColoredTextBox.dll ├── Sources.dll ├── SqlSource.dll ├── data ├── NORTHWND.MDF ├── NORTHWND_log.ldf ├── OrdersShip.csv ├── OrdersShip.xlsx ├── OrdersShip.xml └── OrdersShip.xslt ├── profiles ├── OrdersShip_db2db.xml ├── OrdersShip_db2xls.xml ├── OrdersShip_xml2csv.xml └── OrdersShip_xml2xml.xml ├── readme.txt └── styles.css /README.md: -------------------------------------------------------------------------------- 1 | # comparator 2 | simple application for compare data 3 | -------------------------------------------------------------------------------- /doc/Classes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/doc/Classes.pdf -------------------------------------------------------------------------------- /doc/Comparator EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/doc/Comparator EN.pdf -------------------------------------------------------------------------------- /doc/Comparator_RU.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/doc/Comparator_RU.pdf -------------------------------------------------------------------------------- /doc/Классы.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/doc/Классы.pdf -------------------------------------------------------------------------------- /project/Common/Common.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Threading; 4 | 5 | namespace Common 6 | { 7 | //=========================================================================== 8 | /* Common functions */ 9 | public static class CommonProc 10 | { 11 | // Get path from relative path 12 | public static string GetFilePath(string fileName) 13 | { 14 | return string.IsNullOrEmpty(fileName) ? fileName : 15 | Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileName(fileName))); 16 | } 17 | } 18 | //=========================================================================== 19 | /* Process execution context */ 20 | public class TaskContext 21 | { 22 | public bool Cancel { get; set; } // interrupt flag 23 | public Exception Error { get; set; } // happened exception 24 | public SynchronizationContext ViewContext { get; set; } // synchronization context for displaying progress 25 | public Action OnProgress { get; set; } // progress handler (counter, message) 26 | public Action OnFinish { get; set; } // finish handler (data object, message) 27 | public Action OnError { get; set; } // error handler (message, exception) 28 | } 29 | //=========================================================================== 30 | /* Error and message handling interface */ 31 | public interface ILoger 32 | { 33 | void Error(string mess, object objErr); 34 | void Message(string mess, bool critical); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /project/Common/Common.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {BE7C1378-3118-4F91-892D-484189F8621A} 9 | Library 10 | Properties 11 | Common 12 | Common 13 | v4.5.1 14 | 512 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | x86 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | x86 36 | false 37 | 38 | 39 | true 40 | bin\x86\Debug\ 41 | DEBUG;TRACE 42 | full 43 | x86 44 | prompt 45 | true 46 | true 47 | false 48 | false 49 | 50 | 51 | bin\x86\Release\ 52 | TRACE 53 | true 54 | pdbonly 55 | x86 56 | prompt 57 | true 58 | true 59 | true 60 | false 61 | 62 | 63 | 64 | True 65 | ..\Office12\Microsoft.Office.Interop.Excel.dll 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Form 79 | 80 | 81 | FormFlatData.cs 82 | 83 | 84 | 85 | 86 | 87 | True 88 | True 89 | Resources.resx 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | FormFlatData.cs 98 | 99 | 100 | ResXFileCodeGenerator 101 | Resources.Designer.cs 102 | 103 | 104 | 105 | 112 | -------------------------------------------------------------------------------- /project/Common/EncrDecr.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Security.Cryptography; 4 | 5 | namespace Common 6 | { 7 | /* Encrypt-decrypt string */ 8 | public class EncrDecr 9 | { 10 | AesCryptoServiceProvider aes = new AesCryptoServiceProvider(); 11 | byte[] aesKey = new byte[32]; 12 | byte[] aesIV = new byte[16]; 13 | //------------------------------------------------------------------------- 14 | public EncrDecr(string strKey, string strIV) 15 | { 16 | for (int i = 0; i < (strKey ?? string.Empty).Length; i++) 17 | if (i < aesKey.Length) aesKey[i] = Convert.ToByte(strKey[i]); 18 | for (int i = 0; i < (strIV ?? string.Empty).Length; i++) 19 | if (i < aesIV.Length) aesIV[i] = Convert.ToByte(strIV[i]); 20 | } 21 | //------------------------------------------------------------------------- 22 | public string Encrypt(string str) 23 | { 24 | byte[] arrEncr; 25 | using (AesCryptoServiceProvider aesEncr = new AesCryptoServiceProvider()) 26 | { 27 | ICryptoTransform encryptor = aesEncr.CreateEncryptor(aesKey, aesIV); 28 | using (MemoryStream msEncr = new MemoryStream()) 29 | { 30 | using (CryptoStream csEncr = new CryptoStream(msEncr, encryptor, CryptoStreamMode.Write)) 31 | { 32 | using (StreamWriter swEncr = new StreamWriter(csEncr)) 33 | { 34 | swEncr.Write(str); 35 | } 36 | arrEncr = msEncr.ToArray(); 37 | } 38 | } 39 | } 40 | return Convert.ToBase64String(arrEncr); 41 | } 42 | //------------------------------------------------------------------------- 43 | public string Decrypt(string strEncr) 44 | { 45 | if (string.IsNullOrEmpty(strEncr)) return strEncr; 46 | byte[] arrEncr = Convert.FromBase64CharArray(strEncr.ToCharArray(), 0, strEncr.ToCharArray().Length); 47 | string str; 48 | using (AesCryptoServiceProvider aesDecr = new AesCryptoServiceProvider()) 49 | { 50 | ICryptoTransform decryptor = aesDecr.CreateDecryptor(aesKey, aesIV); 51 | using (MemoryStream msDecr = new MemoryStream(arrEncr)) 52 | { 53 | using (CryptoStream csDecr = new CryptoStream(msDecr, decryptor, CryptoStreamMode.Read)) 54 | { 55 | using (StreamReader srDecr = new StreamReader(csDecr)) 56 | { 57 | str = srDecr.ReadToEnd(); 58 | } 59 | } 60 | } 61 | } 62 | return str; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /project/Common/FormFlatData.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Common 2 | { 3 | partial class FormFlatData 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); 32 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); 33 | this.statusStrip1 = new System.Windows.Forms.StatusStrip(); 34 | this.status = new System.Windows.Forms.ToolStripStatusLabel(); 35 | this.dgData = new System.Windows.Forms.DataGridView(); 36 | this.statusStrip1.SuspendLayout(); 37 | ((System.ComponentModel.ISupportInitialize)(this.dgData)).BeginInit(); 38 | this.SuspendLayout(); 39 | // 40 | // statusStrip1 41 | // 42 | this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 43 | this.status}); 44 | this.statusStrip1.Location = new System.Drawing.Point(0, 193); 45 | this.statusStrip1.Name = "statusStrip1"; 46 | this.statusStrip1.Size = new System.Drawing.Size(624, 22); 47 | this.statusStrip1.TabIndex = 0; 48 | this.statusStrip1.Text = "statusStrip1"; 49 | // 50 | // status 51 | // 52 | this.status.Font = new System.Drawing.Font("Segoe UI", 8.25F); 53 | this.status.Name = "status"; 54 | this.status.Size = new System.Drawing.Size(41, 17); 55 | this.status.Text = "0 rows"; 56 | // 57 | // dgData 58 | // 59 | this.dgData.AllowUserToAddRows = false; 60 | this.dgData.AllowUserToDeleteRows = false; 61 | this.dgData.BackgroundColor = System.Drawing.SystemColors.Control; 62 | this.dgData.BorderStyle = System.Windows.Forms.BorderStyle.None; 63 | this.dgData.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText; 64 | this.dgData.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; 65 | dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; 66 | dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; 67 | dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); 68 | dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; 69 | dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.ActiveCaption; 70 | dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 71 | dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; 72 | this.dgData.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; 73 | this.dgData.Dock = System.Windows.Forms.DockStyle.Fill; 74 | this.dgData.EnableHeadersVisualStyles = false; 75 | this.dgData.Location = new System.Drawing.Point(0, 0); 76 | this.dgData.Name = "dgData"; 77 | this.dgData.ReadOnly = true; 78 | this.dgData.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; 79 | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; 80 | dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; 81 | dataGridViewCellStyle2.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); 82 | dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; 83 | dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.ActiveCaption; 84 | dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 85 | dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; 86 | this.dgData.RowHeadersDefaultCellStyle = dataGridViewCellStyle2; 87 | this.dgData.RowHeadersWidth = 23; 88 | this.dgData.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; 89 | this.dgData.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.SystemColors.ActiveCaption; 90 | this.dgData.Size = new System.Drawing.Size(624, 193); 91 | this.dgData.TabIndex = 1; 92 | // 93 | // FormFlatData 94 | // 95 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 96 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 97 | this.ClientSize = new System.Drawing.Size(624, 215); 98 | this.Controls.Add(this.dgData); 99 | this.Controls.Add(this.statusStrip1); 100 | this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); 101 | this.KeyPreview = true; 102 | this.Name = "FormFlatData"; 103 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 104 | this.Load += new System.EventHandler(this.FormFlatData_Load); 105 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormFlatData_KeyDown); 106 | this.statusStrip1.ResumeLayout(false); 107 | this.statusStrip1.PerformLayout(); 108 | ((System.ComponentModel.ISupportInitialize)(this.dgData)).EndInit(); 109 | this.ResumeLayout(false); 110 | this.PerformLayout(); 111 | 112 | } 113 | 114 | #endregion 115 | 116 | private System.Windows.Forms.StatusStrip statusStrip1; 117 | private System.Windows.Forms.DataGridView dgData; 118 | private System.Windows.Forms.ToolStripStatusLabel status; 119 | } 120 | } -------------------------------------------------------------------------------- /project/Common/FormFlatData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace Common 5 | { 6 | /* Simple form for data table */ 7 | public partial class FormFlatData : Form 8 | { 9 | BindingSource bs = new BindingSource(); 10 | //------------------------------------------------------------------------- 11 | public FormFlatData(object data, string s) 12 | { 13 | InitializeComponent(); 14 | bs.DataSource = data; 15 | dgData.DataSource = bs; 16 | status.Text = s; 17 | } 18 | //------------------------------------------------------------------------- 19 | private void FormFlatData_Load(object sender, EventArgs e) 20 | { 21 | SetDoubleBuffered(dgData, true); 22 | } 23 | //------------------------------------------------------------------------- 24 | private void FormFlatData_KeyDown(object sender, KeyEventArgs e) 25 | { 26 | if (e.KeyCode == Keys.Escape) 27 | Close(); 28 | } 29 | //------------------------------------------------------------------------- 30 | public static void SetDoubleBuffered(Control control, bool setting) // prevent control blinking 31 | { 32 | System.Reflection.BindingFlags bFlags = System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic; 33 | control.GetType().GetProperty("DoubleBuffered", bFlags).SetValue(control, setting, null); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /project/Common/FormFlatData.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /project/Common/Loader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | using System.Xml.Serialization; 5 | 6 | namespace Common 7 | { 8 | /* XML-serialization procedures */ 9 | public static class Loader 10 | { 11 | /* Load from XML-file to object */ 12 | public static T Load(string file) where T : class 13 | { 14 | T obj; 15 | if (!File.Exists(file)) 16 | throw new Exception(String.Format("File not found {0}", file)); 17 | try 18 | { 19 | XmlSerializer xs = new XmlSerializer(typeof(T)); 20 | using (var s = new StreamReader(file, Encoding.GetEncoding("windows-1251"))) 21 | { 22 | obj = (T)xs.Deserialize(s); 23 | } 24 | } 25 | catch (Exception ex) 26 | { 27 | throw new Exception(String.Format("Can't load object from file {0}", file), ex); 28 | } 29 | return obj; 30 | } 31 | //------------------------------------------------------------------------- 32 | /* Save from object XML-file */ 33 | public static void Save(string file, T obj) where T : class 34 | { 35 | if (obj == null) 36 | return; 37 | try 38 | { 39 | XmlSerializer xs = new XmlSerializer(typeof(T)); 40 | using (var s = new StreamWriter(file, false, Encoding.GetEncoding("windows-1251"))) 41 | { 42 | xs.Serialize(s, obj); 43 | } 44 | } 45 | catch (Exception ex) 46 | { 47 | throw new Exception(String.Format("Can't save object to file {0}", file), ex); 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /project/Common/Options.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Windows.Forms; 7 | using System.Xml.Serialization; 8 | 9 | namespace Common 10 | { 11 | //=========================================================================== 12 | /* Application configuration */ 13 | public class Config 14 | { 15 | static Config config; 16 | string file; 17 | public List optionsList = new List(); // list for hosts options 18 | //------------------------------------------------------------------------- 19 | public void Init(string f) 20 | { 21 | config = this; 22 | file = f; 23 | } 24 | //------------------------------------------------------------------------- 25 | public static void Save() 26 | { 27 | Loader.Save(config.file, config); 28 | } 29 | } 30 | //=========================================================================== 31 | /* Configuration for current host */ 32 | public class Options 33 | { 34 | [XmlIgnore] 35 | public string DefPath; 36 | [XmlAttribute] 37 | public string Host = Dns.GetHostName(); 38 | [XmlArrayItem("file")] 39 | public List RecentFiles = new List(); // last profiles 40 | public string ProfileFolder = ""; // folder for profiles 41 | public string ResultFolder = ""; // folder for comparison results 42 | public string LogFile = ""; // log file for batch-mode 43 | public string HtmlStylesFile = ""; // styles for html-result 44 | public string PatternFile = ""; // default profile for new profile 45 | public MailParams SendOptions; 46 | //------------------------------------------------------------------------- 47 | public static Options Create(bool batch) 48 | { 49 | string defPath = AppDomain.CurrentDomain.BaseDirectory; 50 | string configFileName = Path.Combine(defPath, Path.GetFileNameWithoutExtension(AppDomain.CurrentDomain.FriendlyName) + ".xml"); 51 | 52 | Options opt; 53 | try 54 | { 55 | if (!File.Exists(configFileName)) 56 | Loader.Save(configFileName, new Config()); 57 | 58 | Config optList = Loader.Load(configFileName); 59 | opt = optList.optionsList.FirstOrDefault(x => x.Host == (batch ? "BATCH" : Dns.GetHostName())); 60 | if (opt == null) 61 | { 62 | opt = new Options(); 63 | opt.Host = (batch ? "BATCH" : Dns.GetHostName()); 64 | optList.optionsList.Add(opt); 65 | } 66 | optList.Init(configFileName); 67 | 68 | opt.DefPath = defPath; 69 | 70 | if (batch) 71 | { 72 | if (opt.SendOptions == null) 73 | opt.SendOptions = new MailParams(); 74 | if (!string.IsNullOrEmpty(opt.SendOptions.Pwd)) 75 | { 76 | opt.SendOptions.PwdEncr = opt.SendOptions.ed.Encrypt(opt.SendOptions.Pwd); 77 | opt.SendOptions.Pwd = ""; 78 | } 79 | } 80 | 81 | if (!string.IsNullOrEmpty(opt.ProfileFolder)) 82 | opt.ProfileFolder = Path.Combine(defPath, opt.ProfileFolder); 83 | if (string.IsNullOrEmpty(opt.ProfileFolder) || !Directory.Exists(opt.ProfileFolder)) 84 | opt.ProfileFolder = Path.Combine(defPath, "profiles"); 85 | if (!Directory.Exists(opt.ProfileFolder)) 86 | Directory.CreateDirectory(opt.ProfileFolder); 87 | 88 | if (!string.IsNullOrEmpty(opt.ResultFolder)) 89 | opt.ResultFolder = Path.Combine(defPath, opt.ResultFolder); 90 | if (string.IsNullOrEmpty(opt.ResultFolder) || !Directory.Exists(opt.ResultFolder)) 91 | opt.ResultFolder = Path.Combine(defPath, "results"); 92 | if (!Directory.Exists(opt.ResultFolder)) 93 | Directory.CreateDirectory(opt.ResultFolder); 94 | 95 | if (string.IsNullOrEmpty(opt.LogFile)) 96 | opt.LogFile = Path.Combine(defPath, Path.GetFileNameWithoutExtension(AppDomain.CurrentDomain.FriendlyName) + ".log"); 97 | else 98 | opt.LogFile = Path.Combine(defPath, opt.LogFile); 99 | if (String.IsNullOrEmpty(Path.GetDirectoryName(opt.LogFile)) || !Directory.Exists(Path.GetDirectoryName(opt.LogFile))) 100 | opt.LogFile = Path.Combine(defPath, Path.GetFileName(opt.LogFile)); 101 | 102 | if (string.IsNullOrEmpty(opt.HtmlStylesFile) || !File.Exists(opt.HtmlStylesFile)) 103 | opt.HtmlStylesFile = Path.Combine(defPath, "styles.css"); 104 | 105 | if (string.IsNullOrEmpty(opt.PatternFile) || !File.Exists(opt.PatternFile)) 106 | opt.PatternFile = Path.Combine(defPath, "pattern.xml"); 107 | 108 | Loader.Save(configFileName, optList); 109 | } 110 | catch (Exception ex) 111 | { 112 | string msg = String.Format("Configuration error!\n\nConfig file: {0}\n{1}", configFileName, ex); 113 | if (batch) 114 | { 115 | Console.WriteLine(msg); 116 | Console.ReadKey(true); 117 | Environment.Exit(1); 118 | } 119 | else 120 | MessageBox.Show(msg, "Configuration error", MessageBoxButtons.OK, MessageBoxIcon.Error); 121 | opt = null; 122 | } 123 | return opt; 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /project/Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // Управление общими сведениями о сборке осуществляется с помощью 5 | // набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, 6 | // связанные со сборкой. 7 | [assembly: AssemblyTitle("Common")] 8 | [assembly: AssemblyDescription("Common tools and objects")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Pumpet")] 11 | [assembly: AssemblyProduct("Common")] 12 | [assembly: AssemblyCopyright("GNU Lesser General Public License (LGPLv3)")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Параметр ComVisible со значением FALSE делает типы в сборке невидимыми 17 | // для COM-компонентов. Если требуется обратиться к типу в этой сборке через 18 | // COM, задайте атрибуту ComVisible значение TRUE для этого типа. 19 | [assembly: ComVisible(false)] 20 | 21 | // Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM 22 | [assembly: Guid("46787b6a-4cfd-4c9d-9c2c-9f1a234f47ed")] 23 | 24 | // Сведения о версии сборки состоят из следующих четырех значений: 25 | // 26 | // Основной номер версии 27 | // Дополнительный номер версии 28 | // Номер построения 29 | // Редакция 30 | // 31 | // Можно задать все значения или принять номер построения и номер редакции по умолчанию, 32 | // используя "*", как показано ниже: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("2.0.0.0")] 35 | [assembly: AssemblyFileVersion("2.0.0.0")] 36 | -------------------------------------------------------------------------------- /project/Common/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Этот код создан программой. 4 | // Исполняемая версия:4.0.30319.18408 5 | // 6 | // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае 7 | // повторной генерации кода. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Common.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. 17 | /// 18 | // Этот класс создан автоматически классом StronglyTypedResourceBuilder 19 | // с помощью такого средства, как ResGen или Visual Studio. 20 | // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen 21 | // с параметром /str или перестройте свой проект VS. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Common.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Перезаписывает свойство CurrentUICulture текущего потока для всех 51 | /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /project/Common/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /project/Common/SendMail.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net; 4 | using System.Net.Mail; 5 | using System.Xml.Serialization; 6 | 7 | namespace Common 8 | { 9 | public class MailParams 10 | { 11 | [XmlIgnore] 12 | public EncrDecr ed; 13 | public string Server = ""; 14 | public string Port = ""; 15 | public bool Ssl = false; 16 | public string User = ""; 17 | public string Pwd = ""; 18 | public string PwdEncr = ""; 19 | public string From = ""; 20 | public string FromAlias = ""; 21 | public MailParams() 22 | { 23 | ed = new EncrDecr(string.Empty, string.Empty); 24 | } 25 | } 26 | //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 | public static class Mailer 28 | { 29 | public static void SendMail(MailParams par, string to, string subject, string body, string[] attachFiles) 30 | { 31 | MailMessage mail = new MailMessage(); 32 | try 33 | { 34 | mail.From = String.IsNullOrEmpty(par.FromAlias) ? new MailAddress(par.From) : new MailAddress(par.From, par.FromAlias); 35 | mail.To.Add(to.Replace(';', ',').TrimEnd(new[]{','})); 36 | mail.Subject = subject; 37 | mail.IsBodyHtml = true; 38 | mail.Body = body; 39 | if (attachFiles != null) 40 | for (int i = 0; i < attachFiles.Length; i++) 41 | { 42 | string fn = Path.GetFileName(attachFiles[i]); 43 | System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType(); 44 | 45 | ct.CharSet = null; 46 | ct.Boundary = null; 47 | ct.MediaType = "application/octet-stream"; 48 | ct.Name = fn ?? String.Empty; 49 | if (ct.Name != fn) // problem with russian names is more than 20 characters - they turn into Base64. Don't know to solve... 50 | ct.Name = fn.Substring(0, 10) + "~" + Path.GetExtension(fn); 51 | Attachment att = new Attachment(attachFiles[i], ct); 52 | mail.Attachments.Add(att); 53 | } 54 | 55 | SmtpClient client = new SmtpClient(par.Server, string.IsNullOrEmpty(par.Port) ? 25 : int.Parse(par.Port)); 56 | client.EnableSsl = par.Ssl; 57 | if (!string.IsNullOrEmpty(par.User)) 58 | { 59 | string pwd = string.IsNullOrEmpty(par.PwdEncr) ? "" : par.ed.Decrypt(par.PwdEncr); 60 | client.Credentials = new NetworkCredential(par.User, pwd); 61 | } 62 | client.DeliveryMethod = SmtpDeliveryMethod.Network; 63 | 64 | client.Send(mail); 65 | } 66 | finally 67 | { 68 | mail.Dispose(); 69 | } 70 | } 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /project/Common/Views.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Common 5 | { 6 | /* Profile View */ 7 | public interface IView 8 | { 9 | List RecentFiles { set; } // last used profiles list in menu 10 | IViewSource viewSourceA { get; } // view for source A 11 | IViewSource viewSourceB { get; } // view for source B 12 | bool Compared { set; } // flag of successful comparison for current profile 13 | IntPtr ResultHWnd { get; set; } // result window 14 | 15 | event Action NewProfile; 16 | event Action LoadProfile; 17 | event Func SaveProfile; 18 | event Func Check; // check profile 19 | event Action Compare; // prepare and start comparison 20 | event Action CompareStop; // stop comparison 21 | event Action Result; // get last comparison result 22 | event Action DataEdit; // profile data has changed 23 | event Func CloseView; // attempt to close work 24 | 25 | event Action, List> FillColPairs; // forming pairs of fields from field lists 26 | event Action RemoveColPair; // delete pairs with specified indices 27 | event Func MoveColPair; // moving pairs with specified indices 28 | event Func, List, bool> GetFields; // lists of source field names, except for existing in pairs 29 | 30 | void SetDataProps(Dictionary propNames); // set names of objects fields that will be bound to View elements (element name : field name) 31 | void SetData(Dictionary bindings); // receive data objects (object name : object) and refresh 32 | void RefreshData(Dictionary bindings, params string[] bsNames); // refresh view from data objects (object name : object) in source with bsNames 33 | void WaitResult(bool wait, string msg = ""); // start-stop waiting result message 34 | string LoadFile(string folder, string filter, string ext); // load file prompt 35 | string SaveFile(string folder, string name, string filter, string ext); // save file prompt 36 | string SaveRequest(); // message if need to save 37 | } 38 | //=========================================================================== 39 | /* Source View */ 40 | public interface IViewSource 41 | { 42 | IView ParentView { get; set; } // profile view 43 | ISqlView SqlView { get; set; } // db-source editor view 44 | event Func Command; // source event that requires processing in accordance with parameters (command name, some data) 45 | } 46 | //=========================================================================== 47 | /* DB-Source editor View */ 48 | public interface ISqlView 49 | { 50 | event Func, bool> TestConnect; // test connection 51 | event Action GetData; // start getting data process 52 | event Action StopGetData; // stop getting data process 53 | void SetData(object inData, object providers, object fields); // receive data object and refresh 54 | void SetDataProps(Dictionary propNames); // set names of objects fields that will be bound to View elements (element name : field name) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /project/Comparator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlSource", "SqlSource\SqlSource.csproj", "{32B87CF8-E466-4409-A4B5-30AE33CB2262}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DSComparer", "DSComparer\DSComparer.csproj", "{F9C1B252-7A56-4217-A33E-FD0C2E16E587}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Comparator", "Comparator\Comparator.csproj", "{8ED5DE71-C825-4070-BFBC-969A4A47CAC1}" 9 | ProjectSection(ProjectDependencies) = postProject 10 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587} = {F9C1B252-7A56-4217-A33E-FD0C2E16E587} 11 | {32B87CF8-E466-4409-A4B5-30AE33CB2262} = {32B87CF8-E466-4409-A4B5-30AE33CB2262} 12 | EndProjectSection 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{BE7C1378-3118-4F91-892D-484189F8621A}" 15 | EndProject 16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sources", "Sources\Sources.csproj", "{4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}" 17 | EndProject 18 | Global 19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 20 | Debug|Any CPU = Debug|Any CPU 21 | Debug|Mixed Platforms = Debug|Mixed Platforms 22 | Debug|x86 = Debug|x86 23 | Release|Any CPU = Release|Any CPU 24 | Release|Mixed Platforms = Release|Mixed Platforms 25 | Release|x86 = Release|x86 26 | EndGlobalSection 27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 28 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Debug|Any CPU.ActiveCfg = Release|Any CPU 29 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Debug|Any CPU.Build.0 = Release|Any CPU 30 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Debug|Mixed Platforms.ActiveCfg = Release|Any CPU 31 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Debug|Mixed Platforms.Build.0 = Release|Any CPU 32 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Debug|x86.ActiveCfg = Debug|x86 33 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Debug|x86.Build.0 = Debug|x86 34 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Release|Any CPU.ActiveCfg = Release|Any CPU 35 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Release|Any CPU.Build.0 = Release|Any CPU 36 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 37 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Release|Mixed Platforms.Build.0 = Release|Any CPU 38 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Release|x86.ActiveCfg = Release|x86 39 | {32B87CF8-E466-4409-A4B5-30AE33CB2262}.Release|x86.Build.0 = Release|x86 40 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Debug|Any CPU.ActiveCfg = Release|Any CPU 41 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Debug|Any CPU.Build.0 = Release|Any CPU 42 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 43 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 44 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Debug|x86.ActiveCfg = Debug|x86 45 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Debug|x86.Build.0 = Debug|x86 46 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Release|Any CPU.Build.0 = Release|Any CPU 48 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 49 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Release|Mixed Platforms.Build.0 = Release|Any CPU 50 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Release|x86.ActiveCfg = Release|x86 51 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Release|x86.Build.0 = Release|x86 52 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 53 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Debug|Any CPU.Build.0 = Debug|Any CPU 54 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 55 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 56 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Debug|x86.ActiveCfg = Debug|x86 57 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Debug|x86.Build.0 = Debug|x86 58 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Release|Any CPU.ActiveCfg = Release|Any CPU 59 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Release|Any CPU.Build.0 = Release|Any CPU 60 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 61 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Release|Mixed Platforms.Build.0 = Release|Any CPU 62 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Release|x86.ActiveCfg = Release|x86 63 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1}.Release|x86.Build.0 = Release|x86 64 | {BE7C1378-3118-4F91-892D-484189F8621A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 65 | {BE7C1378-3118-4F91-892D-484189F8621A}.Debug|Any CPU.Build.0 = Debug|Any CPU 66 | {BE7C1378-3118-4F91-892D-484189F8621A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 67 | {BE7C1378-3118-4F91-892D-484189F8621A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 68 | {BE7C1378-3118-4F91-892D-484189F8621A}.Debug|x86.ActiveCfg = Debug|x86 69 | {BE7C1378-3118-4F91-892D-484189F8621A}.Debug|x86.Build.0 = Debug|x86 70 | {BE7C1378-3118-4F91-892D-484189F8621A}.Release|Any CPU.ActiveCfg = Release|Any CPU 71 | {BE7C1378-3118-4F91-892D-484189F8621A}.Release|Any CPU.Build.0 = Release|Any CPU 72 | {BE7C1378-3118-4F91-892D-484189F8621A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 73 | {BE7C1378-3118-4F91-892D-484189F8621A}.Release|Mixed Platforms.Build.0 = Release|Any CPU 74 | {BE7C1378-3118-4F91-892D-484189F8621A}.Release|x86.ActiveCfg = Release|x86 75 | {BE7C1378-3118-4F91-892D-484189F8621A}.Release|x86.Build.0 = Release|x86 76 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Debug|Any CPU.ActiveCfg = Debug|x86 77 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 78 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Debug|Mixed Platforms.Build.0 = Debug|x86 79 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Debug|x86.ActiveCfg = Debug|x86 80 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Debug|x86.Build.0 = Debug|x86 81 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Release|Any CPU.ActiveCfg = Release|x86 82 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Release|Mixed Platforms.ActiveCfg = Release|x86 83 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Release|Mixed Platforms.Build.0 = Release|x86 84 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Release|x86.ActiveCfg = Release|x86 85 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D}.Release|x86.Build.0 = Release|x86 86 | EndGlobalSection 87 | GlobalSection(SolutionProperties) = preSolution 88 | HideSolutionNode = FALSE 89 | EndGlobalSection 90 | EndGlobal 91 | -------------------------------------------------------------------------------- /project/Comparator.sln.DotSettings.user: -------------------------------------------------------------------------------- 1 |  2 | SOLUTION -------------------------------------------------------------------------------- /project/Comparator.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/project/Comparator.suo -------------------------------------------------------------------------------- /project/Comparator.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/project/Comparator.v12.suo -------------------------------------------------------------------------------- /project/Comparator/Comparator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {8ED5DE71-C825-4070-BFBC-969A4A47CAC1} 9 | WinExe 10 | Properties 11 | Comparator 12 | Comparator 13 | v4.5.1 14 | 15 | 16 | 512 17 | 18 | 19 | x86 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | false 28 | 29 | 30 | x86 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | false 38 | false 39 | 40 | 41 | true 42 | bin\Debug\ 43 | DEBUG;TRACE 44 | full 45 | AnyCPU 46 | prompt 47 | false 48 | false 49 | false 50 | 51 | 52 | bin\Release\ 53 | true 54 | true 55 | pdbonly 56 | AnyCPU 57 | prompt 58 | false 59 | false 60 | false 61 | 62 | 63 | compare32.ico 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | Form 78 | 79 | 80 | FormCompare.cs 81 | 82 | 83 | Form 84 | 85 | 86 | FormSelectPair.cs 87 | 88 | 89 | Form 90 | 91 | 92 | FormView.cs 93 | 94 | 95 | 96 | 97 | 98 | 99 | True 100 | True 101 | Resources.resx 102 | 103 | 104 | FormCompare.cs 105 | 106 | 107 | FormSelectPair.cs 108 | 109 | 110 | FormView.cs 111 | Designer 112 | 113 | 114 | ResXFileCodeGenerator 115 | Designer 116 | Resources.Designer.cs 117 | 118 | 119 | 120 | SettingsSingleFileGenerator 121 | Settings.Designer.cs 122 | 123 | 124 | True 125 | Settings.settings 126 | True 127 | 128 | 129 | 130 | 131 | {BE7C1378-3118-4F91-892D-484189F8621A} 132 | Common 133 | 134 | 135 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587} 136 | DSComparer 137 | 138 | 139 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D} 140 | Sources 141 | 142 | 143 | {32B87CF8-E466-4409-A4B5-30AE33CB2262} 144 | SqlSource 145 | 146 | 147 | 148 | 149 | 150 | 151 | 158 | -------------------------------------------------------------------------------- /project/Comparator/Comparator.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /project/Comparator/FormCompare.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Comparator 2 | { 3 | partial class FormCompare 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.pbarSourceA = new System.Windows.Forms.ProgressBar(); 32 | this.pbarSourceB = new System.Windows.Forms.ProgressBar(); 33 | this.pbarCompare = new System.Windows.Forms.ProgressBar(); 34 | this.lblSourceA = new System.Windows.Forms.Label(); 35 | this.lblSourceB = new System.Windows.Forms.Label(); 36 | this.lblCompare = new System.Windows.Forms.Label(); 37 | this.bStop = new System.Windows.Forms.Button(); 38 | this.lblWait = new System.Windows.Forms.Label(); 39 | this.SuspendLayout(); 40 | // 41 | // pbarSourceA 42 | // 43 | this.pbarSourceA.Location = new System.Drawing.Point(12, 23); 44 | this.pbarSourceA.Maximum = 500; 45 | this.pbarSourceA.Name = "pbarSourceA"; 46 | this.pbarSourceA.Size = new System.Drawing.Size(460, 8); 47 | this.pbarSourceA.Step = 1; 48 | this.pbarSourceA.TabIndex = 0; 49 | // 50 | // pbarSourceB 51 | // 52 | this.pbarSourceB.Location = new System.Drawing.Point(12, 33); 53 | this.pbarSourceB.Maximum = 500; 54 | this.pbarSourceB.Name = "pbarSourceB"; 55 | this.pbarSourceB.Size = new System.Drawing.Size(460, 8); 56 | this.pbarSourceB.Step = 1; 57 | this.pbarSourceB.TabIndex = 1; 58 | // 59 | // pbarCompare 60 | // 61 | this.pbarCompare.Location = new System.Drawing.Point(12, 82); 62 | this.pbarCompare.Name = "pbarCompare"; 63 | this.pbarCompare.Size = new System.Drawing.Size(460, 8); 64 | this.pbarCompare.Step = 1; 65 | this.pbarCompare.TabIndex = 2; 66 | // 67 | // lblSourceA 68 | // 69 | this.lblSourceA.AutoSize = true; 70 | this.lblSourceA.Location = new System.Drawing.Point(10, 6); 71 | this.lblSourceA.Name = "lblSourceA"; 72 | this.lblSourceA.Size = new System.Drawing.Size(92, 13); 73 | this.lblSourceA.TabIndex = 3; 74 | this.lblSourceA.Text = "Source A: 0 rows"; 75 | // 76 | // lblSourceB 77 | // 78 | this.lblSourceB.AutoSize = true; 79 | this.lblSourceB.Location = new System.Drawing.Point(10, 44); 80 | this.lblSourceB.Name = "lblSourceB"; 81 | this.lblSourceB.Size = new System.Drawing.Size(92, 13); 82 | this.lblSourceB.TabIndex = 4; 83 | this.lblSourceB.Text = "Source B: 0 rows"; 84 | // 85 | // lblCompare 86 | // 87 | this.lblCompare.AutoSize = true; 88 | this.lblCompare.Location = new System.Drawing.Point(10, 66); 89 | this.lblCompare.Name = "lblCompare"; 90 | this.lblCompare.Size = new System.Drawing.Size(56, 13); 91 | this.lblCompare.TabIndex = 5; 92 | this.lblCompare.Text = "Compare "; 93 | // 94 | // bStop 95 | // 96 | this.bStop.Location = new System.Drawing.Point(397, 96); 97 | this.bStop.Name = "bStop"; 98 | this.bStop.Size = new System.Drawing.Size(75, 23); 99 | this.bStop.TabIndex = 6; 100 | this.bStop.Text = "Stop"; 101 | this.bStop.UseVisualStyleBackColor = true; 102 | this.bStop.Click += new System.EventHandler(this.bCancel_Click); 103 | // 104 | // lblWait 105 | // 106 | this.lblWait.AutoSize = true; 107 | this.lblWait.Location = new System.Drawing.Point(12, 101); 108 | this.lblWait.Name = "lblWait"; 109 | this.lblWait.Size = new System.Drawing.Size(0, 13); 110 | this.lblWait.TabIndex = 7; 111 | // 112 | // FormCompare 113 | // 114 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 115 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 116 | this.ClientSize = new System.Drawing.Size(484, 124); 117 | this.ControlBox = false; 118 | this.Controls.Add(this.lblWait); 119 | this.Controls.Add(this.bStop); 120 | this.Controls.Add(this.lblCompare); 121 | this.Controls.Add(this.lblSourceB); 122 | this.Controls.Add(this.lblSourceA); 123 | this.Controls.Add(this.pbarCompare); 124 | this.Controls.Add(this.pbarSourceB); 125 | this.Controls.Add(this.pbarSourceA); 126 | this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); 127 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 128 | this.MaximizeBox = false; 129 | this.MinimizeBox = false; 130 | this.Name = "FormCompare"; 131 | this.ShowIcon = false; 132 | this.ShowInTaskbar = false; 133 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; 134 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 135 | this.Load += new System.EventHandler(this.FormCompare_Load); 136 | this.Shown += new System.EventHandler(this.FormCompare_Shown); 137 | this.ResumeLayout(false); 138 | this.PerformLayout(); 139 | 140 | } 141 | 142 | #endregion 143 | 144 | private System.Windows.Forms.ProgressBar pbarSourceA; 145 | private System.Windows.Forms.ProgressBar pbarSourceB; 146 | private System.Windows.Forms.ProgressBar pbarCompare; 147 | private System.Windows.Forms.Label lblSourceA; 148 | private System.Windows.Forms.Label lblSourceB; 149 | private System.Windows.Forms.Label lblCompare; 150 | private System.Windows.Forms.Button bStop; 151 | private System.Windows.Forms.Label lblWait; 152 | } 153 | } -------------------------------------------------------------------------------- /project/Comparator/FormCompare.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Windows.Forms; 4 | using Common; 5 | 6 | namespace Comparator 7 | { 8 | /* Form for control getting data and comparison processes */ 9 | public partial class FormCompare : Form 10 | { 11 | bool inProc; 12 | SynchronizationContext sync { get; set; } 13 | public event Action Start; 14 | public event Action Stop; 15 | 16 | public FormCompare() 17 | { 18 | InitializeComponent(); 19 | } 20 | //------------------------------------------------------------------------- 21 | private void FormCompare_Load(object sender, EventArgs e) 22 | { 23 | sync = SynchronizationContext.Current; 24 | } 25 | private void FormCompare_Shown(object sender, EventArgs e) 26 | { 27 | Refresh(); 28 | if (Start != null) 29 | { 30 | inProc = true; 31 | // start processes 32 | Start(new TaskContext() { ViewContext = sync, OnProgress = ProgressA, OnFinish = null, OnError = null }, 33 | new TaskContext() { ViewContext = sync, OnProgress = ProgressB, OnFinish = null, OnError = null }, 34 | new TaskContext() { ViewContext = sync, OnProgress = ProgressCompare, OnFinish = Finish, OnError = null } 35 | ); 36 | } 37 | } 38 | //------------------------------------------------------------------------- 39 | private void bCancel_Click(object sender, EventArgs e) 40 | { 41 | if (inProc) 42 | { 43 | if (Stop != null) 44 | Stop(); 45 | //Finish(null, null); 46 | } 47 | else 48 | Close(); 49 | } 50 | //------------------------------------------------------------------------- 51 | void ProgressA(int step, string msg) 52 | { 53 | StepProgress(pbarSourceA, lblSourceA, step, 0, "Source A: " + msg); 54 | } 55 | //------------------------------------------------------------------------- 56 | void ProgressB(int step, string msg) 57 | { 58 | StepProgress(pbarSourceB, lblSourceB, step, 0, "Source B: " + msg); 59 | } 60 | //------------------------------------------------------------------------- 61 | void ProgressCompare(int step, string msg) 62 | { 63 | StepProgress(pbarCompare, lblCompare, step, 100, msg); // step value in percent 64 | } 65 | //------------------------------------------------------------------------- 66 | void StepProgress(ProgressBar pBar, Label lbl, int step, int max, string msg) 67 | { 68 | Func Step = brake => // calculate step, gradually slowing... 69 | { 70 | int d = 1000; 71 | int min = d*100; 72 | double k = pBar.Maximum * brake; 73 | if (step == 0) step = 1; 74 | if (step > min) k = k - (1 - pBar.Value / (double)pBar.Maximum) * (step - min) / d; 75 | if (k < pBar.Maximum) k = pBar.Maximum; 76 | step = (int)(-k / Math.Pow(step, 1.0 / brake) + pBar.Maximum); 77 | if (step < pBar.Value) step = pBar.Value; 78 | if (step > pBar.Maximum) step = pBar.Maximum; 79 | if (step < pBar.Minimum) step = pBar.Minimum + 1; 80 | return step; 81 | }; 82 | if (max > 0) pBar.Maximum = max; 83 | if (step < int.MaxValue) // calculate step value if maximum is unknown or less than current step 84 | pBar.Value = max > 0 && step <= max ? step : Step(4); 85 | else 86 | pBar.Value = pBar.Maximum; 87 | lbl.Text = msg; 88 | Refresh(); 89 | } 90 | //------------------------------------------------------------------------- 91 | void Finish(object res, string msg) 92 | { 93 | inProc = false; 94 | if ((bool)res) 95 | { 96 | Refresh(); 97 | Thread.Sleep(300); 98 | Close(); 99 | } 100 | else 101 | bStop.Text = "Close"; 102 | } 103 | //------------------------------------------------------------------------- 104 | public void WaitState(bool on, string msg) 105 | { 106 | lblWait.Text = msg; 107 | bStop.Enabled = !on; 108 | Cursor = on ? Cursors.WaitCursor : Cursors.Default; 109 | Refresh(); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /project/Comparator/FormCompare.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | True 122 | 123 | 124 | True 125 | 126 | 127 | True 128 | 129 | 130 | True 131 | 132 | 133 | True 134 | 135 | 136 | True 137 | 138 | 139 | True 140 | 141 | 142 | True 143 | 144 | -------------------------------------------------------------------------------- /project/Comparator/FormSelectPair.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Linq; 5 | using System.Windows.Forms; 6 | 7 | namespace Comparator 8 | { 9 | /* Form for selection fields to comparison */ 10 | public partial class FormSelectPair : Form 11 | { 12 | public event Action, List> SetPairs; 13 | List listA; 14 | List listB; 15 | ToolTip tt = new ToolTip(); 16 | //------------------------------------------------------------------------- 17 | public FormSelectPair() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | public FormSelectPair(List a, List b) 23 | { 24 | InitializeComponent(); 25 | listA = new List(a); 26 | listB = new List(b); 27 | listA.RemoveAll(x => string.IsNullOrEmpty(x)); 28 | listB.RemoveAll(x => string.IsNullOrEmpty(x)); 29 | tt.InitialDelay = 1; 30 | } 31 | 32 | private void FormSelectPair_Load(object sender, EventArgs e) 33 | { 34 | clbA.Items.AddRange(listA.ToArray()); 35 | clbB.Items.AddRange(listB.ToArray()); 36 | } 37 | 38 | private void FormSelectPair_KeyUp(object sender, KeyEventArgs e) 39 | { 40 | if (e.KeyCode == Keys.Escape) 41 | Close(); 42 | if (e.KeyCode == Keys.Enter) 43 | bSet.PerformClick(); 44 | } 45 | 46 | //------------------------------------------------------------------------- 47 | private void checkBox1_CheckedChanged(object sender, EventArgs e) 48 | { 49 | CheckedChanged(clbA, ((CheckBox)sender).Checked); 50 | } 51 | 52 | private void checkBox2_CheckedChanged(object sender, EventArgs e) 53 | { 54 | CheckedChanged(clbB, ((CheckBox)sender).Checked); 55 | } 56 | 57 | private void CheckedChanged(CheckedListBox clb, bool check) 58 | { 59 | for (int i = 0; i < clb.Items.Count; i++) 60 | clb.SetItemChecked(i, check); 61 | clb.Refresh(); 62 | clb.Focus(); 63 | if (clb.SelectedIndex >= 0) 64 | clb.SetSelected(clb.SelectedIndex, true); 65 | else if (clb.Items.Count > 0) 66 | clb.SetSelected(0, true); 67 | } 68 | 69 | //------------------------------------------------------------------------- 70 | private void bSet_Click(object sender, EventArgs e) 71 | { 72 | if (SetPairs == null || (clbA.CheckedItems.Count == 0 && clbB.CheckedItems.Count == 0)) return; 73 | SetPairs(cbClear.Checked, rbKey.Checked, rbMatch.Checked, 74 | clbA.CheckedItems.OfType().ToList(), clbB.CheckedItems.OfType().ToList()); 75 | List l = new List(clbA.CheckedItems.OfType()); 76 | foreach (var item in l) 77 | { 78 | clbA.Items.Remove(item); 79 | } 80 | l = new List(clbB.CheckedItems.OfType()); 81 | foreach (var item in l) 82 | { 83 | clbB.Items.Remove(item); 84 | } 85 | Refresh(); 86 | } 87 | 88 | //------------------------------------------------------------------------- 89 | private void clbA_MouseMove(object sender, MouseEventArgs e) 90 | { 91 | SetToolTip(clbA, e.Location); 92 | } 93 | 94 | private void clbB_MouseMove(object sender, MouseEventArgs e) 95 | { 96 | SetToolTip(clbB, e.Location); 97 | } 98 | 99 | private void SetToolTip(ListBox list, Point p) 100 | { 101 | int idx = list.IndexFromPoint(p); 102 | if (idx >= 0) 103 | { 104 | string s = list.Items[idx].ToString(); 105 | Graphics g = list.CreateGraphics(); 106 | if (s != tt.GetToolTip(list)) 107 | tt.SetToolTip(list, list.Width - 30 < g.MeasureString(s, list.Font).Width ? s : null); 108 | } 109 | else 110 | tt.SetToolTip(list, null); 111 | } 112 | 113 | //------------------------------------------------------------------------- 114 | private void bUp_Click(object sender, EventArgs e) 115 | { 116 | MoveListRow(-1, clbA); 117 | } 118 | 119 | private void bDown_Click(object sender, EventArgs e) 120 | { 121 | MoveListRow(1, clbA); 122 | } 123 | 124 | private void bUpB_Click(object sender, EventArgs e) 125 | { 126 | MoveListRow(-1, clbB); 127 | } 128 | 129 | private void bDownB_Click(object sender, EventArgs e) 130 | { 131 | MoveListRow(1, clbB); 132 | } 133 | 134 | private void clbA_KeyDown(object sender, KeyEventArgs e) 135 | { 136 | if (e.Control && e.KeyCode == Keys.Up) 137 | { 138 | MoveListRow(-1, (sender as CheckedListBox)); 139 | e.SuppressKeyPress = true; 140 | } 141 | if (e.Control && e.KeyCode == Keys.Down) 142 | { 143 | MoveListRow(1, (sender as CheckedListBox)); 144 | e.SuppressKeyPress = true; 145 | } 146 | } 147 | 148 | private void MoveListRow(int offset, CheckedListBox lb) 149 | { 150 | if (lb.SelectedIndex < 0) return; 151 | int idx = lb.SelectedIndex; 152 | if ((offset == -1 && idx == 0) || (offset == 1 && idx == lb.Items.Count - 1)) 153 | return; 154 | 155 | string s = lb.Items[idx].ToString(); 156 | bool ch = false; 157 | ch = lb.GetItemChecked(idx); 158 | lb.Items.RemoveAt(idx); 159 | lb.Items.Insert(idx + offset, s); 160 | lb.SetItemChecked(idx+offset, ch); 161 | lb.Refresh(); 162 | lb.SetSelected(idx, false); 163 | lb.Focus(); 164 | lb.SetSelected(idx+offset, true); 165 | } 166 | 167 | //------------------------------------------------------------------------- 168 | private void clbA_SelectedIndexChanged(object sender, EventArgs e) 169 | { 170 | SelectPair(clbA, clbB); 171 | } 172 | 173 | private void clbB_SelectedIndexChanged(object sender, EventArgs e) 174 | { 175 | SelectPair(clbB, clbA); 176 | } 177 | 178 | private void clbA_ItemCheck(object sender, ItemCheckEventArgs e) 179 | { 180 | SelectPair(clbA, clbB, e.NewValue == CheckState.Checked, e.NewValue == CheckState.Checked); 181 | } 182 | 183 | private void clbB_ItemCheck(object sender, ItemCheckEventArgs e) 184 | { 185 | SelectPair(clbB, clbA, e.NewValue == CheckState.Checked, e.NewValue == CheckState.Checked); 186 | } 187 | 188 | private void SelectPair(CheckedListBox lb, CheckedListBox lb2, bool select = true, bool justSelected = false) 189 | { 190 | if (!lb.Focused) return; 191 | lb2.ClearSelected(); 192 | if (lb.SelectedIndices.Count > 0 && (lb.GetItemChecked(lb.SelectedIndex) || justSelected)) 193 | { 194 | int i = lb.CheckedIndices.OfType().Count(x => x < lb.SelectedIndex); 195 | if (i < lb2.CheckedItems.Count) 196 | lb2.SetSelected(lb2.CheckedIndices[i], select); 197 | } 198 | } 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /project/Comparator/Log.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.IO; 4 | 5 | namespace Comparator 6 | { 7 | public static class Log 8 | { 9 | private static object sync = new object(); 10 | private static string fileName; 11 | //------------------------------------------------------------------------- 12 | /* Will be created with application path and application name + .log */ 13 | static Log() 14 | { 15 | fileName = Path.ChangeExtension(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.FriendlyName), "log"); 16 | } 17 | //------------------------------------------------------------------------- 18 | /* Log start or continue */ 19 | public static void Start(bool rewrite) { Start(rewrite, null, null); } 20 | /* + start text */ 21 | public static void Start(bool rewrite, string text) { Start(rewrite, text, null); } 22 | /* + specific log file name */ 23 | public static void Start(bool rewrite, string text, string file) 24 | { 25 | if (string.IsNullOrEmpty(file)) file = fileName; 26 | if (!Path.IsPathRooted(file)) 27 | file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, file); 28 | string path = Path.GetDirectoryName(file); 29 | if (path != null && !Directory.Exists(path)) 30 | Directory.CreateDirectory(path); 31 | fileName = file; 32 | if (rewrite) 33 | File.WriteAllText(fileName, string.Empty, Encoding.GetEncoding("Windows-1251")); 34 | if (text != null) 35 | Write(text, false); 36 | } 37 | //------------------------------------------------------------------------- 38 | /* Write error */ 39 | public static void Write(string text, object ex) { Write(text, ex, false); } 40 | public static void Write(string text, object ex, bool echo) 41 | { 42 | if (ex == null) 43 | text = string.Format("ERROR {0}", text); 44 | else 45 | { 46 | if (ex is Exception) 47 | text = string.Format("ERROR {0} [{1}.{2}()] {3}", text, ((Exception)ex).TargetSite.DeclaringType, ((Exception)ex).TargetSite.Name, ((Exception)ex).Message); 48 | else 49 | text = string.Format("ERROR {0} {1}", text, ex); 50 | } 51 | Write(text, echo); 52 | } 53 | /* Write message */ 54 | public static void Write(string text) { Write(text, false); } 55 | public static void Write(string text, bool echo) 56 | { 57 | if (echo) 58 | Console.WriteLine(text); 59 | text = string.Format("[{0:dd.MM.yyy HH:mm:ss.fff}] {1}\r\n", DateTime.Now, text); 60 | try 61 | { 62 | lock (sync) { File.AppendAllText(fileName, text, Encoding.GetEncoding("Windows-1251")); } 63 | } 64 | catch { } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /project/Comparator/Loger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Common; 3 | 4 | namespace Comparator 5 | { 6 | class Loger : ILoger 7 | { 8 | //~~~~~~~~ ILoger Members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 | #region 10 | //------------------------------------------------------------------------- 11 | public void Error(string mess, object objErr = null) 12 | { 13 | Log.Write(mess, objErr, true); 14 | //Console.WriteLine("-----------"); //test 15 | //Console.WriteLine("Press any key to exit..."); //test 16 | //Console.ReadKey(true); //test 17 | Environment.Exit(1); 18 | } 19 | //------------------------------------------------------------------------- 20 | public void Message(string mess, bool critical = false) 21 | { 22 | Log.Write((critical ? "WARNING: " : "") + mess, true); 23 | } 24 | #endregion 25 | //------------------------------------------------------------------------- 26 | public Loger(string file) 27 | { 28 | Log.Start(false, null, file); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /project/Comparator/Profile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Xml.Serialization; 4 | using System.Linq; 5 | using System.IO; 6 | using Sources; 7 | 8 | namespace Comparator 9 | { 10 | public enum ViewResultType { Excel, HTML } 11 | public enum MailResult { Attachment, GZIP, Text, Link} 12 | //=========================================================================== 13 | /* Profile - describes comparison rules, sourses and its field pairs */ 14 | public class Profile : IDisposable 15 | { 16 | [XmlIgnore] 17 | public bool needSave { get; set; } // has unsaved changes 18 | [XmlIgnore] 19 | public string Filepath { get; set; } // path to saved(serialized) file 20 | [XmlIgnore] 21 | public string ProfileName 22 | { 23 | get 24 | { 25 | if (string.IsNullOrEmpty(Filepath)) 26 | return SrcA.Name + "_" + SrcB.Name; 27 | else 28 | return Path.GetFileNameWithoutExtension(Filepath); 29 | } 30 | } 31 | [XmlIgnore] 32 | public string ViewCaption // header for view 33 | { 34 | get 35 | { 36 | if (string.IsNullOrEmpty(Filepath)) 37 | return "New profile" + (needSave ? "*" : ""); 38 | else 39 | return Path.GetFileNameWithoutExtension(Filepath) + (needSave ? "*" : ""); 40 | } 41 | } 42 | 43 | // comparison options and rules: 44 | bool diffOnly = true; // get only differences in comparison result 45 | public bool DiffOnly { get { return diffOnly; } set { diffOnly = value; } } 46 | bool onlyA = true; // get not matched records of source A in comparison result 47 | public bool OnlyA { get { return onlyA; } set { onlyA = value; } } 48 | bool onlyB = true; // get not matched records of source B in comparison result 49 | public bool OnlyB { get { return onlyB; } set { onlyB = value; } } 50 | public bool MatchInOrder { get; set; } // match records in order, not by keys 51 | public bool MatchAllPairs { get; set; } // match all fields 52 | public bool CheckRepeats { get; set; } 53 | public bool TryConvert { get; set; } 54 | public bool NullAsStr { get; set; } 55 | public bool CaseSens { get; set; } 56 | 57 | // options for batch-mode: 58 | public bool Send { get; set; } // send mail 59 | public string SendTo { get; set; } // recipients 60 | public string Subject { get; set; } // subject 61 | ViewResultType resType = ViewResultType.Excel; // type of result file 62 | public ViewResultType ResType { get { return resType; } set { resType = value; } } 63 | public string ResFolder { get; set; } // path for result file 64 | public string ResFile { get; set; } // result file name 65 | public bool TimeInResFile { get; set; } // include timestamp in result file name 66 | MailResult resMail = MailResult.Attachment; // way to send result in mail 67 | public MailResult ResMail { get { return resMail; } set { resMail = value; } } 68 | [XmlIgnore] 69 | public bool ResExcel { get { return ResType == ViewResultType.Excel; } set { if (value) ResType = ViewResultType.Excel; } } 70 | [XmlIgnore] 71 | public bool ResHTML { get { return ResType == ViewResultType.HTML; } set { if (value) ResType = ViewResultType.HTML; } } 72 | 73 | Source srcA = new Source() { InnerName = "SourceA" }; 74 | public Source SrcA // object for source A 75 | { 76 | get { return srcA; } 77 | set { srcA = value; srcA.InnerName = "SourceA"; } 78 | } 79 | Source srcB = new Source() { InnerName = "SourceB" }; 80 | public Source SrcB // object for source B 81 | { 82 | get { return srcB; } 83 | set { srcB = value; srcB.InnerName = "SourceB"; } 84 | } 85 | 86 | // field pairs 87 | List cols = new List(); 88 | public List Cols 89 | { 90 | get { return cols; } 91 | set { cols = value; } 92 | } 93 | //------------------------------------------------------------------------- 94 | /* lists of source fields */ 95 | public List[] GetFields(bool check) 96 | { 97 | return new[] { 98 | check ? SrcA.Content.GetCheckFields() : SrcA.Content.Fields, 99 | check ? SrcB.Content.GetCheckFields() : SrcB.Content.Fields }; 100 | } 101 | //------------------------------------------------------------------------- 102 | /* check ready for comparison */ 103 | public void Check() 104 | { 105 | if (Cols.Count == 0) 106 | throw new Exception("No fields in pairs"); 107 | SrcA.Check(); 108 | SrcB.Check(); 109 | } 110 | //------------------------------------------------------------------------- 111 | /* check difference between field names in pairs and in sources */ 112 | public void CheckFieldPairs(bool loadFields) 113 | { 114 | List[] flds = GetFields(loadFields); 115 | if (Cols.Exists(x => { return (!string.IsNullOrEmpty(x.ColA) && !flds[0].Contains(x.ColA)) || (!string.IsNullOrEmpty(x.ColB) && !flds[1].Contains(x.ColB)); })) 116 | throw new Exception("Some of fields in pairs not exist in sources"); 117 | } 118 | //------------------------------------------------------------------------- 119 | /* prepare profile for save or for comparison */ 120 | public void Prepare() 121 | { 122 | if (string.IsNullOrEmpty(SrcA.Name)) SrcA.Name = SrcA.InnerName; 123 | if (string.IsNullOrEmpty(SrcB.Name)) SrcB.Name = SrcB.InnerName; 124 | Cols.RemoveAll(x => { return (string.IsNullOrEmpty(x.ColA) && string.IsNullOrEmpty(x.ColB)); }); 125 | foreach (var pair in Cols.Where(x => { return (string.IsNullOrEmpty(x.ColA) || string.IsNullOrEmpty(x.ColB)); })) 126 | { 127 | pair.Key = false; 128 | pair.Match = false; 129 | } 130 | } 131 | //------------------------------------------------------------------------- 132 | public void Dispose() 133 | { 134 | if (SrcA != null) SrcA.DTClear(); 135 | if (SrcB != null) SrcB.DTClear(); 136 | } 137 | } 138 | //=========================================================================== 139 | /* field names pair */ 140 | public class ColPair 141 | { 142 | public bool Key { get; set; } // key fields - use for record matching 143 | public bool Match { get; set; } // fields for comparision in matched records 144 | public string ColA { get; set; } 145 | public string ColB { get; set; } 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /project/Comparator/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 3 | // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 4 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR 5 | // PURPOSE. 6 | // 7 | // License: GNU Lesser General Public License (LGPLv3) 8 | // 9 | // Email: pumpet.net@gmail.com 10 | // Git: https://github.com/Pumpet/comparator 11 | // Copyright (C) Alex Rozanov, 2016 12 | // 13 | // Special thanks to Pavel Torgashov for his excellent FastColoredTextBox component! 14 | // https://github.com/PavelTorgashov/FastColoredTextBox 15 | // 16 | 17 | using System; 18 | using System.Windows.Forms; 19 | using System.Runtime.InteropServices; 20 | 21 | namespace Comparator 22 | { 23 | static class Program 24 | { 25 | [DllImport("kernel32.dll")] 26 | private static extern bool AllocConsole(); 27 | 28 | [STAThread] 29 | static void Main(string[] args) 30 | { 31 | if (args.Length == 1 && args[0] == "-?") 32 | { 33 | Legend(); 34 | Environment.Exit(0); 35 | } 36 | bool batch = Array.Exists(args, s => s.ToLower() == "-batch"); 37 | if (batch) 38 | { 39 | AllocConsole(); 40 | Master master = new Master(true, null, args); 41 | Application.Run(); 42 | } 43 | else 44 | { 45 | Application.EnableVisualStyles(); 46 | Application.SetCompatibleTextRenderingDefault(false); 47 | FormView form = new FormView(); 48 | Master master = new Master(false, form, args); 49 | Application.Run(form); 50 | } 51 | } 52 | //------------------------------------------------------------------------- 53 | static void Legend() 54 | { 55 | string Legend = @" 56 | Launch modes: 57 | 1) comparator [-profile:""[path]filename""] 58 | 2) comparator -batch -profile:""[path]filename"" [-path:""path""][-log:""[path]filename""][-type:excel|html][-sendto:""address[;address...]""][-file:""filename""][-open] 59 | 60 | Required: 61 | -batch – defines console mode 62 | -profile:""pathfilename"" – file containing the profile; 63 | 64 | Optional, ignored if -batch is not defined, have higher priority than respective settings from the application profile and settings: 65 | -path:""path"" – path where the results will be saved (do not use ""/"" in the end); 66 | -log:""[path]filename"" – log file; 67 | -type:excel|html – result file type (excel or html); 68 | -sendto:""address[;address...]"" – mailing list; when specified but the list is empty, the results will not be sent; 69 | -file:""filename"" – result file name; 70 | -open – when specified, the result file will be opened. 71 | 72 | Press any key..."; 73 | 74 | AllocConsole(); 75 | Console.WriteLine(Legend); 76 | Console.ReadKey(true); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /project/Comparator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // Управление общими сведениями о сборке осуществляется с помощью 5 | // набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, 6 | // связанные со сборкой. 7 | [assembly: AssemblyTitle("Comparator")] 8 | [assembly: AssemblyDescription("Compare data from two sources")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Pumpet")] 11 | [assembly: AssemblyProduct("Comparator")] 12 | [assembly: AssemblyCopyright("GNU Lesser General Public License (LGPLv3)")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Параметр ComVisible со значением FALSE делает типы в сборке невидимыми 17 | // для COM-компонентов. Если требуется обратиться к типу в этой сборке через 18 | // COM, задайте атрибуту ComVisible значение TRUE для этого типа. 19 | [assembly: ComVisible(false)] 20 | 21 | // Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM 22 | [assembly: Guid("8b614cce-8540-4d8d-b099-0092f592947e")] 23 | 24 | // Сведения о версии сборки состоят из следующих четырех значений: 25 | // 26 | // Основной номер версии 27 | // Дополнительный номер версии 28 | // Номер построения 29 | // Редакция 30 | // 31 | // Можно задать все значения или принять номер построения и номер редакции по умолчанию, 32 | // используя "*", как показано ниже: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("2.0.0.0")] 35 | [assembly: AssemblyFileVersion("2.0.0.0")] 36 | -------------------------------------------------------------------------------- /project/Comparator/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Этот код создан программой. 4 | // Исполняемая версия:4.0.30319.18408 5 | // 6 | // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае 7 | // повторной генерации кода. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Comparator.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /project/Comparator/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /project/Comparator/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /project/Comparator/compare32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/project/Comparator/compare32.ico -------------------------------------------------------------------------------- /project/Comparator/ico.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/project/Comparator/ico.rar -------------------------------------------------------------------------------- /project/DSComparer/DSComparer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 9.0.30729 7 | 2.0 8 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587} 9 | Library 10 | Properties 11 | DataComparer 12 | DSComparer 13 | v4.5.1 14 | 512 15 | 16 | 17 | 18 | 19 | 20 | 21 | 3.5 22 | 23 | 24 | 25 | 26 | true 27 | full 28 | false 29 | bin\Debug\ 30 | DEBUG;TRACE 31 | prompt 32 | 4 33 | false 34 | 35 | 36 | pdbonly 37 | true 38 | bin\Release\ 39 | TRACE 40 | prompt 41 | 4 42 | false 43 | 44 | 45 | true 46 | bin\x86\Debug\ 47 | DEBUG;TRACE 48 | full 49 | x86 50 | prompt 51 | true 52 | true 53 | false 54 | 55 | 56 | bin\x86\Release\ 57 | TRACE 58 | false 59 | pdbonly 60 | x86 61 | prompt 62 | true 63 | true 64 | false 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | True 73 | ..\Office12\Microsoft.Office.Interop.Excel.dll 74 | 75 | 76 | 77 | 3.5 78 | 79 | 80 | 81 | 82 | 3.5 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | Form 92 | 93 | 94 | FormResult.cs 95 | 96 | 97 | UserControl 98 | 99 | 100 | GridResult.cs 101 | 102 | 103 | 104 | True 105 | True 106 | Resources.resx 107 | 108 | 109 | 110 | 111 | 112 | FormResult.cs 113 | Designer 114 | 115 | 116 | GridResult.cs 117 | 118 | 119 | ResXFileCodeGenerator 120 | Resources.Designer.cs 121 | Designer 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 138 | -------------------------------------------------------------------------------- /project/DSComparer/DSComparer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DSComparer", "DSComparer.csproj", "{F9C1B252-7A56-4217-A33E-FD0C2E16E587}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {F9C1B252-7A56-4217-A33E-FD0C2E16E587}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /project/DSComparer/DSComparer.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/project/DSComparer/DSComparer.suo -------------------------------------------------------------------------------- /project/DSComparer/FormResult.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace DataComparer 2 | { 3 | sealed partial class FormResult 4 | { 5 | /// 6 | /// Требуется переменная конструктора. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Освободить все используемые ресурсы. 12 | /// 13 | /// истинно, если управляемый ресурс должен быть удален; иначе ложно. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Код, автоматически созданный конструктором форм Windows 24 | 25 | /// 26 | /// Обязательный метод для поддержки конструктора - не изменяйте 27 | /// содержимое данного метода при помощи редактора кода. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormResult)); 32 | this.tabs = new System.Windows.Forms.TabControl(); 33 | this.tabDiff = new System.Windows.Forms.TabPage(); 34 | this.resDiff = new DataComparer.GridResult(); 35 | this.tabIdent = new System.Windows.Forms.TabPage(); 36 | this.resIdent = new DataComparer.GridResult(); 37 | this.tabA = new System.Windows.Forms.TabPage(); 38 | this.resA = new DataComparer.GridResult(); 39 | this.tabB = new System.Windows.Forms.TabPage(); 40 | this.resB = new DataComparer.GridResult(); 41 | this.tabs.SuspendLayout(); 42 | this.tabDiff.SuspendLayout(); 43 | this.tabIdent.SuspendLayout(); 44 | this.tabA.SuspendLayout(); 45 | this.tabB.SuspendLayout(); 46 | this.SuspendLayout(); 47 | // 48 | // tabs 49 | // 50 | this.tabs.Appearance = System.Windows.Forms.TabAppearance.Buttons; 51 | this.tabs.Controls.Add(this.tabDiff); 52 | this.tabs.Controls.Add(this.tabIdent); 53 | this.tabs.Controls.Add(this.tabA); 54 | this.tabs.Controls.Add(this.tabB); 55 | this.tabs.Dock = System.Windows.Forms.DockStyle.Fill; 56 | this.tabs.ItemSize = new System.Drawing.Size(150, 23); 57 | this.tabs.Location = new System.Drawing.Point(0, 0); 58 | this.tabs.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); 59 | this.tabs.Name = "tabs"; 60 | this.tabs.SelectedIndex = 0; 61 | this.tabs.Size = new System.Drawing.Size(764, 362); 62 | this.tabs.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; 63 | this.tabs.TabIndex = 0; 64 | this.tabs.SelectedIndexChanged += new System.EventHandler(this.tabs_SelectedIndexChanged); 65 | // 66 | // tabDiff 67 | // 68 | this.tabDiff.Controls.Add(this.resDiff); 69 | this.tabDiff.Location = new System.Drawing.Point(4, 27); 70 | this.tabDiff.Margin = new System.Windows.Forms.Padding(0); 71 | this.tabDiff.Name = "tabDiff"; 72 | this.tabDiff.Size = new System.Drawing.Size(756, 331); 73 | this.tabDiff.TabIndex = 0; 74 | this.tabDiff.Text = "Differences"; 75 | this.tabDiff.UseVisualStyleBackColor = true; 76 | // 77 | // resDiff 78 | // 79 | this.resDiff.Dock = System.Windows.Forms.DockStyle.Fill; 80 | this.resDiff.Location = new System.Drawing.Point(0, 0); 81 | this.resDiff.Name = "resDiff"; 82 | this.resDiff.Size = new System.Drawing.Size(756, 331); 83 | this.resDiff.TabIndex = 0; 84 | // 85 | // tabIdent 86 | // 87 | this.tabIdent.Controls.Add(this.resIdent); 88 | this.tabIdent.Location = new System.Drawing.Point(4, 27); 89 | this.tabIdent.Margin = new System.Windows.Forms.Padding(0); 90 | this.tabIdent.Name = "tabIdent"; 91 | this.tabIdent.Size = new System.Drawing.Size(756, 331); 92 | this.tabIdent.TabIndex = 1; 93 | this.tabIdent.Text = "Identicals"; 94 | this.tabIdent.UseVisualStyleBackColor = true; 95 | // 96 | // resIdent 97 | // 98 | this.resIdent.Dock = System.Windows.Forms.DockStyle.Fill; 99 | this.resIdent.Location = new System.Drawing.Point(0, 0); 100 | this.resIdent.Name = "resIdent"; 101 | this.resIdent.Size = new System.Drawing.Size(756, 331); 102 | this.resIdent.TabIndex = 0; 103 | // 104 | // tabA 105 | // 106 | this.tabA.Controls.Add(this.resA); 107 | this.tabA.Location = new System.Drawing.Point(4, 27); 108 | this.tabA.Margin = new System.Windows.Forms.Padding(0); 109 | this.tabA.Name = "tabA"; 110 | this.tabA.Size = new System.Drawing.Size(756, 331); 111 | this.tabA.TabIndex = 2; 112 | this.tabA.Text = "Only in Source A"; 113 | this.tabA.UseVisualStyleBackColor = true; 114 | // 115 | // resA 116 | // 117 | this.resA.Dock = System.Windows.Forms.DockStyle.Fill; 118 | this.resA.Location = new System.Drawing.Point(0, 0); 119 | this.resA.Name = "resA"; 120 | this.resA.Size = new System.Drawing.Size(756, 331); 121 | this.resA.TabIndex = 0; 122 | // 123 | // tabB 124 | // 125 | this.tabB.Controls.Add(this.resB); 126 | this.tabB.Location = new System.Drawing.Point(4, 27); 127 | this.tabB.Margin = new System.Windows.Forms.Padding(0); 128 | this.tabB.Name = "tabB"; 129 | this.tabB.Size = new System.Drawing.Size(756, 331); 130 | this.tabB.TabIndex = 3; 131 | this.tabB.Text = "Only in Source B"; 132 | this.tabB.UseVisualStyleBackColor = true; 133 | // 134 | // resB 135 | // 136 | this.resB.Dock = System.Windows.Forms.DockStyle.Fill; 137 | this.resB.Location = new System.Drawing.Point(0, 0); 138 | this.resB.Name = "resB"; 139 | this.resB.Size = new System.Drawing.Size(756, 331); 140 | this.resB.TabIndex = 0; 141 | // 142 | // FormResult 143 | // 144 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); 145 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 146 | this.ClientSize = new System.Drawing.Size(764, 362); 147 | this.Controls.Add(this.tabs); 148 | this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); 149 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 150 | this.KeyPreview = true; 151 | this.MinimumSize = new System.Drawing.Size(640, 300); 152 | this.Name = "FormResult"; 153 | this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; 154 | this.Text = "Compare results"; 155 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormResult_FormClosing); 156 | this.Load += new System.EventHandler(this.FormResult_Load); 157 | this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormResult_KeyDown); 158 | this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.FormResult_KeyUp); 159 | this.tabs.ResumeLayout(false); 160 | this.tabDiff.ResumeLayout(false); 161 | this.tabIdent.ResumeLayout(false); 162 | this.tabA.ResumeLayout(false); 163 | this.tabB.ResumeLayout(false); 164 | this.ResumeLayout(false); 165 | 166 | } 167 | 168 | #endregion 169 | 170 | private System.Windows.Forms.TabControl tabs; 171 | private System.Windows.Forms.TabPage tabDiff; 172 | private System.Windows.Forms.TabPage tabIdent; 173 | private System.Windows.Forms.TabPage tabA; 174 | private System.Windows.Forms.TabPage tabB; 175 | public GridResult resDiff; 176 | public GridResult resIdent; 177 | public GridResult resA; 178 | public GridResult resB; 179 | } 180 | } 181 | 182 | -------------------------------------------------------------------------------- /project/DSComparer/FormResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Windows.Forms; 4 | 5 | namespace DataComparer 6 | { 7 | public sealed partial class FormResult : Form 8 | { 9 | bool needClose; 10 | public string ResultPath { get; private set; } 11 | public string ResultFileName { get; private set; } 12 | public string StyleFile { get; private set; } 13 | //------------------------------------------------------------------------- 14 | public FormResult(CompareResult cmp, string resultPath, string resultFileName, string styleFile) 15 | { 16 | InitializeComponent(); 17 | Cursor = Cursors.WaitCursor; 18 | ResultPath = resultPath; 19 | ResultFileName = resultFileName; 20 | StyleFile = styleFile; 21 | try 22 | { 23 | Text = "Compare \"" + cmp.NameA + "\"(A) and \"" + cmp.NameB + "\"(B)"; 24 | // Get available results 25 | resDiff.SetData(cmp, ResultType.rtDiff); 26 | if (cmp.DtIdent == null) tabs.TabPages.RemoveByKey("tabIdent"); else resIdent.SetData(cmp, ResultType.rtIdent); 27 | if (cmp.DtA == null) tabs.TabPages.RemoveByKey("tabA"); else resA.SetData(cmp, ResultType.rtA); 28 | if (cmp.DtB == null) tabs.TabPages.RemoveByKey("tabB"); else resB.SetData(cmp, ResultType.rtB); 29 | 30 | if (DSComparer.FormRect.IsEmpty) 31 | StartPosition = FormStartPosition.CenterScreen; 32 | else 33 | { 34 | StartPosition = FormStartPosition.Manual; 35 | Location = DSComparer.FormRect.Location; 36 | Size = DSComparer.FormRect.Size; 37 | } 38 | WindowState = DSComparer.WinState; 39 | } 40 | finally 41 | { 42 | Cursor = Cursors.Default; 43 | } 44 | } 45 | //------------------------------------------------------------------------- 46 | private void FormResult_Load(object sender, EventArgs e) 47 | { 48 | 49 | } 50 | //------------------------------------------------------------------------- 51 | private void FormResult_KeyDown(object sender, KeyEventArgs e) 52 | { 53 | if (e.KeyCode == Keys.Escape) 54 | Close(); 55 | } 56 | //------------------------------------------------------------------------- 57 | private void FormResult_KeyUp(object sender, KeyEventArgs e) 58 | { 59 | // Switch between tabs 60 | if (e.Modifiers == Keys.Control && e.KeyCode == Keys.Tab) 61 | { 62 | e.Handled = true; 63 | if (tabs.SelectedIndex == -1) 64 | tabs.SelectedIndex = tabs.TabCount - 1; 65 | else if (tabs.SelectedIndex == tabs.TabCount - 1) 66 | tabs.SelectedIndex = 0; 67 | else 68 | tabs.SelectedIndex++; 69 | } 70 | if (e.Modifiers == (Keys.Control | Keys.Shift) && e.KeyCode == Keys.Tab) 71 | { 72 | e.Handled = true; 73 | if (tabs.SelectedIndex == -1) 74 | tabs.SelectedIndex = tabs.TabCount - 1; 75 | else if (tabs.SelectedIndex == 0) 76 | tabs.SelectedIndex = tabs.TabCount - 1; 77 | else 78 | tabs.SelectedIndex--; 79 | } 80 | } 81 | //------------------------------------------------------------------------- 82 | public void Close(bool need) 83 | { 84 | needClose = need; 85 | Close(); 86 | } 87 | //------------------------------------------------------------------------- 88 | private void FormResult_FormClosing(object sender, FormClosingEventArgs e) 89 | { 90 | // save current window position and states 91 | if (WindowState == FormWindowState.Normal) 92 | { 93 | DSComparer.FormRect.Location = Location; 94 | DSComparer.FormRect.Size = Size; 95 | } 96 | DSComparer.WinState = WindowState; 97 | 98 | if (!needClose) 99 | { 100 | e.Cancel = true; 101 | Hide(); 102 | } 103 | } 104 | //------------------------------------------------------------------------- 105 | private void tabs_SelectedIndexChanged(object sender, EventArgs e) 106 | { 107 | // focus from button to grid 108 | if (tabs.SelectedTab != null && tabs.SelectedTab.Controls.OfType().Any()) 109 | tabs.SelectedTab.Controls.OfType().First().Focus(); 110 | } 111 | 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /project/DSComparer/GridResult.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 125 | 126 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 127 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG 128 | YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 129 | 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw 130 | bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc 131 | VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 132 | c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 133 | Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo 134 | mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ 135 | kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D 136 | TgDQASA1MVpwzwAAAABJRU5ErkJggg== 137 | 138 | 139 | 140 | 97, 17 141 | 142 | -------------------------------------------------------------------------------- /project/DSComparer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // Управление общими сведениями о сборке осуществляется с помощью 5 | // набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, 6 | // связанные со сборкой. 7 | [assembly: AssemblyTitle("DSComparer")] 8 | [assembly: AssemblyDescription("Library for DataTables compare")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Pumpet")] 11 | [assembly: AssemblyProduct("DSComparer")] 12 | [assembly: AssemblyCopyright("GNU Lesser General Public License (LGPLv3)")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Параметр ComVisible со значением FALSE делает типы в сборке невидимыми 17 | // для COM-компонентов. Если требуется обратиться к типу в этой сборке через 18 | // COM, задайте атрибуту ComVisible значение TRUE для этого типа. 19 | [assembly: ComVisible(false)] 20 | 21 | // Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM 22 | [assembly: Guid("9dbcb111-9478-4cd5-8ffa-44266ac88a7a")] 23 | 24 | // Сведения о версии сборки состоят из следующих четырех значений: 25 | // 26 | // Основной номер версии 27 | // Дополнительный номер версии 28 | // Номер построения 29 | // Редакция 30 | // 31 | // Можно задать все значения или принять номер построения и номер редакции по умолчанию, 32 | // используя "*", как показано ниже: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("2.0.0.0")] 35 | [assembly: AssemblyFileVersion("2.0.0.0")] 36 | -------------------------------------------------------------------------------- /project/DSComparer/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18408 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DataComparer.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataComparer.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap clear_filter { 67 | get { 68 | object obj = ResourceManager.GetObject("clear_filter", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Looks up a localized resource of type System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap diff { 77 | get { 78 | object obj = ResourceManager.GetObject("diff", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized resource of type System.Drawing.Bitmap. 85 | /// 86 | internal static System.Drawing.Bitmap diskette { 87 | get { 88 | object obj = ResourceManager.GetObject("diskette", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Looks up a localized resource of type System.Drawing.Bitmap. 95 | /// 96 | internal static System.Drawing.Bitmap Excel { 97 | get { 98 | object obj = ResourceManager.GetObject("Excel", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | 103 | /// 104 | /// Looks up a localized resource of type System.Drawing.Bitmap. 105 | /// 106 | internal static System.Drawing.Bitmap filter { 107 | get { 108 | object obj = ResourceManager.GetObject("filter", resourceCulture); 109 | return ((System.Drawing.Bitmap)(obj)); 110 | } 111 | } 112 | 113 | /// 114 | /// Looks up a localized resource of type System.Drawing.Bitmap. 115 | /// 116 | internal static System.Drawing.Bitmap find { 117 | get { 118 | object obj = ResourceManager.GetObject("find", resourceCulture); 119 | return ((System.Drawing.Bitmap)(obj)); 120 | } 121 | } 122 | 123 | /// 124 | /// Looks up a localized resource of type System.Drawing.Bitmap. 125 | /// 126 | internal static System.Drawing.Bitmap html { 127 | get { 128 | object obj = ResourceManager.GetObject("html", resourceCulture); 129 | return ((System.Drawing.Bitmap)(obj)); 130 | } 131 | } 132 | 133 | /// 134 | /// Looks up a localized resource of type System.Drawing.Bitmap. 135 | /// 136 | internal static System.Drawing.Bitmap key { 137 | get { 138 | object obj = ResourceManager.GetObject("key", resourceCulture); 139 | return ((System.Drawing.Bitmap)(obj)); 140 | } 141 | } 142 | 143 | /// 144 | /// Looks up a localized resource of type System.Drawing.Bitmap. 145 | /// 146 | internal static System.Drawing.Bitmap pinoff { 147 | get { 148 | object obj = ResourceManager.GetObject("pinoff", resourceCulture); 149 | return ((System.Drawing.Bitmap)(obj)); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized resource of type System.Drawing.Bitmap. 155 | /// 156 | internal static System.Drawing.Bitmap pinon { 157 | get { 158 | object obj = ResourceManager.GetObject("pinon", resourceCulture); 159 | return ((System.Drawing.Bitmap)(obj)); 160 | } 161 | } 162 | 163 | /// 164 | /// Looks up a localized resource of type System.Drawing.Bitmap. 165 | /// 166 | internal static System.Drawing.Bitmap Repeat { 167 | get { 168 | object obj = ResourceManager.GetObject("Repeat", resourceCulture); 169 | return ((System.Drawing.Bitmap)(obj)); 170 | } 171 | } 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /project/DSComparer/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Этот код создан программой. 4 | // Исполняемая версия:4.0.30319.1026 5 | // 6 | // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае 7 | // повторной генерации кода. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace DataComparer.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /project/DSComparer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /project/DSComparer/ico.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/project/DSComparer/ico.rar -------------------------------------------------------------------------------- /project/FastColoredTextBox/FastColoredTextBox.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/project/FastColoredTextBox/FastColoredTextBox.dll -------------------------------------------------------------------------------- /project/Sources/CsvContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Text; 7 | using Common; 8 | 9 | namespace Sources 10 | { 11 | public class CsvContent : SourceContent 12 | { 13 | public string Filename { get; set; } 14 | public bool FirstLineNames { get; set; } // true if field names must be in the first string 15 | public string Delimiter { get; set; } 16 | public string Codepage { get; set; } 17 | //------------------------------------------------------------------------- 18 | public CsvContent() 19 | { 20 | Fields = new List(); 21 | } 22 | //------------------------------------------------------------------------- 23 | public override void Check() 24 | { 25 | if (string.IsNullOrEmpty(Filename)) 26 | throw new Exception(Parent.Name + ": file name not defined"); 27 | if (!File.Exists(CommonProc.GetFilePath(Filename))) 28 | throw new Exception(Parent.Name + ": file not exist"); 29 | } 30 | //------------------------------------------------------------------------- 31 | public override List GetCheckFields() 32 | { 33 | Check(); 34 | LoadCsvData(true); 35 | return Fields; 36 | } 37 | //------------------------------------------------------------------------- 38 | public override void GetData(TaskContext c, Action a) 39 | { 40 | base.GetData(c, a); 41 | Check(); 42 | if (c != null && c.OnProgress != null) 43 | c.OnProgress(0, "open file \"" + Path.GetFileName(Filename) + "\" ..."); 44 | LoadCsvData(); 45 | GetDataEnd(null, string.Format("{0} rows", Parent.DT.Rows.Count)); 46 | } 47 | //------------------------------------------------------------------------- 48 | /* When select a file */ 49 | public void LoadCsv(string filename) 50 | { 51 | if (string.IsNullOrEmpty(filename)) return; 52 | Filename = filename; 53 | LoadCsvData(true); 54 | } 55 | //------------------------------------------------------------------------- 56 | /* Get data from file to Parent.DT, field names to Fields */ 57 | void LoadCsvData(bool fieldsOnly = false) 58 | { 59 | Fields = new List(); 60 | if (string.IsNullOrEmpty(Filename) || !File.Exists(CommonProc.GetFilePath(Filename))) return; 61 | 62 | Encoding enc = Encoding.Default; 63 | if (!string.IsNullOrEmpty(Codepage)) 64 | { 65 | string cp = Codepage.ToUpper().Trim(); 66 | int cpNo = Encoding.Default.CodePage; 67 | switch (cp) 68 | { 69 | case "UTF8": 70 | enc = Encoding.UTF8; 71 | break; 72 | case "UTF7": 73 | enc = Encoding.UTF7; 74 | break; 75 | case "UTF16": 76 | enc = Encoding.Unicode; 77 | break; 78 | case "UTF32": 79 | enc = Encoding.UTF32; 80 | break; 81 | default: 82 | if (string.IsNullOrEmpty(cp)) 83 | enc = Encoding.Default; 84 | else if (int.TryParse(cp, out cpNo)) 85 | enc = Encoding.GetEncoding(cpNo); 86 | else 87 | enc = Encoding.GetEncoding(cp); 88 | break; 89 | } 90 | } 91 | 92 | using (StreamReader rdr = new StreamReader(CommonProc.GetFilePath(Filename), enc, true)) 93 | { 94 | string[] dlmts = new string[] { string.IsNullOrEmpty(Delimiter) ? Convert.ToString((char)9) : Delimiter }; 95 | string flds = rdr.ReadLine(); 96 | if (!string.IsNullOrEmpty(flds)) 97 | { 98 | Fields = flds.Split(dlmts, StringSplitOptions.None).ToList(); 99 | for (int i = 0; i < Fields.Count; i++) 100 | { 101 | if (!FirstLineNames || string.IsNullOrEmpty(Fields[i])) 102 | Fields[i] = string.Format("Field{0}", i + 1); 103 | } 104 | } 105 | if (!fieldsOnly) 106 | { 107 | Parent.DT = new DataTable(); 108 | for (int i = 0; i < Fields.Count; i++) 109 | { 110 | string tmpName = Fields[i]; 111 | int suff = 0; 112 | while (Parent.DT.Columns.OfType().Count(x => x.ColumnName == Fields[i]) > 0) 113 | Fields[i] = tmpName + "_" + (++suff).ToString(); 114 | Parent.DT.Columns.Add(Fields[i]); 115 | } 116 | if (!FirstLineNames) 117 | { 118 | rdr.BaseStream.Seek(0, 0); 119 | rdr.DiscardBufferedData(); 120 | } 121 | while (rdr.Peek() >= 0) 122 | { 123 | DataRow dr = Parent.DT.NewRow(); 124 | string row = rdr.ReadLine(); 125 | if (string.IsNullOrEmpty(row)) continue; 126 | List rowFields = row.Split(dlmts, StringSplitOptions.None).ToList(); 127 | for (int i = 0; i < Math.Min(Fields.Count, rowFields.Count); i++) 128 | dr[i] = rowFields[i]; 129 | Parent.DT.Rows.Add(dr); 130 | } 131 | Parent.DT.TableName = Parent.Name; 132 | } 133 | rdr.Close(); 134 | } 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /project/Sources/DbContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Xml.Serialization; 4 | using SqlSource; 5 | using Common; 6 | 7 | namespace Sources 8 | { 9 | public class DbContent : SourceContent, ISqlModel 10 | { 11 | EncrDecr ed; 12 | SqlController dbController; 13 | ProviderType provider; 14 | //-- ISqlModel Members --------------------------------------------------- 15 | public ProviderType Provider 16 | { 17 | get { return provider; } 18 | set { provider = value; } 19 | } 20 | public string Server { get; set; } 21 | public string DB { get; set; } 22 | public string Login { get; set; } 23 | [XmlIgnore] 24 | public string Pwd { get; set; } 25 | [XmlIgnore] 26 | public string ConnStr { get; set; } 27 | public int CommandTimeout { get; set; } 28 | public string SQL { get; set; } 29 | // ISqlModel.Fields implemented in SourceContent 30 | //------------------------------------------------------------------------- 31 | public string PwdEncr { get { return ed.Encrypt(Pwd); } set { Pwd = ed.Decrypt(value); } } // encrypted password 32 | public string ConnStrEncr { get { return ed.Encrypt(ConnStr); } set { ConnStr = ed.Decrypt(value); } } // encrypted connection string 33 | [XmlIgnore] 34 | public string ConnectionInfo // short info for View (SourcePanel) 35 | { 36 | get 37 | { 38 | string info, nl = Environment.NewLine; 39 | if (Provider == ProviderType.OleDB || Provider == ProviderType.ODBC) 40 | info = string.Format(@"Source: {0}Connection string: {1}", Provider + nl, ConnStr + nl); 41 | else 42 | info = string.Format(@"Source: {0}Server: {1}DB: {2}Login: {3}", 43 | Provider + nl, Server + nl, DB + nl, Login + nl); 44 | return info; 45 | } 46 | } 47 | //------------------------------------------------------------------------- 48 | public DbContent() 49 | { 50 | Provider = ProviderType.OleDB; 51 | CommandTimeout = 15; 52 | Fields = new List(); 53 | ed = new EncrDecr(string.Empty, string.Empty); 54 | dbController = SqlController.CreateSqlController(this); 55 | } 56 | //------------------------------------------------------------------------- 57 | public ISqlView GetSqlView() 58 | { 59 | return dbController.View; 60 | } 61 | //------------------------------------------------------------------------- 62 | public override void Check() 63 | { 64 | switch (Provider) 65 | { 66 | case ProviderType.MSSQL: 67 | case ProviderType.Oracle: 68 | case ProviderType.Sybase: 69 | case ProviderType.SybaseASE15: 70 | if (string.IsNullOrEmpty(Server)) 71 | throw new Exception(Parent.Name + ": server is not specified"); 72 | break; 73 | case ProviderType.ODBC: 74 | case ProviderType.OleDB: 75 | if (string.IsNullOrEmpty(ConnStr)) 76 | throw new Exception(Parent.Name + ": connection string is not specified"); 77 | break; 78 | default: 79 | break; 80 | } 81 | if (string.IsNullOrEmpty(SQL)) 82 | throw new Exception(Parent.Name + ": query is not specified"); 83 | } 84 | //------------------------------------------------------------------------- 85 | public override List GetCheckFields() 86 | { 87 | if (Fields.Count == 0) // fields are filled only after start process in SqlController 88 | throw new Exception(Parent.Name + ": no fields found. Run query to get!"); 89 | return Fields; 90 | } 91 | //------------------------------------------------------------------------- 92 | public override void GetData(TaskContext c, Action a) 93 | { 94 | base.GetData(c, a); 95 | if (c != null && c.OnProgress != null) 96 | c.OnProgress(0, "execute..."); 97 | // start getting data process in SqlController, which gets this object as ISqlModel 98 | dbController.GetData(SQL, context); 99 | // Parent.DT fills in SourceContent.GetDataEnd(), which is passed in context.OnFinish 100 | // and executes after process successfully completed 101 | } 102 | //------------------------------------------------------------------------- 103 | public override void GetDataStop() 104 | { 105 | dbController.StopGetData(); 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /project/Sources/FormXml.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | True 122 | 123 | 124 | True 125 | 126 | 127 | True 128 | 129 | 130 | 17, 17 131 | 132 | 133 | 121, 17 134 | 135 | 136 | 205, 17 137 | 138 | -------------------------------------------------------------------------------- /project/Sources/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // Управление общими сведениями о сборке осуществляется с помощью 5 | // набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, 6 | // связанные со сборкой. 7 | [assembly: AssemblyTitle("Sources")] 8 | [assembly: AssemblyDescription("Library for sources data models")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Pumpet")] 11 | [assembly: AssemblyProduct("Sources")] 12 | [assembly: AssemblyCopyright("GNU Lesser General Public License (LGPLv3)")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Параметр ComVisible со значением FALSE делает типы в сборке невидимыми 17 | // для COM-компонентов. Если требуется обратиться к типу в этой сборке через 18 | // COM, задайте атрибуту ComVisible значение TRUE для этого типа. 19 | [assembly: ComVisible(false)] 20 | 21 | // Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM 22 | [assembly: Guid("a76f10b5-7034-42b4-bdb0-7719932714f1")] 23 | 24 | // Сведения о версии сборки состоят из следующих четырех значений: 25 | // 26 | // Основной номер версии 27 | // Дополнительный номер версии 28 | // Номер построения 29 | // Редакция 30 | // 31 | // Можно задать все значения или принять номер построения и номер редакции по умолчанию, 32 | // используя "*", как показано ниже: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("2.0.0.0")] 35 | [assembly: AssemblyFileVersion("2.0.0.0")] 36 | -------------------------------------------------------------------------------- /project/Sources/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Этот код создан программой. 4 | // Исполняемая версия:4.0.30319.18408 5 | // 6 | // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае 7 | // повторной генерации кода. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Sources.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. 17 | /// 18 | // Этот класс создан автоматически классом StronglyTypedResourceBuilder 19 | // с помощью такого средства, как ResGen или Visual Studio. 20 | // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen 21 | // с параметром /str или перестройте свой проект VS. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sources.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Перезаписывает свойство CurrentUICulture текущего потока для всех 51 | /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 65 | /// 66 | public static System.Drawing.Bitmap Check { 67 | get { 68 | object obj = ResourceManager.GetObject("Check", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 75 | /// 76 | public static System.Drawing.Bitmap excel { 77 | get { 78 | object obj = ResourceManager.GetObject("excel", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 85 | /// 86 | public static System.Drawing.Bitmap selectfile { 87 | get { 88 | object obj = ResourceManager.GetObject("selectfile", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 95 | /// 96 | public static System.Drawing.Bitmap showexcel { 97 | get { 98 | object obj = ResourceManager.GetObject("showexcel", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | 103 | /// 104 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 105 | /// 106 | public static System.Drawing.Bitmap sql { 107 | get { 108 | object obj = ResourceManager.GetObject("sql", resourceCulture); 109 | return ((System.Drawing.Bitmap)(obj)); 110 | } 111 | } 112 | 113 | /// 114 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 115 | /// 116 | public static System.Drawing.Bitmap viewdata { 117 | get { 118 | object obj = ResourceManager.GetObject("viewdata", resourceCulture); 119 | return ((System.Drawing.Bitmap)(obj)); 120 | } 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /project/Sources/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\ico\selectfile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\ico\sql.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | 128 | ..\ico\excel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | 131 | ..\ico\viewdata.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 132 | 133 | 134 | ..\ico\Check.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 135 | 136 | 137 | ..\ico\showexcel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 138 | 139 | -------------------------------------------------------------------------------- /project/Sources/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Этот код создан программой. 4 | // Исполняемая версия:4.0.30319.18408 5 | // 6 | // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае 7 | // повторной генерации кода. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Sources.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /project/Sources/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /project/Sources/Source.cs: -------------------------------------------------------------------------------- 1 | // 2 | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 3 | // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 4 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR 5 | // PURPOSE. 6 | // 7 | // License: GNU Lesser General Public License (LGPLv3) 8 | // 9 | // Email: pumpet.net@gmail.com 10 | // Git: https://github.com/Pumpet/comparator 11 | // Copyright (C) Alex Rozanov, 2016 12 | // 13 | 14 | using System; 15 | using System.Collections.Generic; 16 | using System.Xml.Serialization; 17 | using DataTable = System.Data.DataTable; 18 | 19 | namespace Sources 20 | { 21 | // types of data sources 22 | public enum SourceType { Database, Excel, CSV, XML } 23 | //=========================================================================== 24 | /* Data Source for comparison */ 25 | public class Source 26 | { 27 | string name; 28 | public string Name { get { return string.IsNullOrEmpty(name) ? InnerName : name; } set { name = value; } } 29 | [XmlIgnore] 30 | public string InnerName { get; set; } // default source name, for messages 31 | 32 | SourceType srcType; // data source type 33 | public SourceType SrcType 34 | { 35 | get { return srcType; } 36 | set 37 | { 38 | srcType = value; 39 | content = GetContent(value); // set current source content (from already created or new) in depend of its type 40 | content.Parent = this; 41 | } 42 | } 43 | 44 | SourceContent content; // data source content - object that getting data from specific type source 45 | public SourceContent Content 46 | { 47 | get { return content; } 48 | set 49 | { 50 | content = value; 51 | currContent[srcType] = value; 52 | currContent[srcType].Parent = this; 53 | } 54 | } 55 | 56 | DataTable dt; 57 | [XmlIgnore] 58 | public DataTable DT { get { return dt; } set { dt = value; } } // source data 59 | [XmlIgnore] 60 | public bool InProc { get; set; } // true if active get data process 61 | 62 | Dictionary currContent = new Dictionary(); // already created contents 63 | 64 | // get already created typed content: 65 | [XmlIgnore] 66 | public DbContent DbSource { get { return (DbContent)GetContent(SourceType.Database); } } 67 | [XmlIgnore] 68 | public ExcelContent ExcelSource { get { return (ExcelContent)GetContent(SourceType.Excel); } } 69 | [XmlIgnore] 70 | public CsvContent CsvSource { get { return (CsvContent)GetContent(SourceType.CSV); } } 71 | [XmlIgnore] 72 | public XmlContent XmlSource { get { return (XmlContent)GetContent(SourceType.XML); } } 73 | 74 | //------------------------------------------------------------------------- 75 | public Source() 76 | { 77 | SrcType = SourceType.Database; 78 | } 79 | //------------------------------------------------------------------------- 80 | // Get already created or create new content according of type 81 | private SourceContent GetContent(SourceType type) 82 | { 83 | if (!currContent.ContainsKey(type)) 84 | switch (type) 85 | { 86 | case SourceType.Database: 87 | currContent.Add(type, new DbContent()); 88 | break; 89 | case SourceType.Excel: 90 | currContent.Add(type, new ExcelContent()); 91 | break; 92 | case SourceType.CSV: 93 | currContent.Add(type, new CsvContent()); 94 | break; 95 | case SourceType.XML: 96 | currContent.Add(type, new XmlContent()); 97 | break; 98 | } 99 | if (currContent[type] != null) currContent[type].Parent = this; // link content object to this object 100 | return currContent[type]; 101 | } 102 | //------------------------------------------------------------------------- 103 | // Check current content 104 | public void Check() 105 | { 106 | Content.Check(); 107 | } 108 | //------------------------------------------------------------------------- 109 | public void DTClear() 110 | { 111 | if (DT != null) 112 | { 113 | //DT.Dispose(); 114 | DT = null; 115 | GC.Collect(); 116 | } 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /project/Sources/SourceContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Xml.Serialization; 5 | using Common; 6 | 7 | namespace Sources 8 | { 9 | /* Base class for "Content"-classes that getting data from specific type sources */ 10 | [XmlInclude(typeof(DbContent))] 11 | [XmlInclude(typeof(ExcelContent))] 12 | [XmlInclude(typeof(CsvContent))] 13 | [XmlInclude(typeof(XmlContent))] 14 | public abstract class SourceContent 15 | { 16 | protected TaskContext context; // parameters for getting data process 17 | protected Action afterGetData; // action after getting data 18 | [XmlIgnore] 19 | public virtual Source Parent { get; set; } // object that uses data in comparison 20 | [XmlArrayItem("field")] 21 | public List Fields { get; set; } // field names 22 | [XmlIgnore] 23 | public virtual Exception Error { get { return context != null ? context.Error : null; } } // last getting data exception 24 | //------------------------------------------------------------------------- 25 | /* check content */ 26 | public virtual void Check() { } 27 | //------------------------------------------------------------------------- 28 | /* check and get fields */ 29 | public virtual List GetCheckFields() 30 | { 31 | return Fields; 32 | } 33 | //------------------------------------------------------------------------- 34 | /* start getting data process */ 35 | public virtual void GetData(TaskContext c, Action afterGetDataAction) 36 | { 37 | afterGetData = afterGetDataAction; 38 | context = c ?? new TaskContext(); 39 | context.Error = null; 40 | context.Cancel = false; 41 | if (context.OnFinish == null) 42 | context.OnFinish = GetDataEnd; // end of process action 43 | Parent.InProc = true; 44 | Parent.DTClear(); 45 | Parent.DT = null; 46 | } 47 | //------------------------------------------------------------------------- 48 | /* end of getting data process */ 49 | public virtual void GetDataEnd(object result, string msg) 50 | { 51 | bool fail = (context.Cancel || context.Error != null); 52 | 53 | if (!fail && result is DataTable) 54 | { 55 | Parent.DT = ((DataTable)result).Copy(); 56 | Parent.DT.TableName = Parent.Name; 57 | } 58 | 59 | if (context.OnProgress != null) 60 | context.OnProgress(fail ? 0 : int.MaxValue, msg); 61 | 62 | Parent.InProc = false; 63 | if (afterGetData != null) 64 | afterGetData(fail); 65 | } 66 | //------------------------------------------------------------------------- 67 | /* stop getting data process */ 68 | public virtual void GetDataStop() { } 69 | //------------------------------------------------------------------------- 70 | /* error of getting data process */ 71 | public virtual void GetDataError(string msg, Exception ex) 72 | { 73 | context.Error = ex; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /project/Sources/Sources.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {4BF7E9B2-9CE7-44DF-892E-7590D3DB537D} 9 | Library 10 | Properties 11 | Sources 12 | Sources 13 | v4.5.1 14 | 15 | 16 | 512 17 | 18 | 19 | x86 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | false 28 | 29 | 30 | x86 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | false 38 | 39 | 40 | 41 | 42 | 43 | 44 | ..\FastColoredTextBox\FastColoredTextBox.dll 45 | 46 | 47 | True 48 | ..\Office12\Microsoft.Office.Interop.Excel.dll 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Form 66 | 67 | 68 | FormXml.cs 69 | 70 | 71 | 72 | 73 | 74 | UserControl 75 | 76 | 77 | SourcePanel.cs 78 | 79 | 80 | 81 | 82 | FormXml.cs 83 | 84 | 85 | PublicResXFileCodeGenerator 86 | Resources.Designer.cs 87 | Designer 88 | 89 | 90 | True 91 | Resources.resx 92 | True 93 | 94 | 95 | SourcePanel.cs 96 | 97 | 98 | SettingsSingleFileGenerator 99 | Settings.Designer.cs 100 | 101 | 102 | True 103 | Settings.settings 104 | True 105 | 106 | 107 | 108 | 109 | {BE7C1378-3118-4F91-892D-484189F8621A} 110 | Common 111 | 112 | 113 | {32B87CF8-E466-4409-A4B5-30AE33CB2262} 114 | SqlSource 115 | 116 | 117 | 118 | 125 | -------------------------------------------------------------------------------- /project/Sources/XmlContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.IO; 5 | using System.Linq; 6 | using System.Xml; 7 | using System.Xml.Serialization; 8 | using Common; 9 | 10 | namespace Sources 11 | { 12 | public enum XlstProcType { None, Script, File } 13 | //=========================================================================== 14 | public class XmlContent : SourceContent 15 | { 16 | public string NameXml { get; set; } // path to XML-file 17 | public string NameXslt { get; set; } // path to XSL-file 18 | public string Codepage { get; set; } 19 | public string XsltScript { get; set; } // xsl script text 20 | 21 | XlstProcType xsltType = XlstProcType.None; 22 | public XlstProcType XsltType 23 | { 24 | get { return xsltType; } 25 | set { xsltType = value; } 26 | } 27 | [XmlIgnore] 28 | public bool XsltNone // do not use xslt 29 | { 30 | get { return XsltType == XlstProcType.None; } 31 | set { if (value) XsltType = XlstProcType.None; } 32 | } 33 | [XmlIgnore] 34 | public bool XsltFromScript // xslt is described in XsltScript 35 | { 36 | get { return XsltType == XlstProcType.Script; } 37 | set { if (value) XsltType = XlstProcType.Script; } 38 | } 39 | [XmlIgnore] 40 | public bool XsltFromFile // xslt is described in xsl-file (NameXslt) 41 | { 42 | get { return XsltType == XlstProcType.File; } 43 | set { if (value) XsltType = XlstProcType.File; } 44 | } 45 | 46 | public string PathRow { get; set; } // XPath for tags which will be used as basis for table data row 47 | public bool DataFromTag { get; set; } // fields will be defined by child tags of tags selected according PathRow 48 | public bool DataFromAttr { get; set; } // fields will be defined by attributes of tags selected according PathRow 49 | public bool UseFieldsMap { get; set; } // fields will be defined by paths from fieldMaps 50 | 51 | // list of (field name : path based on the tag defined in PathRow : default value) 52 | List fieldsMap = new List(); 53 | public List FieldsMap 54 | { 55 | get { return fieldsMap; } 56 | set { fieldsMap = value; } 57 | } 58 | 59 | [XmlIgnore] 60 | public string Info // short info for View (SourcePanel) 61 | { 62 | get 63 | { 64 | string nl = Environment.NewLine; 65 | string info = string.Format(@"XML: {0}XSLT: {1}ROW: {2}FIELDS: {3}", 66 | NameXml + nl, 67 | (XsltType == XlstProcType.None ? "not used" : XsltType == XlstProcType.Script ? "script" : NameXslt) + nl, 68 | PathRow + nl, 69 | UseFieldsMap ? "map options" : DataFromTag && DataFromAttr ? "row tags/attributes" : DataFromTag ? "row tags" : "row attributes"); 70 | return info; 71 | } 72 | } 73 | 74 | //------------------------------------------------------------------------- 75 | public XmlContent() 76 | { 77 | Fields = new List(); 78 | DataFromTag = true; 79 | DataFromAttr = true; 80 | } 81 | //------------------------------------------------------------------------- 82 | public override void Check() 83 | { 84 | if (string.IsNullOrEmpty(NameXml) || !File.Exists(CommonProc.GetFilePath(NameXml))) 85 | throw new Exception(Parent.Name + ": XML file not exist"); 86 | if (XsltType == XlstProcType.File && (string.IsNullOrEmpty(NameXslt) || !File.Exists(CommonProc.GetFilePath(NameXslt)))) 87 | throw new Exception(Parent.Name + ": XSLT file not exist"); 88 | } 89 | //------------------------------------------------------------------------- 90 | public override List GetCheckFields() 91 | { 92 | Check(); 93 | LoadXmlData(true); 94 | return Fields; 95 | } 96 | //------------------------------------------------------------------------- 97 | public override void GetData(TaskContext c, Action a) 98 | { 99 | base.GetData(c, a); 100 | Check(); 101 | if (c != null && c.OnProgress != null) 102 | c.OnProgress(0, "open and transform \"" + Path.GetFileName(NameXml) + "\" ..."); 103 | LoadXmlData(); 104 | GetDataEnd(null, string.Format("{0} rows", Parent.DT.Rows.Count)); 105 | } 106 | //------------------------------------------------------------------------- 107 | /* Transform and convert xml to table, get data to Parent.DT, field names to Fields */ 108 | void LoadXmlData(bool fieldsOnly = false) 109 | { 110 | Fields = new List(); 111 | DataTable dt; 112 | try 113 | { 114 | XmlDocument xml = XmlController.GetXml(CommonProc.GetFilePath(NameXml), Codepage); 115 | if (!XsltNone) 116 | xml = XmlController.Transform(xml, XsltFromFile ? CommonProc.GetFilePath(NameXslt) : XsltScript, XsltFromFile); 117 | 118 | if (UseFieldsMap) 119 | dt = XmlController.GetData(xml, PathRow, FieldsMap, fieldsOnly); // getting data based on FieldMap 120 | else 121 | dt = XmlController.GetData(xml, PathRow, DataFromTag, DataFromAttr, fieldsOnly); // getting data from tags/attributes 122 | 123 | Fields = dt.Columns.OfType().Select(x => x.ColumnName).ToList(); 124 | 125 | if (!fieldsOnly) 126 | { 127 | Parent.DT = dt.Copy(); 128 | Parent.DT.TableName = Parent.Name; 129 | } 130 | } 131 | catch (Exception ex) 132 | { 133 | throw new Exception(Parent.Name + ": " + ex.Message, ex); 134 | } 135 | } 136 | } 137 | //=========================================================================== 138 | /* Describes field, path to it and default value */ 139 | public class FieldMap 140 | { 141 | public string FieldName { get; set; } // field name for xml data 142 | public string Path { get; set; } // XPath relative to tag which will be used as basis for the table data row 143 | public string Default { get; set; } // default value - if path not found or no data 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /project/Sources/ico.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/project/Sources/ico.rar -------------------------------------------------------------------------------- /project/SqlSource/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // Управление общими сведениями о сборке осуществляется с помощью 5 | // набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, 6 | // связанные со сборкой. 7 | [assembly: AssemblyTitle("SqlSource")] 8 | [assembly: AssemblyDescription("Library for connect and query to sql source")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Pumpet")] 11 | [assembly: AssemblyProduct("SqlSource")] 12 | [assembly: AssemblyCopyright("GNU Lesser General Public License (LGPLv3)")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Параметр ComVisible со значением FALSE делает типы в сборке невидимыми 17 | // для COM-компонентов. Если требуется обратиться к типу в этой сборке через 18 | // COM, задайте атрибуту ComVisible значение TRUE для этого типа. 19 | [assembly: ComVisible(false)] 20 | 21 | // Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM 22 | [assembly: Guid("ad3d022f-9902-4928-afa1-47a73168f6e9")] 23 | 24 | // Сведения о версии сборки состоят из следующих четырех значений: 25 | // 26 | // Основной номер версии 27 | // Дополнительный номер версии 28 | // Номер построения 29 | // Редакция 30 | // 31 | // Можно задать все значения или принять номер построения и номер редакции по умолчанию, 32 | // используя "*", как показано ниже: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("2.0.0.0")] 35 | [assembly: AssemblyFileVersion("2.0.0.0")] 36 | -------------------------------------------------------------------------------- /project/SqlSource/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Этот код создан программой. 4 | // Исполняемая версия:4.0.30319.18408 5 | // 6 | // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае 7 | // повторной генерации кода. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace SqlSource.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. 17 | /// 18 | // Этот класс создан автоматически классом StronglyTypedResourceBuilder 19 | // с помощью такого средства, как ResGen или Visual Studio. 20 | // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen 21 | // с параметром /str или перестройте свой проект VS. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SqlSource.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Перезаписывает свойство CurrentUICulture текущего потока для всех 51 | /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 65 | /// 66 | internal static System.Drawing.Bitmap Check { 67 | get { 68 | object obj = ResourceManager.GetObject("Check", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 75 | /// 76 | internal static System.Drawing.Bitmap Collapse { 77 | get { 78 | object obj = ResourceManager.GetObject("Collapse", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 85 | /// 86 | internal static System.Drawing.Bitmap Excel { 87 | get { 88 | object obj = ResourceManager.GetObject("Excel", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 95 | /// 96 | internal static System.Drawing.Bitmap Expand { 97 | get { 98 | object obj = ResourceManager.GetObject("Expand", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | 103 | /// 104 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 105 | /// 106 | internal static System.Drawing.Bitmap Fields { 107 | get { 108 | object obj = ResourceManager.GetObject("Fields", resourceCulture); 109 | return ((System.Drawing.Bitmap)(obj)); 110 | } 111 | } 112 | 113 | /// 114 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 115 | /// 116 | internal static System.Drawing.Bitmap Go { 117 | get { 118 | object obj = ResourceManager.GetObject("Go", resourceCulture); 119 | return ((System.Drawing.Bitmap)(obj)); 120 | } 121 | } 122 | 123 | /// 124 | /// Поиск локализованного ресурса типа System.Drawing.Bitmap. 125 | /// 126 | internal static System.Drawing.Bitmap Stop { 127 | get { 128 | object obj = ResourceManager.GetObject("Stop", resourceCulture); 129 | return ((System.Drawing.Bitmap)(obj)); 130 | } 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /project/SqlSource/SqlSource.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {32B87CF8-E466-4409-A4B5-30AE33CB2262} 9 | Library 10 | Properties 11 | SqlSource 12 | SqlSource 13 | v4.5.1 14 | 512 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | true 39 | bin\x86\Debug\ 40 | DEBUG;TRACE 41 | full 42 | x86 43 | prompt 44 | true 45 | true 46 | false 47 | 48 | 49 | bin\x86\Release\ 50 | TRACE 51 | true 52 | pdbonly 53 | x86 54 | prompt 55 | true 56 | true 57 | false 58 | 59 | 60 | 61 | False 62 | ..\FastColoredTextBox\FastColoredTextBox.dll 63 | 64 | 65 | True 66 | ..\Office12\Microsoft.Office.Interop.Excel.dll 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | True 80 | True 81 | Resources.resx 82 | 83 | 84 | Form 85 | 86 | 87 | SqlView.cs 88 | 89 | 90 | 91 | 92 | 93 | 94 | ResXFileCodeGenerator 95 | Resources.Designer.cs 96 | 97 | 98 | SqlView.cs 99 | Designer 100 | 101 | 102 | 103 | 104 | {BE7C1378-3118-4F91-892D-484189F8621A} 105 | Common 106 | 107 | 108 | 109 | 116 | -------------------------------------------------------------------------------- /project/SqlSource/ico.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/project/SqlSource/ico.rar -------------------------------------------------------------------------------- /project/readme.txt: -------------------------------------------------------------------------------- 1 | Extract ico.rar files in subfolders -------------------------------------------------------------------------------- /release/Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/Common.dll -------------------------------------------------------------------------------- /release/Comparator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/Comparator.exe -------------------------------------------------------------------------------- /release/Comparator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | styles.css 10 | 11 | 12 | 13 | 14 | false 15 | 16 | 17 | 18 | 19 | Comparator 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /release/DSComparer.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/DSComparer.dll -------------------------------------------------------------------------------- /release/FastColoredTextBox.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/FastColoredTextBox.dll -------------------------------------------------------------------------------- /release/Sources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/Sources.dll -------------------------------------------------------------------------------- /release/SqlSource.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/SqlSource.dll -------------------------------------------------------------------------------- /release/data/NORTHWND.MDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/data/NORTHWND.MDF -------------------------------------------------------------------------------- /release/data/NORTHWND_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/data/NORTHWND_log.ldf -------------------------------------------------------------------------------- /release/data/OrdersShip.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/data/OrdersShip.xlsx -------------------------------------------------------------------------------- /release/data/OrdersShip.xslt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /release/profiles/OrdersShip_db2db.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | true 5 | true 6 | false 7 | false 8 | false 9 | false 10 | false 11 | false 12 | false 13 | Excel 14 | false 15 | Attachment 16 | 17 | Orders Ship 1 18 | Database 19 | 20 | 21 | OrderID 22 | CustomerID 23 | OrderDate 24 | Freight 25 | ShipRegion 26 | ShipCountry 27 | 28 | OleDB 29 | .\SQLEXPRESS 30 | Northwind 31 | 32 | 15 33 | declare @Date smalldatetime 34 | select @Date = '19970101' 35 | select 36 | OrderID 37 | , CustomerID 38 | , OrderDate 39 | , Freight 40 | , ShipRegion 41 | , ShipCountry 42 | from Orders 43 | where OrderDate >= @Date 44 | order by OrderDate 45 | 46 | H3iP5thsMXVJaX+/DAf6Qw== 47 | U9C7e1yDqOxIH/sLiq+hdQFdqFSgQInxSFn4Tv2xD3ucXwNGO+q4yU0H/CYGj6DXN6ctLaZL+QhgFubh99TxRsaQRmhpnG1dptxPKbeG6Ti59yqTawVX65HsHt67ljrlCri5at7GBV2nD1XlkyybcwEmRM4Fw0n++7qAiy+6Z5s= 48 | 49 | 50 | 51 | Orders Ship 2 52 | Database 53 | 54 | 55 | OrderID 56 | CustomerID 57 | OrderDate 58 | Freight 59 | Region 60 | ShipCountry 61 | ShipCity 62 | 63 | OleDB 64 | 15 65 | select 66 | OrderID 67 | , CustomerID 68 | , OrderDate 69 | , Freight 70 | , isnull(ShipRegion,'no') as Region 71 | , ShipCountry 72 | , ShipCity 73 | from Orders 74 | where OrderDate < '19980101' 75 | order by OrderDate 76 | 77 | H3iP5thsMXVJaX+/DAf6Qw== 78 | U9C7e1yDqOxIH/sLiq+hdQFdqFSgQInxSFn4Tv2xD3ucXwNGO+q4yU0H/CYGj6DXN6ctLaZL+QhgFubh99TxRsaQRmhpnG1dptxPKbeG6Ti59yqTawVX65HsHt67ljrlCri5at7GBV2nD1XlkyybcwEmRM4Fw0n++7qAiy+6Z5s= 79 | 80 | 81 | 82 | 83 | true 84 | true 85 | OrderID 86 | OrderID 87 | 88 | 89 | false 90 | true 91 | CustomerID 92 | CustomerID 93 | 94 | 95 | false 96 | true 97 | OrderDate 98 | OrderDate 99 | 100 | 101 | false 102 | true 103 | Freight 104 | Freight 105 | 106 | 107 | false 108 | true 109 | ShipRegion 110 | Region 111 | 112 | 113 | false 114 | false 115 | 116 | ShipCity 117 | 118 | 119 | false 120 | false 121 | ShipCountry 122 | ShipCountry 123 | 124 | 125 | -------------------------------------------------------------------------------- /release/profiles/OrdersShip_db2xls.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Pumpet/comparator/0bc2cc884fcbc7fe0c9b084e423ae9a7c020b448/release/profiles/OrdersShip_db2xls.xml -------------------------------------------------------------------------------- /release/readme.txt: -------------------------------------------------------------------------------- 1 | For execute sample from profiles OrdersShip_db2db.xml or OrdersShip_db2xls.xml: 2 | 3 | 1) start server - for example: SqlLocalDB.exe start "v11.0" 4 | 5 | 2) set path to DB in connection string OleDb, for example: 6 | Provider=SQLNCLI11.1;Server=(localdb)\v11.0;Integrated Security=SSPI;AttachDbFileName=C:\Comparator\data\Northwnd.mdf 7 | 8 | Enjoy! 9 | 10 | -------------------------------------------------------------------------------- /release/styles.css: -------------------------------------------------------------------------------- 1 | * { 2 | mso-displayed-decimal-separator:"\."; 3 | mso-displayed-thousand-separator:" "; 4 | font-size: 10pt; 5 | font-family: Calibri; 6 | } 7 | .dat { 8 | border-collapse: collapse; 9 | border: 0; 10 | font-size: 10pt; 11 | font-weight: 400; 12 | font-family: Calibri; 13 | } 14 | tr td { 15 | border: .5pt solid silver; 16 | padding: 5; 17 | } 18 | tr td.e { /* different data */ 19 | border: .5pt solid silver; 20 | color: DarkRed; 21 | } 22 | tr td.k { /* keys */ 23 | border: .5pt solid silver; 24 | color: DarkBlue; 25 | } 26 | tr td.m { /* matched data */ 27 | border: .5pt solid silver; 28 | color: DarkGreen; 29 | } 30 | tr td.h { /* main headers */ 31 | border: 0; 32 | font-size: 13pt; 33 | font-weight: 700; 34 | font-family: Calibri; 35 | } 36 | tr td.l { /* headers */ 37 | border: 0; 38 | font-size: 11pt; 39 | font-weight: 400; 40 | font-family: Calibri; 41 | } 42 | tr.h1 td { /* column names for source A */ 43 | border: .5pt solid silver; 44 | background: #F5F5F5; 45 | } 46 | tr.h2 td { /* column names for source B */ 47 | border-bottom: 3pt double silver; 48 | background: #DCDCDC; 49 | } 50 | tr.r td { /* row from source B */ 51 | background: #CCFFFF; 52 | border-bottom: 3pt double silver; 53 | padding: 5; 54 | } 55 | a { /* link in headers */ 56 | font-size: 11pt; 57 | font-weight: 400; 58 | } 59 | --------------------------------------------------------------------------------