Exemplo n.º 1
0
        /// <inheritdoc />
        public unsafe void Update()
        {
            if (this.isDisposed)
            {
                throw new ObjectDisposedException(nameof(Gw2MumbleClient));
            }

            this.memoryMappedViewAccessor.Value.Read <Gw2LinkedMem>(0, out var linkedMem);
            int oldTick = this.Tick;

            this.Name        = new string(linkedMem.name);
            this.IsAvailable = this.Name == MUMBLE_LINK_GAME_NAME;

            if (this.IsAvailable && linkedMem.uiTick != oldTick)
            {
                // There's actually a possible identity update
                this.newIdentityJson = new string(linkedMem.identity);
            }
            else if (!this.IsAvailable)
            {
                // Mumble Link isn't available, clear the identity
                this.newIdentityJson = null;
            }

            this.linkedMem = linkedMem;
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public unsafe void Update()
        {
            if (this.isDisposed)
            {
                throw new ObjectDisposedException(nameof(Gw2MumbleClient));
            }

            this.memoryMappedViewAccessor.Value.Read <Gw2LinkedMem>(0, out var mem);
            int oldTick = this.Tick;

            if (mem.uiTick != oldTick)
            {
                var gameNameSpan   = new ReadOnlySpan <char>(mumbleLinkGameName);
                var linkedNameSpan = new ReadOnlySpan <char>(mem.name, mumbleLinkGameName.Length);
                this.IsAvailable = gameNameSpan.SequenceEqual(linkedNameSpan);

                if (this.IsAvailable)
                {
                    this.Name = MUMBLE_LINK_GAME_NAME_GUILD_WARS_2;
                    this.serverAddressCacheDirty = true;
                }
                else
                {
                    this.Name = new string(mem.name);
                }
            }

            this.linkedMem = mem;
        }