Exemple #1
0
        public Dialog(Bolt bolt, string Title,
                      ConsoleColor foreColor = ConsoleColor.White,
                      ConsoleColor backColor = ConsoleColor.Black) : base(bolt)
        {
            this.Title     = Title;
            this.backColor = backColor;
            this.foreColor = foreColor;

            Format(new Location(0, GUI.ScreenHeight / 3), new Size(GUI.ScreenWidth, GUI.ScreenHeight / 3));

            Focus();
        }
Exemple #2
0
 public CommandPanel(Bolt bolt) : base(bolt)
 {
     currentNotification = defaultNotification;
 }
 public GraphicalInterface(Bolt bolt)
 {
     this.bolt = bolt;
 }
Exemple #4
0
 public StatusBar(Bolt bolt, string fileLocation) : base(bolt)
 {
     FileLocation = fileLocation;
 }
Exemple #5
0
 public Editor(Bolt bolt, CodeFile codeFile) : base(bolt)
 {
     this.codeFile          = codeFile;
     lines                  = new List <string>(codeFile.code.Split('\n'));
     bolt.CurrentlyUpdating = this;
 }
Exemple #6
0
 public InputManager(Bolt bolt)
 {
     this.bolt = bolt;
 }
Exemple #7
0
        /*
         * Controls;
         *  Exit: CTRL+C
         *  Save: CTRL+O (O for out)
         *  Exit and Save (CTRL+X)
         */

        public Bolt(string[] args)
        {
            string fileLocation = args[0];

            if (!fileLocation.Contains("/"))
            {
                fileLocation = Directory.GetCurrentDirectory() + "/" + fileLocation;
            }
            //Load parameters from command line arguments
            LoadParams(args);

            if (!DO_EXECUTE)
            {
                return;
            }

            if (!File.Exists(fileLocation))
            {
                File.Create(fileLocation).Close();
            }

            //Uncomment for file input information, aswell as; working directory.
            ///Console.WriteLine("DIR: " + Directory.GetCurrentDirectory());
            ///Console.WriteLine(fileLocation);
            ///return;

            instance = this;

            //TODO: check for NO_LOAD_CONFIG flag in command line args
            settings = new Settings();
            settings.LoadSettings(((OSInfo.OS_OSX || OSInfo.OS_WINDOWS) ? "/Users" : "/home") + $"/{Environment.UserName}/.boltrc");
            if (Settings.LOAD_FAILED)
            {
                Logger.LogError("Failed to load settings... Exiting.");
                return;
            }

            Console.Clear();

            GUI.Initialize(this);

            isRepository = Directory.Exists(fileLocation) && File.Exists(fileLocation);

            if (isRepository)
            {
                //Editing a directory (Repository)
                RootDirectory = new SubDirectory(fileLocation);
                RootDirectory.ScanDirectory();
            }
            else
            {
                //Editing a single file
                codeFile = new CodeFile(new SubDirectory(fileLocation), Path.GetFileName(fileLocation));
            }

            inputManager = new InputManager(this);

            //Console Initialization
            //Undone when CTRL+C is pressed in InputManager.cs
            Console.CursorVisible        = true;
            Console.TreatControlCAsInput = true;

            //Initialize Text Ballet (Bottom of screen)
            commandPanel = new CommandPanel(this);
            commandPanel.Format(new Location(0, GUI.ScreenHeight), new Size(GUI.ScreenWidth, 1));
            AddComponent(commandPanel);

            //Initialize Text/Code Editor
            editor = new Editor(this, codeFile);
            editor.Format(new Location(0, 0), new Size(GUI.ScreenWidth, GUI.ScreenHeight - 1));
            editor.Focus();
            AddComponent(editor);

            //Start the GUI Listener
            //this will raise an event when the console is resized.
            GUI.StartGUIEventListener();

            //Draw components to screen
            Refresh();

            inputManager.StartListener();
        }
Exemple #8
0
        private static readonly bool ENABLED = true;         //TURN TO FALSE FOR LOGGER.cs OUTPUT

        public static void Initialize(Bolt bolt)
        {
            GUI.bolt = bolt;
        }
Exemple #9
0
 public CodeEditor(Bolt bolt) : base(bolt)
 {
 }