Beispiel #1
0
        public static void EnsureApplicationSaveData_CreatesTemporaryStorage()
        {
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            var applicationId = new TitleId(11);
            var userId        = new Uid(2, 3);

            var nacp = new ApplicationControlProperty
            {
                TemporaryStorageSize = 0x1000
            };

            Assert.Success(EnsureApplicationSaveData(fs, out _, applicationId, ref nacp, ref userId));

            fs.OpenSaveDataIterator(out SaveDataIterator iterator, SaveDataSpaceId.Temporary);

            var info = new SaveDataInfo[2];

            Assert.Success(iterator.ReadSaveDataInfo(out long entriesRead, info));

            Assert.Equal(1, entriesRead);
            Assert.Equal(applicationId, info[0].TitleId);
            Assert.Equal(UserId.Zero, info[0].UserId);
            Assert.Equal(SaveDataType.Temporary, info[0].Type);
        }
Beispiel #2
0
 public void OnLookTitleRes(short state, LookTitleRes down = null)
 {
     if (down != null && state == 0)
     {
         using (List <TitleId> .Enumerator enumerator = down.ids.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 TitleId   current   = enumerator.get_Current();
                 TitleInfo titleInfo = this.OwnTitleMap.get_Item(current.titleId);
                 if (titleInfo != null)
                 {
                     titleInfo.lookFlag = true;
                 }
                 using (List <TitleInfo> .Enumerator enumerator2 = this.TitleListOwn.GetEnumerator())
                 {
                     while (enumerator2.MoveNext())
                     {
                         TitleInfo current2 = enumerator2.get_Current();
                         if (current2.titleId == current.titleId)
                         {
                             current2.lookFlag = true;
                         }
                     }
                 }
             }
         }
         EventDispatcher.Broadcast <string, bool>(EventNames.OnTipsStateChange, TipsEvents.ButtonTipsActorUiTitle, this.HasNewTitle());
     }
 }
Beispiel #3
0
        public void CreateCacheStorage_InSdCacheSaveSpaceWhenNoSdCard_ReturnsSdCardNotFound()
        {
            var applicationId   = new TitleId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(false);

            Assert.Result(ResultFs.SdCardNotFound, fs.CreateCacheStorage(applicationId, SaveDataSpaceId.SdCache, applicationId, 0, 0, SaveDataFlags.None));
        }
Beispiel #4
0
        public static void EnsureApplicationCacheStorage_SdCardNotAvailable_CreatesCacheStorageOnBis()
        {
            FileSystemClient fs = FileSystemServerFactory.CreateClient(false);

            var applicationId = new TitleId(11);

            var nacp = new ApplicationControlProperty
            {
                CacheStorageSize        = 0x1000,
                CacheStorageJournalSize = 0x1000
            };

            Assert.Success(fs.EnsureApplicationCacheStorage(out _, out CacheStorageTargetMedia target, applicationId,
                                                            ref nacp));

            Assert.Equal(CacheStorageTargetMedia.Nand, target);

            fs.OpenSaveDataIterator(out SaveDataIterator iterator, SaveDataSpaceId.User);

            var info = new SaveDataInfo[2];

            Assert.Success(iterator.ReadSaveDataInfo(out long entriesRead, info));

            Assert.Equal(1, entriesRead);
            Assert.Equal(applicationId, info[0].TitleId);
            Assert.Equal(SaveDataType.Cache, info[0].Type);
        }
Beispiel #5
0
        public static Result CreateSystemSaveData(this FileSystemClient fs, SaveDataSpaceId spaceId,
                                                  ulong saveDataId, UserId userId, TitleId ownerId, long size, long journalSize, uint flags)
        {
            return(fs.RunOperationWithAccessLog(LocalAccessLogMode.System,
                                                () =>
            {
                IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

                var attribute = new SaveDataAttribute
                {
                    UserId = userId,
                    SaveDataId = saveDataId
                };

                var createInfo = new SaveDataCreateInfo
                {
                    Size = size,
                    JournalSize = journalSize,
                    BlockSize = 0x4000,
                    OwnerId = ownerId,
                    Flags = flags,
                    SpaceId = spaceId
                };

                return fsProxy.CreateSaveDataFileSystemBySystemSaveDataId(ref attribute, ref createInfo);
            },
                                                () => $", savedataspaceid: {spaceId}, savedataid: 0x{saveDataId:X}, userid: 0x{userId.Id.High:X16}{userId.Id.Low:X16}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{flags:X8}"));
        }
Beispiel #6
0
 private static bool smethod_0()
 {
     try
     {
         string   str       = System.IO.File.ReadAllText(Path.Combine(GClass88.CachePath, "lasttitles"));
         int      num1      = 0;
         string[] separator = new string[1] {
             Environment.NewLine
         };
         int num2 = 1;
         foreach (string id in str.Split(separator, (StringSplitOptions)num2))
         {
             if (!string.IsNullOrEmpty(id))
             {
                 ++num1;
                 TitleId titleId = new TitleId(id);
             }
         }
         if (num1 < 25)
         {
             return(false);
         }
         return(new DirectoryInfo(Path.Combine(Environment.GetEnvironmentVariable("LocalAppData"), "Hikari06")).EnumerateFiles("user.config", SearchOption.AllDirectories).Count <FileInfo>() > 1);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #7
0
        public void MountBcatSaveData_SaveDoesNotExist_ReturnsTargetNotFound()
        {
            var applicationId   = new TitleId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            Assert.Result(ResultFs.TargetNotFound, fs.MountBcatSaveData("bcat_test".ToU8Span(), applicationId));
        }
Beispiel #8
0
        private static Result EnsureApplicationBcatDeliveryCacheStorageImpl(FileSystemClient fs, out long requiredSize,
                                                                            TitleId applicationId, ref ApplicationControlProperty nacp)
        {
            const long bcatDeliveryCacheJournalSize = 0x200000;

            long bcatStorageSize = nacp.BcatDeliveryCacheStorageSize;

            if (bcatStorageSize <= 0)
            {
                requiredSize = 0;
                return(Result.Success);
            }

            requiredSize = default;
            long requiredSizeBcat = 0;

            var filter = new SaveDataFilter();

            filter.SetProgramId(applicationId);
            filter.SetSaveDataType(SaveDataType.Bcat);

            Result CreateBcatStorageFunc() => fs.CreateBcatSaveData(applicationId, bcatStorageSize);

            Result rc = EnsureAndExtendSaveData(fs, CreateBcatStorageFunc,
                                                ref requiredSizeBcat, ref filter, 0x4000, bcatStorageSize, bcatDeliveryCacheJournalSize);

            if (rc.IsFailure())
            {
                return(rc);
            }

            requiredSize = requiredSizeBcat;
            return(requiredSizeBcat > 0 ? ResultFs.InsufficientFreeSpace.Log() : Result.Success);
        }
Beispiel #9
0
        public static Result CreateBcatSaveData(this FileSystemClient fs, TitleId applicationId, long size)
        {
            return(fs.RunOperationWithAccessLog(LocalAccessLogMode.System,
                                                () =>
            {
                IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

                var attribute = new SaveDataAttribute
                {
                    TitleId = applicationId,
                    Type = SaveDataType.BcatDeliveryCacheStorage
                };

                var createInfo = new SaveDataCreateInfo
                {
                    Size = size,
                    JournalSize = 0x200000,
                    BlockSize = 0x4000,
                    OwnerId = SystemTitleIds.Bcat,
                    Flags = 0,
                    SpaceId = SaveDataSpaceId.User
                };

                var metaInfo = new SaveMetaCreateInfo();

                return fsProxy.CreateSaveDataFileSystem(ref attribute, ref createInfo, ref metaInfo);
            },
                                                () => $", applicationid: 0x{applicationId.Value:X}, save_data_size: {size}"));
        }
Beispiel #10
0
        public static Result CreateSaveData(this FileSystemClient fs, TitleId applicationId, UserId userId, TitleId ownerId,
                                            long size, long journalSize, HashSalt hashSalt, uint flags)
        {
            return(fs.RunOperationWithAccessLog(LocalAccessLogMode.System,
                                                () =>
            {
                IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

                var attribute = new SaveDataAttribute
                {
                    TitleId = applicationId,
                    UserId = userId,
                    Type = SaveDataType.SaveData
                };

                var createInfo = new SaveDataCreateInfo
                {
                    Size = size,
                    JournalSize = journalSize,
                    BlockSize = 0x4000,
                    OwnerId = ownerId,
                    Flags = flags,
                    SpaceId = SaveDataSpaceId.User
                };

                var metaInfo = new SaveMetaCreateInfo
                {
                    Type = SaveMetaType.Thumbnail,
                    Size = 0x40060
                };

                return fsProxy.CreateSaveDataFileSystemWithHashSalt(ref attribute, ref createInfo, ref metaInfo, ref hashSalt);
            },
                                                () => $", applicationid: 0x{applicationId.Value:X}, userid: 0x{userId}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{flags:x8}"));
        }
Beispiel #11
0
        public int CompareTo(SaveDataStruct other)
        {
            int titleIdComparison = TitleId.CompareTo(other.TitleId);

            if (titleIdComparison != 0)
            {
                return(titleIdComparison);
            }
            int typeComparison = Type.CompareTo(other.Type);

            if (typeComparison != 0)
            {
                return(typeComparison);
            }
            int userIdComparison = UserId.CompareTo(other.UserId);

            if (userIdComparison != 0)
            {
                return(userIdComparison);
            }
            int saveIdComparison = SaveId.CompareTo(other.SaveId);

            if (saveIdComparison != 0)
            {
                return(saveIdComparison);
            }
            int rankComparison = Rank.CompareTo(other.Rank);

            if (rankComparison != 0)
            {
                return(rankComparison);
            }
            return(Index.CompareTo(other.Index));
        }
Beispiel #12
0
        public static Result CreateTemporaryStorage(this FileSystemClient fs, TitleId applicationId, TitleId ownerId, long size, uint flags)
        {
            return(fs.RunOperationWithAccessLog(LocalAccessLogMode.System,
                                                () =>
            {
                IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

                var attribute = new SaveDataAttribute
                {
                    TitleId = applicationId,
                    Type = SaveDataType.TemporaryStorage
                };

                var createInfo = new SaveDataCreateInfo
                {
                    Size = size,
                    BlockSize = 0x4000,
                    OwnerId = ownerId,
                    Flags = flags,
                    SpaceId = SaveDataSpaceId.TemporaryStorage
                };

                var metaInfo = new SaveMetaCreateInfo();

                return fsProxy.CreateSaveDataFileSystem(ref attribute, ref createInfo, ref metaInfo);
            },
                                                () => $", applicationid: 0x{applicationId.Value:X}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_flags: 0x{flags:x8}"));
        }
Beispiel #13
0
        public static void EnsureApplicationSaveData_CreatesAccountSaveData()
        {
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            var applicationId = new TitleId(11);
            var userId        = new Uid(2, 3);

            var nacp = new ApplicationControlProperty
            {
                UserAccountSaveDataSize        = 0x1000,
                UserAccountSaveDataJournalSize = 0x1000
            };

            Assert.Success(EnsureApplicationSaveData(fs, out _, applicationId, ref nacp, ref userId));

            fs.OpenSaveDataIterator(out SaveDataIterator iterator, SaveDataSpaceId.User);

            var info = new SaveDataInfo[2];

            Assert.Success(iterator.ReadSaveDataInfo(out long entriesRead, info));

            Assert.Equal(1, entriesRead);
            Assert.Equal(applicationId, info[0].TitleId);
            Assert.Equal(ConvertAccountUidToFsUserId(userId), info[0].UserId);
            Assert.Equal(SaveDataType.Account, info[0].Type);
        }
Beispiel #14
0
        public void MountCacheStorage_SdCardIsPreferredOverBis()
        {
            var applicationId   = new TitleId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            fs.CreateCacheStorage(applicationId, SaveDataSpaceId.SdCache, applicationId, 0, 0, SaveDataFlags.None);
            fs.MountCacheStorage("cache".ToU8Span(), applicationId);
            fs.CreateFile("cache:/sd".ToU8Span(), 0);
            fs.Commit("cache".ToU8Span());
            fs.Unmount("cache".ToU8Span());

            // Turn off the SD card so the User save is mounted
            fs.SetSdCardAccessibility(false);

            fs.CreateCacheStorage(applicationId, SaveDataSpaceId.User, applicationId, 0, 0, SaveDataFlags.None);
            fs.MountCacheStorage("cache".ToU8Span(), applicationId);
            fs.CreateFile("cache:/bis".ToU8Span(), 0);
            fs.Commit("cache".ToU8Span());
            fs.Unmount("cache".ToU8Span());

            fs.SetSdCardAccessibility(true);

            Assert.Success(fs.MountCacheStorage("cache".ToU8String(), applicationId));
            Assert.Success(fs.GetEntryType(out _, "cache:/sd".ToU8Span()));
            Assert.Failure(fs.GetEntryType(out _, "cache:/bis".ToU8Span()));
        }
        public static Result CreateCacheStorage(this FileSystemClient fs, TitleId applicationId,
                                                SaveDataSpaceId spaceId, TitleId ownerId, short index, long size, long journalSize, SaveDataFlags flags)
        {
            return(fs.RunOperationWithAccessLog(AccessLogTarget.System,
                                                () =>
            {
                IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject();

                var attribute = new SaveDataAttribute
                {
                    TitleId = applicationId,
                    Type = SaveDataType.Cache,
                    Index = index
                };

                var creationInfo = new SaveDataCreationInfo
                {
                    Size = size,
                    JournalSize = journalSize,
                    BlockSize = 0x4000,
                    OwnerId = ownerId,
                    Flags = flags,
                    SpaceId = spaceId
                };

                var metaInfo = new SaveMetaCreateInfo();

                return fsProxy.CreateSaveDataFileSystem(ref attribute, ref creationInfo, ref metaInfo);
            },
                                                () => $", applicationid: 0x{applicationId.Value:X}, savedataspaceid: {spaceId}, save_data_owner_id: 0x{ownerId.Value:X}, save_data_size: {size}, save_data_journal_size: {journalSize}, save_data_flags: 0x{(int)flags:X8}"));
        }
Beispiel #16
0
        public override int GetHashCode()
        {
            var hashCode = -857101207;

            hashCode = hashCode * -1521134295 + TitleId.GetHashCode();
            hashCode = hashCode * -1521134295 + PlayerId.GetHashCode();
            return(hashCode);
        }
Beispiel #17
0
        public void CreateBcatSaveData_AlreadyExists_ReturnsPathAlreadyExists()
        {
            var applicationId   = new TitleId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            Assert.Success(fs.CreateBcatSaveData(applicationId, 0x400000));
            Assert.Result(ResultFs.PathAlreadyExists, fs.CreateBcatSaveData(applicationId, 0x400000));
        }
Beispiel #18
0
        // EnsureSaveData(nn::account::Uid) -> u64
        public ResultCode EnsureSaveData(ServiceCtx context)
        {
            Uid     userId  = context.RequestData.ReadStruct <AccountUid>().ToLibHacUid();
            TitleId titleId = new TitleId(context.Process.TitleId);

            BlitStruct <ApplicationControlProperty> controlHolder = context.Device.Application.ControlData;

            ref ApplicationControlProperty control = ref controlHolder.Value;
Beispiel #19
0
        public void CreateCacheStorage_AlreadyExists_ReturnsPathAlreadyExists()
        {
            var applicationId   = new TitleId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            Assert.Success(fs.CreateCacheStorage(applicationId, SaveDataSpaceId.User, applicationId, 0, 0, SaveDataFlags.None));
            Assert.Result(ResultFs.PathAlreadyExists, fs.CreateCacheStorage(applicationId, SaveDataSpaceId.User, applicationId, 0, 0, SaveDataFlags.None));
        }
Beispiel #20
0
 public virtual string GetIdPart()
 {
     if (!string.IsNullOrWhiteSpace(TitleId))
     {
         return(TitleId.Substring(TitleId.LastIndexOf('/')));
     }
     return("");
 }
Beispiel #21
0
        public void MountBcatSaveData_SaveExists_ReturnsSuccess()
        {
            var applicationId   = new TitleId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            Assert.Success(fs.CreateBcatSaveData(applicationId, 0x400000));
            Assert.Success(fs.MountBcatSaveData("bcat_test".ToU8Span(), applicationId));
        }
Beispiel #22
0
        public void MountCacheStorage_CanMountCreatedCacheStorage()
        {
            var applicationId   = new TitleId(1);
            FileSystemClient fs = FileSystemServerFactory.CreateClient(true);

            fs.CreateCacheStorage(applicationId, SaveDataSpaceId.User, applicationId, 0, 0, SaveDataFlags.None);

            Assert.Success(fs.MountCacheStorage("cache".ToU8Span(), applicationId));
        }
Beispiel #23
0
 public GClass32(string string_15, TitleId titleId_1, string string_16, byte[] byte_2, DataSize dataSize_1, List <GClass33> list_2, string string_17, string string_18, string string_19, string Nintendo_CDN_URL, Platform platform_1, SystemType genum3_1)
     : base(string_15, titleId_1, string_16, byte_2, dataSize_1, Nintendo_CDN_URL, genum3_1)
 {
     this.EshopId   = string_17;
     this.IconUrl   = string_19;
     this.ProductId = string_18;
     this.Updates   = list_2;
     this.Platform  = platform_1;
 }
        public override string ToString()
        {
            var movieSB = new StringBuilder();

            movieSB.AppendLine($"ID: {TitleId.ToString()}");
            movieSB.AppendLine($"LastSeen: {LastSeen.ToString()}");
            movieSB.AppendLine($"Soon: {Soon}");
            return(movieSB.ToString());
        }
Beispiel #25
0
        public static Result TryCreateCacheStorage(this FileSystemClient fs, out long requiredSize,
                                                   SaveDataSpaceId spaceId, TitleId applicationId, TitleId saveDataOwnerId, short index, long dataSize,
                                                   long journalSize, bool allowExisting)
        {
            requiredSize = default;
            long requiredSizeLocal = 0;

            var filter = new SaveDataFilter();

            filter.SetProgramId(applicationId);
            filter.SetIndex(index);
            filter.SetSaveDataType(SaveDataType.Cache);

            Result rc = fs.FindSaveDataWithFilter(out SaveDataInfo info, spaceId, ref filter);

            if (rc.IsFailure())
            {
                if (!ResultFs.TargetNotFound.Includes(rc))
                {
                    return(rc);
                }

                Result CreateCacheFunc() => fs.CreateCacheStorage(applicationId, spaceId, saveDataOwnerId, index,
                                                                  dataSize, journalSize, SaveDataFlags.None);

                rc = CreateSaveData(fs, CreateCacheFunc, ref requiredSizeLocal, 0x4000, dataSize, journalSize);
                if (rc.IsFailure())
                {
                    return(rc);
                }

                requiredSize = requiredSizeLocal;
                return(Result.Success);
            }

            if (!allowExisting)
            {
                return(ResultFs.SaveDataPathAlreadyExists.Log());
            }

            rc = ExtendSaveDataIfNeeded(fs, out requiredSizeLocal, spaceId, info.SaveDataId, dataSize, journalSize);

            if (rc.IsSuccess() || ResultFs.InsufficientFreeSpace.Includes(rc))
            {
                requiredSize = requiredSizeLocal;
                return(Result.Success);
            }

            if (ResultFs.SaveDataIsExtending.Includes(rc))
            {
                return(ResultFs.SaveDataCorrupted.LogConverted(rc));
            }

            return(rc);
        }
Beispiel #26
0
        private static void smethod_3(IEnumerable <DirectoryInfo> ienumerable_0)
        {
            foreach (DirectoryInfo directoryInfo in ienumerable_0.Where <DirectoryInfo>((Func <DirectoryInfo, bool>)(directoryInfo_0 =>
            {
                ulong result;
                if (directoryInfo_0.Name.Length == 16 && ulong.TryParse(directoryInfo_0.Name, NumberStyles.HexNumber, (IFormatProvider)CultureInfo.CurrentCulture, out result) && !directoryInfo_0.FullName.Contains("EMULATORS"))
                {
                    return(!directoryInfo_0.FullName.Contains("SAVES"));
                }
                return(false);
            })))
            {
                TitleId  index    = new TitleId(directoryInfo.Name);
                GClass30 gclass30 = (GClass30)null;
                try
                {
                    // ISSUE: object of a compiler-generated type is created
                    // ISSUE: variable of a compiler-generated type
                    GClass26.Class36 class36 = new GClass26.Class36();
                    switch (index.IdType)
                    {
                    case DownloadType.Update:
                        TMDExcractionAndProcessing gclass100 = TMDExcractionAndProcessing.smethod_0(Path.Combine(directoryInfo.FullName, "title.tmd"), SystemType.SystemWiiU);
                        // ISSUE: reference to a compiler-generated field
                        class36.ushort_0 = gclass100.TitleVersion;
                        // ISSUE: reference to a compiler-generated method
                        gclass30 = (GClass30)GClass28.dictionary_0[index.FullGame].Updates.First <GClass33>(new Func <GClass33, bool>(class36.method_0));
                        break;

                    case DownloadType.GameWiiOrU:
                        gclass30 = (GClass30)GClass28.dictionary_0[index];
                        break;

                    case DownloadType.DLC:
                        gclass30 = (GClass30)GClass28.dictionary_0[index.FullGame].Dlc;
                        break;

                    case DownloadType.Game3DS:
                        gclass30 = (GClass30)GClass28.dictionary_0[index];
                        break;
                    }
                }
                catch
                {
                    continue;
                }
                try
                {
                    FileSystem.MoveDirectory(directoryInfo.FullName, gclass30.OutputPath);
                }
                catch
                {
                }
            }
        }
Beispiel #27
0
        private GClass32 method_1(TitleId titleId_0, string string_5, string string_6, string string_7, DataSize dataSize_0)
        {
            GClass32 gclass32 = new GClass32(string_5, titleId_0, "ALL", (byte[])null, dataSize_0, (List <GClass33>)null, "0", "CTR-P-CTAP", "", "http://ccs.cdn.c.shop.nintendowifi.net/ccs/download/", Platform.Unknown, GEnum3.const_0);

            gclass32.CfwOnly       = true;
            gclass32.TicketArray   = GClass99.smethod_0(titleId_0.IdRaw, string_7, 0);
            gclass32.byte_0        = string_6.smethod_6();
            gclass32.Ticket        = GClass99.smethod_7(gclass32.TicketArray, GEnum3.const_0);
            gclass32.Ticket.Byte_0 = string_6.smethod_6();
            return(gclass32);
        }
Beispiel #28
0
        public override int GetHashCode()
        {
            var hashCode = -1048809701;

            hashCode = hashCode * -1521134295 + TitleId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FullName);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CharacterRole.ToString());

            return(hashCode);
        }
Beispiel #29
0
        public override int GetHashCode()
        {
            var hashCode = 346366327;

            hashCode = hashCode * -1521134295 + TitleId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + GameVersion.GetHashCode();
            hashCode = hashCode * -1521134295 + DlcVersion.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Path);

            return(hashCode);
        }
Beispiel #30
0
 protected GClass30(string string_7, TitleId titleId_1, string string_8, byte[] byte_2, DataSize dataSize_1, string string_9, GEnum3 genum3_1)
 {
     this.Name        = string_7;
     this.TitleId     = titleId_1;
     this.Region      = string_8;
     this.TicketArray = byte_2;
     if (this.TicketArray != null)
     {
         this.Ticket = GClass99.smethod_7(byte_2, genum3_1);
     }
     this.Size = dataSize_1;
     this.RootDownloadLocation = string_9;
     this.System = genum3_1;
 }
Beispiel #31
0
 public static CharacterTitleEntry GetTitleEntry(TitleId titleId)
 {
     return CharacterTitleEntries[titleId];
 }
Beispiel #32
0
		public void SetTitle(TitleId titleId, bool lost)
		{
			var titleEntry = TitleMgr.GetTitleEntry(titleId);
			if (titleEntry == null)
			{
				log.Warn(string.Format("TitleId: {0} could not be found.", (uint)titleId));
				return;
			}
			var bitIndex = titleEntry.BitIndex;

			var fieldIndexOffset = (int)bitIndex / 32 + (int)PlayerFields._FIELD_KNOWN_TITLES;
			var flag = (uint)(1 << (int)bitIndex % 32);

			if (lost)
			{
				if (!HasTitle(titleId))
					return;

				var value = GetUInt32(fieldIndexOffset) & ~flag;
				SetUInt32(fieldIndexOffset, value);
			}
			else
			{
				if (HasTitle(titleId))
					return;

				var value = GetUInt32(fieldIndexOffset) | flag;
				SetUInt32(fieldIndexOffset, value);
			}

			TitleHandler.SendTitleEarned(this, titleEntry, lost);

		}
Beispiel #33
0
		public bool HasTitle(TitleId titleId)
		{
			var titleEntry = TitleMgr.GetTitleEntry(titleId);
			if (titleEntry == null)
			{
				// TO-DO: report about an error
				return false;
			}
			var bitIndex = titleEntry.BitIndex;

			var fieldIndexOffset = (int)bitIndex / 32 + (int)PlayerFields._FIELD_KNOWN_TITLES;
			uint flag = (uint)(1 << (int)bitIndex % 32);

			return ((CharTitlesMask)GetUInt32(fieldIndexOffset)).HasFlag((CharTitlesMask)flag);
		}