示例#1
0
文件: OPT.cs 项目: Rappelz/Grimoire
        public static void Load()
        {
            if (File.Exists("Grimoire.opt"))
            {
                using (StreamReader sR = new StreamReader("Grimoire.opt"))
                {
                    string lineVal = null;
                    while ((lineVal = sR.ReadLine()) != null)
                    {
                        if (!lineVal.StartsWith("#"))
                        {
                            string[] lineBlocks   = lineVal.Split(new char[] { ':' }, 2);
                            string   settingName  = lineBlocks[0];
                            string   settingValue = lineBlocks[1];
                            settings.Add(settingName, settingValue);
                        }
                    }
                }

                lManager.Enter(Logs.Sender.OPT, Logs.Level.NOTICE, "OPT Manager Initialized.\n\t- {0} settings loaded from Grimoire.opt", settings.Count);
            }
            else
            {
                string error = "Failed to load Grimoire.opt, it does not exist! Cannot continue! Closing.";
                System.Windows.Forms.MessageBox.Show(error, "Fatal Exception", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                lManager.Enter(Logs.Sender.OPT, Logs.Level.ERROR, error);
                GUI.Main.Instance.Close();
            }
        }
示例#2
0
文件: OPT.cs 项目: odasm/Grimoire
        public static void Load()
        {
            if (File.Exists("Grimoire.opt"))
            {
                using (StreamReader sR = new StreamReader("Grimoire.opt"))
                {
                    string currentLineValue = null;
                    while ((currentLineValue = sR.ReadLine()) != null)
                    {
                        if (!currentLineValue.StartsWith("#"))
                        {
                            //Break the line
                            string[] lineBlocks   = currentLineValue.Split(new char[] { ':' }, 2);
                            string   settingName  = lineBlocks[0];
                            string   settingValue = lineBlocks[1];
                            settings.Add(settingName, settingValue);
                        }
                    }
                }

                lManager.Enter(Logs.Sender.OPT, Logs.Level.NOTICE, "OPT Manager Initialized.\n\t- {0} settings loaded from Grimoire.opt", settings.Count);
            }
            else
            {
                lManager.Enter(Logs.Sender.OPT, Logs.Level.ERROR, "Failed to load Grimoire.opt, it does not exist");
            }
        }
示例#3
0
 public Manager()
 {
     main  = GUI.Main.Instance;
     tabs  = main.TabControl;
     pages = tabs.TabPages;
     lManager.Enter(Logs.Sender.MANAGER, Logs.Level.NOTICE, "Tab Manager Initialized.");
 }
示例#4
0
        private void UseFlag_Load(object sender, EventArgs e)
        {
            string flagsPath = Grimoire.Utilities.OPT.GetString("useflag.list_path");

            if (flagsPath == null)
            {
                MessageBox.Show("No path for flag file defined!", "Flag Path Exception", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }

            int flags = 0;

            if (File.Exists(flagsPath))
            {
                using (StreamReader sR = new StreamReader(flagsPath))
                {
                    string lineVal = null;
                    while ((lineVal = sR.ReadLine()) != null)
                    {
                        flagList.Items.Add(lineVal);
                        flags++;
                    }
                }

                lManager.Enter(Logs.Sender.USEFLAG, Logs.Level.NOTICE, "{0} Flags loaded to tab: {1}", flags, Tabs.Manager.Instance.Text);
            }
            else
            {
                string msg = string.Format("Could not load flag list at:\n{0}", flagsPath);
                lManager.Enter(Logs.Sender.USEFLAG, Logs.Level.ERROR, msg);
                MessageBox.Show(msg, "Load Flags Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        private void flipBtn_Click(object sender, EventArgs e)
        {
            if (output.Text.Length > 3)
            {
                input.Text = output.Text;
            }

            lManager.Enter(Sender.HASHER, Level.NOTICE, "User flipped input/output");
        }
示例#6
0
 public Hasher()
 {
     InitializeComponent();
     lManager = Logs.Manager.Instance;
     lManager.Enter(Logs.Sender.HASHER, Logs.Level.NOTICE, "Hasher Utility Started.");
     set_checks();
 }
示例#7
0
        public int FetchRowCount(string tableName)
        {
            try
            {
                DataSet ds = db.ExecuteWithResults(string.Format("SELECT COUNT(*) FROM dbo.{0}", tableName));
                return((int)ds.Tables[0].Rows[0][0]);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "SQL Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
                lManager.Enter(Logs.Sender.DATA, Logs.Level.SQL_ERROR, ex);
            }


            return(0);
        }
示例#8
0
        private void generate_new_list()
        {
            string[] styles = Grimoire.Utilities.OPT.GetString("tab.styles").Trim().Split(',');

            if (styles.Length == 0)
            {
                string msg = "Setting: tab.styles is missing or empty, please add at-least one tab style!";
                MessageBox.Show(msg);
                lManager.Enter(Logs.Sender.MAIN, Logs.Level.ERROR, msg);
            }

            new_list.Items.Clear();
            foreach (string style in styles)
            {
                new_list.Items.Add(style);
            }
        }
示例#9
0
        private void generate_new_list()
        {
            List <string> styles = ConfigMan["Styles"];

            if (styles.Count == 0)
            {
                string msg = "Setting: tab.styles is missing or empty, please add at-least one tab style!";
                MessageBox.Show(msg);
                lManager.Enter(Sender.MAIN, Level.ERROR, msg);
            }

            new_list.Items.Clear();
            foreach (string style in styles)
            {
                new_list.Items.Add(style);
            }
        }
示例#10
0
        public StructureManager(string directory)
        {
            names = Directory.GetFiles(directory);

            if (names.Length == 0)
            {
                lManager.Enter(Logs.Sender.MANAGER, Logs.Level.ERROR, "There are no files in the provided directory:\n\t{0}", directory);
                return;
            }
        }
示例#11
0
        void configureDB()
        {
            DbConType sqlEngine = (DbConType)confMgr["Engine", "DB"];

            db = new DBHelper(confMgr, sqlEngine);

            db.ProgressMaxSet += (o, x) =>
            {
                progressBar.Maximum = x.Maximum;

                //if (x.Message != null)
                //s_status_lb.Text = x.Message;
            };

            db.ProgressValueSet += (o, x) =>
            {
                progressBar.Value = x.Value;

                //if (x.Message != null)
                //ts_status_lb.Text = x.Message;
            };

            db.ProgressReset += (o, x) =>
            {
                progressBar.Maximum = 100;
                progressBar.Value   = 0;
                //ts_status_lb.Text = string.Empty;
            };

            db.Message += (o, x) => progressBar.Text = x.Message;

            db.Error += (o, x) =>
            {
                MessageBox.Show(x.Message, "SQL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                logMgr.Enter(Sender.RDB, Level.NOTICE, x.Message);
            };
        }
示例#12
0
        void generate_file_list()
        {
            string dir = Grimoire.Utilities.OPT.GetString("flag.directory") ?? string.Format(@"{0}\Flags", Directory.GetCurrentDirectory());

            if (!Directory.Exists(dir))
            {
                string msg = string.Format("flag.directory does not exist!\n\tDirectory: {0}", dir);

                MessageBox.Show(msg, "Flag Utility Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
                lManager.Enter(Logs.Sender.FLAG, Logs.Level.ERROR, msg);

                return;
            }

            string[] paths = Directory.GetFiles(dir);

            foreach (string filePath in paths)
            {
                lists.Add(Path.GetFileNameWithoutExtension(filePath));
            }

            lManager.Enter(Logs.Sender.FLAG, Logs.Level.DEBUG, "{0} flag files loaded from {1}", paths.Length, dir);
        }
示例#13
0
        public XmlManager()
        {
            key       = ConfigMan["Locale"];
            localeDir = ConfigMan.GetDirectory("Directory", "Localization");

            lManager.Enter(Sender.MANAGER, Level.NOTICE, "Localization Manager Started.");

            compileLocales();

            lManager.Enter(Sender.MANAGER, Level.DEBUG, string.Format("{0} locales loaded from:\n\t- {1}", locales.Count, localeDir));
        }
示例#14
0
 private void Core_MessageOccured(object sender, MessageArgs e)
 {
     Invoke(new MethodInvoker(delegate { status.Text = e.Message; }));
     lManager.Enter(Logs.Sender.DATA, Logs.Level.NOTICE, e.Message);
 }
示例#15
0
        public XmlManager()
        {
            lManager.Enter(Logs.Sender.MANAGER, Logs.Level.NOTICE, "Localization Manager Started.");

            compileLocales();

            lManager.Enter(Logs.Sender.MANAGER, Logs.Level.DEBUG, string.Format("{0} locales loaded from:\n\t- {1}", locales.Count, localeDir));
        }
示例#16
0
        private void ts_enc_list_Click(object sender, EventArgs e)
        {
            if (ts_enc_list.SelectedIndex != -1)
            {
                core.SetEncoding(Encodings.GetByName(ts_enc_list.Text));
            }

            lManager.Enter(Logs.Sender.RDB, Logs.Level.NOTICE, "Encoding: {0} set.", ts_enc_list.Text);
        }