Exemple #1
0
        private static void AddDirectory(string path)
        {
            Console.Title = "AAEmu.Patch " + Settings.appVer + " @ " + path;

            PakFileInfo   pfi;
            DirectoryInfo thisDir = new DirectoryInfo(path);

            FileInfo[] files = thisDir.GetFiles();
            foreach (FileInfo fi in files)
            {
                if (Settings.CanAddFile(fi.Name))
                {
                    pfi = new PakFileInfo();

                    pfi.filePath = path.Substring(Settings.masterRoot.Length) + fi.Name;
                    pfi.fileSize = fi.Length;
                    pfi.fileInfo = fi;
                    pfi.fileHash = GetMD5ForFile(path + fi.Name);
                    pfi.filePath = pfi.filePath.Replace("\\", "/").ToLower(); // make all forward slashes, and lowercase it while we're at it


                    pakFiles.Add(pfi);

                    if ((pakFiles.Count % 250) == 0)
                    {
                        Console.Write(".");
                    }
                }
            }

            DirectoryInfo[] dirs = thisDir.GetDirectories();
            foreach (DirectoryInfo di in dirs)
            {
                if (Settings.CanAddFile(di.Name))
                {
                    // We no longer store the directories, as the pak itself doesn't either
                    // This will save roughly 30k lines to compare

                    /*
                     * pfi = new PakFileInfo();
                     *
                     * pfi.filePath = path.Substring(Settings.masterRoot.Length) + di.Name;
                     * pfi.fileSize = -1 ;
                     * pfi.fileInfo = di ;
                     * pfi.fileHash = "";
                     * pfi.filePath = pfi.filePath.Replace("\\", "/"); // make all forward slashes
                     *
                     * pakFiles.Add(pfi);
                     */
                    AddDirectory(path + di.Name + "\\");
                }
            }


            Console.Title = "AAEmu.Patch " + Settings.appVer;
        }
Exemple #2
0
        private static void AddDirectory(string path)
        {
            Console.Title = "AAEmu.Patch " + Settings.appVer + " @ " + path;

            PakFileInfo   pfi;
            DirectoryInfo thisDir = new DirectoryInfo(path);

            FileInfo[] files = thisDir.GetFiles();
            foreach (FileInfo fi in files)
            {
                if (Settings.CanAddFile(fi.Name))
                {
                    pfi = new PakFileInfo();

                    pfi.filePath = path.Substring(Settings.masterRoot.Length) + fi.Name;
                    pfi.fileSize = fi.Length;
                    pfi.fileInfo = fi;
                    pfi.fileHash = GetMD5ForFile(path + fi.Name);
                    pfi.filePath = pfi.filePath.Replace("\\", "/"); // make all forward slashes


                    pakFiles.Add(pfi);

                    if ((pakFiles.Count % 250) == 0)
                    {
                        Console.Write(".");
                    }
                }
            }

            DirectoryInfo[] dirs = thisDir.GetDirectories();
            foreach (DirectoryInfo di in dirs)
            {
                if (Settings.CanAddFile(di.Name))
                {
                    pfi = new PakFileInfo();

                    pfi.filePath = path.Substring(Settings.masterRoot.Length) + di.Name;
                    pfi.fileSize = -1;
                    pfi.fileInfo = di;
                    pfi.fileHash = "";
                    pfi.filePath = pfi.filePath.Replace("\\", "/"); // make all forward slashes

                    pakFiles.Add(pfi);

                    AddDirectory(path + di.Name + "\\");
                }
            }


            Console.Title = "AAEmu.Patch " + Settings.appVer;
        }