コード例 #1
0
ファイル: ModMainForm.cs プロジェクト: wawanpoem/AAEmu-Packer
        private void ReadNewFilesFromRestore()
        {
            RestoreNewFilesList.Clear();
            AAPakFileInfo rnfl = restorepak.nullAAPakFileInfo;

            if (restorepak.GetFileByName(ModNewFilesFileName, ref rnfl))
            {
                var rf = restorepak.ExportFileAsStream(rnfl);
                var s  = AAPak.StreamToString(rf);
                RestoreNewFilesList.AddRange(s.Split('\n').ToArray());
            }
        }
コード例 #2
0
ファイル: ModMainForm.cs プロジェクト: wawanpoem/AAEmu-Packer
        private void ValidateInstallOptions()
        {
            // TODO: Enabled buttons depending on the state of game_pak and restore_pak compared to the aamod pak
            // Get file list from mod pak
            FilesToMod.Clear();
            foreach (var fi in modpak.files)
            {
                if (fi.name.StartsWith(ModFileFolderName))
                {
                    // Don't include own mod files
                }
                else
                {
                    // TODO: compare to gamepak to check if installed or not
                    FilesToMod.Add(fi);
                }
            }

            FilesToInstall.Clear();
            FilesAddedWithInstall.Clear();
            foreach (var fi in FilesToMod)
            {
                AAPakFileInfo gfi = gamepak.nullAAPakFileInfo;
                if (gamepak.GetFileByName(fi.name, ref gfi))
                {
                    if ((fi.size != gfi.size) || (!fi.md5.SequenceEqual(gfi.md5)))
                    {
                        FilesToInstall.Add(fi);
                    }
                }
                else
                {
                    FilesToInstall.Add(fi);
                    FilesAddedWithInstall.Add(fi);
                }
            }

            FilesToUnInstall.Clear();
            foreach (var fi in FilesToMod)
            {
                if (restorepak.FileExists(fi.name))
                {
                    FilesToUnInstall.Add(fi);
                }
            }

            if (FilesToInstall.Count > 0)
            {
                btnInstall.Enabled = true;
                string s = string.Empty;
                if (FilesToMod.Count != 1)
                {
                    s += "Mod " + FilesToMod.Count.ToString() + " file(s)";
                }
                else
                {
                    s += "Mod " + FilesToMod.Count.ToString() + " file";
                }
                if (FilesAddedWithInstall.Count > 0)
                {
                    s += ", with " + FilesAddedWithInstall.Count.ToString() + " new";
                }
                lInstallInfo.Text = s;
            }

            // Check if these same files are all present in the restore pak
            // If not, disable the uninstall option (likely not installed)
            // TODO:
            btnUninstall.Enabled = (FilesToUnInstall.Count > 0);
        }