Esempio n. 1
0
        void pbw_DoWork(object sender, DoWorkEventArgs e)
        {
            IroOp            io = e.Argument as IroOp;
            BackgroundWorker bw = sender as BackgroundWorker;
            var files           = System.IO.Directory.GetFiles(io.Folder, "*", System.IO.SearchOption.AllDirectories)
                                  .Select(s => s.Substring(io.Folder.Length).Trim('\\', '/'))
                                  .ToList();

            using (var fs = new System.IO.FileStream(io.Iro, System.IO.FileMode.Create))
                _7thWrapperLib.IrosArc.Create(fs, files.Select(s => _7thWrapperLib.IrosArc.ArchiveCreateEntry.FromDisk(io.Folder, s)), _7thWrapperLib.ArchiveFlags.None, io.Compress, IroProgress);
        }
Esempio n. 2
0
        void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            IroOp            io = e.Argument as IroOp;
            BackgroundWorker bw = sender as BackgroundWorker;

            using (var arc = new _7thWrapperLib.IrosArc(io.Iro)) {
                var files = arc.AllFileNames().ToList();
                int count = 0;
                foreach (string file in files)
                {
                    string path = System.IO.Path.Combine(io.Folder, file);
                    System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(path));
                    System.IO.File.WriteAllBytes(path, arc.GetBytes(file));
                    count++;
                    IroProgress(1.0 * count / files.Count, file);
                }
            }
        }
Esempio n. 3
0
        void PatchA_DoWork(object sender, DoWorkEventArgs e)
        {
            IroOp            io = e.Argument as IroOp;
            BackgroundWorker bw = sender as BackgroundWorker;
            var files           = System.IO.Directory.GetFiles(io.Folder, "*", System.IO.SearchOption.AllDirectories)
                                  .Select(s => s.Substring(io.Folder.Length).Trim('\\', '/'))
                                  .Select(s => _7thWrapperLib.IrosArc.ArchiveCreateEntry.FromDisk(io.Folder, s))
                                  .ToList();

            if (io.Delete.Any())
            {
                byte[] deldata = System.Text.Encoding.Unicode.GetBytes(String.Join("\n", io.Delete));
                files.Add(new _7thWrapperLib.IrosArc.ArchiveCreateEntry()
                {
                    Filename = "%IrosPatch:Deleted",
                    GetData  = () => deldata
                });
            }

            using (var fs = new System.IO.FileStream(io.Iro, System.IO.FileMode.Create))
                _7thWrapperLib.IrosArc.Create(fs, files, _7thWrapperLib.ArchiveFlags.Patch, io.Compress, IroProgress);
        }