private void GetStruc() { string path = Path.Combine(_GamePath, "Struct.info"); using (StreamWriter fs = new StreamWriter(path, false)) { fs.WriteLine(FoncSchem.TraitListFolder(_Tree, 0)); } }
/// <summary> /// Copie les images / Copy the images /// </summary> /// <remarks>To Add Mask see 'Where'</remarks> private void CopyImages() { //2020/10/28 déplacé var res = MB_SimpleAll.Show($"{Lang.ImagesP} ?", Lang.ImagesTitle, buttons: Dcs_Buttons2.OverWrite | Dcs_Buttons2.Pass); ITrace.WriteLine(prefix: false); ITrace.WriteLine(prefix: false); Queue <PackFile> lPackFile = new Queue <PackFile>(); // Get All images (To Add mask see at Where) Console.WriteLine($"[CopyImages] Search all images for '{_ZeGame.Title}'"); foreach (PlatformFolder plfmFolder in _ZePlatform.PlatformFolders) { //filtre switch (plfmFolder.MediaType) { case "Manual": case "Music": case "Theme Video": case "Video": continue; } // 2020 - on modify pour certains titres, la recherche string toSearch = _ZeGame.Title.Replace(':', '_').Replace('\'', '_'); toSearch = toSearch.Replace("__", "_"); // Liste du contenu des dossiers foreach (var fichier in Directory.EnumerateFiles(plfmFolder.FolderPath, "*.*", System.IO.SearchOption.AllDirectories) .Where(s => Path.GetFileName(s).StartsWith($"{toSearch}-") || Path.GetFileName(s).StartsWith($"{_ZeGame.Title}.{_ZeGame.ID}-"))) { Console.WriteLine($"\t\t[CopyImages] Found '{fichier}' in '{plfmFolder.FolderPath}'"); PackFile tmp = new PackFile(plfmFolder.MediaType, fichier); lPackFile.Enqueue(tmp); } } ITrace.WriteLine(prefix: false); EDestDecision res = EDestDecision.None; // Copy Process while (lPackFile.Count != 0) { var pkFile = lPackFile.Dequeue(); int pos = pkFile.LinkToThePath.IndexOf(pkFile.Categorie); string tail1 = Path.GetDirectoryName(pkFile.LinkToThePath).Substring(pos); // Dossier de destination string destFolder = Path.Combine(_Tree.Children[nameof(SubFolder.Images)].Path, tail1); // Fichier de destination string destFile = Path.Combine(destFolder, Path.GetFileName(pkFile.LinkToThePath)); // Création des dossiers Console.WriteLine(destFolder); if (!Directory.Exists(destFolder)) { //2020 CreateVFolders(_Tree.Children["Images"], tail1); CreateVFolders(_Tree.Children[nameof(SubFolder.Images)], tail1); } //2020 FoncSchem.MakeListFolder(_Tree.Children["Images"]); FoncSchem.MakeListFolder(_Tree.Children[nameof(SubFolder.Images)]); // copy // TODO // 21/10/2020 // CopyFile(pkFile.LinkToThePath, dest, res); bool?rezDec = false; // On déclenche en cas de conflit un handle copy + une demande avant if (File.Exists(destFile)) { // On va demander une fois que faire en cas de conflit. if (res == EDestDecision.None) { res = MB_SimpleAll.Show($"{Lang.ImagesP} ?", Lang.ImagesTitle, buttons: Dcs_Buttons2.OverWrite | Dcs_Buttons2.Pass); } // rezDec = Handle_Copy(pkFile.LinkToThePath, ref destFile, res); } if (rezDec == null) { continue; } File.Copy(pkFile.LinkToThePath, destFile, (bool)rezDec); //21/10/2020 } }