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


C# Area.GetRecord方法代码示例

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


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

示例1: AlterationVM

        public AlterationVM(Alteration alteration, Area area, Version version)
        {
            _alteration = alteration;
            _area = area;
            _version = version;

            if (_alteration.PriorRecord.HasValue)
                _priorRecord = _area.GetRecord(_alteration.PriorRecord.Value);
            if (_alteration.NewRecord.HasValue)
                _newRecord = _area.GetRecord(_alteration.NewRecord.Value);

            DiffWithPreviousCommand = new DelegateCommand(DiffWithPrevious, CanDiffWithPrevious);
            DiffWithCurrentCommand = new DelegateCommand(DiffWithCurrent, CanDiffWithCurrent);
            LogCommand = new DelegateCommand(Log);
            SaveVersionAsCommand = new DelegateCommand(SaveVersionAs, CanSaveVersionAs);
        }
开发者ID:eatplayhate,项目名称:versionr,代码行数:16,代码来源:AlterationVM.cs

示例2: RunInternal

        protected override bool RunInternal(Area ws, Versionr.Status status, IList<Versionr.Status.StatusEntry> targets, FileBaseCommandVerbOptions options)
		{
            DiffVerbOptions localOptions = options as DiffVerbOptions;

			Objects.Version version = null;
			Objects.Version parent = null;
			if (!string.IsNullOrEmpty(localOptions.Version))
			{
				version = Workspace.GetPartialVersion(localOptions.Version);
				if (version == null)
				{
					Printer.PrintError("No version found matching {0}", localOptions.Version);
					return false;
				}
				if (version.Parent.HasValue)
					parent = Workspace.GetVersion(version.Parent.Value);

				if (parent == null)
				{
					Printer.PrintMessage("Version {0} has no parent", version.ID);
					return true;
				}
                Printer.PrintMessage("Showing changes for version #c#{0}", version.ID);
			}

            bool showUnchangedObjects = localOptions.Objects.Count != 0;

			List<Task> tasks = new List<Task>();
            List<string> tempFiles = new List<string>();
            List<System.Diagnostics.Process> diffProcesses = new List<System.Diagnostics.Process>();
            try
            {
                if (version == null)
                {
                    foreach (var x in targets)
                    {
                        if (x.VersionControlRecord != null && !x.IsDirectory && x.FilesystemEntry != null && x.Code == StatusCode.Modified)
                        {
                            if (Utilities.FileClassifier.Classify(x.FilesystemEntry.Info) == Utilities.FileEncoding.Binary)
                            {
                                Printer.PrintMessage("File: #b#{0}## is binary #w#different##.", x.CanonicalName);
                                continue;
                            }
                            // Displaying local modifications
                            string tmp = Utilities.DiffTool.GetTempFilename();
                            if (Workspace.ExportRecord(x.CanonicalName, Workspace.Version, tmp))
                            {
                                Printer.PrintMessage("Displaying changes for file: #b#{0}", x.CanonicalName);
                                if (localOptions.External)
                                {
                                    tempFiles.Add(tmp);
                                    bool nonblocking = Workspace.Directives.NonBlockingDiff.HasValue && Workspace.Directives.NonBlockingDiff.Value;
                                    var t = Utilities.LimitedTaskDispatcher.Factory.StartNew(() =>
                                    {
                                        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 if (x.Code == StatusCode.Unchanged && showUnchangedObjects && !x.IsDirectory)
                        {
                            var filter = Filter(new KeyValuePair<string, Objects.Record>[] { new KeyValuePair<string, Objects.Record>(x.CanonicalName, x.VersionControlRecord) }).FirstOrDefault();
                            if (filter.Value != null && filter.Key == true) // check if the file was really specified
                                Printer.PrintMessage("Object: #b#{0}## is #s#unchanged##.", x.CanonicalName);
                        }
                        else if (x.VersionControlRecord == null && showUnchangedObjects)
                        {
                            var filter = Filter(new KeyValuePair<string, bool>[] { new KeyValuePair<string, bool>(x.CanonicalName, true) }).FirstOrDefault();
                            if (filter.Value != false && filter.Key == true) // check if the file was really specified
                                Printer.PrintMessage("Object: #b#{0}## is #c#unversioned##.", x.CanonicalName);
                        }
                    }
                }
                else
                {
                    if (localOptions.Local)
                    {
                        var records = ws.GetRecords(version);
//.........这里部分代码省略.........
开发者ID:eatplayhate,项目名称:versionr,代码行数:101,代码来源:Diff.cs

示例3: ResolvedAlteration

			public ResolvedAlteration(Objects.Alteration alteration, Area ws)
			{
				Alteration = alteration;
				if (alteration.NewRecord.HasValue)
					Record = ws.GetRecord(Alteration.NewRecord.Value);
				else if (alteration.PriorRecord.HasValue)
					Record = ws.GetRecord(Alteration.PriorRecord.Value);
				else
					throw new Exception("unexpected");
			}
开发者ID:eatplayhate,项目名称:versionr,代码行数:10,代码来源:Log.cs


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