/// <summary> /// Vraca preporucenu ekstenziju za file koji se otvara alatom /// </summary> /// <param name="tool"></param> /// <returns></returns> public static String getOutputExtensionFor(this externalTool tool) { switch (tool) { case externalTool.chrome: case externalTool.explorer: case externalTool.firefox: return("html"); break; default: return("txt"); break; } }
/// <summary> /// Snima prosledjen sadrzaj i otvara ga u odabranoj aplikaciji /// </summary> /// <param name="whatApplication">Koja aplikacija</param> /// <param name="content">String sadrzaj koji treba da otvori</param> /// <param name="contentName">Filename ili cela putanja</param> /// <returns></returns> public static Process openWithApplication(externalTool whatApplication, String content, String contentName = "tempfile") { String p = ""; String e = whatApplication.getOutputExtensionFor(); if (Path.IsPathRooted(contentName)) { p = contentName; } else { //p = content fileOps.getOutputPath(contentName, e, e, // imbTimeStampFormat.imbExceptionStamp, "", // imbCore.environment.files.enums.outputFolder.reports); } throw new NotImplementedException(); //objectSerialization //save.saveToFile(p, content); return(startApplication(whatApplication, p)); }
/// <summary> /// Pokrece eksterni alat i u njemu otvara prosledjenu putanju /// </summary> /// <param name="filePathOrUrl"></param> /// <param name="whatApplication"></param> public static Process startApplication(externalTool whatApplication, String filePathOrUrl = "") { Process myProcess = null; String path = ""; try { // path = imbSettingsManager.current.externalToolsPath[whatApplication]; } catch { } switch (whatApplication) { case externalTool.phpMyAdmin: myProcess = startApplication(path, " \"http://localhost/phpmyadmin/\" --single-process "); break; case externalTool.firefox: // filePathOrUrl = filePathOrUrl.Replace("/", "\\"); myProcess = startApplication(path, " -url " + filePathOrUrl); break; case externalTool.explorer: filePathOrUrl = filePathOrUrl.Replace("/", "\\"); myProcess = startApplication(path, " -url " + filePathOrUrl); break; case externalTool.chrome: filePathOrUrl = filePathOrUrl.Replace("/", "\\"); myProcess = startApplication(path, " \"" + filePathOrUrl + "\" --single-process "); break; case externalTool.wampLocalhost: myProcess = startApplication(path, " \"http://localhost/\" --single-process "); break; case externalTool.notepadpp: myProcess = startApplication(path, " -multiInst " + filePathOrUrl); break; case externalTool.dreamweaver: myProcess = startApplication(path, " \"" + filePathOrUrl + "\""); break; case externalTool.wamp: myProcess = startApplication(path); break; case externalTool.projectFolder: // startApplication("explorer.exe", Path.GetPathRoot(imbCoreManager.projectSource.projectPath)); break; case externalTool.runtimeFolder: //myProcess = startApplication("explorer.exe", // Path.GetPathRoot(imbCoreApplicationSettings.installedPath)); break; case externalTool.wampWWW: myProcess = startApplication("explorer.exe", "C:\\wamp\\www"); break; case externalTool.fusekiServer: //myProcess = startApplication(path, ""); myProcess = startApplication(path, "--update --mem /ds"); break; case externalTool.fusekiServerJava: myProcess = startApplication("java", "-jar fuseki-server.jar"); break; case externalTool.folderExplorer: myProcess = startApplication("explorer.exe", Path.GetPathRoot(filePathOrUrl)); break; case externalTool.fusekiLocalhost: myProcess = startApplication(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe", @" -url http://localhost:3030/"); break; } throw new NotImplementedException(); //if (imbCoreApplicationSettings.doKillExisting) //{ // if (activeTools.ContainsKey(whatApplication)) // { // activeTools[whatApplication].Kill(); // activeTools.Remove(whatApplication); // } // activeTools.Add(whatApplication, myProcess); //} return(myProcess); }
/// <summary> /// Setting dsa_externalTool argument /// </summary> /// <param name="externalTool">Value for dsa_externalTool</param> /// <returns>Instruction</returns> public docScriptInstruction arg(externalTool externalTool) { this.add(docScriptArguments.dsa_externalTool, externalTool); return(this); }
public static metaLink setTool(this metaLink link, externalTool tool, displayOption display) { link.tool = tool; link.display = display; return(link); }
/// <summary> /// Pokrece eksterni alat i u njemu otvara prosledjenu putanju /// </summary> /// <param name="filePathOrUrl"></param> /// <param name="whatApplication"></param> public static Process run(this externalTool whatApplication, String filePathOrUrl = "") { Process myProcess = null; String path = ""; try { path = externalToolsPath[whatApplication]; } catch { } switch (whatApplication) { case externalTool.firefox: // filePathOrUrl = filePathOrUrl.Replace("/", "\\"); myProcess = runProcess(path, " -url " + filePathOrUrl); break; case externalTool.explorer: filePathOrUrl = filePathOrUrl.Replace("/", "\\"); myProcess = runProcess(path, " -url " + filePathOrUrl); break; case externalTool.chrome: filePathOrUrl = filePathOrUrl.Replace("/", "\\"); myProcess = runProcess(path, " \"" + filePathOrUrl + "\" --single-process "); break; case externalTool.notepadpp: myProcess = runProcess(path, " -multiInst " + filePathOrUrl); break; case externalTool.projectFolder: // startApplication("explorer.exe", Path.GetPathRoot(imbCoreManager.projectSource.projectPath)); break; case externalTool.runtimeFolder: myProcess = runProcess("explorer.exe", Path.GetPathRoot(Directory.GetCurrentDirectory())); break; } if (doKillExisting) { if (activeTools.ContainsKey(whatApplication)) { try { activeTools[whatApplication].Kill(); activeTools.Remove(whatApplication); } catch (Exception ex) { } } activeTools.Add(whatApplication, myProcess); } return(myProcess); }
/// <summary> /// Opens file specified with an <see cref="externalTool"/> /// </summary> /// <param name="fi">The fi.</param> /// <param name="whatApplication">The what application.</param> /// <returns></returns> public static Process run(this FileInfo fi, externalTool whatApplication) { return(run(whatApplication, fi.FullName)); }