示例#1
0
文件: Amanda.cs 项目: remco138/amanda
        //Run a block of code (eg: definitions)
        public bool Load(string code)
        {
            File.WriteAllText(".temp.ama", code);
            bool success = AmandaHook.Load(".temp.ama");

            File.Delete(".temp.ama");

            return(success);
        }
示例#2
0
文件: Amanda.cs 项目: remco138/amanda
        private Amanda(string autorun = null)
        {
            if (Instance == null)
            {
                Instance = this;
            }

            AmandaHook.InitOptions(true, ""); //empty char will result in amanda loading up amanda.ini
            AmandaHook.CreateInterpreter();
            if (autorun != null)
            {
                AmandaHook.Load(autorun);
            }
        }
示例#3
0
        public mainForm()
        {
            InitializeComponent();

            outputCallback = OutputCallbackMethod;
            AmandaHook.SetOutputCallback(outputCallback);

            AmandaObj = Amanda.GetInstance();
            tbConsole.AppendText(tempOutput.ToString());
            tempOutput.Clear();

            runButton.Click  += new EventHandler(RunCodeHandler);
            loadButton.Click += (sender, e) =>
            {
                if (fileManager.SelectedTabTextBox.Text == "")
                {
                    return;
                }

                if (AmandaObj.Load(fileManager.SelectedTabTextBox.Text) == true)
                {
                    MessageBox.Show("File Loaded");
                    fileManager.UpdateAutocompleteIdentifiers(AmandaObj.GetIdentifiers());
                }

                // Print if error
                //
                tbConsole.AppendText("\n\n");
                tbConsole.AppendText(tempOutput.ToString());
                tempOutput.Clear();
                tbConsole.SelectionStart = tbConsole.TextLength;
                tbConsole.ScrollToCaret();
            };

            //
            fileManager.UpdateAutocompleteIdentifiers(AmandaObj.GetIdentifiers());

            bwInterpret.WorkerSupportsCancellation = true;
            bwInterpret.WorkerReportsProgress      = false;
            bwInterpret.DoWork             += new DoWorkEventHandler(bwInterpret_doWork);
            bwInterpret.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwInterpret_runWorkerCompleted);

            bwTextToConsole.WorkerSupportsCancellation = true;
            bwTextToConsole.WorkerReportsProgress      = false;
            bwTextToConsole.DoWork             += new DoWorkEventHandler(bwTextToConsole_doWork);
            bwTextToConsole.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwTextToConsole_runWorkerCompleted);
        }
示例#4
0
文件: Amanda.cs 项目: remco138/amanda
 public List <String> GetOutput()
 {
     return(CStringPointerToList(AmandaHook.getMessages()));
 }
示例#5
0
文件: Amanda.cs 项目: remco138/amanda
 //C char** to C# string
 public List <string> GetIdentifiers(string search = "")
 {
     return(CStringPointerToList(AmandaHook.gethashtable(search)));
 }
示例#6
0
文件: Amanda.cs 项目: remco138/amanda
 public void SetInterrupt(bool b)
 {
     AmandaHook.SetInterrupt(b);
 }
示例#7
0
文件: Amanda.cs 项目: remco138/amanda
 //Run a single expression
 public bool Interpret(string expression)
 {
     AmandaHook.Interpret(expression);
     return(true);
 }