/// <summary> /// Forcing references files and base Quasar Mod Types to be refreshed in the user folder /// </summary> public static void UpdateInstallation() { String ResourcePath = Properties.Settings.Default.DefaultDir + "\\Resources\\"; String AppPath = Properties.Settings.Default.AppPath + "\\Resources\\"; FileOperation.CheckCopyFolder(AppPath, ResourcePath, true, true); }
/// <summary> /// Moves the installation files to a new location /// </summary> /// <param name="newPath">New install folder path</param> public static void ChangeInstallLocation(string newPath) { string SourcePath = Properties.Settings.Default.DefaultDir; bool proceed = true; try { FileOperation.CheckCopyFolder(SourcePath + "\\Library", newPath + "\\Library"); FileOperation.CheckCopyFolder(SourcePath + "\\Resources", newPath + "\\Resources"); File.Copy(SourcePath + "\\Quasar.log", newPath + "\\Quasar.log", true); } catch (Exception e) { proceed = false; } if (proceed) { try { Directory.Delete(SourcePath + "\\Library", true); } catch (Exception e) { proceed = false; } } if (proceed) { Properties.Settings.Default.DefaultDir = newPath; Properties.Settings.Default.Save(); ModalEvent Meuh = new ModalEvent() { EventName = "MoveInstall", Action = "LoadOK", }; EventSystem.Publish <ModalEvent>(Meuh); } else { ModalEvent Meuh = new ModalEvent() { EventName = "MoveInstall", Action = "LoadKO", }; EventSystem.Publish <ModalEvent>(Meuh); } }
public void ImportFolder(string FolderPath) { //Creating destination if (!Directory.Exists(LibraryContentFolderPath)) { Directory.CreateDirectory(LibraryContentFolderPath); } //Emptying it if necessary FileOperation.RecreateFolder(LibraryContentFolderPath); //Copying mod files FileOperation.CheckCopyFolder(FolderPath, LibraryContentFolderPath); }
/// <summary> /// Verifies needed folders for execution /// </summary> public static void CreateBaseFolders() { //Setting Paths String InstallationPath = Properties.Settings.Default.DefaultDir; String AppPath = Properties.Settings.Default.AppPath; String LibraryPath = "\\Library\\"; String ModsPath = "\\Library\\Mods\\"; String DownloadsPath = "\\Library\\Downloads\\"; String ScreenshotPath = "\\Library\\Screenshots\\"; String ResourcePath = "\\Resources\\"; FileOperation.CheckCreate(InstallationPath); FileOperation.CheckCreate(InstallationPath + LibraryPath); FileOperation.CheckCreate(InstallationPath + ModsPath); FileOperation.CheckCreate(InstallationPath + DownloadsPath); FileOperation.CheckCreate(InstallationPath + ScreenshotPath); FileOperation.CheckCopyFolder(AppPath + ResourcePath, InstallationPath + ResourcePath); }
public static void GetMoveOldLibrary(ILog QuasarLogger) { QuasarLogger.Debug("Loading Old Library"); List <Data.V1.LibraryMod> OldLibrary = Quasar.Helpers.XML.XMLHelper.GetLibraryModList(); ObservableCollection <LibraryItem> NewLibrary = new ObservableCollection <LibraryItem>(); QuasarLogger.Debug("Loading API"); GamebananaAPI API = JSonHelper.GetGamebananaAPI(); Directory.CreateDirectory(Properties.Settings.Default.DefaultDir + @"\LibraryBackup"); FileOperation.CheckCopyFolder(Properties.Settings.Default.DefaultDir + @"\Library", Properties.Settings.Default.DefaultDir + @"\LibraryBackup"); foreach (Data.V1.LibraryMod lm in OldLibrary) { QuasarLogger.Debug(String.Format("Processing Mod #{0}", lm.ID)); //Creating new item based on old one LibraryItem li = new LibraryItem() { GameID = lm.GameID, Guid = Guid.NewGuid(), Time = DateTime.Now, Name = lm.Name, }; //Finding corresponding data GamebananaRootCategory rc = API.Games[0].RootCategories.Single(c => c.Name == lm.TypeLabel); GamebananaSubCategory sc = rc.SubCategories.Single(c => c.Name == lm.APICategoryName); GamebananaItem item = new GamebananaItem() { Description = "", GamebananaItemID = lm.ID, Name = lm.Name, UpdateCount = lm.Updates, RootCategoryGuid = rc.Guid, SubCategoryGuid = sc.Guid, Authors = new ObservableCollection <Author>() }; //Processing Authors foreach (string[] val in lm.Authors) { Author au = new Author() { Name = val[0], Role = val[1], GamebananaAuthorID = int.Parse(val[2]) }; item.Authors.Add(au); } //Assigning GBItem to the LibraryItem li.GBItem = item; //Assigning item to the new Library NewLibrary.Add(li); QuasarLogger.Debug(String.Format("Processed Mod #{0}", lm.ID)); } QuasarLogger.Debug("Transferring Mods"); //Moving mods to new path TransferMods(NewLibrary, QuasarLogger); JSonHelper.SaveLibrary(NewLibrary); }