/// <summary> /// Loads all saved projects /// </summary> /// <returns></returns> private static void LoadProjects() { var dirInf = new DirectoryInfo(ConstantDefinitions.RelativeProjectsPath); Log.LogInfo("Loading projects..."); // TODO : Tell user he has to create a project ... startup page? // If dir doesn't exist, a new project has to be created if (!dirInf.Exists || dirInf.GetDirectories().Length == 0) { Log.LogWarning("No projects found."); if (!dirInf.Exists) { dirInf.Create(); } return; } var subDirs = dirInf.GetDirectories(); if (subDirs.Length == 0) { Log.LogWarning("No projects found."); return; } // Now load all the project's names into a list so they can be accessed if needed foreach (var dir in subDirs) { FoundProjectsNames.Add(dir.Name); Log.LogInfo("Found project with name: " + dir.Name); } }
/// <summary> /// Loads the last known profile, profile history, creates a logging instance. /// If this fails, the application will not work and should shut down. /// </summary> /// <returns>True on success</returns> public static bool Init() { if (!LoadGlobalSettings()) { Log.LogError("Failed to load global settings!"); return(false); } Log.LogInfo("Successfully loaded global settings."); // No way to fail, if there are no projects a new one will have to be created LoadProjects(); Log.LogInfo("Successfully loaded profiles."); FoundProjectsNames.Add("fakeProject"); LoadGameTemplates(); return(true); }