Example #1
0
        /// <summary>
        /// Compresses the specified type.
        /// </summary>
        /// <param name="fileInfo">The file information.</param>
        /// <param name="type">The type.</param>
        /// <param name="destinationPath">The destination path.</param>
        /// <param name="compressedFileInfo">The compressed file information.</param>
        /// <returns>True if successful</returns>
        public static bool Compress(this FileInfo fileInfo, CompressionType type, string destinationPath,
                                    out CompressedElement compressedFileInfo)
        {
            bool         success;
            ICompression compression;

            switch (type)
            {
            case CompressionType.GZip:
                compression = new GZipCompression();
                success     = compression.CompressFolder(fileInfo.FullName, destinationPath, out compressedFileInfo);
                break;

            case CompressionType.ZipArchive:
                compression = new ZipArchiveCompression();
                success     = compression.CompressFolder(fileInfo.FullName, destinationPath, out compressedFileInfo);
                break;

            default:
                compression = new ZipCompression();
                success     = compression.CompressFolder(fileInfo.FullName, destinationPath, out compressedFileInfo);
                break;
            }
            return(success);
        }
Example #2
0
        ///// <summary>
        ///// De-compress the file.
        ///// </summary>
        ///// <param name="fileInfo">The file information.</param>
        ///// <param name="destinationPath">The destination path.</param>
        ///// <param name="deCompressed">The de compressed.</param>
        ///// <returns>True if successful</returns>
        public static bool DeCompressFile(this FileInfo fileInfo, string destinationPath, out DeCompressedElement deCompressed)
        {
            bool         success;
            ICompression compression;

            switch (fileInfo.Extension.ToLower())
            {
            case "gz":
                compression = new GZipCompression();
                success     = compression.DeCompressFile(fileInfo.FullName, destinationPath, out deCompressed);
                break;

            case "zip":
                compression = new ZipCompression();
                success     = compression.DeCompressFile(fileInfo.FullName, destinationPath, out deCompressed);
                break;

            case "ziparc":
                compression = new ZipArchiveCompression();
                success     = compression.DeCompressFile(fileInfo.FullName, destinationPath, out deCompressed);
                break;

            default:
                success      = false;
                deCompressed = null;
                break;
            }
            return(success);
        }
Example #3
0
        ///// <summary>
        ///// De-compress the file.
        ///// </summary>
        ///// <param name="fileInfo">The file information.</param>
        ///// <param name="destinationPath">The destination path.</param>
        ///// <param name="deCompressed">The de compressed.</param>
        ///// <returns>True if successful</returns>
        public static bool DeCompressFile(this FileInfo fileInfo, string destinationPath, out DeCompressedElement deCompressed)
        {
            bool success;
            ICompression compression;
            switch (fileInfo.Extension.ToLower())
            {
                case "gz":
                    compression = new GZipCompression();
                    success = compression.DeCompressFile(fileInfo.FullName, destinationPath, out deCompressed);
                    break;
                case "zip":
                    compression = new ZipCompression();
                    success = compression.DeCompressFile(fileInfo.FullName, destinationPath, out deCompressed);
                    break;
                case "ziparc":
                    compression = new ZipArchiveCompression();
                    success = compression.DeCompressFile(fileInfo.FullName, destinationPath, out deCompressed);
                    break;
                default:
                    success = false;
                    deCompressed = null;
                    break;

            }
            return success;
        }
Example #4
0
        /// <summary>
        /// Launch zipCompression
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void miZip_Click(object sender, EventArgs e)
        {
            string gameName    = ((ShortGame)lvGames.SelectedItems[0].Tag).FileName.Split('.')[0];
            string folder2Comp = Path.Combine(_OutPPath, PlatformName, gameName);
            string workFolder  = Path.Combine(_OutPPath, PlatformName);

            ZipCompression.Make_Folder(folder2Comp, workFolder, gameName);
        }
Example #5
0
        public void CompressByZip()
        {
            ICompressionStrategy zipCompresstion = new ZipCompression();

            var result = zipCompresstion.Compress();

            Assert.Equal("ZIP Compression done successfully", result);
        }
Example #6
0
 internal static DeflateSettings CreateDeflateSettings(
     ZipCompression compressionLevel)
 {
     return(new DeflateSettings()
     {
         CompressionLevel = compressionLevel == ZipCompression.Default ? CompressionLevel.Optimal : (CompressionLevel)compressionLevel
     });
 }
Example #7
0
 public void AddStream(
     Stream stream,
     string fileNameInZip,
     ZipCompression method,
     DateTime dateTime)
 {
     this.AddStream(stream, fileNameInZip, method, dateTime, CompressionType.Default);
 }
        public Stream DownloadQuickFix(string path, bool filtroTipoArtigo = false)
        {
            var filenames = _vfs.ListFolderContent(path);

            using (var zip = new ZipCompression())
            {
                foreach (var filename in filenames)
                {
                    // HACK 1: ignore article 0
                    if (filename.Contains("-artigo0-"))
                    {
                        continue;
                    }

                    string basename = GetFilename(filename);
                    using (var file = _vfs.OpenReader(filename))
                        using (var txtFile = new StreamReader(file))
                        {
                            var text = txtFile.ReadToEnd();

                            // HACK 4: filtrar por tipo de artigo
                            if (filtroTipoArtigo && FiltrarTipoArtigo(text))
                            {
                                continue;
                            }

                            // HACK 2: convert date YYYY_MM_DD to DD/MM/YYYY
                            var newtext = QuickFix2(QuickFix(text));

                            using (var newstream = new MemoryStream())
                            {
                                using (var memwrite = new StreamWriter(newstream))
                                {
                                    memwrite.Write(newtext);
                                    memwrite.Flush();
                                    newstream.Seek(0, SeekOrigin.Begin);

                                    // HACK3: remove "article" from name
                                    string newbasename = basename
                                                         .Replace("-artigo", "")
                                                         .Replace("DO", "")
                                                         .Replace("_", "");

                                    int idxP = newbasename.IndexOf("-p");
                                    newbasename = newbasename.Substring(0, idxP);

                                    // add XML extension
                                    newbasename = newbasename + ".xml";

                                    zip.Add(newbasename, newstream);
                                }
                            }
                        }
                }

                return(zip.DownloadStream());
            }
        }
Example #9
0
        /// <summary>
        /// Constructor
        /// Use StartClient() to start a connection to a server.
        /// </summary>
        protected SocketClient()
        {
            KeepAliveTimer           = new System.Timers.Timer(15000);
            KeepAliveTimer.Elapsed  += KeepAlive;
            KeepAliveTimer.AutoReset = true;
            KeepAliveTimer.Enabled   = false;

            IsRunning           = false;
            AllowReceivingFiles = false;

            MessageEncryption = new Aes256();
            FileCompressor    = new GZipCompression();
            FolderCompressor  = new ZipCompression();
        }
        public void BytecodeApi_IO_ZipCompression()
        {
            byte[] data1 = MathEx.RandomNumberGenerator.GetBytes(10000);
            byte[] data2 = MathEx.RandomNumberGenerator.GetBytes(10000);

            BlobTree tree = new BlobTree();

            tree.Root.Blobs.Add(new Blob("file1.txt", data1));
            tree.Root.Blobs.Add(new Blob("file2.txt", data2));

            BlobTree decompressed = ZipCompression.Decompress(ZipCompression.Compress(tree));

            Assert.IsTrue(tree.Root.Blobs[0].Compare(decompressed.Root.Blobs[0]));
            Assert.IsTrue(tree.Root.Blobs[1].Compare(decompressed.Root.Blobs[1]));
        }
Example #11
0
        /// <summary>
        /// Base constructor
        /// </summary>
        protected ServerListener()
        {
            //Set timer that checks all clients every 5 minutes
            _keepAliveTimer           = new System.Timers.Timer(300000);
            _keepAliveTimer.Elapsed  += KeepAlive;
            _keepAliveTimer.AutoReset = true;
            _keepAliveTimer.Enabled   = true;
            WhiteList = new List <IPAddress>();
            BlackList = new List <IPAddress>();

            IsRunning           = false;
            AllowReceivingFiles = false;

            MessageEncryption = new Aes256();
            FileCompressor    = new GZipCompression();
            FolderCompressor  = new ZipCompression();
        }
Example #12
0
        public Stream Download2(string path)
        {
            var filenames = _vfs.ListFolderContent(path);

            using (var zip = new ZipCompression())
            {
                foreach (var filename in filenames)
                {
                    string basename = GetFilename(filename);
                    using (var file = _vfs.OpenReader(filename))
                    {
                        zip.Add(basename, file);
                    }
                }

                return(zip.DownloadStream());
            }
        }
        /// <summary>
        /// Base constructor
        /// </summary>
        protected SimpleSocketListener()
        {
            //Set timer that checks all clients every 5 minutes
            _keepAliveTimer           = new System.Timers.Timer(300000);
            _keepAliveTimer.Elapsed  += KeepAlive;
            _keepAliveTimer.AutoReset = true;
            _keepAliveTimer.Enabled   = true;
            WhiteList = new List <IPAddress>();
            BlackList = new List <IPAddress>();

            IsRunning           = false;
            AllowReceivingFiles = false;

            ParallelQueue = new ParallelQueue(50);
            ClientThreads = new List <Task>();

            ByteCompressor    = new DeflateByteCompression();
            MessageEncryption = new Aes256();
            FileCompressor    = new GZipCompression();
            FolderCompressor  = new ZipCompression();
        }
Example #14
0
        /// <summary>
        /// Compresses the specified type.
        /// </summary>
        /// <param name="directory">The directory.</param>
        /// <param name="type">The type.</param>
        /// <param name="destinationPath">The destination path.</param>
        /// <param name="compressedFileInfo">The compressed file information.</param>
        /// <param name="name">The name.</param>
        /// <returns>True if succeeded</returns>
        public static bool Compress(this DirectoryInfo directory, CompressionType type, string destinationPath, out CompressedElement compressedFileInfo, string name = "")
        {
            bool success;
            ICompression compression;
            switch (type)
            {
                case CompressionType.GZip:
                    compression = new GZipCompression();
                    success = compression.CompressFolder(directory.FullName, destinationPath, out compressedFileInfo);
                    break;
                case CompressionType.ZipArchive:
                    compression = new ZipArchiveCompression();
                    success = compression.CompressFolder(directory.FullName, destinationPath, out compressedFileInfo);
                    break;
                default:
                    compression = new ZipCompression();
                    success = compression.CompressFolder(directory.FullName, destinationPath, out compressedFileInfo);
                    break;

            }
            return success;
        }
Example #15
0
        public void AddStream(
            Stream stream,
            string fileNameInZip,
            ZipCompression method,
            DateTime dateTime,
            CompressionType compressionType)
        {
            if (compressionType == CompressionType.Lzma)
            {
                throw new NotSupportedException();
            }
            DeflateSettings deflateSettings = ZipOutputStream.CreateDeflateSettings(method);

            deflateSettings.HeaderType = CompressedStreamHeader.None;
            this.DeleteAvailableEntry(fileNameInZip);
            using (ZipArchiveEntry entry = this.CreateEntry(fileNameInZip, (CompressionSettings)deflateSettings))
            {
                entry.LastWriteTime      = (DateTimeOffset)dateTime;
                entry.ExternalAttributes = 32;
                Stream destination = entry.Open();
                ZipFile.CopyStreamTo(stream, destination);
            }
        }
Example #16
0
        public static CsvData ImportFromCloud()
        {
            CsvData csvData = new CsvData();

            BlobTree countryBlob = ZipCompression.Decompress(HttpClient.Default.CreateGetRequest("https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip").ReadBytes());
            BlobTree asnBlob     = ZipCompression.Decompress(HttpClient.Default.CreateGetRequest("https://geolite.maxmind.com/download/geoip/database/GeoLite2-ASN-CSV.zip").ReadBytes());
            BlobTree cityBlob    = ZipCompression.Decompress(HttpClient.Default.CreateGetRequest("https://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip").ReadBytes());

            csvData.Country    = FindBlob(countryBlob, "GeoLite2-Country-Locations-en.csv");
            csvData.Range      = FindBlob(countryBlob, "GeoLite2-Country-Blocks-IPv4.csv");
            csvData.Range6     = FindBlob(countryBlob, "GeoLite2-Country-Blocks-IPv6.csv");
            csvData.Asn        = FindBlob(asnBlob, "GeoLite2-ASN-Blocks-IPv4.csv");
            csvData.Asn6       = FindBlob(asnBlob, "GeoLite2-ASN-Blocks-IPv6.csv");
            csvData.City       = FindBlob(cityBlob, "GeoLite2-City-Locations-en.csv");
            csvData.CityRange  = FindBlob(cityBlob, "GeoLite2-City-Blocks-IPv4.csv");
            csvData.CityRange6 = FindBlob(cityBlob, "GeoLite2-City-Blocks-IPv6.csv");

            return(csvData);

            byte[] FindBlob(BlobTree blobs, string name)
            {
                return(blobs.Root.Nodes.First().Blobs[name].Content);
            }
        }
Example #17
0
        /*
         *
         * /// <summary>
         * /// Créer des dossiers à la verticale dans un répertoire, ajoute au dictionnaire
         * /// </summary>
         * /// <param name="basePath">Starting Directory</param>
         * /// <param name="folders"></param>
         * void CreateVFolders(Folder basePath, string tail)
         * {
         *  string[] arrTail = tail.Split('\\');
         *
         *  string path = basePath.Path; // 22/10/2020
         *  foreach (string name in arrTail)
         *  {
         *      path = Path.Combine(path, name);
         *
         *      HeTrace.WriteLine($"[CreateFolders] Creation of the folder: '{path}'");
         *
         *      // Creation
         *      Directory.CreateDirectory(path);
         *  }
         *
         *
         * }*/
        #endregion tree



        #region Compression & Hash
        /// <summary>
        ///
        /// </summary>
        /// <param name="gamePath"></param>
        /// <param name="title">Tite du jeu</param>
        private void Compress_ZipMode(string gamePath)
        {
            var archiveLink = Path.Combine(_SystemPath, $"{Path.GetFileName(gamePath)}.zip");

            if (File.Exists(archiveLink))
            {
                var Length      = DxLocalTransf.Tools.FileSizeFormatter.Convert(new FileInfo(archiveLink).Length);
                var resConflict = SafeBoxes.Ask4_DestConflict
                                  (
                    LanguageManager.Instance.Lang.File_Ex, archiveLink, Length,
                    E_DxConfB.OverWrite | E_DxConfB.Trash
                                  );

                switch (resConflict)
                {
                case E_Decision.OverWriteAll:
                case E_Decision.OverWrite:
                    File.Delete(archiveLink);
                    break;

                case E_Decision.Trash:
                case E_Decision.TrashAll:
                    OpDFiles.Trash(archiveLink);
                    break;
                }
            }


            ZipCompression zippy = new ZipCompression(_SystemPath)
            {
                IsPaused    = this.IsPaused,
                TokenSource = this.TokenSource,
            };

            /*
             * zippy.UpdateProgressT += this.SetProgress;
             * zippy.UpdateStatus += this.SetStatus;
             * zippy.MaximumProgressT += this.SetMaximum;*/
            zippy.UpdateStatus += (x, y) => HeTrace.WriteLine(y.Message);



            var res = PackMe_IHM.ZipCompressFolder(zippy, () => zippy.CompressFolder(
                                                       gamePath, Path.GetFileName(gamePath), Config.ZipLvlCompression), "Compression Zip");

            //ZipCompression.CompressFolder(gamePath, Path.Combine(_SystemPath, shGame.ExploitableFileName), PS.Default.c7zCompLvl);
            if (res != true)
            {
                return;
            }

            #region Création du fichier  MD5
            if (Config.CreateMD5)
            {
                Gen_PlusCalculator calculator = Gen_PlusCalculator.Create(CancelToken);

                string sum = string.Empty;
                PackMe_IHM.LaunchOpProgress(calculator,
                                            () => sum = calculator.Calcul(zippy.ArchiveLink, () => MD5.Create()),
                                            "Calcul de somme");

                HashCalc.Files.ClassicParser.Write(zippy.ArchiveLink, sum, HashType.md5, overwrite: true);
            }
            else
            {
                HeTrace.WriteLine($"[Run] MD5 disabled", this);
            }
            #endregion
        }
Example #18
0
 public ZipOutputStream(Stream baseStream, ZipCompression compressionLevel)
     : base(baseStream, StreamOperationMode.Write, (CompressionSettings)ZipOutputStream.CreateDeflateSettings(compressionLevel), false, (EncryptionSettings)null)
 {
 }
Example #19
0
        // This is basically a runner class, runs various classes implemented.
        public static void Main(string[] args)
        {
            //var datalist = new StoreData<int>();
            //datalist.Add(1);
            //datalist.Add(2);
            //datalist.Add(3);
            //datalist.Add(4);
            //datalist.Add(5);

            //foreach (var item in datalist)
            //{
            //    Console.WriteLine(item);
            //}

            //var datalist2 = new StoreData<string>();
            //datalist2.Add("If ");
            //datalist2.Add("Only ");
            //datalist2.Add("I ");
            //datalist2.Add("Could ");
            //datalist2.Add("***.");

            //foreach (var item in datalist2)
            //{
            //    Console.Write(item);
            //}
            //Console.ReadLine();


            A dataA = new A()
            {
                Data1 = "Hello", Data2 = "World"
            };
            // Assigning like this does a "shallow copy".
            A dataB = dataA;

            dataB.Data1 = "Goodbye";
            dataB.Data2 = "City";

            A dataBDistinct = new A(dataA);

            // dataBDistinct should not be affected by changes made to dataA
            dataA.Data1 = "Hello";
            dataA.Data2 = "World";

            StructExample someStruct      = new StructExample();
            StructExample someOtherStruct = new StructExample(1, 2);

            //FileInfo fi = new FileInfo("ads");
            //fi.Attributes = FileAttributes.ReadOnly | FileAttributes.ReadOnly;

            Type predefineAttribute = typeof(AttributeUsageAttribute);
            Type conditionalAttr    = typeof(ConditionalAttribute);

            foreach (Attribute attr in  predefineAttribute.GetCustomAttributes(false))
            {
                Console.WriteLine(attr.ToString());
            }
            foreach (PropertyInfo poperty in predefineAttribute.GetProperties())
            {
                Console.WriteLine(poperty.ToString());
            }

            SomeObsoleteMethod();

            IMyInterfaceCompression compression = new ZipCompression();

            compression.Compress("", null);
            compression = new RarCompression();
            compression.Compress("", null);

            Console.WriteLine("***************Async****************");
            TestAsync();
            // Console.WriteLine("***************Async****************");

            Console.WriteLine("***************LINQ EXAMPLE ****************");
            LinqExample db        = new LinqExample();
            var         customers = from cust in db.Customers
                                    select cust;

            db.AddCustomer(new Customer()
            {
                Name = "NitinAr", Designation = "Technical Fellow", City = "Seattle"
            });
            foreach (Customer cst in customers)
            {
                Console.Write(cst.Name + ", ");
            }
            Console.WriteLine();
            Console.WriteLine("***************LINQ EXAMPLE ****************");

            Console.WriteLine("*************** DELEGATES, LAMBDAS ****************");
            Func <int, int, bool> comparisonHandler = LessThan;

            comparisonHandler = (a, b) => a < b;
            comparisonHandler = delegate(int a, int b)
            {
                return(a < b);
            };
            Console.WriteLine("***************DELEGATES, LAMBDAS****************");

            Console.WriteLine("***************vs EXPRESSIONS****************");
            // Expression tree is a collection of Data and by iterating over data, it is possible to convert
            // data to another type.
            // Look at the different in calling ToString() on Func<> v/s Expression<>.
            Expression <Func <int, int, bool> > comparisonHandlerExpression;

            comparisonHandlerExpression = (x, y) => x < y;

            Console.WriteLine(comparisonHandler.ToString());
            Console.WriteLine(comparisonHandlerExpression.ToString());
            Console.WriteLine(comparisonHandlerExpression.Body.ToString());
            Console.WriteLine("***************vs EXPRESSIONS****************");

            CloseOverMe     closeOverMe = new CloseOverMe();
            Func <int, int> incrementer = closeOverMe.GetFuncIncrementer();

            Console.WriteLine(incrementer(3));
            Console.WriteLine(incrementer(4));

            Console.ReadLine();
        }
Example #20
0
        /// <summary>
        ///
        /// </summary>
        internal bool Run()
        {
            ITrace.WriteLine(prefix: false);

            #region
            // Verifications
            // Todo Verifications with zip and 7z
            //if (Directory.Exists(_GamePath))
            //{


            //}
            #endregion

            /* Déplacé 2020
             * // Creation of System folder and working assign
             * ITrace.WriteLine($"[Run] {Lang.CreationFolder}: '{_SystemName}'");
             * Directory.CreateDirectory(_SystemName);
             * Directory.SetCurrentDirectory(_SystemPath);
             *
             * // Creation of Game folder
             * ITrace.WriteLine($"[Run] {Lang.CreationFolder}: '{_GamePath}'");
             * Directory.CreateDirectory(_GamePath);
             */
            //2020 Directory.SetCurrentDirectory(_GamePath);


            #region Creation of the Infos.xml
            if (Settings.Default.opInfos)
            {
                MakeXML.InfoGame(_GamePath, _ZeGame);
            }
            else
            {
                ITrace.WriteLine("[Run] Make info disabled");
            }
            #endregion

            // Tree root + lvl1
            MakeStructure();



            // Copy Roms
            #region 22/08/2020 new rom management
            vApps = CopyRoms(_zBackGame.ApplicationPath, _Tree.Children[nameof(SubFolder.Roms)].Path);

            //vApps = CopySpecific(_zBackGame.ApplicationPath, _Tree.Children["Roms"].Path, "Roms", x => _zBackGame.ApplicationPath = x);
            #endregion


            // Video, Music, Manual
            vManual = CopySpecific(_zBackGame.ManualPath, _Tree.Children[nameof(SubFolder.Manuals)].Path, "Manual", x => _zBackGame.ManualPath = x);
            vMusic  = CopySpecific(_zBackGame.MusicPath, _Tree.Children[nameof(SubFolder.Musics)].Path, "Music", x => _zBackGame.MusicPath = x);
            vVideo  = CopySpecific(_zBackGame.VideoPath, _Tree.Children[nameof(SubFolder.Videos)].Path, "Video", x => _zBackGame.VideoPath = x);


            // CopySpecificFiles() old way;

            // Copy images
            CopyImages();

            #region Copy CheatCodes
            if (Settings.Default.opCheatCodes && !string.IsNullOrEmpty(Settings.Default.CCodesPath))
            {
                CopyCheatCodes();
            }
            else
            {
                ITrace.WriteLine("[Run] Copy Cheat Codes disabled");
            }
            #endregion

            #region Copy Clones
            if (Settings.Default.opClones)
            {
                CopyClones();
            }
            else
            {
                ITrace.WriteLine($"[Run] Clone copy disabled");
            }
            #endregion

            #region Serialization / backup ameliorated of launchbox datas (with found medias missing)
            if (Settings.Default.opEBGame)
            {
                MakeXML.Backup_Game(_GamePath, _zBackGame, "EBGame");
            }
            else
            {
                ITrace.WriteLine($"[Run] Enhanced Backup Game disabled");
            }

            #endregion

            #region Save Struct
            if (Settings.Default.opTreeV)
            {
                GetStruc();
            }
            else
            {
                ITrace.WriteLine($"[Run] Save Struct disabled");
            }
            #endregion


            #region 2020 Résultats
            // au lieu de mettre à true le bool au moment de la copie,
            //on fait un recheck au cas où l'utilisateur a modifié le contenu)
            //PackMeRes.ShowDialog(vGame, vManual, vMusic, vVideo, vApps);


            PackMeRes2 pmr2 = new PackMeRes2(_Tree.Path)
            {
                GameName = _zBackGame.Title,
                // Destinations

                /*CheatPath = _Tree.Children[nameof(SubFolder.CheatCodes)].Path,
                 * ManualPath = _Tree.Children[nameof(SubFolder.Manuals)].Path,
                 * MusicPath = _Tree.Children[nameof(SubFolder.Musics)].Path,
                 * RomPath = _Tree.Children[nameof(SubFolder.Roms)].Path,
                 * VideoPath = _Tree.Children[nameof(SubFolder.Videos)].Path,*/
                // Sources
                SourceRomPath    = _ZePlatform.FolderPath,
                SourceManuelPath = _ZePlatform.PlatformFolders.FirstOrDefault(x => x.MediaType == "Manual"),
                SourceMusicPath  = _ZePlatform.PlatformFolders.FirstOrDefault(x => x.MediaType == "Music"),
                SourceVideoPath  = _ZePlatform.PlatformFolders.FirstOrDefault(x => x.MediaType == "Video"),
            };

            // Liste des manuels

            //pmr2.Musics = Directory.GetFiles(_Tree.Children["Musics"].Path, "*.*", System.IO.SearchOption.TopDirectoryOnly);

            pmr2.LoadDatas();
            pmr2.ShowDialog();


            //pmr2.AddManual();
            #endregion

            #region 2020 choix du nom
            // Fenêtre pour le choix du nom
            GameName gnWindows = new GameName();
            gnWindows.SuggestedGameName = _ZeGame.ExploitableFileName;
            gnWindows.ShowDialog();

            // Changement de nom du dossier
            ushort i = 0;

            string destFolder = Path.Combine(_SystemPath, gnWindows.ChoosenGameName);

            if (!_GamePath.Equals(destFolder))
            {
                while (i < 10)
                {
                    try
                    {
                        Directory.Move(_GamePath, destFolder);
                        ITrace.WriteLine("Folder successfully renamed");

                        // Attribution du résultat
                        _GamePath = destFolder;

                        // Sortie
                        break;
                    }
                    catch (IOException ioe)
                    {
                        ITrace.WriteLine($"Try {i}: {ioe}");
                        Thread.Sleep(10);
                        i++;
                    }
                }
            }

            //string destArchLink = Path.Combine(path, $"{destArchive}");
            //string destArchLink = Path.Combine(path, gnWindows.ChoosenGameName);

            // On verra si on dissocie un jour
            _ZeGame.ExploitableFileName = gnWindows.ChoosenGameName;
            #endregion

            // Archive
            //string destArchive = Path.Combine(_SystemPath, _ZeGame.ExploitableFileName);

            #region Compression
            // Zip
            if (Properties.Settings.Default.opZip)
            {
                //  MessageBox.Show("test "+ destArchive);
                //     Make_Zip(destArchive);
                // ZipCompression.Make_Folder(_GamePath, _SystemPath, destArchive);
                ZipCompression.Make_Folder(_GamePath, _SystemPath, _ZeGame.ExploitableFileName);
            }
            else
            {
                ITrace.WriteLine($"[Run] Zip Compression disabled");
            }
            // 7-Zip
            if (Properties.Settings.Default.op7_Zip)
            {
                //MessageBox.Show("test " + destArchive);

                // SevenZipCompression.Make_Folder(_GamePath, _SystemPath, destArchive);
                SevenZipCompression.Make_Folder(_GamePath, _SystemPath, _ZeGame.ExploitableFileName);
            }
            else
            {
                ITrace.WriteLine($"[Run] 7z Compression disabled");
            }
            #endregion

            // Erase the temp folder
            if (MessageBox.Show($"{Lang.EraseTmpFolder} '{_ZeGame.ExploitableFileName}' ?", Lang.Erase, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    Directory.SetCurrentDirectory(_WFolder);
                    Directory.Delete(_GamePath, true);
                    Console.WriteLine($"[Run] folder {_GamePath} erased");
                }
                catch (Exception exc)
                {
                    Console.WriteLine($"[Run] Error when Erasing temp folder {_GamePath}\n{exc.Message }");
                }
            }


            // Stop loggers
            if (_IScreen != null)
            {
                _IScreen.KillAfter(10);
            }

            ITrace.RemoveListerners(_Loggers);

            return(true);
        }