示例#1
0
        private ConfigData(string fileName)
        {
            Debug.Log("Loading config data at: " + fileName);
            this.configFile = fileName;
            Properties configuration = new Properties(fileName);

            try
            {
                configuration.Reload(fileName);
                languageFile = configuration.GetProperty("LanguageFile");
                aboutFile    = configuration.GetProperty("AboutFile");
                loadingImage = configuration.GetProperty("LoadingImage");

                // Editor
                editorWindowX = ExParsers.ParseDefault(configuration.GetProperty("EditorWindowX"), int.MaxValue);
                editorWindowY = ExParsers.ParseDefault(configuration.GetProperty("EditorWindowY"), int.MaxValue);
                editorWindowW = ExParsers.ParseDefault(configuration.GetProperty("EditorWindowWidth"), int.MaxValue);
                editorWindowH = ExParsers.ParseDefault(configuration.GetProperty("EditorWindowHeight"), int.MaxValue);
                engineWindowX = ExParsers.ParseDefault(configuration.GetProperty("EngineWindowX"), int.MaxValue);
                engineWindowY = ExParsers.ParseDefault(configuration.GetProperty("EngineWindowY"), int.MaxValue);
                engineWindowW = ExParsers.ParseDefault(configuration.GetProperty("EngineWindowWidth"), int.MaxValue);
                engineWindowH = ExParsers.ParseDefault(configuration.GetProperty("EngineWindowHeight"), int.MaxValue);
                debugWindowX  = ExParsers.ParseDefault(configuration.GetProperty("DebugWindowX"), int.MaxValue);
                debugWindowY  = ExParsers.ParseDefault(configuration.GetProperty("DebugWindowY"), int.MaxValue);
                debugWindowW  = ExParsers.ParseDefault(configuration.GetProperty("DebugWindowWidth"), int.MaxValue);
                debugWindowH  = ExParsers.ParseDefault(configuration.GetProperty("DebugWindowHeight"), int.MaxValue);


                showItemReferences_F = bool.Parse(configuration.GetProperty("ShowItemReferences"));
                showNPCReferences_F  = bool.Parse(configuration.GetProperty("ShowNPCReferences"));
                showStartDialog_F    = bool.Parse(configuration.GetProperty("ShowStartDialog"));

                debugOptions = new DebugSettings();
                if (configuration.GetProperty("PaintBoundingAreas") != null)
                {
                    debugOptions.setPaintBoundingAreas(bool.Parse(configuration.GetProperty("PaintBoundingAreas")));
                }
                if (configuration.GetProperty("PaintGrid") != null)
                {
                    debugOptions.setPaintGrid(bool.Parse(configuration.GetProperty("PaintGrid")));
                }
                if (configuration.GetProperty("PaintHotSpots") != null)
                {
                    debugOptions.setPaintHotSpots(bool.Parse(configuration.GetProperty("PaintHotSpots")));
                }

                exportsPath = configuration.GetProperty("ExportsDirectory");
                if (exportsPath != null)
                {
                    ReleaseFolders.setExportsPath(exportsPath);
                }
                reportsPath = configuration.GetProperty("ReportsDirectory");
                if (reportsPath != null)
                {
                    ReleaseFolders.setReportsPath(reportsPath);
                }
                projectsPath = configuration.GetProperty("ProjectsDirectory");
                if (projectsPath != null)
                {
                    ReleaseFolders.setProjectsPath(projectsPath);
                }

                effectSelectorTab = ExParsers.ParseDefault(configuration.GetProperty("EffectSelectorTab"), 0);
                extraProperties   = new Properties();
                if (!string.IsNullOrEmpty(configuration.GetProperty("ExtraProperties")))
                {
                    extraProperties.ReloadFromString(configuration.GetProperty("ExtraProperties"));
                }
            }
            catch (FileNotFoundException)
            {
                checkConsistency();
            }
            catch (IOException)
            {
                checkConsistency();
            }
            catch (Exception)
            {
                checkConsistency();
            }
        }
示例#2
0
        private ConfigData(string fileName)
        {
            this.configFile = fileName;
            Properties configuration = new Properties(fileName);

            try
            {
                configuration.reload(fileName);
                languageFile = configuration.getProperty("LanguageFile");
                aboutFile    = configuration.getProperty("AboutFile");
                loadingImage = configuration.getProperty("LoadingImage");

                // Editor
                try
                {
                    editorWindowX = int.Parse(configuration.getProperty("EditorWindowX"));

                    /*if (editorWindowX<0 || editorWindowX>size.width){
                     *  editorWindowX=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    editorWindowX = int.MaxValue;
                }
                try
                {
                    editorWindowY = int.Parse(configuration.getProperty("EditorWindowY"));

                    /*if (editorWindowY<0 || editorWindowY>size.height){
                     *  editorWindowY=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    editorWindowY = int.MaxValue;
                }
                try
                {
                    editorWindowW = int.Parse(configuration.getProperty("EditorWindowWidth"));

                    /*if (editorWindowW<0 || editorWindowW>size.width){
                     *  editorWindowW=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    editorWindowW = int.MaxValue;
                }
                try
                {
                    editorWindowH = int.Parse(configuration.getProperty("EditorWindowHeight"));

                    /*if (editorWindowH<0 || editorWindowH>size.height){
                     *  editorWindowH=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    editorWindowH = int.MaxValue;
                }

                // Engine
                try
                {
                    engineWindowX = int.Parse(configuration.getProperty("EngineWindowX"));

                    /*if (engineWindowX<0 || engineWindowX>size.width){
                     *  engineWindowX=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    engineWindowX = int.MaxValue;
                }
                try
                {
                    engineWindowY = int.Parse(configuration.getProperty("EngineWindowY"));

                    /*if (engineWindowY<0 || engineWindowY>size.height){
                     *  engineWindowY=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    engineWindowY = int.MaxValue;
                }
                try
                {
                    engineWindowW = int.Parse(configuration.getProperty("EngineWindowWidth"));

                    /*if (engineWindowW<0 || engineWindowW>size.width){
                     *  engineWindowW=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    engineWindowW = int.MaxValue;
                }
                try
                {
                    engineWindowH = int.Parse(configuration.getProperty("EngineWindowHeight"));

                    /*if (engineWindowH<0 || engineWindowH>size.height){
                     *  engineWindowH=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    engineWindowH = int.MaxValue;
                }

                // Debug
                try
                {
                    debugWindowX = int.Parse(configuration.getProperty("DebugWindowX"));

                    /*if (debugWindowX<0 || debugWindowX>size.width){
                     *  debugWindowX=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    debugWindowX = int.MaxValue;
                }
                try
                {
                    debugWindowY = int.Parse(configuration.getProperty("DebugWindowY"));

                    /*if (debugWindowY<0 || debugWindowY>size.height){
                     *  debugWindowY=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    debugWindowY = int.MaxValue;
                }
                try
                {
                    debugWindowW = int.Parse(configuration.getProperty("DebugWindowWidth"));

                    /*if (debugWindowW<0 || debugWindowW>size.width){
                     *  debugWindowW=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    debugWindowW = int.MaxValue;
                }
                try
                {
                    debugWindowH = int.Parse(configuration.getProperty("DebugWindowHeight"));

                    /*if (debugWindowH<0 || debugWindowH>size.height){
                     *  debugWindowH=int.MaxValue;
                     * }*/
                }
                catch (FormatException)
                {
                    debugWindowH = int.MaxValue;
                }


                showItemReferences_F = bool.Parse(configuration.getProperty("ShowItemReferences"));
                showNPCReferences_F  = bool.Parse(configuration.getProperty("ShowNPCReferences"));
                showStartDialog_F    = bool.Parse(configuration.getProperty("ShowStartDialog"));

                debugOptions = new DebugSettings();
                if (configuration.getProperty("PaintBoundingAreas") != null)
                {
                    debugOptions.setPaintBoundingAreas(bool.Parse(configuration.getProperty("PaintBoundingAreas")));
                }
                if (configuration.getProperty("PaintGrid") != null)
                {
                    debugOptions.setPaintGrid(bool.Parse(configuration.getProperty("PaintGrid")));
                }
                if (configuration.getProperty("PaintHotSpots") != null)
                {
                    debugOptions.setPaintHotSpots(bool.Parse(configuration.getProperty("PaintHotSpots")));
                }

                exportsPath = configuration.getProperty("ExportsDirectory");
                if (exportsPath != null)
                {
                    ReleaseFolders.setExportsPath(exportsPath);
                }
                reportsPath = configuration.getProperty("ReportsDirectory");
                if (reportsPath != null)
                {
                    ReleaseFolders.setReportsPath(reportsPath);
                }
                projectsPath = configuration.getProperty("ProjectsDirectory");
                if (projectsPath != null)
                {
                    ReleaseFolders.setProjectsPath(projectsPath);
                }
                try
                {
                    effectSelectorTab = int.Parse(configuration.getProperty("EffectSelectorTab"));
                }
                catch (Exception)
                {
                    effectSelectorTab = 0;
                }

                recentFiles = new RecentFiles(configuration);
            }
            catch (FileNotFoundException)
            {
                checkConsistency();
            }
            catch (IOException)
            {
                checkConsistency();
            }
            catch (Exception)
            {
                checkConsistency();
            }
        }