本文整理汇总了C#中Path.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Path.ToString方法的具体用法?C# Path.ToString怎么用?C# Path.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureDirectory
public static void EnsureDirectory(this IFileSystem fileSystem, Path directory)
{
var path = directory.ToString();
if(fileSystem.DirectoryExists(path))
return;
fileSystem.CreateDirectory(path);
}
示例2: AddADSIPath
public static string AddADSIPath( string Path, Path ADSIPath )
{
if( Path.IndexOf( "://" ) != - 1 )
{
//Clean existing ADs path first
Path = Path.Substring( Path.Length - Path.Length - ( Path.IndexOf( "://" ) + 3 ), Path.Length - ( Path.IndexOf( "://" ) + 3 ) );
}
return ADSIPath.ToString() + "://" + Path;
}
示例3: MakeRequestAsync
public static async Task<Dictionary<int, Dictionary<string, ClassLine>>> MakeRequestAsync(Path path)
{
// Create a HTTP Client:
var client = new HttpClient();
// Make a request:
var response = await client.GetAsync(path.ToString());
// Get data:
return await response.Content.ReadAsAsync<Dictionary<int, Dictionary<string, ClassLine>>>();
}
示例4: Save
public static void Save(Path path, string fileName)
{
if (string.IsNullOrEmpty(fileName))
{
throw new ArgumentException("The name of the file cannot be empty.");
}
using (var file = new StreamWriter(fileName))
{
file.Write(path.ToString());
}
}
示例5: Main
static void Main()
{
Point3D p = new Point3D();
Point3D q = new Point3D(4, 4, 4);
Console.WriteLine(CalcDistance.Distance(p, q));
Path path = new Path();
path.Add(p);
path.Add(q);
path.Add(new Point3D(9, 9, 9));
Console.WriteLine(path.ToString());
PathStorage.Save(path);
Console.WriteLine(PathStorage.Load().ToString());
}
示例6: Main
static void Main()
{
Path path = new Path();
path.AddPoint(new Point(1, 2, 3));
path.AddPoint(Point.CoordStart);
path.AddPoint(new Point(4, 5, 6));
path.AddPoint(new Point(7, 8, 9));
path.AddPoint(new Point(11, 12, 13));
Console.WriteLine(path.ToString());
string filePath = @"..\..\save.txt";
PathStorage.SavePath(filePath, path);
Path pathLoad = PathStorage.LoadPath(filePath);
Console.WriteLine(pathLoad.ToString());
}
示例7: Main
private static void Main()
{
var coordinate = new Point(2, 8, 4);
Console.WriteLine(coordinate);
Console.WriteLine(Point.Start);
Console.WriteLine(Distance.CalculateDistance(coordinate, Point.Start));
Path path = new Path(new Point(3, 1, 8), new Point(15, 5.2, 6), new Point(8, 6.3, 4));
Console.WriteLine(path.ToString());
PathStorage.Save(path, "../../save.txt");
Path path2 = new Path();
path2 = PathStorage.Load("../../load.txt");
PathStorage.Save(path2, "../../save.txt");
}
示例8: SavePath
public static void SavePath(Path path, string file)
{
File.WriteAllText(file, path.ToString());
}
示例9: Write
public static void Write(Path path, string file = DefaultFile)
{
File.WriteAllText(file, path.ToString());
}
示例10: Test_EmptySegments
public void Test_EmptySegments()
{
var p = new Path("a//b");
Assert.AreEqual(2, p.Segments.Count);
Assert.AreEqual("a", p.Segments[0].ResourceKey);
Assert.AreEqual("b", p.Segments[1].ResourceKey);
Assert.AreEqual("a/b", p.ToString());
p = new Path("a///b");
Assert.AreEqual(2, p.Segments.Count);
Assert.AreEqual("a", p.Segments[0].ResourceKey);
Assert.AreEqual("b", p.Segments[1].ResourceKey);
Assert.AreEqual("a/b", p.ToString());
p = new Path("/a///b/");
Assert.AreEqual(2, p.Segments.Count);
Assert.AreEqual("a", p.Segments[0].ResourceKey);
Assert.AreEqual("b", p.Segments[1].ResourceKey);
Assert.AreEqual("a/b", p.ToString());
}
示例11: BuildAction
internal IAction BuildAction()
{
IAction action = AbstractAction.Create(_action);
Stack<PathSegment> stack = new Stack<PathSegment>();
AbstractActionModelTreeNode current = this;
do
{
stack.Push(current.PathSegment);
current = current.Parent;
} while (current != null);
Path path = new Path(stack.Pop()); // the first path segment is the site, which is never processed through the resource resolver
while (stack.Count > 0)
{
// for each subsequent segment, ensure the action's resolver will resolve the string in the expected way
PathSegment pathSegment = stack.Pop();
string localizedString = action.ResourceResolver.LocalizeString(pathSegment.ResourceKey);
if (localizedString == pathSegment.LocalizedText)
path = path.Append(pathSegment);
else
path = path.Append(new PathSegment(pathSegment.LocalizedText, pathSegment.LocalizedText));
}
action.Path = new ActionPath(path.ToString(), action.ResourceResolver);
return action;
}
示例12: PathException
public PathException(Path p, String s) : this(p.ToString() + s)
{
}
示例13: WithSubPath
public Path WithSubPath(Path subPath) {
return new FilePath(System.IO.Path.Combine(directoryPath, subPath.ToString()));
}
示例14: FileExportItem
public FileExportItem(Path relativePath, IFile file, IPackage package)
{
Path = relativePath.ToString();
File = file;
Package = package;
}
示例15: GetRootForestPath
///<summary>
/// Obtain the path to access top level domain entry in Windows Active Directory
///</summary>
///<remarks>For better performance and avoid error, Global Catalog is preferer accessing method
///</remarks>
///<history>
/// [tamttt] 08/01/2004 Created
///</history>
public static string GetRootForestPath( Path ADSIPath )
{
try
{
string strADSIPath = ADSIPath.ToString() + "://";
DirectoryEntry ADsRoot = new DirectoryEntry( strADSIPath + "rootDSE" );
string strRootDomain = strADSIPath + Convert.ToString( ADsRoot.Properties[Configuration.ADSI_ROOTDOMAINNAMIMGCONTEXT].Value );
return strRootDomain;
}
catch( COMException ex )
{
Exceptions.LogException( ex );
return null;
}
}