當前位置: 首頁>>代碼示例>>C#>>正文


C# Uri.GetScrubbedLocalPath方法代碼示例

本文整理匯總了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;
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:29,代碼來源:FileTypeIconHandlerUnix.cs

示例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();
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:34,代碼來源:LocalFileSystemHandler.cs

示例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);
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:12,代碼來源:LocalFileSystemHandler.cs

示例4: DisplayPath

		public override string DisplayPath (Uri uri) {
			return uri.GetScrubbedLocalPath();
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:3,代碼來源:LocalFileSystemHandler.cs

示例5: FileName

		public override string[] FileName(Uri uri) {
			string path = uri.GetScrubbedLocalPath();
			return new string[] { Path.GetFileName(path), Path.GetFileNameWithoutExtension(path), Path.GetExtension(path) };
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:4,代碼來源:LocalFileSystemHandler.cs

示例6: ParentDirectory

		public override Uri ParentDirectory(Uri uri) {
			return new Uri("file://" + Path.Combine(uri.GetScrubbedLocalPath(), ".."));
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:3,代碼來源:LocalFileSystemHandler.cs

示例7: Combine

		public override Uri Combine(Uri uri, string addition) {
			return new Uri("file://" + Path.Combine(uri.GetScrubbedLocalPath(), addition));
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:3,代碼來源:LocalFileSystemHandler.cs

示例8: LoadsUriType

		public override bool LoadsUriType(Uri uri) {
			return uri.IsFile && Directory.Exists(uri.GetScrubbedLocalPath());
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:3,代碼來源:LocalFileSystemHandler.cs

示例9: Recycle

		public override void Recycle(Uri uri) {
			switch(OS) {
				case PluginOSType.Unix:
					Send2Trash.Send2Trash.Put(uri.GetScrubbedLocalPath());
					break;
				
				default:
					throw new NotImplementedException();
			}
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:10,代碼來源:LocalFileSystemHandler.cs

示例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();
			}
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:12,代碼來源:LocalFileSystemHandler.cs

示例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);
				}
			}
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:19,代碼來源:LocalFileSystemHandler.cs

示例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));
			}
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:13,代碼來源:LocalFileSystemHandler.cs

示例13: CreateDirectory

		public override void CreateDirectory(Uri path) {
			Directory.CreateDirectory(path.GetScrubbedLocalPath());
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:3,代碼來源:LocalFileSystemHandler.cs

示例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;
			}
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:10,代碼來源:LocalFileSystemHandler.cs

示例15: Exists

		public override bool Exists(Uri uri) {
			return uri.IsFile && (File.Exists(uri.GetScrubbedLocalPath()) || Directory.Exists(uri.GetScrubbedLocalPath()));
		}
開發者ID:MI3Guy,項目名稱:Xenon-File-Manager--.NET-Mono-,代碼行數:3,代碼來源:LocalFileSystemHandler.cs


注:本文中的System.Uri.GetScrubbedLocalPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。