Example #1
0
        static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ProjectManager projectSelect;

            //Properties.Settings.Default.Upgrade();
            settings = ProjectManagerSettings.Load();

            // first check to see if we're configured properly.
            if (!AnyGamesConfigured())
            {
                GameConfig   gameConfig   = new GameConfig();
                DialogResult configResult = gameConfig.ShowDialog();

                if (configResult == DialogResult.Abort)
                {
                    return((int)SA_Tools.Split.SplitERRORVALUE.InvalidConfig);
                }
                gameConfig.Dispose();
            }

            // todo: catch unhandled exceptions
            projectSelect = new ProjectManager();
            Application.ThreadException += Application_ThreadException;
            Application.Run(projectSelect);

            return(0);
        }
Example #2
0
 /// <summary>
 /// Updates colors of a all document tabs
 /// </summary>
 public static void UpdateTabColors(ProjectManagerSettings settings)
 {
     if (PluginBase.CurrentProject == null)
     {
         foreach (ITabbedDocument doc in PluginBase.MainForm.Documents)
         {
             DockContent tab = doc as DockContent;
             if (doc.IsEditable && tab.TabColor != Color.Transparent)
             {
                 tab.TabColor = Color.Transparent;
             }
         }
     }
     else if (!PluginBase.MainForm.ClosingEntirely)
     {
         List<String> paths = new List<String>();
         paths.Add(Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath));
         foreach (String path in PluginBase.CurrentProject.SourcePaths)
         {
             paths.Add(PluginBase.CurrentProject.GetAbsolutePath(path));
         }
         foreach (ITabbedDocument doc in PluginBase.MainForm.Documents)
         {
             if (doc.IsEditable) UpdateTabColor(doc, paths, settings);
         }
     }
 }
Example #3
0
        public static ProjectManagerSettings Load(string iniPath)
        {
            if (File.Exists(iniPath))
            {
                return((ProjectManagerSettings)IniSerializer.Deserialize(typeof(ProjectManagerSettings), iniPath));
            }
            else
            {
                ProjectManagerSettings result = new ProjectManagerSettings()
                {
                    SA2PCPath  = "",
                    SADXPCPath = ""
                };

                return(result);
            }
        }
Example #4
0
 public void LoadSettings()
 {
     Settings = new ProjectManagerSettings();
     if (!Directory.Exists(SettingsDir))
     {
         Directory.CreateDirectory(SettingsDir);
     }
     if (!File.Exists(SettingsPath))
     {
         this.SaveSettings();
     }
     else
     {
         Object obj = ObjectSerializer.Deserialize(SettingsPath, Settings);
         Settings = (ProjectManagerSettings)obj;
         PatchSettings();
     }
     // set manually to avoid dependency in FDBuild
     FileInspector.ExecutableFileTypes = Settings.ExecutableFileTypes;
     Settings.Changed += SettingChanged;
 }
Example #5
0
 /// <summary>
 /// Updates color of a document tab
 /// </summary>
 private static void UpdateTabColor(ITabbedDocument doc, List<String> paths, ProjectManagerSettings settings)
 {
     Boolean isMatch = false;
     foreach (String path in paths)
     {
         if (doc.FileName.StartsWith(path, StringComparison.OrdinalIgnoreCase))
         {
             isMatch = true;
             break;
         }
     }
     DockContent tab = doc as DockContent;
     if (!isMatch && settings.TabHighlightType == HighlightType.ExternalFiles)
     {
         if (tab.TabColor != settings.TabHighlightColor) tab.TabColor = settings.TabHighlightColor;
     }
     else if (isMatch && settings.TabHighlightType == HighlightType.ProjectFiles)
     {
         if (tab.TabColor != settings.TabHighlightColor) tab.TabColor = settings.TabHighlightColor;
     }
     else if (tab.TabColor != Color.Transparent) tab.TabColor = Color.Transparent;
 }
Example #6
0
 public void LoadSettings()
 {
     Settings = new ProjectManagerSettings();
     if (!Directory.Exists(SettingsDir)) Directory.CreateDirectory(SettingsDir);
     if (!File.Exists(SettingsPath)) this.SaveSettings();
     else
     {
         Object obj = ObjectSerializer.Deserialize(SettingsPath, Settings);
         Settings = (ProjectManagerSettings)obj;
         PatchSettings();
     }
     // set manually to avoid dependency in FDBuild
     FileInspector.ExecutableFileTypes = Settings.ExecutableFileTypes;
     Settings.Changed += SettingChanged;
 }
Example #7
0
        static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ProjectManager projectSelect;

            //Properties.Settings.Default.Upgrade();
            settings = ProjectManagerSettings.Load();

            StartupArgs startupArgs = new StartupArgs();

            startupArgs.mode = CLIMode.None;

            FluentCommandLineParser parser = new FluentCommandLineParser();

            // parse main options
            parser.Setup <CLIMode>('m', "mode").Callback((CLIMode mode) =>
            {
                startupArgs.mode = mode;
            });

            // parse split options
            parser.Setup <string>('f', "FileToSplit").Callback((string fileToSplit) => { startupArgs.filePath = fileToSplit; });
            parser.Setup <string>('o', "OutputFolder").Callback((string folder) => { startupArgs.outputFolder = folder; });
            parser.Setup <string>('d', "DataMappingFilePath").Callback((string mappingPath) => { startupArgs.dataMappingPath = mappingPath; });
            parser.Setup <bool>('b', "BigEndian").Callback((bool bigEndian) => { startupArgs.isBigEndian = bigEndian; });
            parser.Setup <List <string> >('a', "AnimationList").Callback((List <string> animationList) => { startupArgs.animationList = animationList.ToArray(); });
            //parser.Setup<bool>

            // parse build options
            parser.Setup <string>('p', "ProjectName").Callback((string projectName) => { startupArgs.projectName = projectName; });
            parser.Setup <SA_Tools.Game>('g', "Game").Callback((SA_Tools.Game game) => { startupArgs.game = game; });
            parser.Setup <bool>('r', "RunAfterBuild").Callback((bool runAfterbuild) => { startupArgs.runAfterBuild = runAfterbuild; });

            // do help
            parser.SetupHelp("?", "help").Callback((string text) =>
            {
                Console.WriteLine("Project Manager cmd line options:");
                Console.WriteLine(text);
                Console.WriteLine("NOTE: Not all of these options are valid in all contexts.");
                Console.WriteLine("You must set Mode. To either Split, SplitMDL, or Build.");
                Console.WriteLine("Split requires:");
                Console.WriteLine("   FileToSplit: This is the file with the data you'd like to extract.");
                Console.WriteLine("   DataMappingFilePath: This is the INI file that says where things are in the data file.");
                Console.WriteLine("   OutputFolder: This is where the split data will be placed.");
                Console.WriteLine();
                Console.WriteLine("SplitMDL requires everything Split does but also:");
                Console.WriteLine("   BigEndian: true/false. States whether or not the file is big endian.");
                Console.WriteLine("   AnimationList: (optional) a list of SAAnimation files to use. Paths are relative to the mdl file.");
                Console.WriteLine("Build requires:");
                Console.WriteLine("   ProjectName: name of the project to build.");
                Console.WriteLine("   Game: Game the project is for. Valid values are SADXPC and SA2B");
                Console.WriteLine("   RunAfterBuild: true/false. Whether or not to start the game and load the mod after build is complete");
            });

            parser.Parse(args);

            if (startupArgs.mode != CLIMode.None)            // user wants to use the CLI
            {
                switch (startupArgs.mode)
                {
                case CLIMode.Split:
                    CLISplit(startupArgs);
                    break;

                case CLIMode.SplitMDL:
                    CLISplitMDL(startupArgs);
                    break;

                case CLIMode.Build:
                    CLIBuild(startupArgs);
                    break;

                default:
                    break;
                }
            }
            else
            {
                // first check to see if we're configured properly.
                if (!AnyGamesConfigured())
                {
                    GameConfig   gameConfig   = new GameConfig();
                    DialogResult configResult = gameConfig.ShowDialog();

                    if (configResult == DialogResult.Abort)
                    {
                        return((int)ERRORVALUE.InvalidConfig);
                    }
                    gameConfig.Dispose();
                }

                // todo: catch unhandled exceptions
                projectSelect = new ProjectManager();
                Application.ThreadException += Application_ThreadException;
                Application.Run(projectSelect);
            }

            return(0);
        }
Example #8
0
 public void LoadSettings()
 {
     Settings = new ProjectManagerSettings();
     if (!Directory.Exists(SettingsDir)) Directory.CreateDirectory(SettingsDir);
     if (!File.Exists(SettingsPath)) this.SaveSettings();
     else
     {
         Object obj = ObjectSerializer.Deserialize(SettingsPath, Settings);
         Settings = (ProjectManagerSettings)obj;
     }
     // Fix empty key bindings...
     if (Settings.ShortcutTestMovie == Keys.None)
     {
         Settings.ShortcutTestMovie = ProjectManagerSettings.DEFAULT_TESTMOVIE;
     }
     if (Settings.ShortcutBuildProject == Keys.None)
     {
         Settings.ShortcutBuildProject = ProjectManagerSettings.DEFAULT_BUILDPROJECT;
     }
     if (Settings.ShortcutOpenResource == Keys.None)
     {
         Settings.ShortcutOpenResource = ProjectManagerSettings.DEFAULT_OPENRESOURCE;
     }
     // set manually to avoid dependency in FDBuild
     FileInspector.ExecutableFileTypes = Settings.ExecutableFileTypes;
     Settings.Changed += SettingChanged;
 }
Example #9
0
        static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ProjectManager projectSelect;

            //Properties.Settings.Default.Upgrade();
            settings = ProjectManagerSettings.Load();

            StartupArgs startupArgs = new StartupArgs();

            startupArgs.mode = CLIMode.None;

            FluentCommandLineParser parser = new FluentCommandLineParser();

            // parse main options
            parser.Setup <CLIMode>('m', "mode").Callback(mode => startupArgs.mode = mode);

            // parse split options
            parser.Setup <string>('f', "FileToSplit").Callback(fileToSplit => startupArgs.filePath = fileToSplit);
            parser.Setup <string>('d', "DataMappingFilePath").Callback(mappingPath => startupArgs.dataMappingPath = mappingPath);
            parser.Setup <bool>('b', "BigEndian").Callback(bigEndian => startupArgs.isBigEndian    = bigEndian);
            parser.Setup <string>('o', "OutputFolder").Callback(folder => startupArgs.outputFolder = folder);
            parser.Setup <List <string> >('a', "AnimationList").Callback(animationList => startupArgs.animationList = animationList.ToArray());
            //parser.Setup<bool>

            // parse build options
            parser.Setup <string>('p', "ProjectName").Callback(projectName => startupArgs.projectName = projectName);
            parser.Setup <SA_Tools.Game>('g', "Game").Callback(game => startupArgs.game = game);
            parser.Setup <bool>('r', "RunAfterBuild").Callback(runAfterbuild => startupArgs.runAfterBuild = runAfterbuild);

            // do help
            parser.SetupHelp("?", "help").Callback(text => Console.WriteLine(text));

            parser.Parse(args);

            if (startupArgs.mode != CLIMode.None)            // user wants to use the CLI
            {
                switch (startupArgs.mode)
                {
                case CLIMode.Split:
                    CLISplit(startupArgs);
                    break;

                case CLIMode.SplitMDL:
                    CLISplitMDL(startupArgs);
                    break;

                case CLIMode.Build:
                    CLIBuild(startupArgs);
                    break;

                default:
                    break;
                }
            }
            else
            {
                // first check to see if we're configured properly.
                if (!AnyGamesConfigured())
                {
                    GameConfig   gameConfig   = new GameConfig();
                    DialogResult configResult = gameConfig.ShowDialog();

                    if (configResult == DialogResult.Abort)
                    {
                        return((int)ERRORVALUE.InvalidConfig);
                    }
                    gameConfig.Dispose();
                }

                // todo: catch unhandled exceptions
                projectSelect = new ProjectManager();
                Application.ThreadException += Application_ThreadException;
                Application.Run(projectSelect);
            }

            return(0);
        }