Example #1
0
        private static void Main()
        {
            // Get the command line arguments and check
            // if the current session is a restart
            string[] args = Environment.GetCommandLineArgs();
            if (args.Any(arg => arg == $"{ProgramController.ParameterPrefix}restart"))
            {
                isRestarted = true;
            }

            // Make sure only one instance is running
            // if the application is not currently restarting
            Mutex mutex = new Mutex(true, "ParserMini", out bool isUnique);

            if (!isUnique && !isRestarted)
            {
                MessageBox.Show(Strings.OtherInstanceRunning, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Initialize the controllers and
            // display the main user form
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LocalizationController.InitializeLocale();
            ProgramController.InitializeServerIp();
            Application.Run(new UI.Main());

            // Don't let the garbage
            // collector touch the Mutex
            GC.KeepAlive(mutex);
        }
Example #2
0
        /// <summary>
        /// Saves the main settings
        /// </summary>
        private void SaveSettings()
        {
            Properties.Settings.Default.DirectoryPath    = DirectoryPath.Text;
            Properties.Settings.Default.RemoveTimestamps = RemoveTimestamps.Checked;

            Properties.Settings.Default.Save();
            ProgramController.InitializeServerIp();
        }
Example #3
0
        /// <summary>
        /// Attempts to parse the
        /// current chat log
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Parse_Click(object sender, EventArgs e)
        {
            // The paths may have changed since the program has
            // started, we need to initialize the locations again
            ProgramController.InitializeServerIp();

            if (string.IsNullOrWhiteSpace(DirectoryPath.Text) || !Directory.Exists(DirectoryPath.Text + "client_resources\\"))
            {
                MessageBox.Show(Strings.InvalidDirectoryPath, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!File.Exists(DirectoryPath.Text + ProgramController.LogLocation))
            {
                MessageBox.Show(Strings.NoChatLog, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Parsed.Text = ProgramController.ParseChatLog(DirectoryPath.Text, RemoveTimestamps.Checked);
        }