예제 #1
0
 public static void ShowGUI()
 {
     MainForm = new MainFrm();
     Application.Run(MainForm);
 }
예제 #2
0
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Load Addons
            if (Directory.Exists("Addons"))
            {
                Addon.LoadAddons(new DirectoryInfo("Addons").FullName);
            }


            if (args.Length < 1)
            {
                ShowGUI();
            }
            else
            {
                switch (args[0].ToLower())
                {
                case "/e":
                {
                    if (args.Length < 2)
                    {
                        ShowHelp();
                        break;
                    }

                    try
                    {
                        // Load the archive
                        FileInfo fileInfo = new FileInfo(args[1]);
                        var      arc      = LoadArchive(args[1]);

                        // Extract it's contents
                        var dir = (args.Length < 3) ?
                                  Path.Combine(fileInfo.DirectoryName,
                                               fileInfo.Name.Substring(0, fileInfo.Name.Length -
                                                                       fileInfo.Extension.Length))
                                    : args[2];

                        Directory.CreateDirectory(dir);
                        arc.Extract(dir);
                        // Prints the working directory.
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, ProgramName,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    break;
                }

                case "/temp":
                    System.Diagnostics.Process.Start("explorer", $"\"{MainFrm.tempPath}\"");
                    break;

                case "/fa":
                    if (args.Length < 2)
                    {
                        ShowHelp();
                        break;
                    }
                    if (args[1].ToLower() == GensArchive.ListExtension)
                    {
                        SetFileAssociation(GensArchive.ListExtension, "GensARLArchive", "Sonic Generations Archive");
                    }
                    else if (args[1].ToLower() == GensArchive.PFDExtension)
                    {
                        SetFileAssociation(GensArchive.PFDExtension, "GensPFDArchive", "Sonic Generations Archive");
                    }
                    else if (args[1].ToLower() == LWArchive.Extension)
                    {
                        SetFileAssociation(LWArchive.Extension, "LWPACArchive", "Sonic Lost World Archive");
                    }
                    else if (args[1].ToLower() == ONEArchive.Extension)
                    {
                        SetFileAssociation(ONEArchive.Extension, "ONEArchive", "Sonic Heroes ONE Archive");
                    }
                    else if (args[1].ToLower() == SBArchive.Extension)
                    {
                        SetFileAssociation(SBArchive.Extension, "SBArchive", "Story Book ONE Archive");
                    }
                    break;

                case "/?":
                    ShowHelp();
                    break;

                default:
                {
                    if (!File.Exists(args[0]))
                    {
                        ShowHelp();
                        break;
                    }

                    MainForm = new MainFrm();
                    MainForm.OpenArchive(args[0]);
                    MainForm.RefreshGUI();

                    Application.Run(MainForm);
                    break;
                }
                }
            }
        }