/// <summary> /// Called when plugin is loaded into IDE. /// </summary> /// <param name="bridge">Object used to communicate with IDE from plugin.</param> public void onLoad(IIdeBridge bridge) { mBridge = bridge; FileSyntaxModeProvider fsmp = new FileSyntaxModeProvider(mBridge.GetPluginsPath() + @"\syntax"); HighlightingManager.Manager.AddSyntaxModeFileProvider(fsmp); }
/// <summary> /// Compile Tiny BASIC script to Intuicio Assembly script. /// </summary> /// <param name="input">File path to input Tiny BASIC script.</param> /// <param name="output">File path to output Intuicio Assembly script.</param> /// <returns></returns> private bool CompileTinyBasic(String input, String output) { // make sure that input file exists. if (!File.Exists(input)) { return(false); } // prepare arguments for Tiny BASIC compiler. String args = "-o \"" + output + "\" \"" + input + "\""; // prepare and run Tiny BASIC compiler. ProcessStartInfo psi = new ProcessStartInfo(mBridge.GetPluginsPath() + @"\ttbc.exe", args); psi.UseShellExecute = false; psi.RedirectStandardOutput = true; psi.RedirectStandardError = true; psi.CreateNoWindow = true; mBridge.onLogInfo(@"Tiny BASIC compilation start for file: '" + Path.GetFileName(input) + "'" + Environment.NewLine + "Tiny BASIC compiler arguments: " + args + Environment.NewLine); Process proc = Process.Start(psi); proc.WaitForExit(); if (proc.ExitCode == 0) { while (!proc.StandardOutput.EndOfStream) { mBridge.onLogInfo(proc.StandardOutput.ReadLine() + Environment.NewLine); } mBridge.onLogInfo(@"Successful Tiny BASIC compilation for file: '" + Path.GetFileName(input) + "'" + Environment.NewLine); return(true); } else { while (!proc.StandardError.EndOfStream) { mBridge.onLogError(proc.StandardError.ReadLine() + Environment.NewLine); } mBridge.onLogError(@"Tiny BASIC compilation failed for file: '" + Path.GetFileName(input) + "'" + Environment.NewLine); return(false); } }