コード例 #1
0
ファイル: Launcher.cs プロジェクト: SteveLever73/Budford
        private void CopySaves()
        {
            // Copy saves
            DirectoryInfo src     = new DirectoryInfo(SpecialFolders.CurrentUserSaveDirCemu(runningVersion, runningGame));
            DirectoryInfo dest    = new DirectoryInfo(SpecialFolders.CurrentUserSaveDirBudford(Model, Model.CurrentUser, runningGame, ""));
            DirectoryInfo src255  = new DirectoryInfo(SpecialFolders.CommonUserFolderCemu(runningVersion, runningGame));
            DirectoryInfo dest255 = new DirectoryInfo(SpecialFolders.CommonSaveDirBudford(Model, runningGame, ""));

            if (Directory.Exists(src.FullName))
            {
                if (File.Exists(Path.Combine(src.FullName, "Budford.lck")))
                {
                    // Delete the lock file, to allow Budford to overwrite the Cemu save in future.
                    File.Delete(Path.Combine(src.FullName, "Budford.lck"));
                }

                if (src.GetDirectories().Any() || src.GetFiles().Any() || (Directory.Exists(src255.FullName) && (src255.GetFiles().Any() || src255.GetDirectories().Any())))
                {
                    if (!Directory.Exists(dest.FullName))
                    {
                        dest.Create();
                    }
                    if (!Directory.Exists(dest255.FullName))
                    {
                        dest255.Create();
                    }

                    FileManager.CopyFilesRecursively(src, dest, false, true);
                    FileManager.CopyFilesRecursively(src255, dest255, false, true);
                }
            }
        }
コード例 #2
0
ファイル: Launcher.cs プロジェクト: SteveLever73/Budford
        /// <summary>
        ///
        /// </summary>
        /// <param name="src"></param>
        /// <param name="dest"></param>
        /// <param name="smashIt"></param>
        internal static void UpdateFolder(DirectoryInfo src, DirectoryInfo dest, bool smashIt = false)
        {
            if (smashIt)
            {
                if (Directory.Exists(dest.FullName))
                {
                    dest.Delete(true);
                }
                dest.Create();
            }

            if (Directory.Exists(src.FullName))
            {
                if (src.GetFiles().Any() || src.GetDirectories().Any())
                {
                    FileManager.CopyFilesRecursively(src, dest, false, true);
                }
            }
        }
コード例 #3
0
        private static void CopyOnlineFiles(InstalledVersion onlineSource, InstalledVersion onlineDestination)
        {
            if (onlineDestination.VersionNumber > 1110)
            {
                File.Copy(Path.Combine(onlineSource.Folder, "otp.bin"), Path.Combine(onlineDestination.Folder, "otp.bin"), true);
                File.Copy(Path.Combine(onlineSource.Folder, "seeprom.bin"), Path.Combine(onlineDestination.Folder, "seeprom.bin"), true);

                Directory.CreateDirectory(Path.Combine(onlineDestination.Folder, "mlc01", "usr", "save", "system", "act", "80000001"));
                File.Copy(Path.Combine(onlineSource.Folder, "mlc01", "usr", "save", "system", "act", "80000001", "account.dat"), Path.Combine(onlineDestination.Folder, "mlc01", "usr", "save", "system", "act", "80000001", "account.dat"), true);

                Directory.CreateDirectory(Path.Combine(onlineSource.Folder, "mlc01", "sys", "title", "0005001b", "10054000", "content", "ccerts"));
                DirectoryInfo s1 = new DirectoryInfo(Path.Combine(onlineSource.Folder, "mlc01", "sys", "title", "0005001b", "10054000", "content", "ccerts"));
                DirectoryInfo d1 = new DirectoryInfo(Path.Combine(onlineDestination.Folder, "mlc01", "sys", "title", "0005001b", "10054000", "content", "ccerts"));
                FileManager.CopyFilesRecursively(s1, d1);

                Directory.CreateDirectory(Path.Combine(onlineDestination.Folder, "mlc01", "sys", "title", "0005001b", "10054000", "content", "scerts"));
                DirectoryInfo s2 = new DirectoryInfo(Path.Combine(onlineSource.Folder, "mlc01", "sys", "title", "0005001b", "10054000", "content", "scerts"));
                DirectoryInfo d2 = new DirectoryInfo(Path.Combine(onlineDestination.Folder, "mlc01", "sys", "title", "0005001b", "10054000", "content", "scerts"));
                FileManager.CopyFilesRecursively(s2, d2);
            }
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        internal static void CopyLatestControllerProfiles(Model.Model model, InstalledVersion installedVersion)
        {
            int latestVersionWithProfiles = -1;
            InstalledVersion versionWithControllerProfiles = null;

            foreach (var v in model.Settings.InstalledVersions)
            {
                if (v.HasControllerProfiles)
                {
                    if (v.VersionNumber > latestVersionWithProfiles)
                    {
                        latestVersionWithProfiles     = v.VersionNumber;
                        versionWithControllerProfiles = v;
                    }
                }
            }

            if (versionWithControllerProfiles != null)
            {
                FileManager.CopyFilesRecursively(
                    new DirectoryInfo(Path.Combine(versionWithControllerProfiles.Folder, "controllerProfiles")),
                    new DirectoryInfo(Path.Combine(installedVersion.Folder, "controllerProfiles")));
            }
        }
コード例 #5
0
ファイル: CemuSettings.cs プロジェクト: SteveLever73/Budford
        private int CopyBudfordPacks(InstalledVersion version)
        {
            int packs = 0;

            if (resolutionPack != null)
            {
                FileManager.CopyFilesRecursively(new DirectoryInfo(Path.Combine("graphicsPacks", "graphicPacks_2-" + model.Settings.GraphicsPackRevision, resolutionPack.Folder)),
                                                 new DirectoryInfo(Path.Combine(version.Folder, "graphicPacks", "Budford_" + packs)), false, true);
                resolutionPack.PackId = packs;
                packs++;
            }

            foreach (var pack in settings.graphicsPacks)
            {
                if (pack.Active)
                {
                    FileManager.CopyFilesRecursively(new DirectoryInfo(Path.Combine("graphicsPacks", "graphicPacks_2-" + model.Settings.GraphicsPackRevision, pack.Folder)),
                                                     new DirectoryInfo(Path.Combine(version.Folder, "graphicPacks", "Budford_" + packs)), false, true);
                    pack.PackId = packs;
                    packs++;
                }
            }
            return(packs);
        }