本文整理汇总了C#中PathType类的典型用法代码示例。如果您正苦于以下问题:C# PathType类的具体用法?C# PathType怎么用?C# PathType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PathType类属于命名空间,在下文中一共展示了PathType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPathFromRegistry
private static string GetPathFromRegistry(PathType type)
{
var mainKey = type == PathType.User ? Registry.CurrentUser : Registry.LocalMachine;
try
{
var subKey = mainKey.OpenSubKey(type == PathType.User ? UserPathKey : SystemPathKey);
if (subKey == null)
throw new Exception();
var path = subKey
.GetValue("Path", "", RegistryValueOptions.DoNotExpandEnvironmentNames) as string;
return path;
}
catch (SecurityException)
{
MessageBox.Show("An error has occured while trying to open registry.\n" +
"Your account probably doesn't have necessary permissions.");
Application.Current.Shutdown();
}
catch (UnauthorizedAccessException)
{
MessageBox.Show("An error has occured while trying to open registry.\n" +
"Your account probably doesn't have necessary permissions.");
Application.Current.Shutdown();
}
catch (Exception e)
{
MessageBox.Show("An unknown error has occured while trying to open registry:\n" + e.Message);
Application.Current.Shutdown();
}
return "";
}
示例2: FillPathData
private void FillPathData(Windows.UI.Xaml.Shapes.Path pathInstance, PathType typeOfPath){
var dataPath = string.Empty ;
if (typeOfPath == PathType.Book)
{
dataPath = "M8.15192985534668,0L8.16493034362793,0 8.16493034362793,39.189998626709C8.16493034362793,39.6419982910156 8.31793022155762,40.0549983978271 8.55592918395996,40.2599983215332 8.79993057250977,40.4699993133545 9.08692932128906,40.4329986572266 9.30992889404297,40.173999786377L15.2389297485352,33.1699991226196 20.8559303283691,40.1579990386963C20.9839305877686,40.3139991760254,21.1359310150146,40.3959999084473,21.2879314422607,40.3959999084473L21.6139316558838,40.2689990997314C21.8609313964844,40.0629997253418,22.0179309844971,39.6469993591309,22.0179309844971,39.189998626709L22.0179309844971,0 52.1599340438843,0C53.090934753418,0,53.8439350128174,0.757999420166016,53.8439350128174,1.6879997253418L53.8439350128174,49.3569984436035C53.8439350128174,50.2879981994629,53.090934753418,51.0459976196289,52.1599340438843,51.0459976196289L52.1399345397949,51.0410003662109C52.0039348602295,51.0699996948242,51.8759346008301,51.0909996032715,51.7449340820313,51.0909996032715L8.14793014526367,51.0909996032715C5.61592864990234,51.0909996032715 3.5399284362793,53.0789985656738 3.39693069458008,55.5789985656738 3.39693069458008,55.7309989929199 3.40092849731445,55.8460006713867 3.40092849731445,55.9209976196289L3.39292907714844,56.0529975891113C3.49493026733398,58.5929985046387,5.58692932128906,60.6279983520508,8.14793014526367,60.6279983520508L50.4719343185425,60.6279983520508 50.4719343185425,55.9669990539551C50.4719343185425,55.0359992980957 51.2299346923828,54.2779998779297 52.1599340438843,54.2779998779297 53.090934753418,54.2779998779297 53.8439350128174,55.0359992980957 53.8439350128174,55.9669990539551L53.8439350128174,62.3120002746582C53.8439350128174,63.246997833252,53.090934753418,64,52.1599340438843,64L7.89292907714844,64 7.63792991638184,63.9749984741211C3.3879280090332,63.7070007324219,0.00792694091796875,60.1749992370605,0.00792694091796875,55.8589973449707L0.0229301452636719,55.5669975280762C-0.0290718078613281,50.5599994659424,0.0229301452636719,12.4609990119934,0.0279273986816406,8.3179988861084L0.0119285583496094,8.14099884033203C0.0119285583496094,3.65299892425537,3.6649284362793,0,8.15192985534668,0z";
}
else if (typeOfPath == PathType.Key) {
dataPath = "M16.547848,26.872497C14.451092,26.916562 12.365034,27.710413 10.729302,29.266098 7.2240894,32.589393 7.0834706,38.118687 10.403706,41.615683 13.72137,45.118677 19.252512,45.263676 22.752474,41.941881 26.247238,38.621584 26.401036,33.097193 23.078072,29.594298 21.314234,27.73567 18.92417,26.822555 16.547848,26.872497z M47.555126,0.0002117157C47.726013,0.0044841766,47.895291,0.073574066,48.021641,0.20638657L52.778168,5.1985388C53.03077,5.4641666,53.020371,5.888484,52.754769,6.1409225L52.232945,6.6370945 58.379608,13.115402C58.632122,13.382402,58.621121,13.806803,58.354809,14.058203L56.356011,15.956708C56.089798,16.207609,55.665879,16.197409,55.413365,15.930308L49.269745,9.4546347 48.00716,10.655153 52.407509,15.294587C52.660187,15.560289,52.649086,15.984593,52.382813,16.237495L50.384396,18.133013C50.118122,18.386015,49.694359,18.375215,49.441685,18.109612L45.04353,13.473104 30.99349,26.832494 31.170538,27.124847C35.031944,33.685067 34.017586,42.279621 28.253817,47.748075 21.549486,54.107365 10.954499,53.828564 4.5965569,47.125475 -1.7705653,40.417484 -1.4855343,29.826198 5.21898,23.462906 10.672487,18.294763 18.680851,17.507213 24.908787,20.994482L25.088602,21.09812 47.078934,0.18294907C47.211735,0.056484222,47.384236,-0.0040607452,47.555126,0.0002117157z";
}
if (!string.IsNullOrEmpty(dataPath))
{
var b = new Binding { Source = dataPath };
BindingOperations.SetBinding(pathInstance, Windows.UI.Xaml.Shapes.Path.DataProperty, b);
}
}
示例3: AddOption
public void AddOption(PathType type, Delivery delivery)
{
if (delivery == null)
throw new ArgumentException("Delivery cannot be null", "delivery");
options[type] = delivery;
}
示例4: Path
/// <summary>
/// Create a path from XZ nodes defined in a pathFile.
/// The file must be accessible from the executable environment.
/// </summary>
/// <param name="theStage"> "world's stage" </param>
/// <param name="aPathType"> SINGLE, REVERSE, or LOOP path traversal</param>
/// <param name="pathFile"> text file, each line a node of X Z values, separated by a single space </x></param>
public Path(Stage theStage, PathType aPathType, string pathFile)
: base(theStage)
{
node = new List<NavNode>();
stage = theStage;
nextNode = 0;
pathType = aPathType;
done = false;
// read file
using (StreamReader fileIn = File.OpenText(pathFile)) {
int x, z;
string line;
string[] tokens;
line = fileIn.ReadLine();
do {
// use default separators
tokens = line.Split(new char[] { });
x = Int32.Parse(tokens[0]);
z = Int32.Parse(tokens[1]);
node.Add(new NavNode(new Vector3(x, 0, z), NavNode.NavNodeEnum.WAYPOINT));
line = fileIn.ReadLine();
}
while (line != null);
}
}
示例5: DiskSpaceNotification
public DiskSpaceNotification(string path, PathType pathType, double freeSpaceInBytes, double freeSpaceInPercentage)
{
Path = path;
PathType = pathType;
FreeSpaceInBytes = freeSpaceInBytes;
FreeSpaceInPercentage = freeSpaceInPercentage;
}
示例6: FileChecksum
/// <summary>
/// Initializes a new instance of the FileChecksum class, and loads the file's hash (computed immediately)
/// </summary>
/// <param name="fileName">File to compute hash of</param>
/// <param name="basePath">Base path</param>
/// <param name="pathType">Path type</param>
/// <param name="checksumType">Checksum type</param>
public FileChecksum(string fileName, string basePath, PathType pathType, ChecksumType checksumType)
{
FilePath = fileName;
ResolvedFileName = GetFileName(FilePath, basePath, pathType);
Checksum = FileUtils.GetFileChecksum(fileName, checksumType);
}
示例7: ReadDisabledItems
public static IEnumerable<PathEntry> ReadDisabledItems(PathType type)
{
var name = type == PathType.User ? DisabledUserItemsFileName : DisabledSystemItemsFileName;
var fullPath = Path.Combine(AppDataPath.AppDataDirPath, name);
if (!File.Exists(fullPath))
return new List<PathEntry>();
return File.ReadAllLines(fullPath).Select(x => new PathEntry(x) { Enabled = false });
}
示例8: CookieStatus
internal CookieStatus(string name, string path, BrowserType browserType, PathType pathType)
{
_name = name;
_path = path;
_browserType = browserType;
_pathType = pathType;
_displayName = null;
}
示例9: PathElement
public PathElement(string name, PathType type)
{
if (string.IsNullOrEmpty(name) && type != PathType.Root)
{
throw new ArgumentException("Can't have empty name for non root path element");
}
_pathType = type;
_name = name;
}
示例10: Path
/// <summary>
/// Create a path
/// </summary>
/// <param name="theStage"> "world's stage" </param>
/// <param name="apath"> collection of nodes in path</param>
/// <param name="aPathType"> SINGLE, REVERSE, or LOOP path traversal</param>
public Path(Stage theStage, List<NavNode> aPath, PathType aPathType)
: base(theStage)
{
node = aPath;
nextNode = 0;
pathType = aPathType;
stage = theStage;
done = false;
}
示例11: SaveDisabledItems
public static void SaveDisabledItems(PathType type, IEnumerable<PathEntry> items)
{
var name = type == PathType.User ? DisabledUserItemsFileName : DisabledSystemItemsFileName;
var fullPath = Path.Combine(AppDataPath.AppDataDirPath, name);
var disabledItems = items.Where(x => x.Enabled == false).Select(x => x.Path);
File.WriteAllLines(fullPath, disabledItems);
}
示例12: SavePathToRegistry
public static void SavePathToRegistry(PathType type, string path)
{
#if DEBUG
System.Diagnostics.Debug.WriteLine(path);
#else
Environment.SetEnvironmentVariable("Path", path,
type == PathType.User ? EnvironmentVariableTarget.User : EnvironmentVariableTarget.Machine);
#endif
}
示例13: Contains
public static bool Contains(Route route, PathType type)
{
for (uint i = 0x0; i < route.GetNumPaths(); i++)
{
PathData pathData = route.GetPathData(i);
if (pathData.PathType == type) return true;
}
return false;
}
示例14: Path
// ***********************************************************************************
// CONSTRUCTOR
// ***********************************************************************************
public Path(PathType type, Vector3[] waypoints, int subdivisionsXSegment, Color? gizmoColor = null)
{
this.type = type;
this.subdivisionsXSegment = subdivisionsXSegment;
if (gizmoColor != null) this.gizmoColor = (Color)gizmoColor;
AssignWaypoints(waypoints, true);
AssignDecoder(type);
if (DOTween.isUnityEditor) DOTween.GizmosDelegates.Add(Draw);
}
示例15: CreateTemporaryPath
public static PathSpec CreateTemporaryPath(PathType type)
{
var path = Path.GetRandomFileName();
var spec = path.ToPathSpec().Value;
if (type == PathType.File)
spec.Create(PathType.File);
if (type == PathType.Folder)
spec.Create(PathType.Folder);
return spec;
}