コード例 #1
0
 public static void SetBefore(DependencyObject obj, SideBySideDiffModel value)
 {
     obj.SetValue(BeforeProperty, value);
 }
コード例 #2
0
 /// <summary>
 /// 差分前後の文字を比較表示
 /// </summary>
 public static string ToDisplayString(this SideBySideDiffModel ssDiff) => $"{ssDiff.OldText.ToRawText()}->{ssDiff.NewText.ToRawText()}";
コード例 #3
0
 public static void SetVorher(DependencyObject obj, SideBySideDiffModel value)
 {
     obj.SetValue(VorherProperty, value);
 }
コード例 #4
0
 public SideBySideDiffModel GetMergedText(SideBySideDiffModel model)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
 public FileDifferences(string fileName, SideBySideDiffModel differences)
 {
     FileName    = fileName;
     Differences = differences;
 }
コード例 #6
0
ファイル: ProjectTracker.cs プロジェクト: ace-n/code-chord
        // Handle fileSystemWatcher update
        private static void fsw_Changed(object sender, FileSystemEventArgs e)
        {
            // Make sure file/directory still exists - otherwise, remove it from the list of tracked files
            if (!File.Exists(e.FullPath))
            {
                string dumpPath = getDumpPath(e.FullPath);

                if (trackedLocations.ContainsKey(e.FullPath))
                {
                    trackedLocations.Remove(e.FullPath);
                }
                else if (trackedLocations.ContainsKey(dumpPath))
                {
                    trackedLocations.Remove(dumpPath);
                }

                // Skip this file since it no longer exists
                return;
            }

            // --- Get changes ---
            // Get old/new filepaths
            string oldText = File.ReadAllText(getDumpPath(e.FullPath));
            string newText = File.ReadAllText(e.FullPath);

            // Get diff
            object     model     = new SideBySideDiffModel();
            DiffResult lineDiffs = differ.CreateLineDiffs(oldText, newText, true, true);

            // If nothing actually changed, move along
            if (lineDiffs.DiffBlocks.Count == 0)
            {
                return;
            }

            // Calculate LOC change
            int locChanged = 0;

            for (int i = 0; i < lineDiffs.DiffBlocks.Count; i++)
            {
                locChanged += lineDiffs.PiecesOld[i].ToCharArray().Count(x => @"\n".Contains(x));
            }

            // Calculate code quality metrics (on the entire file)
            int avgCodeQualityChange = 0;

            avgCodeQualityChange += getCodeQuality(newText) - getCodeQuality(oldText);
            avgCodeQualityChange /= lineDiffs.DiffBlocks.Count;

            // --- Log changes ---
            File.AppendAllLines(changeLogDump, new string[] {
                "---",
                "File changed: " + e.FullPath,
                "Timestamp: " + DateTime.Now.ToString(),
                "Code quality change: " + avgCodeQualityChange.ToString(),
                "Lines changed: " + locChanged
            });

            // --- Store changes ---
            File.Copy(e.FullPath, getDumpPath(e.FullPath), true);
        }
コード例 #7
0
 public SideBySideViewModel(SideBySideDiffModel diffModel)
 {
     ViewMode  = ViewMode.SideBySide;
     DiffModel = diffModel;
 }
コード例 #8
0
 public InLineViewModel(SideBySideDiffModel diffModel)
 {
     this.ViewMode  = ViewMode.Inline;
     this.DiffModel = ConvertToInline(diffModel);
 }
コード例 #9
0
ファイル: EjDiffModel.cs プロジェクト: asifraja/Digger
 public EjDiffModel(SideBySideDiffModel sideBySideDiffModel, string thisFilename, string withFilename)
 {
     SideBySideDiffModel = sideBySideDiffModel;
     ThisFilename        = thisFilename;
     WithFilename        = withFilename;
 }
コード例 #10
0
        public async Task BuildAsync(SideBySideDiffModel sideBySideDiffModel, StreamWriter streamWriter, bool includeUnchanged)
        {
            var diffPane = new DiffPane(includeUnchanged);

            await diffPane.BuildAsync(sideBySideDiffModel, streamWriter);
        }
コード例 #11
0
 public static void SetRight(DependencyObject obj, SideBySideDiffModel value)
 {
     obj.SetValue(RightProperty, value);
 }
 public static void SetActualText(DependencyObject obj, SideBySideDiffModel value)
 {
     obj.SetValue(ActualTextProperty, value);
 }