当前位置: 首页>>代码示例>>C#>>正文


C# Area.GetAlterations方法代码示例

本文整理汇总了C#中Area.GetAlterations方法的典型用法代码示例。如果您正苦于以下问题:C# Area.GetAlterations方法的具体用法?C# Area.GetAlterations怎么用?C# Area.GetAlterations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Area的用法示例。


在下文中一共展示了Area.GetAlterations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunInternal


//.........这里部分代码省略.........
                                        {
                                            var diffResult = Utilities.DiffTool.Diff(tmp, x.Name + "-base", Workspace.GetLocalCanonicalName(x.VersionControlRecord), x.Name, ws.Directives.ExternalDiff, nonblocking);
                                            if (diffResult != null)
                                            {
                                                lock (diffProcesses)
                                                {
                                                    diffProcesses.Add(diffResult);
                                                }
                                            }
                                        });
                                        if (nonblocking)
                                            tasks.Add(t);
                                        else
                                            t.Wait();
                                    }
                                    else
                                    {
                                        try
                                        {
                                            RunInternalDiff(tmp, System.IO.Path.Combine(Workspace.RootDirectory.FullName, Workspace.GetLocalCanonicalName(x.VersionControlRecord)));
                                        }
                                        finally
                                        {
                                            System.IO.File.Delete(tmp);
                                        }
                                    }
                                }
                            }
                            else
                                Printer.PrintMessage("File: #b#{0}## is not in other version.", x.CanonicalName);
                        }
                    }
                    else
                    {
                        List<KeyValuePair<string, Objects.Record>> updates = ws.GetAlterations(version)
                            .Where(x => x.Type == Objects.AlterationType.Update)
                            .Select(x => ws.GetRecord(x.NewRecord.Value))
                            .Select(x => new KeyValuePair<string, Objects.Record>(x.CanonicalName, x)).ToList();
                        foreach (var pair in Filter(updates))
                        {
                            Objects.Record rec = pair.Value;
                            string tmpVersion = Utilities.DiffTool.GetTempFilename();
                            if (!Workspace.ExportRecord(rec.CanonicalName, version, tmpVersion))
                                continue;

                            string tmpParent = Utilities.DiffTool.GetTempFilename();
                            if (!Workspace.ExportRecord(rec.CanonicalName, parent, tmpParent))
                            {
                                System.IO.File.Delete(tmpVersion);
                                continue;
                            }

                            Printer.PrintMessage("Displaying changes for file: #b#{0}", rec.CanonicalName);
                            if (localOptions.External)
                            {
                                tempFiles.Add(tmpVersion);
                                tempFiles.Add(tmpParent);
                                bool nonblocking = Workspace.Directives.NonBlockingDiff.HasValue && Workspace.Directives.NonBlockingDiff.Value;
                                var t = Utilities.LimitedTaskDispatcher.Factory.StartNew(() =>
                                {
                                    var diffResult = Utilities.DiffTool.Diff(tmpParent, rec.Name + "-" + parent.ShortName, tmpVersion, rec.Name + "-" + version.ShortName, ws.Directives.ExternalDiff, nonblocking);
                                    if (diffResult != null)
                                    {
                                        lock (diffProcesses)
                                        {
                                            diffProcesses.Add(diffResult);
                                        }
                                    }
                                });
                                if (nonblocking)
                                    tasks.Add(t);
                                else
                                    t.Wait();
                            }
                            else
                            {
                                try
                                {
                                    RunInternalDiff(tmpParent, tmpVersion);
                                }
                                finally
                                {
                                    System.IO.File.Delete(tmpVersion);
                                    System.IO.File.Delete(tmpParent);
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                Task.WaitAll(tasks.ToArray());
                foreach (var x in diffProcesses)
                    x.WaitForExit();
                foreach (var x in tempFiles)
                    System.IO.File.Delete(x);
            }
            return true;
        }
开发者ID:eatplayhate,项目名称:versionr,代码行数:101,代码来源:Diff.cs


注:本文中的Area.GetAlterations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。