示例#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);
     }
 }
示例#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);
        }
示例#3
0
        /// <summary>
        /// Run the Flash IDE with the additional parameters provided
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns>Operation successful</returns>
        static public bool Run(string pathToIDE, string cmdData)
        {
            if (BridgeManager.Active)
            {
                pathToIDE = "Flash";
            }
            else
            {
                if (pathToIDE != null && Directory.Exists(pathToIDE))
                {
                    var exe = Path.Combine(pathToIDE, "Animate.exe");
                    if (!File.Exists(exe))
                    {
                        exe = Path.Combine(pathToIDE, "Flash.exe");
                    }
                    pathToIDE = exe;
                }
                if (pathToIDE == null || !File.Exists(pathToIDE))
                {
                    string       msg    = TextHelper.GetString("Info.ConfigureFlashPath");
                    string       title  = TextHelper.GetString("Info.ConfigurationRequired");
                    DialogResult result = MessageBox.Show(msg, title, MessageBoxButtons.OKCancel);
                    if (result == DialogResult.OK)
                    {
                        PluginBase.MainForm.ShowSettingsDialog("ASCompletion", "Flash");
                    }
                    return(false);
                }
            }

            TimeSpan diff = DateTime.Now.Subtract(lastRun);

            if (diff.Seconds < 1)
            {
                return(false);
            }
            lastRun = DateTime.Now;

            string args = null;

            if (cmdData != null)
            {
                args = PluginBase.MainForm.ProcessArgString(cmdData);
                if (args.IndexOf('"') < 0)
                {
                    args = '"' + args + '"';
                }
            }

            // execution
            ASContext.SetStatusText(TextHelper.GetString("Info.CallingFlashIDE"));
            PluginBase.MainForm.CallCommand("SaveAllModified", null);
            EventManager.DispatchEvent(null, new NotifyEvent(EventType.ProcessStart));

            try
            {
                string file = args.StartsWith('\"') ? args.Substring(1, args.Length - 2) : args;
                if (BridgeManager.Active && BridgeManager.Settings.TargetRemoteIDE &&
                    File.Exists(file) && Path.GetExtension(file) == ".jsfl" && file[0] <= 'H')
                {
                    string   folder = Path.Combine(BridgeManager.Settings.SharedDrive, ".FlashDevelop\\flashide");
                    string[] logs   = Directory.GetFiles(folder, "*.log");
                    foreach (string log in logs)
                    {
                        File.Delete(log);
                    }

                    string shared = Path.Combine(folder, Path.GetFileName(file));
                    File.Copy(file, shared, true);
                    BridgeManager.RemoteOpen(shared);
                    return(true);
                }
            }
            catch { }

            if (args != null)
            {
                ProcessHelper.StartAsync(pathToIDE, args);
            }
            else
            {
                ProcessHelper.StartAsync(pathToIDE);
            }
            return(true);
        }