Exemple #1
0
 void LoadIni(AppIniFile ini)
 {
     Session.Action             = ini.GetActionType("General", "ActionType") ?? ActionType.Extract;
     Session.FolderPath         = ini.GetString("General", "FolderPath");
     Session.FilePath           = ini.GetString("General", "FilePath");
     Session.DiffTool           = ini.GetString("DiffTool", "Path");
     Session.DiffToolParameters = ini.GetString("DiffTool", "Parameters") ?? "\"{OldFile}\" \"{NewFile}\"";
 }
Exemple #2
0
        void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var ini = new AppIniFile(_store, "LastSession.ini", Encoding.UTF8);

            // don't persist these settings
            ini.Delete("General", "ActionType");
            ini.Delete("General", "FolderPath");
            ini.Delete("General", "FilePath");
            ini.Delete("General", "AutoRun");

            ini.AddFile(Path.Combine(Environment.CurrentDirectory, "VBASync.ini"));
            ini.AddFile(Path.Combine(Environment.CurrentDirectory, Process.GetCurrentProcess().ProcessName + ".ini"));
            var args          = Environment.GetCommandLineArgs();
            var autoRunSwitch = false;

            for (var i = 1; i < args.Length; i++)
            {
                switch (args[i].ToUpperInvariant())
                {
                case "-R":
                case "/R":
                    autoRunSwitch = true;
                    break;

                default:
                    ini.AddFile(args[i]);
                    break;
                }
            }

            Session.Action             = ini.GetActionType("General", "ActionType") ?? ActionType.Extract;
            Session.FolderPath         = ini.GetString("General", "FolderPath");
            Session.FilePath           = ini.GetString("General", "FilePath");
            Session.DiffTool           = ini.GetString("DiffTool", "Path");
            Session.DiffToolParameters = ini.GetString("DiffTool", "Parameters") ?? "\"{OldFile}\" \"{NewFile}\"";

            if (!string.IsNullOrEmpty(Session.FolderPath) && !string.IsNullOrEmpty(Session.FilePath))
            {
                refreshButton_Click(null, null);
                if (autoRunSwitch || (ini.GetBool("General", "AutoRun") ?? false))
                {
                    okButton_Click(null, null);
                }
            }
        }