Exemple #1
0
        private void trvZip_AfterSelect(object sender, TreeViewEventArgs e)
        {
            DirData dirData = e.Node.Tag as DirData;

            this.UpdateLvw(dirData);
        }
Exemple #2
0
        // recursive
        private static int UnzipFileRecursive(List <FileData> fileDatas, List <DirData> dirDatas, BinaryReader br, string dir, DirData dirData = null)
        {
            if (Directory.Exists(dir) == false)
            {
                Directory.CreateDirectory(dir);
                if (dirData != null)
                {
                    try {
                        Directory.SetCreationTimeUtc(dir, dirData.creationTimeUtc);
                        Directory.SetLastAccessTimeUtc(dir, dirData.lastAccessTimeUtc);
                        Directory.SetLastWriteTimeUtc(dir, dirData.lastWriteTimeUtc);
                    } catch {
                    }
                }
            }

            // files
            foreach (var fileData in fileDatas)
            {
                string filePath = dir + "\\" + fileData.name;
                DecodeFile(br, fileData, filePath);
            }

            int fileCnt = fileDatas.Count;

            // dirs
            foreach (var subDirData in dirDatas)
            {
                string subDir = dir + "\\" + subDirData.name;
                fileCnt += UnzipFileRecursive(subDirData.fileDatas, subDirData.dirDatas, br, subDir, subDirData);
            }

            return(fileCnt);
        }