Esempio n. 1
0
        private void CopyClones(LBGame lBGame, string destLocation)
        {
            //ITrace.WriteLine(prefix: false);

            /* 26/03/2021
             * OPFiles opF = new OPFiles()
             * {
             *  Buttons = Dcs_Buttons.NoStop,
             *  WhoCallMe = "Clone"
             * };
             * opF.IWriteLine += (string message) => ITrace.WriteLine(message);
             * opF.IWrite += (string message) => ITrace.BeginLine(message);*/

            List <Clone> clones = XML_Games.ListClones(_XMLPlatformFile, "GameID", lBGame.Id).ToList();

            // tri des doublons / filter duplicates
            List <Clone> fClones = FilesFunc.DistinctClones(clones, lBGame.ApplicationPath, PS.Default.LBPath);

            // On va vérifier que chaque clone n'est pas déjà présent et selon déjà copier
            foreach (Clone zeClone in fClones)
            {
                //waiting zeClone.ApplicationPath = ReconstructPath(zeClone.ApplicationPath);

                SimpleCopyManager(Path.GetFullPath(zeClone.ApplicationPath, PS.Default.LBPath), destLocation, ref _FileConflictDecision);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Copie les clones / Clones copy
        /// </summary>
        private void CopyClones()
        {
            ITrace.WriteLine(prefix: false);

            OPFiles opF = new OPFiles()
            {
                Buttons   = Dcs_Buttons.NoStop,
                WhoCallMe = "Clone"
            };

            opF.IWriteLine += (string message) => ITrace.WriteLine(message);
            opF.IWrite     += (string message) => ITrace.BeginLine(message);

            List <Clone> clones = new List <Clone>();

            _XFunctions.ListClones(clones, _ZeGame.ID);

            // tri des doublons / filter duplicates

            List <Clone> fClones;

            //fClones= clones.Distinct().ToList();
            fClones = FilesFunc.DistinctClones(clones, _ZeGame.FileName);

            // On va vérifier que chaque clone n'est pas déjà présent et selon déjà copier
            foreach (Clone zeClone in fClones)
            {
                zeClone.ApplicationPath = ReconstructPath(zeClone.ApplicationPath);

                /* 20/10/2020
                 * var cloneRes = opF.FileNameCompare(zeClone.ApplicationPath, _Tree.Children[nameof(SubFolder.Roms)].Path);
                 * CopyFile(zeClone.ApplicationPath, _Tree.Children[nameof(SubFolder.Roms)].Path, cloneRes);
                 */
                Copy_Handler(zeClone.ApplicationPath, _Tree.Children[nameof(SubFolder.Roms)].Path, "Roms");
            }
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="applicationPath"></param>
        /// <param name="applications"></param>
        /// <returns>Le fichier sélectionné</returns>
        private ICollection <DataPlus> GetFilesForGames(LBGame lbGame)
        {
            List <DataPlus> games = new List <DataPlus>();

            HeTrace.WriteLine($"\t[GetFilesForGames]", this);

            if (string.IsNullOrEmpty(lbGame.ApplicationPath))
            {
                throw new ArgumentNullException("[GetFiles] Folder of application path is empty");
            }

            string extension = Path.GetExtension(lbGame.ApplicationPath);

            // si aucune extension on ne pack pas le fichier
            if (string.IsNullOrEmpty(extension))
            {
                throw new ArgumentNullException("[GetFiles] Extension of application is null");
            }


            // --- Cas des extensions cue
            if (extension.Equals(".cue", StringComparison.OrdinalIgnoreCase))
            {
                string srcFile = Path.GetFullPath(lbGame.ApplicationPath, Common.Config.HLaunchBoxPath);

                //Lecture du fichier cue
                Cue_Scrapper cuecont = new Cue_Scrapper(srcFile);

                //Folder containing files
                string sourceFold = Path.GetDirectoryName(srcFile);

                // Fonctionne avec le nom du fichier
                foreach (string fileName in cuecont.Files)
                {
                    // Donne le lien complet vers le fichier
                    games.Add(DataPlus.MakeNormal(Path.Combine(sourceFold, fileName)));
                }
            }

            games.Add(DataPlus.MakeChosen(lbGame.Id, lbGame.Title, Path.GetFullPath(lbGame.ApplicationPath, Common.Config.HLaunchBoxPath)));


            // ---  Récupération des clones
            List <Clone> clones = XML_Games.ListClones(_XMLPlatformFile, "GameID", lbGame.Id).ToList();

            // tri des doublons / filter duplicates
            List <Clone> fClones = FilesFunc.DistinctClones(clones, lbGame.ApplicationPath, Common.Config.HLaunchBoxPath);


            if (fClones.Any())
            {
                HeTrace.WriteLine($"\t[{nameof(XML_Games.ListClones)}] found: '{fClones.Count()}'", this);

                foreach (Clone c in fClones)
                {
                    string path = Path.GetFullPath(c.ApplicationPath, Common.Config.HLaunchBoxPath);

                    if (File.Exists(path))
                    {
                        games.Add(DataPlus.MakeNormal(c.Id, Path.GetFileName(path), path));
                    }
                }
            }

            return(games);
        }