コード例 #1
0
        public void PublishRichPresence([In] RichPresenceUpdate[] updates)
        {
            UpdateRequest updateRequest = new UpdateRequest();

            updateRequest.EntityId = this.m_battleNet.GameAccountId;
            FieldOperation fieldOperation = new FieldOperation();
            Field          field          = new Field();
            FieldKey       fieldKey       = new FieldKey();

            fieldKey.SetProgram(BnetProgramId.BNET.GetValue());
            fieldKey.SetGroup(2u);
            fieldKey.SetField(8u);
            foreach (RichPresenceUpdate richPresenceUpdate in updates)
            {
                fieldKey.SetIndex(richPresenceUpdate.presenceFieldIndex);
                RichPresence richPresence = new RichPresence();
                richPresence.SetIndex(richPresenceUpdate.index);
                richPresence.SetProgramId(richPresenceUpdate.programId);
                richPresence.SetStreamId(richPresenceUpdate.streamId);
                Variant variant = new Variant();
                variant.SetMessageValue(ProtobufUtil.ToByteArray(richPresence));
                field.SetKey(fieldKey);
                field.SetValue(variant);
                fieldOperation.SetField(field);
                updateRequest.SetEntityId(this.m_battleNet.GameAccountId);
                updateRequest.AddFieldOperation(fieldOperation);
            }
            this.PublishField(updateRequest);
        }
コード例 #2
0
        public void SetPresenceBlob(uint field, byte[] val)
        {
            UpdateRequest updateRequest = new UpdateRequest();

            updateRequest.EntityId = this.m_battleNet.GameAccountId;
            FieldOperation fieldOperation = new FieldOperation();
            Field          field2         = new Field();
            FieldKey       fieldKey       = new FieldKey();

            fieldKey.SetProgram(BnetProgramId.WOW.GetValue());
            fieldKey.SetGroup(2u);
            fieldKey.SetField(field);
            Variant variant = new Variant();

            if (val == null)
            {
                val = new byte[0];
            }
            variant.SetBlobValue(val);
            field2.SetKey(fieldKey);
            field2.SetValue(variant);
            fieldOperation.SetField(field2);
            updateRequest.SetEntityId(this.m_battleNet.GameAccountId);
            updateRequest.AddFieldOperation(fieldOperation);
            this.PublishField(updateRequest);
        }
コード例 #3
0
    public void PublishRichPresence([In] BattleNet.DllRichPresenceUpdate[] updates)
    {
        UpdateRequest updateRequest = new UpdateRequest {
            EntityId = base.m_battleNet.GameAccountId
        };
        FieldOperation val   = new FieldOperation();
        Field          field = new Field();
        FieldKey       key   = new FieldKey();

        key.SetProgram(BnetProgramId.BNET.GetValue());
        key.SetGroup(2);
        key.SetField(8);
        foreach (BattleNet.DllRichPresenceUpdate update in updates)
        {
            key.SetIndex(update.presenceFieldIndex);
            bnet.protocol.presence.RichPresence protobuf = new bnet.protocol.presence.RichPresence();
            protobuf.SetIndex(update.index);
            protobuf.SetProgramId(update.programId);
            protobuf.SetStreamId(update.streamId);
            bnet.protocol.attribute.Variant variant = new bnet.protocol.attribute.Variant();
            variant.SetMessageValue(ProtobufUtil.ToByteArray(protobuf));
            field.SetKey(key);
            field.SetValue(variant);
            val.SetField(field);
            updateRequest.SetEntityId(base.m_battleNet.GameAccountId);
            updateRequest.AddFieldOperation(val);
        }
        this.PublishField(updateRequest);
    }
コード例 #4
0
        public void PublishRichPresence([In] RichPresenceUpdate[] updates)
        {
            UpdateRequest updateRequest = new UpdateRequest()
            {
                EntityId = this.m_battleNet.GameAccountId
            };
            FieldOperation fieldOperation = new FieldOperation();
            Field          field          = new Field();
            FieldKey       fieldKey       = new FieldKey();

            fieldKey.SetProgram(BnetProgramId.BNET.GetValue());
            fieldKey.SetGroup(2);
            fieldKey.SetField(8);
            RichPresenceUpdate[] richPresenceUpdateArray = updates;
            for (int i = 0; i < (int)richPresenceUpdateArray.Length; i++)
            {
                RichPresenceUpdate richPresenceUpdate = richPresenceUpdateArray[i];
                fieldKey.SetIndex(richPresenceUpdate.presenceFieldIndex);
                RichPresence richPresence = new RichPresence();
                richPresence.SetIndex(richPresenceUpdate.index);
                richPresence.SetProgramId(richPresenceUpdate.programId);
                richPresence.SetStreamId(richPresenceUpdate.streamId);
                bnet.protocol.attribute.Variant variant = new bnet.protocol.attribute.Variant();
                variant.SetMessageValue(ProtobufUtil.ToByteArray(richPresence));
                field.SetKey(fieldKey);
                field.SetValue(variant);
                fieldOperation.SetField(field);
                updateRequest.SetEntityId(this.m_battleNet.GameAccountId);
                updateRequest.AddFieldOperation(fieldOperation);
            }
            this.PublishField(updateRequest);
        }
コード例 #5
0
        public void SetPresenceBool(uint field, bool val)
        {
            UpdateRequest  updateRequest  = new UpdateRequest();
            FieldOperation fieldOperation = new FieldOperation();
            Field          field1         = new Field();
            FieldKey       fieldKey       = new FieldKey();

            fieldKey.SetProgram(BnetProgramId.WOW.GetValue());
            fieldKey.SetGroup(2);
            fieldKey.SetField(field);
            bnet.protocol.attribute.Variant variant = new bnet.protocol.attribute.Variant();
            variant.SetBoolValue(val);
            field1.SetKey(fieldKey);
            field1.SetValue(variant);
            fieldOperation.SetField(field1);
            updateRequest.SetEntityId(this.m_battleNet.GameAccountId);
            updateRequest.AddFieldOperation(fieldOperation);
            this.PublishField(updateRequest);
        }