public void SetEnum <T>(Option option, T val) { if (!Enum.IsDefined(typeof(T), val)) { object[] messageArgs = new object[] { val, typeof(T), option }; Error.AddDevFatal("Options.SetEnum() - {0} is not convertible to enum type {1} for option {2}", messageArgs); } else { System.Type optionType = this.GetOptionType(option); if (optionType == typeof(int)) { this.SetInt(option, Convert.ToInt32(val)); } else if (optionType == typeof(long)) { this.SetLong(option, Convert.ToInt64(val)); } else { object[] objArray2 = new object[] { option, optionType }; Error.AddDevFatal("Options.SetEnum() - option {0} has unsupported underlying type {1}", objArray2); } } }
private string GetGameTypeName(GameType gameType, int missionId) { DbfRecord adventureRecord = GameUtils.GetAdventureRecord(missionId); if (adventureRecord == null) { string str; if (this.m_gameTypeNameKeys.TryGetValue(gameType, out str)) { return(GameStrings.Get(str)); } object[] messageArgs = new object[] { missionId, gameType }; Error.AddDevFatal("ReconnectMgr.GetGameTypeName() - no name for mission {0} gameType {1}", messageArgs); return(string.Empty); } switch (adventureRecord.GetInt("ID")) { case 1: return(GameStrings.Get("GLUE_RECONNECT_GAME_TYPE_TUTORIAL")); case 2: return(GameStrings.Get("GLUE_RECONNECT_GAME_TYPE_PRACTICE")); case 3: return(GameStrings.Get("GLUE_RECONNECT_GAME_TYPE_NAXXRAMAS")); case 4: return(GameStrings.Get("GLUE_RECONNECT_GAME_TYPE_BRM")); case 7: return(GameStrings.Get("GLUE_RECONNECT_GAME_TYPE_TAVERN_BRAWL")); } return(adventureRecord.GetLocString("NAME")); }
private object GetClientOption(Option option, string optionName) { System.Type optionType = this.GetOptionType(option); if (optionType == typeof(bool)) { return(LocalOptions.Get().GetBool(optionName)); } if (optionType == typeof(int)) { return(LocalOptions.Get().GetInt(optionName)); } if (optionType == typeof(long)) { return(LocalOptions.Get().GetLong(optionName)); } if (optionType == typeof(ulong)) { return(LocalOptions.Get().GetULong(optionName)); } if (optionType == typeof(float)) { return(LocalOptions.Get().GetFloat(optionName)); } if (optionType == typeof(string)) { return(LocalOptions.Get().GetString(optionName)); } object[] messageArgs = new object[] { option, optionType }; Error.AddDevFatal("Options.GetClientOption() - option {0} has unsupported underlying type {1}", messageArgs); return(null); }
public static bool UpgradeServerOptions() { int @int = Options.Get().GetInt(Option.SERVER_OPTIONS_VERSION); if (!Options.Get().HasOption(Option.SERVER_OPTIONS_VERSION)) { if (!UpgradeServerOptions_V2()) { return(false); } @int = 2; } while (@int < 2) { UpgradeCallback callback; if (!s_serverUpgradeCallbacks.TryGetValue(@int, out callback)) { object[] messageArgs = new object[] { @int, @int + 1, 2 }; Error.AddDevFatal("OptionsMigration.UpgradeServerOptions() - Current version is {0} and there is no function to upgrade to {1}. Latest is {2}.", messageArgs); return(false); } if (!callback()) { return(false); } @int++; } return(true); }
public static IntPtr LoadPlugin(string fileName, bool handleError = true) { PlatformDependentValue <string> value2 = new PlatformDependentValue <string>(PlatformCategory.OS) { PC = "Hearthstone_Data/Plugins/{0}", Mac = "Hearthstone.app/Contents/Plugins/{0}.bundle/Contents/MacOS/{0}", iOS = string.Empty, Android = string.Empty }; try { string filename = string.Format((string)value2, fileName); IntPtr ptr = DLLUtils.LoadLibrary(filename); if ((ptr == IntPtr.Zero) && handleError) { string str2 = Directory.GetCurrentDirectory().Replace(@"\", "/"); string str3 = string.Format("{0}/{1}", str2, filename); object[] messageArgs = new object[] { str3 }; Error.AddDevFatal("Failed to load plugin from '{0}'", messageArgs); object[] objArray2 = new object[] { fileName }; Error.AddFatalLoc("GLOBAL_ERROR_ASSET_LOAD_FAILED", objArray2); } return(ptr); } catch (Exception exception) { object[] objArray3 = new object[] { exception.Message, exception.StackTrace }; Error.AddDevFatal("FileUtils.LoadPlugin() - Exception occurred. message={0} stackTrace={1}", objArray3); return(IntPtr.Zero); } }
private void LoadSpell() { if (string.IsNullOrEmpty(this.m_emoteSoundSpellPath)) { Debug.LogWarning(string.Format("Could not load emote of type {0} as no sound asset was specified", this.m_emoteType)); } else { GameObject obj2 = AssetLoader.Get().LoadSpell(this.m_emoteSoundSpellPath, true, false); if (obj2 != null) { this.m_emoteSoundSpell = obj2.GetComponent <CardSoundSpell>(); } if (this.m_emoteSoundSpell == null) { if (AssetLoader.DOWNLOADABLE_LANGUAGE_PACKS == null) { object[] messageArgs = new object[] { this.m_emoteSoundSpellPath, this.m_emoteType }; Error.AddDevFatal("EmoteEntry.LoadSpell() - FAILED TO LOAD \"{0}\" (emoteType {1})", messageArgs); } } else if (this.m_initSpellFunc != null) { this.m_initSpellFunc(this.m_emoteSoundSpell); } } }
public void LoadSoundSpell(int index) { if ((((index >= 0) && (this.m_soundSpellPathes != null)) && ((index < this.m_soundSpellPathes.Count) && !string.IsNullOrEmpty(this.m_soundSpellPathes[index]))) && (this.m_soundSpells[index] == null)) { string name = this.m_soundSpellPathes[index]; GameObject obj2 = AssetLoader.Get().LoadSpell(name, true, false); if (obj2 == null) { if (AssetLoader.DOWNLOADABLE_LANGUAGE_PACKS == null) { object[] messageArgs = new object[] { this.m_spellPath, index }; Error.AddDevFatal("CardEffect.LoadSoundSpell() - FAILED TO LOAD \"{0}\" (index {1})", messageArgs); } } else { this.m_soundSpells[index] = obj2.GetComponent <CardSoundSpell>(); if (this.m_soundSpells[index] == null) { if (AssetLoader.DOWNLOADABLE_LANGUAGE_PACKS == null) { object[] objArray2 = new object[] { this.m_spellPath, index }; Error.AddDevFatal("CardEffect.LoadSoundSpell() - FAILED TO LOAD \"{0}\" (index {1})", objArray2); } } else if (this.m_initSoundSpell != null) { this.m_initSoundSpell(this.m_soundSpells[index]); } } } }
private void reportUnhandledException(string message, string stackTrace) { string item = createHash(message + stackTrace); if (!this.m_previousExceptions.Contains(item)) { this.m_previousExceptions.Add(item); object[] messageArgs = new object[] { message, stackTrace }; Error.AddDevFatal("Uncaught Exception!\n{0}\nAt:\n{1}", messageArgs); } }
private void ThrowDnsResolveError(string environment) { if (ApplicationMgr.IsInternal()) { Error.AddDevFatal("Environment " + environment + " could not be resolved! Please check your environment and Internet connection!", new object[0]); } else { Error.AddFatalLoc("GLOBAL_ERROR_NETWORK_NO_CONNECTION", new object[0]); } }
private void Load() { string path = s_downloadManifestFilePath; int num = 0; try { using (StreamReader reader = new StreamReader(path)) { string str2; bool flag = true; while ((str2 = reader.ReadLine()) != null) { num++; if (!string.IsNullOrEmpty(str2)) { if (flag) { if (str2.Equals("<END OF HASHES>")) { flag = false; } else { this.ParseAndAddHashName(str2); } } else { this.m_fileSet.Add(str2); } } } } } catch (FileNotFoundException exception) { Error.AddDevFatal(string.Format("Failed to find download manifest at '{0}': {1}", path, exception.Message), new object[0]); } catch (IOException exception2) { Error.AddDevFatal(string.Format("Failed to read download manifest at '{0}': {1}", path, exception2.Message), new object[0]); } catch (NullReferenceException exception3) { Error.AddDevFatal(string.Format("Failed to read from download manifest '{0}' line {1}: {2}", path, num, exception3.Message), new object[0]); } catch (Exception exception4) { Error.AddDevFatal(string.Format("An unknown error occurred loading download manifest '{0}' line {1}: {2}", path, num, exception4.Message), new object[0]); } }
private void LoadSpell() { this.m_spell = AssetLoader.Get().LoadSpell(this.m_spellPath, true, false).GetComponent <Spell>(); if (this.m_spell == null) { object[] messageArgs = new object[] { this.m_spellPath }; Error.AddDevFatal("CardEffect.LoadSpell() - FAILED TO LOAD \"{0}\"", messageArgs); } else if (this.m_initSpell != null) { this.m_initSpell(this.m_spell); } }
private bool EncodeStatusVal(Enum[] status, int index, out byte id, out int intVal) { Enum enum2 = status[index]; System.Type key = enum2.GetType(); intVal = Convert.ToInt32(enum2); if (!this.m_enumToIdMap.TryGetValue(key, out id)) { object[] messageArgs = new object[] { enum2, index, key }; Error.AddDevFatal("PresenceMgr.EncodeStatusVal() - {0} at index {1} belongs to type {2}, which has no id", messageArgs); return(false); } return(true); }
private void OnOptionChanged(Option option, object prevValue, bool existed, object userData) { Option option2 = option; if (option2 == Option.IDLE_KICKER) { this.UpdateCheckForInactivity(); } else if (option2 == Option.IDLE_KICK_TIME) { this.UpdateIdleKickTimeOption(); } else { object[] messageArgs = new object[] { option }; Error.AddDevFatal("InactivePlayerKicker.OnOptionChanged() - unhandled option {0}", messageArgs); } }
private static void CachedReceivedAsset(AssetType assetType, int assetId, byte[] assetBytes, int assetBytesLength) { byte[] assetHash = System.Security.Cryptography.SHA1.Create().ComputeHash(assetBytes, 0, assetBytesLength); string path = GetCachedAssetFilePath(assetType, assetId, assetHash); try { using (FileStream stream = new FileStream(path, FileMode.Create)) { stream.Write(assetBytes, 0, assetBytesLength); } } catch (Exception exception) { object[] messageArgs = new object[] { path, exception.ToString() }; Error.AddDevFatal("Error saving cached asset {0}:\n{1}", messageArgs); } }
private void UpdateCardAssets(CardDef cardDef, CardPortraitQuality quality) { CardPortraitQuality portraitQuality = cardDef.GetPortraitQuality(); if ((quality > portraitQuality) && !string.IsNullOrEmpty(cardDef.m_PortraitTexturePath)) { if (portraitQuality.TextureQuality < quality.TextureQuality) { string textureName = GetTextureName(cardDef.m_PortraitTexturePath, quality.TextureQuality); Texture portrait = AssetLoader.Get().LoadCardTexture(textureName, false); if (portrait == null) { object[] messageArgs = new object[] { cardDef.m_PortraitTexturePath, cardDef }; Error.AddDevFatal("DefLoader.UpdateCardTextures() - Failed to load {0} for card {1}", messageArgs); return; } cardDef.OnPortraitLoaded(portrait, quality.TextureQuality); } if (((quality.LoadPremium && !portraitQuality.LoadPremium) || cardDef.m_AlwaysRenderPremiumPortrait) && !string.IsNullOrEmpty(cardDef.m_PremiumPortraitMaterialPath)) { Material material = AssetLoader.Get().LoadPremiumMaterial(cardDef.m_PremiumPortraitMaterialPath, false); Texture texture2 = null; if (material == null) { object[] objArray2 = new object[] { cardDef.m_PremiumPortraitMaterialPath, cardDef }; Error.AddDevFatal("DefLoader.UpdateCardTextures() - Failed to load {0} for card {1}", objArray2); } else { if (!string.IsNullOrEmpty(cardDef.m_PremiumPortraitTexturePath)) { texture2 = AssetLoader.Get().LoadCardTexture(cardDef.m_PremiumPortraitTexturePath, false); if (texture2 == null) { object[] objArray3 = new object[] { cardDef.m_PremiumPortraitTexturePath, cardDef }; Error.AddDevFatal("DefLoader.UpdateCardTextures() - Failed to load {0} for card {1}", objArray3); return; } } cardDef.OnPremiumMaterialLoaded(material, texture2); } } } }
private void PreloadSpell(string tableName, SpellType type) { SpellTable spellTable = this.GetSpellTable(tableName); if (spellTable == null) { object[] messageArgs = new object[] { tableName }; Error.AddDevFatal("SpellCache.PreloadSpell() - Preloaded nonexistent SpellTable {0}", messageArgs); } else { SpellTableEntry entry = spellTable.FindEntry(type); if (entry == null) { object[] objArray2 = new object[] { tableName, type }; Error.AddDevFatal("SpellCache.PreloadSpell() - SpellTable {0} has no spell of type {1}", objArray2); } else if (entry.m_Spell == null) { string name = FileUtils.GameAssetPathToName(entry.m_SpellPrefabName); GameObject obj2 = AssetLoader.Get().LoadActor(name, true, true); if (obj2 == null) { object[] objArray3 = new object[] { name }; Error.AddDevFatal("SpellCache.PreloadSpell() - {0} does not contain a spell component: ", objArray3); } else { Spell component = obj2.GetComponent <Spell>(); if (component == null) { object[] objArray4 = new object[] { name }; Error.AddDevFatal("SpellCache.PreloadSpell() - {0} does not contain a spell component: ", objArray4); } else { spellTable.SetSpell(type, component); } } } } }
private void OnIconLoaded(string name, UnityEngine.Object obj, object callbackData) { if (name == this.m_loadingIcon) { Texture texture = obj as Texture; if (texture == null) { object[] messageArgs = new object[] { name, this.m_programId }; Error.AddDevFatal("FriendListGameIcon.OnIconLoaded() - Failed to load {0}. ProgramId={1}", messageArgs); this.m_currentIcon = null; this.m_loadingIcon = null; } else { this.m_currentIcon = this.m_loadingIcon; this.m_loadingIcon = null; this.m_Icon.GetComponent <Renderer>().material.mainTexture = texture; } } }
private void OnTextureLoaded(string name, UnityEngine.Object obj, object callbackData) { if (name == this.m_loadingTextureName) { Texture texture = obj as Texture; if (texture == null) { object[] messageArgs = new object[] { name, this.m_programId }; Error.AddDevFatal("PlayerPortrait.OnTextureLoaded() - Failed to load {0}. ProgramId={1}", messageArgs); this.m_currentTextureName = null; this.m_loadingTextureName = null; } else { this.m_currentTextureName = this.m_loadingTextureName; this.m_loadingTextureName = null; base.GetComponent <Renderer>().material.mainTexture = texture; } } }
private SpellTable LoadSpellTable(string tableName) { GameObject obj2 = AssetLoader.Get().LoadActor(tableName, false, false); if (obj2 == null) { object[] messageArgs = new object[] { base.name }; Error.AddDevFatal("SpellCache.LoadSpellTable() - {0} failed to load", messageArgs); return(null); } SpellTable component = obj2.GetComponent <SpellTable>(); if (component == null) { object[] objArray2 = new object[] { base.name }; Error.AddDevFatal("SpellCache.LoadSpellTable() - {0} has no SpellTable component", objArray2); return(null); } component.transform.parent = base.transform; this.m_spellTableCache.Add(tableName, component); return(component); }
private object GetServerOption(Option option, ServerOption serverOption) { System.Type optionType = this.GetOptionType(option); if (optionType == typeof(int)) { return(NetCache.Get().GetIntOption(serverOption)); } if (optionType == typeof(long)) { return(NetCache.Get().GetLongOption(serverOption)); } if (optionType == typeof(float)) { return(NetCache.Get().GetFloatOption(serverOption)); } if (optionType == typeof(ulong)) { return(NetCache.Get().GetULongOption(serverOption)); } object[] messageArgs = new object[] { option, optionType }; Error.AddDevFatal("Options.GetServerOption() - option {0} has unsupported underlying type {1}", messageArgs); return(null); }
public bool SetString(string composite) { if (composite == null) { Error.AddDevFatal("BnetBattleTag.SetString() - Given null string.", new object[0]); return(false); } char[] separator = new char[] { '#' }; string[] strArray = composite.Split(separator); if (strArray.Length < 2) { object[] messageArgs = new object[] { composite, 2 }; Error.AddDevFatal("BnetBattleTag.SetString() - Failed to split \"{0}\" into {1} parts.", messageArgs); return(false); } if (!int.TryParse(strArray[1], out this.m_number)) { object[] objArray2 = new object[] { strArray[1], composite }; Error.AddDevFatal("BnetBattleTag.SetString() - Failed to parse \"{0}\" into a number. Original string: \"{1}\"", objArray2); return(false); } this.m_name = strArray[0]; return(true); }