Example #1
0
        // ctor
        public HostScripter(FrmScripter frm)
        {
            _frm = frm;

            _markerTimer.Elapsed  += new ElapsedEventHandler(OnMarkerTimerTick);
            _markerTimer.Enabled   = false;
            _markerTimer.AutoReset = false;
            _markerTimer.Interval  = 5500;
        }
Example #2
0
        public static bool Parse(FrmScripter frmScp, Editor editor)
        {
            Debug.Assert(null != frmScp);
            Debug.Assert(null != editor);

            _frm    = frmScp;
            _editor = editor;

            _editor.Variables.Clear();
            _editor.Functions.Clear();

            CreateDefaultTreeNodes();
            CreateTreeNodes(_frm.tvwImported, _editor.Path2File);

            List <string> lst = new List <string>(_editor.Lines);

            ParseLines(lst);

            foreach (string rawline in editor.Lines)
            {
                string line = rawline.Trim();

                if (line.StartsWith(keyword_import))
                {
                    string str = line.Replace(keyword_import, "");
                    str = str.Trim();
                    str = str.Substring(1, str.Length - 2);

                    CreateTreeNodes(frmScp.tvwImported, str);

                    lst = UtilIO.ReadFile(Path.Combine(Application.StartupPath, str));

                    ParseLines(lst);
                }
            }

            foreach (TreeNode node in _nodesFiles)
            {
                node.Expand();
            }

            _frm.tvwImported.SelectedNode = _frm.tvwImported.Nodes[0];

            return(true);
        }
Example #3
0
        public static string[] Load(FrmScripter frmScp, MRU mru, string path)
        {
            if (!File.Exists(path))
            {
                UtilSys.MessageBox("File '" + path + "' does not exist.");
                mru.Remove(path);
                mru.Save();
                return(null);
            }

            frmScp.Output("Loading file: " + path);

            string[] buffer = UtilIO.ReadFile2Array(path);

            mru.Add(path);
            mru.Save();

            return(buffer);
        }
Example #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!Util.Support.CreateFolderStructure(Application.StartupPath))
            {
                UtilSys.MessageBoxError("Error Creating the QABOT Folder Structure.");
                System.Environment.Exit(-1);
                Application.Exit();
                return;
            }

            //UtilSys.MessageBoxInfo("Startup: " + Application.StartupPath);

            string path = Path.Combine(Application.StartupPath, @"data\log\QABOT-Scripter.log");

            logger = new Logger(Globals.ProcessScripter, Application.ProductVersion, path, null);

            string[] args = Environment.GetCommandLineArgs();

            path = Path.Combine(Application.StartupPath, @"data\settings\QABOT-Scripter-Settings.dat");

            // try to load setting two times
            // if first time fails then, probably settings file or folder does not exist (will be created and filled with default data)
            // return value is false, then try to load the settings second time
            if (!Settings.Load(path))
            {
                Settings.Load(path);
            }

            ScripterForm = new FrmScripter();

            _host = new HostScripter(ScripterForm);

            if (!HandleCommandLineArgs())
            {
                System.Environment.Exit(-1);
                Application.Exit();
            }

            Application.Run(ScripterForm);
        }