本文整理汇总了C#中Area.GetLocalCanonicalName方法的典型用法代码示例。如果您正苦于以下问题:C# Area.GetLocalCanonicalName方法的具体用法?C# Area.GetLocalCanonicalName怎么用?C# Area.GetLocalCanonicalName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Area
的用法示例。
在下文中一共展示了Area.GetLocalCanonicalName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunInternal
protected override bool RunInternal(Area ws, Versionr.Status status, IList<Versionr.Status.StatusEntry> targets, FileBaseCommandVerbOptions options)
{
StatusVerbOptions localOptions = (StatusVerbOptions)options;
if (localOptions.Objects != null && localOptions.Objects.Count > 0)
{
if (targets.Count == 0)
{
Printer.PrintError("#x#Error:##\n Could not find objects matching pattern #b#{0}##", GetPatterns(localOptions.Objects));
if (ActiveDirectory.FullName != Workspace.Root.FullName)
Printer.PrintMessage(" - Relative to folder \"#b#{0}##\"", Workspace.GetLocalPath(ActiveDirectory.FullName));
return false;
}
}
var ss = status;
if (!string.IsNullOrEmpty(ss.RestrictedPath))
Printer.WriteLineMessage(" Computing status for path: #b#{0}##", ss.RestrictedPath);
int[] codeCount = new int[(int)StatusCode.Count];
if (status.MergeInputs.Count > 0)
Printer.WriteLineMessage("Workspace has #b#{0}## pending merges.", status.MergeInputs.Count);
foreach (var x in status.MergeInputs)
{
Printer.WriteLineMessage(" #c#{0}#q# from branch \"#b#{1}##\" (rev {2})", x.ID, Workspace.GetBranch(x.Branch).Name, x.Revision);
}
if (status.MergeInputs.Count > 0)
Printer.WriteLineMessage("");
IEnumerable<Versionr.Status.StatusEntry> operands = targets.Where(x => { codeCount[(int)x.Code]++; return x.Code != StatusCode.Ignored; });
if (!localOptions.All)
operands = operands.Where(x => x.Code != StatusCode.Unchanged);
string localRestrictedPath = null;
if (ss.RestrictedPath != null)
localRestrictedPath = ws.GetLocalCanonicalName(ss.RestrictedPath);
if (!localOptions.NoList)
{
if (localOptions.Flat)
{
foreach (var x in operands.OrderBy(x => x.CanonicalName))
{
PrintFile(ws, localRestrictedPath, x, true);
}
}
else
{
var staged = operands.OrderBy(x => x.CanonicalName).Where(y => y.Staged);
if (staged.Count() > 0)
{
Printer.WriteLineMessage("");
Printer.WriteLineMessage(" Changes recorded for commit:");
Printer.WriteLineMessage(" (use \"vsr unrecord <file>...\" to unrecord)");
Printer.WriteLineMessage("");
foreach (var x in staged)
{
PrintFile(ws, localRestrictedPath, x);
}
}
var nonstaged = operands.OrderBy(x => x.CanonicalName).Where(y => !y.Staged && y.Code != StatusCode.Unversioned);
if (nonstaged.Count() > 0)
{
Printer.WriteLineMessage("");
Printer.WriteLineMessage(" Changes not staged:");
Printer.WriteLineMessage(" (use \"vsr record <file>...\" to add files to this record)");
Printer.WriteLineMessage(" (use \"vsr revert <file>...\" to revert changes from working directory)");
Printer.WriteLineMessage("");
foreach (var x in nonstaged)
{
PrintFile(ws, localRestrictedPath, x);
}
}
var untracked = operands.OrderBy(x => x.CanonicalName).Where(y => y.Code == StatusCode.Unversioned);
if (untracked.Count() > 0)
{
Printer.WriteLineMessage("");
Printer.WriteLineMessage(" Untracked files:");
Printer.WriteLineMessage(" (use \"vsr record <file>...\" to add files to this record)");
Printer.WriteLineMessage("");
foreach (var x in untracked)
{
PrintFile(ws, localRestrictedPath, x);
}
}
}
}
if (localOptions.Summary)
{
Printer.WriteLineMessage("\n#b#Summary:##");
for (int i = 0; i < codeCount.Length; i++)
Printer.WriteLineMessage(" {0} #b#{2}## #q#{1}##", codeCount[i], codeCount[i] != 1 ? "Objects" : "Object", ((StatusCode)i).ToString());
Printer.WriteLineMessage("\n {0}#q# files in ##{1}#q# diectories ({2} ignored)", ss.Files, ss.Directories, ss.IgnoredObjects);
}
foreach (var x in Workspace.Externs)
{
bool include = true;
if (!string.IsNullOrEmpty(ss.RestrictedPath))
include = Workspace.PathContains(ss.RestrictedPath, System.IO.Path.Combine(ws.Root.FullName, x.Value.Location));
//.........这里部分代码省略.........
示例2: PrintFile
private void PrintFile(Area ws, string localRestrictedPath, Versionr.Status.StatusEntry x, bool flat = false)
{
string name = ws.GetLocalCanonicalName(x.CanonicalName);
if (FilterOptions.WindowsPaths)
name = name.Replace('/', '\\');
if (localRestrictedPath != null)
name = name.Substring(localRestrictedPath.Length);
int index = name.LastIndexOf('/');
if (index != name.Length - 1)
name = name.Insert(index + 1, "#b#");
if (name.Length == 0)
name = "#q#<parent directory>##";
if (x.IsSymlink)
name += " #q# -> " + (x.FilesystemEntry != null ? x.FilesystemEntry.SymlinkTarget : x.VersionControlRecord.Fingerprint);
Printer.WriteLineMessage("{1}##{0}", name, GetStatus(x, flat));
if (x.Code == StatusCode.Renamed || x.Code == StatusCode.Copied)
Printer.WriteLineMessage(" #q#<== {0}", x.VersionControlRecord.CanonicalName);
}