本文整理汇总了C#中System.Uri.GetScrubbedLocalPath方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.GetScrubbedLocalPath方法的具体用法?C# Uri.GetScrubbedLocalPath怎么用?C# Uri.GetScrubbedLocalPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Uri
的用法示例。
在下文中一共展示了Uri.GetScrubbedLocalPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindIcon
public override object FindIcon(Uri path, string ext, string mimetype) {
if(mimetype == null) {
if(!path.IsFile) throw new ArgumentException();
if(!fileMimeHash.ContainsKey(path.GetScrubbedLocalPath())) {
ProcessStartInfo psi = new ProcessStartInfo("xdg-mime", string.Format("query filetype '{0}'", path.GetScrubbedLocalPath()));
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
Process p = Process.Start(psi);
p.WaitForExit();
StreamReader sr = p.StandardOutput;
mimetype = sr.ReadLine();
fileMimeHash[path.GetScrubbedLocalPath()] = mimetype;
}
else {
mimetype = fileMimeHash[path.GetScrubbedLocalPath()];
}
}
IconSet iconset = new IconSet();
IconSource source = new IconSource();
source.IconName = mimetype.Replace('/', '-'); //"inode-directory";
//Console.WriteLine("{0}: {1}", psi.Arguments, text);
iconset.AddSource(source);
return iconset;
}
示例2: LoadDirectory
public override XeFileInfo[] LoadDirectory(ref Uri uri) {
if(!LoadsUriType(uri)) throw new ArgumentException();
//System.Threading.Thread.Sleep(1000);
DirectoryInfo di = new DirectoryInfo(uri.GetScrubbedLocalPath());
Console.WriteLine("file://" + di.FullName.TrimEnd('\\', '/') + Path.DirectorySeparatorChar);
uri = new Uri("file://" + di.FullName.TrimEnd('\\', '/') + Path.DirectorySeparatorChar);
Console.WriteLine(uri.ToString());
DirectoryInfo[] di2 = di.GetDirectories();
FileInfo[] fi = di.GetFiles();
int extra = ((bool)SettingsUtil.MainSettings["show..item"].data && di.Parent != null) ? 1 : 0;
XeFileInfo[] fi2 = new XeFileInfo[di2.Length + fi.Length + extra];
if(extra != 0) {
fi2[0] = new XeFileInfo(di.Parent);
fi2[0].Name = "..";
}
int i = extra;
for(int j = 0; j < di2.Length; ++j, ++i) {
try {
fi2[i] = new XeFileInfo(di2[j]);
}
catch {
}
}
for(int j = 0; j < fi.Length; ++j, ++i) {
try {
fi2[i] = new XeFileInfo(fi[j]);
}
catch {
}
}
return (from fival in fi2 where fival != null select fival).ToArray();
}
示例3: ShortPath
public override string ShortPath (Uri uri) {
string txt = uri.GetScrubbedLocalPath();
if(System.IO.Path.GetFileName(txt) == string.Empty) {
string tmptxt = System.IO.Path.GetDirectoryName(txt);
if(tmptxt == null) {
return txt;
}
txt = tmptxt;
}
return System.IO.Path.GetFileName(txt);
}
示例4: DisplayPath
public override string DisplayPath (Uri uri) {
return uri.GetScrubbedLocalPath();
}
示例5: FileName
public override string[] FileName(Uri uri) {
string path = uri.GetScrubbedLocalPath();
return new string[] { Path.GetFileName(path), Path.GetFileNameWithoutExtension(path), Path.GetExtension(path) };
}
示例6: ParentDirectory
public override Uri ParentDirectory(Uri uri) {
return new Uri("file://" + Path.Combine(uri.GetScrubbedLocalPath(), ".."));
}
示例7: Combine
public override Uri Combine(Uri uri, string addition) {
return new Uri("file://" + Path.Combine(uri.GetScrubbedLocalPath(), addition));
}
示例8: LoadsUriType
public override bool LoadsUriType(Uri uri) {
return uri.IsFile && Directory.Exists(uri.GetScrubbedLocalPath());
}
示例9: Recycle
public override void Recycle(Uri uri) {
switch(OS) {
case PluginOSType.Unix:
Send2Trash.Send2Trash.Put(uri.GetScrubbedLocalPath());
break;
default:
throw new NotImplementedException();
}
}
示例10: Delete
public override void Delete(Uri uri) {
string path = uri.GetScrubbedLocalPath();
if(File.Exists(path)) {
File.Delete(path);
}
else if(Directory.Exists(path)) {
Directory.Delete(path, true);
}
else {
throw new FileNotFoundException();
}
}
示例11: Move
public override void Move(Uri src, Uri dest) {
string src2 = src.GetScrubbedLocalPath();
string dest2 = dest.GetScrubbedLocalPath();
if(File.Exists(src2)) {
if(Directory.Exists(dest2)) {
dest2 = Path.Combine(dest2, Path.GetFileName(src2));
}
File.Move(src2, dest2);
}
else if(Directory.Exists(src2)) {
try {
Directory.Move(src2, dest2);
}
catch(IOException) {
CopyDirectory(new DirectoryInfo(src2), new DirectoryInfo(dest2));
Directory.Delete(src2, true);
}
}
}
示例12: Copy
public override void Copy(Uri src, Uri dest) {
string src2 = src.GetScrubbedLocalPath();
string dest2 = dest.GetScrubbedLocalPath();
if(File.Exists(src2)) {
if(Directory.Exists(dest2)) {
dest2 = Path.Combine(dest2, Path.GetFileName(src2));
}
File.Copy(src2, dest2);
}
else if(Directory.Exists(src2)) {
CopyDirectory(new DirectoryInfo(src2), new DirectoryInfo(dest2));
}
}
示例13: CreateDirectory
public override void CreateDirectory(Uri path) {
Directory.CreateDirectory(path.GetScrubbedLocalPath());
}
示例14: LoadFile
public override void LoadFile(Uri path) {
switch(OS) {
case PluginOSType.Unix:
Process.Start("xdg-open", string.Format("'{0}'", path.GetScrubbedLocalPath()));
break;
case PluginOSType.Windows:
Process.Start(path.GetScrubbedLocalPath());
break;
}
}
示例15: Exists
public override bool Exists(Uri uri) {
return uri.IsFile && (File.Exists(uri.GetScrubbedLocalPath()) || Directory.Exists(uri.GetScrubbedLocalPath()));
}