public override BaseMode BuildViewSchemaClone(Database.View.ViewSchema.Builder builder) { var newModeFirst = modeFirst.BuildViewSchemaClone(builder); if (newModeFirst == null) { return(null); } var newModeSecond = modeSecond.BuildViewSchemaClone(builder); if (newModeSecond == null) { return(null); } DiffMode copy = new DiffMode(this); copy.modeFirst = newModeFirst; copy.modeSecond = newModeSecond; copy.m_SchemaFirst = copy.modeFirst.GetSchema(); copy.m_SchemaSecond = copy.modeSecond.GetSchema(); copy.m_SchemaDiff = new Database.Operation.DiffSchema(copy.m_SchemaFirst, copy.m_SchemaSecond); copy.UpdateTableSelectionNames(); return(copy); }
protected DiffMode(DiffMode copy) { m_DataRenderer = copy.m_DataRenderer; m_DataRenderer.PrettyNamesOptionChanged += UpdateTableSelectionNames; modeFirst = copy.modeFirst; modeSecond = copy.modeSecond; m_SchemaFirst = copy.m_SchemaFirst; m_SchemaSecond = copy.m_SchemaSecond; m_SchemaDiff = copy.m_SchemaDiff; }
public void DiffLastAndCurrentSnapshot(bool firstIsOlder) { history.Clear(); diffMode = new DiffMode(FormattingOptions.ObjectDataFormatter, firstIsOlder ? FirstMode : SecondMode, firstIsOlder ? SecondMode : FirstMode); CurrentViewMode = ViewMode.ShowDiff; if (firstIsOlder) { SnapshotAge = FirstSnapshotAge.Older; } }
public bool LoadView(string filename) { if (CurrentViewMode == ViewMode.ShowNone) { DebugUtility.LogWarning("Must open a snapshot before loading a view file"); MemoryProfilerAnalytics.AddMetaDatatoEvent <MemoryProfilerAnalytics.LoadViewXMLEvent>(1); return(false); } if (String.IsNullOrEmpty(filename)) { return(false); } using (ScopeDebugContext.Func(() => { return("File '" + filename + "'"); })) { var builder = Database.View.ViewSchema.Builder.LoadFromXMLFile(filename); if (builder == null) { return(false); } BaseMode newMode = CurrentMode.BuildViewSchemaClone(builder); if (newMode == null) { return(false); } switch (CurrentViewMode) { case ViewMode.ShowFirst: FirstMode = newMode; break; case ViewMode.ShowSecond: SecondMode = newMode; break; case ViewMode.ShowDiff: diffMode = newMode as DiffMode; FirstMode = diffMode.modeFirst; SecondMode = diffMode.modeSecond; break; default: break; } history.Clear(); ModeChanged(CurrentMode, CurrentViewMode); } return(true); }
/// <summary> /// Gets path to the diff executable while taking care of config file settings. /// </summary> /// <param name="context"></param> /// <returns>The exe path.</returns> protected string GetDiffPath(DiffMode mode, String filename) { IAnkhConfigurationService cs = GetService <IAnkhConfigurationService>(); switch (mode) { case DiffMode.PreferInternal: return(null); default: return(cs.Instance.GetDiffExePath(filename)); } }
public void ClearAllOpenModes() { if (SecondMode != null) { SecondMode.Clear(); } SecondMode = null; if (FirstMode != null) { FirstMode.Clear(); } FirstMode = null; CurrentViewMode = ViewMode.ShowNone; diffMode = null; history.Clear(); }
/// <summary> /// 取得刊登開始與結束時間差異天數或月數 /// </summary> /// <param name="mode">1: 取得天數 2:取得月數</param> /// <returns></returns> private double GetIssueTimeDiff(DiffMode mode) { if (IssueStart.HasValue && IssueEnd.HasValue) { var ts = new TimeSpan(Convert.ToDateTime(IssueEnd).Ticks - Convert.ToDateTime(IssueStart).Ticks); if (mode == DiffMode.Days) { return(Math.Round(ts.TotalDays, 2)); } else if (mode == DiffMode.Month) { return(Math.Round(ts.TotalDays / 30, 1)); } } return(0); }
public void SetDiffMode(DiffMode mode) { switch (mode) { case DiffMode.Left: RenderManager.Rebuild(Diff.Left, AddressSpaceControl.Width); AddressSpaceControl.SnapshotOverride = Diff.Left; break; case DiffMode.Middle: RenderManager.Rebuild(Diff.Difference, AddressSpaceControl.Width); AddressSpaceControl.SnapshotOverride = Diff.Difference; break; case DiffMode.Right: RenderManager.Rebuild(Diff.Right, AddressSpaceControl.Width); AddressSpaceControl.SnapshotOverride = Diff.Right; break; } }
public void ClearDiffMode() { diffMode = null; if (CurrentViewMode == ViewMode.ShowDiff) { if (FirstMode != null) { CurrentViewMode = ViewMode.ShowFirst; } else if (SecondMode != null) { CurrentViewMode = ViewMode.ShowSecond; } else { CurrentViewMode = ViewMode.ShowNone; } } }
public void DiffLastAndCurrentSnapshot(bool firstIsOlder) { history.Clear(); diffMode = new DiffMode(DataRenderer, firstIsOlder ? FirstMode : SecondMode, firstIsOlder ? SecondMode : FirstMode); CurrentViewMode = ViewMode.ShowDiff; }
private string[] ConvertHtmlToListOfWords(string[] characterString) { DiffMode mode = DiffMode.character; string current_word = String.Empty; List <string> words = new List <string>(); foreach (var character in characterString) { switch (mode) { case DiffMode.character: if (this.IsStartOfTag(character)) { if (current_word != String.Empty) { words.Add(current_word); } current_word = "<"; mode = DiffMode.tag; } else if (Regex.IsMatch(character, "\\s")) { if (current_word != String.Empty) { words.Add(current_word); } current_word = character; mode = DiffMode.whitespace; } else { current_word += character; } break; case DiffMode.tag: if (this.IsEndOfTag(character)) { current_word += ">"; words.Add(current_word); current_word = ""; if (IsWhiteSpace(character)) { mode = DiffMode.whitespace; } else { mode = DiffMode.character; } } else { current_word += character; } break; case DiffMode.whitespace: if (this.IsStartOfTag(character)) { if (current_word != String.Empty) { words.Add(current_word); } current_word = "<"; mode = DiffMode.tag; } else if (Regex.IsMatch(character, "\\s")) { current_word += character; } else { if (current_word != String.Empty) { words.Add(current_word); } current_word = character; mode = DiffMode.character; } break; default: break; } } if (current_word != string.Empty) { words.Add(current_word); } return(words.ToArray()); }
public GitDiffArguments(DiffMode mode, CommonArguments commonArgs, object specialArgs) { Mode = mode; CommonArgs = commonArgs; SpecialArgs = specialArgs; }
public static int GetSimilarityValue(string fileA, string fileB, bool forward, DiffMode mode) { int retVal = 0; string[] strArrayA; string[] strArrayB; int diagLength = 0; var snakes = new List <Snake>(); var vstates = new List <VState>(); if (mode == DiffMode.SlowByChar) { string strA = System.IO.File.ReadAllText(fileA); string strB = System.IO.File.ReadAllText(fileB); strA = strA.RemoveWhitespace(); strB = strB.RemoveWhitespace(); strArrayA = strA.ToCharArray().Select(c => c.ToString()).ToArray(); strArrayB = strB.ToCharArray().Select(c => c.ToString()).ToArray(); } else { strArrayA = System.IO.File.ReadAllLines(fileA); strArrayB = System.IO.File.ReadAllLines(fileB); } var VState = new VState(strArrayA.Length, strArrayB.Length); diagLength = CompareStr(snakes, vstates, strArrayA, strArrayA.Length, strArrayB, strArrayB.Length, VState, forward); retVal = ComputeSimilarityPercentage2(strArrayA.Length, strArrayB.Length, diagLength); // return new Results(V.Memory, snakes, forward, vs); return(retVal); }
private string[] ConvertHtmlToListOfWords(string[] characterString) { DiffMode character = DiffMode.character; string item = string.Empty; List <string> list = new List <string>(); foreach (string str2 in characterString) { switch (character) { case DiffMode.character: { if (!IsStartOfTag(str2)) { break; } if (item != string.Empty) { list.Add(item); } item = "<"; character = DiffMode.tag; continue; } case DiffMode.tag: { if (!IsEndOfTag(str2)) { goto Label_00CE; } item = item + ">"; list.Add(item); item = ""; if (!IsWhiteSpace(str2)) { goto Label_00CA; } character = DiffMode.whitespace; continue; } case DiffMode.whitespace: { if (!IsStartOfTag(str2)) { goto Label_00FF; } if (item != string.Empty) { list.Add(item); } item = "<"; character = DiffMode.tag; continue; } default: { continue; } } if (Regex.IsMatch(str2, @"\s")) { if (item != string.Empty) { list.Add(item); } item = str2; character = DiffMode.whitespace; } else { item = item + str2; } continue; Label_00CA: character = DiffMode.character; continue; Label_00CE: item = item + str2; continue; Label_00FF: if (Regex.IsMatch(str2, @"\s")) { item = item + str2; } else { if (item != string.Empty) { list.Add(item); } item = str2; character = DiffMode.character; } } if (item != string.Empty) { list.Add(item); } return(list.ToArray()); }
protected string GetPatchPath(DiffMode mode) { IVisualGitConfigurationService cs = GetService<IVisualGitConfigurationService>(); switch (mode) { case DiffMode.PreferInternal: return null; default: return cs.Instance.PatchExePath; } }
/// <summary> /// Gets path to the diff executable while taking care of config file settings. /// </summary> /// <param name="context"></param> /// <returns>The exe path.</returns> protected string GetMergePath(DiffMode mode) { IAnkhConfigurationService cs = GetService<IAnkhConfigurationService>(); switch (mode) { case DiffMode.PreferInternal: return null; default: return cs.Instance.MergeExePath; } }