private void checkConsistency() { if (debugOptions == null) { debugOptions = new DebugSettings(); } if (languageFile == null) { languageFile = ReleaseFolders.getLanguageFilePath(ReleaseFolders.LANGUAGE_ENGLISH); } if (aboutFile == null) { aboutFile = "Assets/Resources/" + ReleaseFolders.LANGUAGE_DIR_EDITOR + "/" + ReleaseFolders.getDefaultAboutFilePath(); } if (loadingImage == null) { loadingImage = "Assets/Resources/" + ReleaseFolders.IMAGE_LOADING_DIR + " / " + Controller.getInstance().getDefaultLanguage() + "/Editor2D-Loading.png"; } if (exportsPath == null) { } if (projectsPath == null) { } if (reportsPath == null) { } if (recentFiles == null) { recentFiles = new RecentFiles(new Properties(instance.configFile)); } }
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(); } }