예제 #1
0
        public static void Main(string[] arg)
        {
            Process CurrentProcess = Process.GetCurrentProcess();

            CurrentProcess.PriorityBoostEnabled = true;
            CurrentProcess.PriorityClass        = ProcessPriorityClass.High;

            bool Priority  = false;
            bool LogExport = false;

            foreach (string Arg in arg)
            {
                bool Processed = true;
                switch (Arg)
                {
                case "-SafeMode":
                    Utils.InstanceData.UseDefaultSetting = true;
                    Utils.InstanceData.SafeMode          = true;
                    break;

                case "-Default":
                    Utils.InstanceData.UseDefaultSetting = true;
                    break;

                case "-DisableAS":
                    Utils.InstanceData.AutoSave = false;
                    break;

                case "-RaiseError":
                    Utils.InstanceData.ErrorRaise = true;
                    break;

                case "-Priotity":
                    Priority = true;
                    break;

                case "-Log":
                    Utils.InstanceData.LogMode = true;
                    break;

                case "-LogExport":
                    LogExport = true;
                    break;

                case "-DoNotInitialize":
                    Utils.InstanceData.DoNotInitialize = true;
                    break;

                case "-InitPluginDir":
                    Utils.InstanceData.DoNotInitialize = true;
                    Initialize();
                    System.IO.Directory.CreateDirectory(Config.Current.Path[Enums.Path.PluginDirectory]);
                    break;

                case "-Hash":
#if DEBUG == false
                    byte[] hash = Utils.InstanceData.SrtLib.Auth.ComputeHash(new System.Security.Cryptography.SHA256Managed(),
                                                                             Process.GetCurrentProcess().Modules[0].FileName);

                    Console.WriteLine(BitConverter.ToString(hash).Replace("-", ""));
#endif
                    break;

                default:
                    if (Priority)
                    {
                        switch (Arg)
                        {
                        case "RealTime":
                            CurrentProcess.PriorityClass = ProcessPriorityClass.RealTime;
                            break;

                        case "AboveNormal":
                            CurrentProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
                            break;

                        case "Normal":
                            CurrentProcess.PriorityClass = ProcessPriorityClass.Normal;
                            break;

                        case "Low":
                            CurrentProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
                            break;
                        }
                        Priority = false;
                    }
                    else if (LogExport)
                    {
                        Utils.InstanceData.LogExp     = true;
                        Utils.InstanceData.LogExpPath = Arg;
                    }
                    else if (Arg.StartsWith("-Loc"))
                    {
                        Utils.InstanceData.OverrideLanguage = true;
                        int ind = Arg.IndexOf("=");
                        Utils.InstanceData.LocalizeFilePath =
                            Arg.Substring(ind + 1, Arg.Length - ind - 1);
                    }
                    else
                    {
                        Priority  = false;
                        LogExport = false;
                        Processed = false;
                    }
                    break;
                }

                if (!Processed)
                {
                    Dialogs.LogWindow.Append(Arg + " : Unknown Arg");
                }
                else
                {
                    Dialogs.LogWindow.Append(Arg + " : Processed");
                }
            }

            if (!Utils.InstanceData.DoNotInitialize)
            {
                Initialize();

                if (Config.Current.bValue[Enums.bValue.AutoUpdate])
                {
                    UpdateMan.AutoUpdate(true);
                }

                App = new App();
                App.ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose;
                App.Exit        += App_Exit;
                App.DispatcherUnhandledException += App_DispatcherUnhandledException;
                App.InitializeComponent();

                LAPP.Events.AppendLog += Events_AppendLog;
                Dialogs.LogWindow.Append("LAP Initialized");

                App.Run();

                Utils.PluginManager.SaveInfo();
                Config.Save(Config.Current.Path[Enums.Path.SettingFile]);
            }
        }
예제 #2
0
 public static void Main()
 {
     LAP.App app = new LAP.App();
     app.InitializeComponent();
     app.Run();
 }