Esempio n. 1
0
 /// <summary>
 /// Opens the selected path in windows explorer
 /// </summary>
 private void ExploreDirectory(string path)
 {
     try
     {
         path = PluginBase.MainForm.ProcessArgString(path);
         if (BridgeManager.Active && BridgeManager.IsRemote(path) && BridgeManager.Settings.UseRemoteExplorer)
         {
             BridgeManager.RemoteOpen(path);
             return;
         }
         Dictionary <string, string> config = ConfigHelper.Parse(configFilename, true).Flatten();
         if (!config.ContainsKey("explorer"))
         {
             config["explorer"] = "explorer.exe /e,\"{0}\"";
         }
         String explorer = PluginBase.MainForm.ProcessArgString(config["explorer"]);
         int    start    = explorer.StartsWith("\"") ? explorer.IndexOf("\"", 2) : 0;
         int    p        = explorer.IndexOf(" ", start);
         if (!path.StartsWith("\""))
         {
             path = "\"" + path + "\"";
         }
         // Start the process...
         ProcessStartInfo psi = new ProcessStartInfo(explorer.Substring(0, p));
         psi.Arguments        = String.Format(explorer.Substring(p + 1), path);
         psi.WorkingDirectory = path;
         ProcessHelper.StartAsync(psi);
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(ex);
     }
 }
Esempio n. 2
0
        private void ShellOpenFile(string path)
        {
            if (BridgeManager.Active && BridgeManager.IsRemote(path) && !BridgeManager.AlwaysOpenLocal(path))
            {
                BridgeManager.RemoteOpen(path);
                return;
            }
            ProcessStartInfo psi = new ProcessStartInfo(path);

            psi.WorkingDirectory = Path.GetDirectoryName(path);
            ProcessHelper.StartAsync(psi);
        }