private void tsmiNewDirectory_Click(object sender, EventArgs e) { try { SelectDirectory(); string dir = GetTreeViewPath(SelectedNode); if (!Directory.Exists(dir)) { return; } string folderName = "folder"; int i = 1; while (Directory.Exists(System.IO.Path.Combine(dir, folderName))) { folderName = "folder" + i; i++; } Directory.CreateDirectory(System.IO.Path.Combine(dir, folderName)); TreeNode node = new TreeNode(folderName); SelectedNode.Nodes.Add(node); UpdateIcon(node); SelectedNode.Expand(); OldPath = GetTreeViewPath(node); LabelEdit = true; node.BeginEdit(); } catch (Exception ex) { ProgramData.Log("ProjectTree", ex.Message, ProgramData.LOG_STYLE_ERROR); } }
public static void Push(List <string> files, string basedir, string subdir = "") { Task task = new Task(() => { try { StopLog(); var device = GetDevice(); using (SyncService sync = device.SyncService) { ProgramData.Log("ADB", "Starting copying files.......", LOG_STYLE_NORMAL); PushFiles(files, basedir, ProgramData.Project.Name + "/" + subdir, sync); sync.Close(); ProgramData.Log("ADB", "Successfully pushed file(s) to remote device", LOG_STYLE_NORMAL); } if (RunProgram) { ConsoleOutputReceiver receiver = new ConsoleOutputReceiver(); device.ExecuteShellCommand("am force-stop " + ProgramData.Project.ProgramPackage, receiver); device.ExecuteShellCommand("monkey -p " + ProgramData.Project.ProgramPackage + " 1", receiver); ProgramData.Log("ADB", "Restarted package " + ProgramData.Project.ProgramPackage, LOG_STYLE_NORMAL); InitLogging(device); } ProgramData.MainForm.StopProgress(); } catch (Exception e) { Log("ADB", e.Message, LOG_STYLE_ERROR); FChooseDevice.Ask = true; MainForm.StopProgress(); } }); task.Start(); }
private void tsmiNewFile_Click(object sender, System.EventArgs e) { try { SelectDirectory(); string dir = GetTreeViewPath(SelectedNode); if (!Directory.Exists(dir)) { return; } string fileName = "file.js"; int i = 1; while (File.Exists(System.IO.Path.Combine(dir, fileName))) { fileName = "file" + i + ".js"; i++; } Path path = (Path)dir + fileName; File.Create(System.IO.Path.Combine(dir, fileName)).Close(); TreeNode node = new TreeNode(fileName); SelectedNode.Nodes.Add(node); UpdateIcon(node); SelectedNode.Expand(); OldPath = GetTreeViewPath(node); LabelEdit = true; node.BeginEdit(); } catch (Exception ex) { ProgramData.Log("ProjectTree", ex.Message, ProgramData.LOG_STYLE_ERROR); } }
public override void Run() { try { context.Run(source); } catch (Exception e) { ProgramData.Log("Plugin: " + name, e.Message, ProgramData.LOG_STYLE_ERROR); } }
static ModPE() { try { LoadData("modpescript_dump.txt"); } catch (Exception e) { ProgramData.Log("ModPE", "Cannot load ModPE data: " + e.Message, ProgramData.LOG_STYLE_ERROR); } }
static ZCore() { try { LoadData("core.txt", "patterns.txt"); } catch (Exception e) { ProgramData.Log("ZCore", "Cannot load ZCore data: " + e.Message, ProgramData.LOG_STYLE_ERROR); } }
private void menuButtonClick(object sender, EventArgs e) { string command = ((ToolStripItem)sender).Text; try { menuButtons[command].Call(); } catch (Exception ex) { ProgramData.Log("Plugin: " + name, ex.Message, ProgramData.LOG_STYLE_ERROR); } }
public EditorTab(string file, CodeEditor editor) { InitializeComponent(); DoubleBuffered = true; Controls.Add(fctb); File = file; Editor = editor; try { fctb.OpenFile(file, ProgramData.Encoding); saved = true; base.Text = System.IO.Path.GetFileName(file); } catch (Exception e) { ProgramData.Log("FileSystem", "Unable to open script! " + e.Message, ProgramData.LOG_STYLE_ERROR); } }
public JavaScriptPlugin(string name) { this.name = name; string file = "plugins\\" + name + ".js"; try { source = System.IO.File.ReadAllText(file, ProgramData.Encoding); context = new JavascriptContext(); context.SetParameter("Nide", new Nide(name)); context.SetParameter("File", new File()); context.SetParameter("Project", new Project()); context.SetParameter("Plugin", new Plugin(name)); } catch (Exception e) { ProgramData.Log("Plugin: " + name, e.Message, ProgramData.LOG_STYLE_ERROR); } }
public void UpdateNlib() { Libraries.Clear(); Autocomplete.UserItems.Clear(); foreach (var line in File.ReadAllLines(Nproj, ProgramData.Encoding)) { string[] keyValue = line.Split(':'); if (keyValue.Length != 2) { continue; } switch (keyValue[0]) { case "project-name": Name = keyValue[1]; break; case "project-version": Version = keyValue[1]; break; case "settings-compress": Compress = Convert.ToBoolean(keyValue[1]); break; case "include-library": try { var l = new Library(keyValue[1], LibraryPath, Libraries, OutFiles); if (!LibraryInstalled(l.name)) { Libraries.Add(l); } } catch (Exception e) { ProgramData.Log("ProjectManager", e.Message, ProgramData.LOG_STYLE_ERROR); } break; } } }
public void AddOutput(byte[] data, int offset, int length) { string item = Encoding.UTF8.GetString(data, offset, length); string[] items = item.Split('\n'); foreach (var its in items) { string it = its.Trim(); if (it.Contains("INNERCORE")) { string msg = it.Substring(it.IndexOf(':') + 2); ProgramData.Log("InnerCore", msg, ProgramData.LOG_STYLE_NORMAL); } else if (it.Contains("MOD-PRINT")) { string msg = it.Substring(it.IndexOf(':') + 2); ProgramData.Log("Mod-Print", msg, ProgramData.LOG_STYLE_NORMAL); } } }
public void error(string message) { ProgramData.Log("Plugin: " + name, message, ProgramData.LOG_STYLE_ERROR); }
public void warn(string message) { ProgramData.Log("Plugin: " + name, message, ProgramData.LOG_STYLE_WARN); }
public void success(string message) { ProgramData.Log("Plugin: " + name, message, ProgramData.LOG_STYLE_SUCCESS); }
public void log(string message) { ProgramData.Log("Plugin: " + name, message, ProgramData.LOG_STYLE_NORMAL); }