コード例 #1
0
        internal void Exec()
        {
            IEnumerable <DataTrans> datas = GetFiles();


            HeTrace.WriteLine("Copy");
            HashCopy hashCopy = new HashCopy();

            hashCopy.AskToUser    += SafeBoxes.HashCopy_AskToUser;
            hashCopy.UpdateStatus += (x, y) => HeTrace.WriteLine(y.Message);
            PersistProgressD mee = new PersistProgressD(hashCopy);

            TaskLauncher launcher = new TaskLauncher()
            {
                ProgressIHM     = new DxDoubleProgress(mee),
                AutoCloseWindow = true,
                MethodToRun     = () => hashCopy.VerifSevNCopy(datas),
            };

            launcher.Launch(hashCopy);
        }
コード例 #2
0
        // ---

        private void CopyFiles(GameDataCont gdC, Folder tree)
        {
            HashCopy objCopy = new HashCopy();

            objCopy.AskToUser += PackMe_IHM.Ask4_FileConflict2;

            HeTrace.WriteLine("[CopyFiles] All files except images");
            // Fusion des fichiers sauf les images
            List <DataTrans> Fichiers = new List <DataTrans>();

            Fichiers.AddRange(gdC.Applications);
            Fichiers.AddRange(gdC.CheatCodes);
            Fichiers.AddRange(gdC.Manuals);
            Fichiers.AddRange(gdC.Musics);
            Fichiers.AddRange(gdC.Videos);

            PackMe_IHM.DoubleProgress(objCopy, "Copy",
                                      (test) => test = objCopy.CopySevNVerif(Fichiers),
                                      (test) => test = objCopy.CopySevNVerif(gdC.Images));
            //copyObj.CopySNVerif(Fichiers);
        }
コード例 #3
0
ファイル: M_PackMeRes.cs プロジェクト: daerlnaxe/Pack-My-Game
        private bool Copy2(string srcFolder, string subFolder, string message, Collection <DataRep> collec)
        {
            srcFolder = Path.GetFullPath(srcFolder, Config.HLaunchBoxPath);
            DataRep dr = null;

            TreeChoose tc = new TreeChoose()
            {
                Model = new M_ChooseRaw()
                {
                    Info           = message,
                    Mode           = ChooseMode.File,
                    ShowFiles      = true,
                    StartingFolder = srcFolder
                }
            };

            if (tc.ShowDialog() == true)
            {
                string folderDest = Path.Combine(_Root, subFolder);
                dr      = DataTrans.MakeSrcnDest <DataRep>(tc.LinkResult, subFolder);
                dr.Name = dr.DestPath.Replace(subFolder, ".");

                DateTime oldLW = new DateTime();
                DataRep  oldDr = collec.FirstOrDefault(x => x.DestPath.Equals(dr.DestPath));
                if (oldDr != null)
                {
                    oldLW = File.GetLastWriteTimeUtc(oldDr.DestPath);
                }

                //
                EphemProgress ephem   = new EphemProgress();
                HashCopy      copyZat = new HashCopy();
                copyZat.AskToUser += PackMe_IHM.Ask4_FileConflict2;

                bool         copyres  = false;
                TaskLauncher launcher = new TaskLauncher()
                {
                    AutoCloseWindow = true,
                    ProgressIHM     = new DxProgressB1(ephem),
                    MethodToRun     = () => copyres = copyZat.CopyOneNVerif(dr),
                };
                launcher.Launch(copyZat);

                //
                if (!copyres)
                {
                    return(false);
                }

                DateTime newLW = File.GetLastWriteTimeUtc(dr.DestPath);
                if (oldLW == newLW)
                {
                    return(false);
                }

                if (oldDr != null)
                {
                    collec.Remove(oldDr);
                }

                collec.Add(dr);

                return(true);
                //return Copy(tc.LinkResult, Path.Combine(Root, subFolder));
            }

            return(false);
        }