/// <summary> /// Initializes a new instance of the <see cref="Trilogic.CompareWindow"/> class. /// </summary> /// <param name="parent">The parent window.</param> /// <param name="compareName">Compare name.</param> /// <param name="fileSide">File side.</param> /// <param name="databaseSide">Database side.</param> public CompareWindow(MainWindow parent, string compareName, SchemaData fileSide, SchemaData databaseSide) : base(Gtk.WindowType.Toplevel) { this.Build(); this.parent = parent; this.docLocal = new TextDocument(); this.docDB = new TextDocument(); this.editorLocal = new TextEditor(this.docLocal); this.editorDB = new TextEditor(this.docDB); Gtk.ScrolledWindow scrollLocal = new Gtk.ScrolledWindow(); Gtk.ScrolledWindow scrollDB = new Gtk.ScrolledWindow(); scrollLocal.Add(this.editorLocal); scrollDB.Add(this.editorDB); this.hbox1.Add(scrollDB); this.hbox1.Add(scrollLocal); Gtk.Box.BoxChild childLocal = (Gtk.Box.BoxChild)this.hbox1[scrollLocal]; childLocal.Position = 2; Gtk.Box.BoxChild childDB = (Gtk.Box.BoxChild)this.hbox1[scrollDB]; childDB.Position = 0; this.ShowAll(); this.Title += " - " + compareName; this.fileSide = fileSide; this.databaseSide = databaseSide; this.ShowSchema(); }
/// <summary> /// Determines whether this instance is modified. /// </summary> /// <returns><c>true</c> if this instance is modified; otherwise, <c>false</c>.</returns> /// <param name="schema">The schema.</param> public bool IsModified(SchemaData schema) { return this.IsModified(schema.Name, schema.Hash); }
/// <summary> /// Whether the collection contains the name. /// </summary> /// <returns><c>true</c>, if name was contained, <c>false</c> otherwise.</returns> /// <param name="schema">The schema.</param> public bool ContainsName(SchemaData schema) { return this.ContainsName(schema.Name); }
/// <summary> /// Add the specified schema. /// </summary> /// <param name="schema">The schema.</param> public void Add(SchemaData schema) { this.dataList.Add(schema.Name, schema); this.stringList.Add(schema.Name); }
/// <summary> /// Gets the file. /// </summary> /// <param name="schema">The schema.</param> /// <returns>Text string</returns> private string GetFile(SchemaData schema) { string str = System.IO.File.ReadAllText(schema.FilePath); return str; }
/// <summary> /// Gets the DB schema. /// </summary> /// <param name="schema">The schema.</param> /// <returns>Text string</returns> private string GetDBSchema(SchemaData schema) { string str = string.Empty; if (schema.Type == SchemaDataType.StoredProcedure) { str = this.parent.Sql.GetStoredProcedureDefinition(schema.ObjectID); } else if (schema.Type == SchemaDataType.Table) { str = this.parent.Sql.GetTableSchema(schema.ObjectID); } return str; }
/// <summary> /// Reads the log. /// </summary> /// <returns>The log.</returns> /// <param name="path">The path.</param> public SchemaCollection ReadLog(string path) { SchemaCollection collection = new SchemaCollection(); foreach (string line in System.IO.File.ReadAllLines(path + "/" + this.baseFileName + "_" + this.databaseName.ToString())) { string[] split = line.Split(';'); SchemaData schema = new SchemaData(); schema.Name = split[1]; schema.Type = (SchemaDataType)Enum.Parse(typeof(SchemaDataType), split[0]); schema.ModifyDate = DateTime.Parse(split[2]); collection.Add(schema); } return collection; }