示例#1
0
        private static void CopyFFmpeg(string destination, bool include32bit, bool include64bit)
        {
            if (include32bit)
            {
                if (!File.Exists(FFmpeg32bit))
                {
                    string filePath = SetupHelpers.DownloadFile("https://github.com/ShareX/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-win32.zip");
                    ZipManager.Extract(filePath, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 100_000_000);
                    File.Move("ffmpeg.exe", FFmpeg32bit);
                }

                SetupHelpers.CopyFile(FFmpeg32bit, destination);
            }

            if (include64bit)
            {
                if (!File.Exists(FFmpeg64bit))
                {
                    string filePath = SetupHelpers.DownloadFile("https://github.com/ShareX/FFmpeg/releases/download/v4.3.1/ffmpeg-4.3.1-win64.zip");
                    ZipManager.Extract(filePath, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 100_000_000);
                    File.Move("ffmpeg.exe", FFmpeg64bit);
                }

                SetupHelpers.CopyFile(FFmpeg64bit, destination);
            }
        }
示例#2
0
        public void execute(string phoneId,string zipPath,string pass)
        {
            DBManager dbm = new DBManager();

            try
            {
                string res = dbm.saveFile(phoneId, Path.GetFileName(zipPath), false, true, new FileInfo(zipPath).Length);

                if (res == "OK.")
                {

                    ZipManager zm = new ZipManager();
                    zm.descomprimirDir(zipPath, pass, Path.GetDirectoryName(zipPath), new ZipLog());

                    string[] files = Directory.GetFiles(Path.GetDirectoryName(zipPath), "*.txt", SearchOption.TopDirectoryOnly);

                    for (int i = 0; (i < files.Length) && (res == "OK."); i++)
                    {
                        this.processFile(phoneId, files[i], dbm);
                        File.Delete(files[i]);
                    }

                    if (res == "OK.")
                        dbm.saveFile(phoneId, Path.GetFileName(zipPath), true, true, new FileInfo(zipPath).Length);
                }
            }
            catch (Exception ex)
            {
                dbm.saveFile(phoneId, Path.GetFileName(zipPath), false, true, new FileInfo(zipPath).Length);
            }
        }
示例#3
0
        private static void CopyFFmpeg(string destination, bool include32bit, bool include64bit)
        {
            if (include32bit)
            {
                if (!File.Exists(FFmpeg32bit))
                {
                    string filename = SetupHelpers.DownloadFile("https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20171130-83ecdc9-win32-static.zip");
                    ZipManager.Extract(filename, ".", false, new List <string>()
                    {
                        "ffmpeg.exe"
                    });
                    File.Move("ffmpeg.exe", FFmpeg32bit);
                }

                SetupHelpers.CopyFile(FFmpeg32bit, destination);
            }

            if (include64bit)
            {
                if (!File.Exists(FFmpeg64bit))
                {
                    string filename = SetupHelpers.DownloadFile("https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20171130-83ecdc9-win64-static.zip");
                    ZipManager.Extract(filename, ".", false, new List <string>()
                    {
                        "ffmpeg.exe"
                    });
                    File.Move("ffmpeg.exe", FFmpeg64bit);
                }

                SetupHelpers.CopyFile(FFmpeg64bit, destination);
            }
        }
示例#4
0
        public static string ExtractPackage(string packageFilePath, string destination)
        {
            string configJson = null;

            if (!string.IsNullOrEmpty(packageFilePath) && File.Exists(packageFilePath) && !string.IsNullOrEmpty(destination))
            {
                ZipManager.Extract(packageFilePath, destination, true, entry =>
                {
                    if (Helpers.IsImageFile(entry.Name))
                    {
                        return(true);
                    }

                    if (configJson == null && entry.FullName.Equals(ConfigFileName, StringComparison.OrdinalIgnoreCase))
                    {
                        using (Stream stream = entry.Open())
                            using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8))
                            {
                                configJson = streamReader.ReadToEnd();
                            }
                    }

                    return(false);
                }, 100_000_000);
            }

            return(configJson);
        }
示例#5
0
        public static string Package(string outputFilePath, string configJson, string assetsFolderPath)
        {
            if (!string.IsNullOrEmpty(outputFilePath))
            {
                List <ZipEntryInfo> entries = new List <ZipEntryInfo>();

                byte[]       bytes = Encoding.UTF8.GetBytes(configJson);
                MemoryStream ms    = new MemoryStream(bytes);
                entries.Add(new ZipEntryInfo(ms, ConfigFileName));

                if (!string.IsNullOrEmpty(assetsFolderPath) && Directory.Exists(assetsFolderPath))
                {
                    string parentFolderPath  = Directory.GetParent(assetsFolderPath).FullName;
                    int    entryNamePosition = parentFolderPath.Length + 1;

                    foreach (string assetPath in Directory.EnumerateFiles(assetsFolderPath, "*.*", SearchOption.AllDirectories).Where(x => Helpers.IsImageFile(x)))
                    {
                        string entryName = assetPath.Substring(entryNamePosition);
                        entries.Add(new ZipEntryInfo(assetPath, entryName));
                    }
                }

                ZipManager.Compress(outputFilePath, entries);

                return(outputFilePath);
            }

            return(null);
        }
示例#6
0
    /// <summary>
    /// Partial extract of a single package, before listing the savegames
    /// Only the quest.ini and translations needs to be extracted to validate quest and get its name
    /// </summary>
    /// <param name="path">path of the file to extract</param>
    public static void ExtractSinglePackagePartial(string path)
    {
        // Extract into temp
        string extractedPath = Path.Combine(ContentData.TempValyriePath, Path.GetFileName(path));

        ZipManager.Extract(extractedPath, path, ZipManager.Extract_mode.ZIPMANAGER_EXTRACT_INI_TXT);
    }
示例#7
0
        /// <summary>
        /// Generate zip file with database backup.
        /// </summary>
        /// <param name="connectionString"></param>
        /// <param name="databaseName"></param>
        /// <returns>Path to the generated file.</returns>
        protected static string GenerateZipFile(string connectionString, string databaseName)
        {
            FileInfo backupFile = BackupDatabase(connectionString, databaseName);

            string zipFile = ZipManager.GenerateZipFile(backupFile, databaseName);

            return(zipFile);
        }
示例#8
0
 public static byte[] smethod_0(string string1)
 {
     return(ZipManager.smethod_5(
                KeyGenerator.CryptoMethod(
                    Assembly.GetExecutingAssembly()
                    .GetManifestResourceStream(string.Concat("GHTCP.FileDB.QBS.", GameName, '.', string1)),
                    "MinimizedScript1f2g4h"), string1 + ".qbs"));
 }
示例#9
0
 public void GetZipEntryExisting()
 {
     using (ZipManager zipMgr = new ZipManager(@"E:\Data\S1\SRC\S1A_IW_SLC__1SDV_20190711T034707_20190711T034737_028064_032B5E_9546.zip"))
     {
         zipMgr.GoThrogh();
     }
     Assert.AreEqual(true, true);
 }
示例#10
0
 public void Loaded()
 {
     _zip                  = new ZipManager(this.FolderPath, this.Compression);
     _zip.Loaded          += unzip_Loaded;
     _zip.ProgressChanged += unzip_ProgressChanged;
     _zip.Completed       += unzip_Completed;
     _zip.ExtractAsync();
 }
示例#11
0
        internal void InitializeForm(String fileNameAndPath)
        {
            privateFileNameAndPath = fileNameAndPath;

            InitializeComponent();
            filenameLabel.Text = StringUtil.CheckStringLength(privateFileNameAndPath, 63);
            ZipManager.ReadZipContent(this, privateFileNameAndPath, out isPasswordProtected);
            SetLanguage();
        }
示例#12
0
    /// <summary>
    /// Fully extract one single package, before starting a quest, and save package filename
    /// </summary>
    /// <param name="path">path of the file to extract</param>
    public static void ExtractSinglePackageFull(string path)
    {
        // Extract into temp
        string tempValkyriePath = ContentData.TempValyriePath;

        mkDir(tempValkyriePath);

        string extractedPath = Path.Combine(tempValkyriePath, Path.GetFileName(path));

        ZipManager.Extract(extractedPath, path, ZipManager.Extract_mode.ZIPMANAGER_EXTRACT_FULL);
    }
示例#13
0
    /// <summary>
    /// Partial extract of all package in a directory, to list quests,  and save package filename
    /// </summary>
    /// <param name="path">path of the directory containing .valkyrie package</param>
    public static void ExtractPackages(string path)
    {
        // Find all packages at path
        string[] archives = Directory.GetFiles(path, "*.valkyrie", SearchOption.AllDirectories);

        // Extract all packages
        foreach (string f in archives)
        {
            string extractedPath = Path.Combine(ContentData.TempValyriePath, Path.GetFileName(f));
            ZipManager.Extract(extractedPath, f, ZipManager.Extract_mode.ZIPMANAGER_EXTRACT_INI_TXT_PIC);
        }
    }
示例#14
0
        public static bool Dirty; //This hasn't been saved yet?..

        public static void smethod_0()
        {
            if (Dirty)
            {
                return;
            }
            AddAllLinesToDictionary(new MemoryStream(
                                        ZipManager.smethod_5(
                                            KeyGenerator.CryptoMethod(
                                                Assembly.GetExecutingAssembly()
                                                .GetManifestResourceStream("NeversoftTools.NSTreeView.nstags.aes"), "MinimizedNSTags1245"),
                                            "nstags.ids")));
            Dirty = true;
        }
示例#15
0
        private static FileInfo BackupFiles(DirectoryInfo pathToBackup, DirectoryInfo destinationDirectory, string destinationBackupName)
        {
            //Creo la directory dove sarà depositato il file di backup
            destinationDirectory.Create();

            //Definisco dove sarà copiato lo zip di backup
            var destinationZipFile = new FileInfo(Path.Combine(destinationDirectory.FullName, destinationBackupName));

            //Effettuo lo zip della cartella
            ZipManager.CompressFolder(pathToBackup, destinationZipFile);

            //Ritorno il FileInfo dello zip
            return(destinationZipFile);
        }
示例#16
0
        public static bool ExtractFFmpeg(string archivePath, string extractPath)
        {
            try
            {
                ZipManager.Extract(archivePath, extractPath, false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 1_000_000_000);
                return(true);
            }
            catch (Exception e)
            {
                DebugHelper.WriteException(e);
            }

            return(false);
        }
示例#17
0
        async Task <(string fileName, string journalContent)> GetJournalForDate(DateTime journalDate)
        {
            var f = "CAPIJournal." +
                    journalDate.Year.ToString().Substring(2) +
                    journalDate.Month.ToString().PadLeft(2, '0') +
                    journalDate.Day.ToString().PadLeft(2, '0') +
                    journalDate.Hour.ToString().PadLeft(2, '0') +
                    journalDate.Minute.ToString().PadLeft(2, '0') +
                    journalDate.Second.ToString().PadLeft(2, '0') +
                    ".01.log";

            var journalItem = await _db.ExecuteSingleRowAsync <UserJournal>(
                "SELECT * FROM user_journal WHERE user_identifier = @user_identifier AND journal_date = @journal_date",
                new SqlParameter("user_identifier", User.Identity.Name),
                new SqlParameter("journal_date", journalDate.Date)
                );

            if (journalItem == null)
            {
                return(null, null);
            }

            using (MemoryStream outFile = new MemoryStream())
            {
                var journalIdentifier = journalItem.S3Path;

                try
                {
                    var stats = await _minioClient.StatObjectAsync("journal-limpet", journalIdentifier);

                    await _minioClient.GetObjectAsync("journal-limpet", journalIdentifier,
                                                      0, stats.Size,
                                                      cb =>
                    {
                        cb.CopyTo(outFile);
                    }
                                                      );

                    outFile.Seek(0, SeekOrigin.Begin);

                    var journalContent = ZipManager.Unzip(outFile.ToArray());

                    return(f, journalContent);
                }
                catch (ObjectNotFoundException)
                {
                    return(null, null);
                }
            }
        }
示例#18
0
        protected void btnSavePictures_Click(object sender, EventArgs e)
        {
            //create zip package and redirect to it
            string zipShortFilename = string.Format("Charts-{0}-{1}.zip",
                                                    deStartDate.Date.ToString("dd.MM.yyyy"),
                                                    deFinishDate.Date.ToString("dd.MM.yyyy"));
            string zipFilename = Path.Combine(Server.MapPath(Config.UploadDirectory), zipShortFilename);

            FileInfo[] files = new FileInfo[this.FilesToSave.Count];
            for (int i = 0; i < files.Length; i++)
            {
                files[i] = new FileInfo(this.FilesToSave[i]);
            }
            ZipManager.GenerateZipFile(files, zipFilename);
            Response.Redirect(string.Format("~/{0}/{1}", Config.UploadDirectory, zipShortFilename));
        }
示例#19
0
        static void Main(string[] args)
        {
            using (ZipManager zipMgr = new ZipManager(@"E:\Data\S1\SRC\S1A_IW_SLC__1SDV_20190711T034707_20190711T034737_028064_032B5E_9546.zip"))
            {
                var annotationFolder = zipMgr.GetFoldersStructure().Where(f => f.EndsWith("annotation/")).FirstOrDefault();
                if (!string.IsNullOrEmpty(annotationFolder))
                {
                    var filse = zipMgr.GetFileNamesFormFolder(annotationFolder).ToArray();
                }


                var zipEntry = zipMgr.GetEntry("s1a-iw1-slc-vh-20190711t034707-20190711t034735-028064-032b5e-001.xml");

                zipMgr.GoThrogh();
            }
        }
示例#20
0
        public void CompressFileToZipAndCheckZipFileExists()
        {
            string dirName = "dir";
            string zipPath = "archive.zip";

            Directory.CreateDirectory(dirName);

            ZipManager zipManager = new ZipManager();

            zipManager.CompressToZip(dirName, zipPath);

            Assert.IsTrue(File.Exists(zipPath));

            Directory.Delete(dirName);
            File.Delete(zipPath);
        }
示例#21
0
        public static void ExecuteTransferFromZipToMssql()
        {
            var sqlContext = new SupermarketsChainMssqlContext();

            Console.WriteLine();
            Console.WriteLine("Extracting data from reports...\n");
            var zipManager = new ZipManager(Constants.SalesImportPath, sqlContext);

            using (TransactionScope tran = new TransactionScope())
            {
                Console.WriteLine("\nSending data to SQL Server...");
                zipManager.TransferData();
                tran.Complete();
            }

            Console.WriteLine("Sales reports imported.");
        }
示例#22
0
        public static bool ExtractFFmpeg(string archivePath, string extractPath)
        {
            try
            {
                ZipManager.Extract(archivePath, extractPath, false, new List <string>()
                {
                    "ffmpeg.exe"
                });
                return(true);
            }
            catch (Exception e)
            {
                DebugHelper.WriteException(e);
            }

            return(false);
        }
示例#23
0
        public static void ExecuteTransferFromZipToMssql()
        {
            var sqlContext = new SupermarketsChainMssqlContext();

            Console.WriteLine();
            Console.WriteLine("Extracting data from reports...\n");
            var zipManager = new ZipManager(Constants.SalesImportPath, sqlContext);

            using (TransactionScope tran = new TransactionScope())
            {
                Console.WriteLine("\nSending data to SQL Server...");
                zipManager.TransferData();
                tran.Complete();
            }

            Console.WriteLine("Sales reports imported.");
        }
示例#24
0
        public static string ExtractPackage(string packageFilePath, string destination)
        {
            if (!string.IsNullOrEmpty(packageFilePath) && File.Exists(packageFilePath) && !string.IsNullOrEmpty(destination))
            {
                string configFilePath = Path.Combine(destination, ConfigFileName);

                if (File.Exists(configFilePath))
                {
                    File.Delete(configFilePath);
                }

                ZipManager.Extract(packageFilePath, destination);

                return(configFilePath);
            }

            return(null);
        }
示例#25
0
        public void ImportSGH()
        {
            byte[] byte_;
            ZipManager.ExtractBytesFrom(_saveLocation, out byte_, "songs.info", "SGH9ZIP2PASS4MXKR");
            var @class = new ZzGenericNode1("songs", KeyGenerator.smethod_8(byte_, "SNG4AES4KEY9MXKR"));

            foreach (StructurePointerNode class302 in @class.Nodes)
            {
                var gH3Song = new Gh3Song(class302)
                {
                    Editable = true
                };
                _gh3SongList.method_0(gH3Song, _string0 != null);
            }
            ZipManager.ExtractBytesFrom(_saveLocation, out byte_, "setlist.info", "SGH9ZIP2PASS4MXKR");
            SetlistToExport.method_1(new Gh3Setlist(
                                         (StructureHeaderNode) new ZzGenericNode1("setlist", KeyGenerator.smethod_8(byte_, "SET4AES4KEY9MXKR"))
                                         .Nodes[0], _gh3SongList));
            if (_string0 == null)
            {
                return;
            }
            var list  = new List <string>();
            var list2 = new List <string>();

            foreach (var current in SetlistToExport.Tiers)
            {
                foreach (var current2 in current.Songs)
                {
                    if (!current2.Editable)
                    {
                        continue;
                    }
                    list.Add(current2.Name + "_song.pak.xen");
                    list2.Add(_string0 + "songs\\" + current2.Name + "_song.pak.xen");
                    list.Add(current2.Name + ".dat.xen");
                    list2.Add(_string0 + "music\\" + current2.Name + ".dat.xen");
                    list.Add(current2.Name + ".fsb.xen");
                    list2.Add(_string0 + "music\\" + current2.Name + ".fsb.xen");
                }
            }
            ZipManager.smethod_11(_saveLocation, list2, list, "SGH9ZIP2PASS4MXKR");
        }
示例#26
0
        public static async Task <string[]> LoadJournal(MinioClient _minioClient, UserJournal journalItem, MemoryStream outFile)
        {
            var stats = await _minioClient.StatObjectAsync("journal-limpet", journalItem.S3Path);

            await _minioClient.GetObjectAsync("journal-limpet", journalItem.S3Path,
                                              0, stats.Size,
                                              cb =>
            {
                cb.CopyTo(outFile);
            }
                                              );

            outFile.Seek(0, SeekOrigin.Begin);

            var journalContent = ZipManager.Unzip(outFile.ToArray());
            var journalRows    = journalContent.Trim().Split('\n', StringSplitOptions.RemoveEmptyEntries);

            return(journalRows);
        }
示例#27
0
        public void method_1()
        {
            var    fileStreamList = new List <Stream>();
            Stream stream         = new MemoryStream();

            KeyGenerator.smethod_1(new ZzGenericNode1("setlist", SetlistToExport.method_6()).method_8(), stream,
                                   "SET4AES4KEY9MXKR");
            var fileNameList = new List <string>();
            var list3        = new List <StructurePointerNode>();

            foreach (var current in SetlistToExport.Tiers)
            {
                foreach (var current2 in current.Songs)
                {
                    if (current2.Editable)
                    {
                        list3.Add(current2.vmethod_5());
                        if (_string0 != null && File.Exists(_string0 + "songs\\" + current2.Name + "_song.pak.xen") &&
                            File.Exists(_string0 + "music\\" + current2.Name + ".dat.xen") &&
                            File.Exists(_string0 + "music\\" + current2.Name + ".fsb.xen"))
                        {
                            fileNameList.Add(current2.Name + "_song.pak.xen");
                            fileStreamList.Add(File.OpenRead(_string0 + "songs\\" + current2.Name + "_song.pak.xen"));
                            fileNameList.Add(current2.Name + ".dat.xen");
                            fileStreamList.Add(File.OpenRead(_string0 + "music\\" + current2.Name + ".dat.xen"));
                            fileNameList.Add(current2.Name + ".fsb.xen");
                            fileStreamList.Add(File.OpenRead(_string0 + "music\\" + current2.Name + ".fsb.xen"));
                        }
                    }
                }
            }
            Stream stream2 = new MemoryStream();

            KeyGenerator.smethod_1(new ZzGenericNode1("songs", list3.ToArray()).method_8(), stream2,
                                   "SNG4AES4KEY9MXKR");
            fileNameList.Add("setlist.info");
            fileStreamList.Add(stream);
            fileNameList.Add("songs.info");
            fileStreamList.Add(stream2);
            ZipManager.smethod_0(fileNameList, _saveLocation, "SGH9ZIP2PASS4MXKR", fileStreamList.ToArray());
        }
示例#28
0
        /// <summary>
        /// Finds content int zippped file
        /// </summary>
        /// <param name="contentSource">Content source</param>
        /// <param name="resourcePath">Resource path</param>
        /// <param name="throwException">Sets wether throw exception or not</param>
        /// <returns>Returns resource paths found</returns>
        /// <remarks>
        /// Content source can be a folder or a zip file
        /// If not unique file found, searchs pattern "[filename]*[extension]" and returns result array
        /// </remarks>
        private static IEnumerable <MemoryStream> FindContentZip(string contentSource, string resourcePath, bool throwException)
        {
            if (ZipManager.Contains(contentSource, resourcePath))
            {
                return(new[] { ZipManager.GetFile(contentSource, resourcePath) });
            }

            var res = ZipManager.GetFiles(contentSource, Path.GetFileNameWithoutExtension(resourcePath) + "*" + Path.GetExtension(resourcePath));

            if (res?.Any() == true)
            {
                return(res.ToArray());
            }

            if (throwException)
            {
                throw new FileNotFoundException("File not found", resourcePath);
            }

            return(new MemoryStream[] { });
        }
示例#29
0
        private static void countFiles(GameType gameType, CPUArch cpuArch)
        {
            switch (cpuArch)
            {
            case CPUArch.x64:
            {
                total += ZipManager.countFiles(Properties.Resources.x64);
                break;
            }

                /*case CPUArch.x86:
                 *  {
                 *      total += ZipManager.countFiles(Properties.Resources.x86);
                 *      break;
                 *  }*/
            }

            switch (gameType)
            {
            case GameType.BFG:
            {
                total += ZipManager.countFiles(Properties.Resources._base);
                total += ZipManager.countFiles(Properties.Resources.base_BFG);
                break;
            }

            case GameType.NEW:
            {
                total += ZipManager.countFiles(Properties.Resources._base);
                total += ZipManager.countFiles(Properties.Resources.base_NEW);
                break;
            }

            case GameType.CLASSIC:
            {
                total += ZipManager.countFiles(Properties.Resources.base_CLASSIC);
                break;
            }
            }
        }
示例#30
0
        /// <summary>
        /// Pack log files, older than first day of previous month.
        /// </summary>
        protected void PackOldFiles()
        {
            // Get log files older than first day of previous month
            DateTime olderDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-1).Date;

            FileInfo[] oldFiles = LoggerUtilities.GetOlderLogFiles(olderDate);
            if (oldFiles.Length == 0)
            {
                return;
            }

            // Generate ZIP file from old log files
            string zipFile = ZipManager.GenerateZipFile(oldFiles, ZipManager.CreateZipFile());

            // Create name for ZIP file
            string logsPath = Path.Combine(
                HttpContext.Current.Server.MapPath("~/"),
                ConfigSettings.ApplicationLogFolder);

            string zipFileName = Path.Combine(logsPath, String.Concat("Logs", olderDate.ToString("yyyyMM"), ".zip"));

            #region Check if file exists and add appender

            bool isZipExists = System.IO.File.Exists(zipFileName);
            int  appender    = 1;
            while (isZipExists)
            {
                zipFileName = Path.Combine(logsPath, String.Concat("Logs", olderDate.ToString("yyyyMM"), "-", appender, ".zip"));
                isZipExists = System.IO.File.Exists(zipFileName);
                appender++;
            }

            #endregion

            // Move ZIP file into the log directory
            System.IO.File.Move(zipFile, zipFileName);

            // Delete old log files
            LoggerUtilities.DeleteLogFiles(oldFiles);
        }
示例#31
0
        public static string Package(string outputFilePath, string configJson, string assetsFolderPath)
        {
            if (!string.IsNullOrEmpty(outputFilePath))
            {
                string outputFolder = Path.GetDirectoryName(outputFilePath);
                Helpers.CreateDirectory(outputFolder);

                string configFilePath = Path.Combine(outputFolder, ConfigFileName);
                File.WriteAllText(configFilePath, configJson, Encoding.UTF8);

                Dictionary <string, string> files = new Dictionary <string, string>();
                files.Add(configFilePath, ConfigFileName);

                if (!string.IsNullOrEmpty(assetsFolderPath) && Directory.Exists(assetsFolderPath))
                {
                    string parentFolderPath  = Directory.GetParent(assetsFolderPath).FullName;
                    int    entryNamePosition = parentFolderPath.Length + 1;

                    foreach (string assetPath in Directory.EnumerateFiles(assetsFolderPath, "*.*", SearchOption.AllDirectories).Where(x => Helpers.IsImageFile(x)))
                    {
                        string entryName = assetPath.Substring(entryNamePosition);
                        files.Add(assetPath, entryName);
                    }
                }

                try
                {
                    ZipManager.Compress(outputFilePath, files);
                }
                finally
                {
                    File.Delete(configFilePath);
                }

                return(outputFilePath);
            }

            return(null);
        }
示例#32
0
        public void method_1()
        {
            var    list   = new List <Stream>();
            Stream stream = new MemoryStream();

            KeyGenerator.smethod_1(new ZzGenericNode1("tier", Gh3Tier0.method_3()).method_8(), stream,
                                   "TIR4AES4KEY9MXKR");
            var list2 = new List <string>();
            var list3 = new List <StructurePointerNode>();

            foreach (var current in Gh3Tier0.Songs)
            {
                if (current.Editable)
                {
                    list3.Add(current.vmethod_5());
                    if (_string0 != null && File.Exists(_string0 + "songs\\" + current.Name + "_song.pak.xen") &&
                        File.Exists(_string0 + "music\\" + current.Name + ".dat.xen") &&
                        File.Exists(_string0 + "music\\" + current.Name + ".fsb.xen"))
                    {
                        list2.Add(current.Name + "_song.pak.xen");
                        list.Add(File.OpenRead(_string0 + "songs\\" + current.Name + "_song.pak.xen"));
                        list2.Add(current.Name + ".dat.xen");
                        list.Add(File.OpenRead(_string0 + "music\\" + current.Name + ".dat.xen"));
                        list2.Add(current.Name + ".fsb.xen");
                        list.Add(File.OpenRead(_string0 + "music\\" + current.Name + ".fsb.xen"));
                    }
                }
            }
            Stream stream2 = new MemoryStream();

            KeyGenerator.smethod_1(new ZzGenericNode1("songs", list3.ToArray()).method_8(), stream2,
                                   "SNG4AES4KEY9MXKR");
            list2.Add("tier.info");
            list.Add(stream);
            list2.Add("songs.info");
            list.Add(stream2);
            ZipManager.smethod_0(list2, _string1, "TGH9ZIP2PASS4MXKR", list.ToArray());
        }