private bool FetchRichPresenceResource(Variant presenceValue)
        {
            if (presenceValue == null)
            {
                return(false);
            }
            RichPresence richPresence = RichPresence.ParseFrom(presenceValue.MessageValue);

            if (richPresence == null || !richPresence.IsInitialized)
            {
                base.ApiLog.LogError("Rich presence field from battle.net does not contain valid RichPresence message");
                return(false);
            }
            if (this.m_richPresenceStringTables.ContainsKey(richPresence))
            {
                return(false);
            }
            FourCC programId = new FourCC(richPresence.ProgramId);
            FourCC streamId  = new FourCC(richPresence.StreamId);
            FourCC locale    = new FourCC(BattleNet.Client().GetLocaleName());

            this.IncrementOutstandingRichPresenceStringFetches();
            ResourcesAPI resources = this.m_battleNet.Resources;

            resources.LookupResource(programId, streamId, locale, new ResourcesAPI.ResourceLookupCallback(this.ResouceLookupCallback), richPresence);
            return(true);
        }
Exemple #2
0
        public override void Initialize()
        {
            this.m_wordFilters = null;
            ResourcesAPI resources = this.m_battleNet.Resources;

            if (resources == null)
            {
                base.ApiLog.LogWarning("ResourcesAPI is not initialized! Unable to proceed.");
                return;
            }
            this.m_localeName = BattleNet.Client().GetLocaleName();
            if (string.IsNullOrEmpty(this.m_localeName))
            {
                base.ApiLog.LogWarning("Unable to get Locale from Localization class");
                this.m_localeName = "enUS";
            }
            base.ApiLog.LogDebug("Locale is {0}", new object[] { this.m_localeName });
            resources.LookupResource(new FourCC("BN"), new FourCC("apft"), new FourCC(this.m_localeName), new ResourcesAPI.ResourceLookupCallback(this.ResouceLookupCallback), null);
        }