コード例 #1
0
        public void LoadSaveGameDataFromDisk(SaveGameData p_saveGameData, String p_file)
        {
            CreateUserSubPath();
            String path = Path.Combine(Path.Combine(GamePaths.UserGamePath, LegacyLogic.Instance.ServiceWrapper.GetUserName()), p_file);

            if (File.Exists(path))
            {
                using (FileStream fileStream = File.OpenRead(path))
                {
                    using (BinaryReader binaryReader = new BinaryReader(fileStream))
                    {
                        p_saveGameData.Read(binaryReader);
                    }
                }
            }
        }
コード例 #2
0
        public void LoadSaveGameData(SaveGameData p_saveGameData, String p_file)
        {
            Boolean             flag = false;
            UPLAY_SAVE_GameList uplay_SAVE_GameList;
            Int32 saveGameList = GetSaveGameList(out uplay_SAVE_GameList);

            if (saveGameList != 0)
            {
                IntPtr list = uplay_SAVE_GameList.list;
                for (Int32 i = 0; i < uplay_SAVE_GameList.count; i++)
                {
                    IntPtr          ptr        = Marshal.ReadIntPtr(list, 0);
                    UPLAY_SAVE_Game p_saveGame = (UPLAY_SAVE_Game)Marshal.PtrToStructure(ptr, typeof(UPLAY_SAVE_Game));
                    if (p_saveGame.nameUtf8 == p_file)
                    {
                        using (MemoryStream memoryStream = OpenSaveGame(p_saveGame))
                        {
                            if (memoryStream == null)
                            {
                                return;
                            }
                            using (BinaryReader binaryReader = new BinaryReader(memoryStream))
                            {
                                p_saveGameData.Read(binaryReader);
                                flag = true;
                                SaveSaveGameDataToDisk(p_saveGameData, p_file);
                                DeleteSaveGame(p_file);
                                break;
                            }
                        }
                    }
                    list = new IntPtr(list.ToInt32() + IntPtr.Size);
                }
            }
            if (!flag)
            {
                LoadSaveGameDataFromDisk(p_saveGameData, p_file);
            }
        }