コード例 #1
0
ファイル: EntryTypes.cs プロジェクト: 709881059/party-buffalo
 void f_FolderAction(ref FolderAction Progress)
 {
     FolderActionInternal(ref Progress);
 }
コード例 #2
0
ファイル: EntryTypes.cs プロジェクト: 709881059/party-buffalo
 public void ResetFolderAction()
 {
     fa = new FolderAction();
 }
コード例 #3
0
ファイル: EntryTypes.cs プロジェクト: 709881059/party-buffalo
 internal virtual void OnFolderAction(ref FolderAction a)
 {
     if (FolderActionInternal != null)
     {
         FolderActionInternal(ref a);
     }
 }
コード例 #4
0
ファイル: EntryTypes.cs プロジェクト: 709881059/party-buffalo
        /// <summary>
        /// Extracts the subfolders and files to the given paht
        /// </summary>
        /// <param name="Path">Path to extract the folder to</param>
        /// <param name="FoldersToSkip">Folder names to skip when extracting (folders will not be created, files will not be extracted)</param>
        public void Extract(string Path, string[] FoldersToSkip)
        {
            for (int i = 0; i < FoldersToSkip.Length; i++)
            {
                if (Name.ToLower() == FoldersToSkip[i].ToLower())
                {
                    return;
                }
            }
            // Create our new folder action
            fa = new FolderAction();
            OnFolderAction(ref fa);
            if (fa.Cancel)
            {
                fa.CurrentFile = "Canceling...";
                OnFolderAction(ref fa);
                fa.Cancel = false;
                return;
            }
            // Let's start off by creating this directory in the path defined
            if (!System.IO.Directory.Exists(Path + "\\" + Name))
            {
                System.IO.Directory.CreateDirectory(Path + "\\" + Name);
            }

            // Now, extract all the files in this directory to that one...
            foreach (File f in Files())
            {
                if (fa.Cancel)
                {
                    fa.Cancel = false;
                    return;
                }
                fa.CurrentFile = f.Name;
                f.FileAction += new FileActionChanged(f_FileAction);
                f.Extract(Path + "\\" + Name + "\\" + f.Name);
            }

            foreach (Folder f in Folders())
            {
                if (fa.Cancel)
                {
                    fa.Cancel = false;
                    return;
                }
                f.FolderAction += new FolderActionChanged(f_FolderAction);
                f.Extract(Path + "\\" + Name, FoldersToSkip);
            }
        }