コード例 #1
0
        public async Task GetStatus(IHttpContext context)
        {
            Authenticator.VerifyAuth(context);

            var payload = await Dispatcher.RunOnMainThread(() => StatusPayload.FromServer());

            await context.SendResponse(HttpStatusCode.OK, payload);
        }
コード例 #2
0
ファイル: Payload.cs プロジェクト: Aida-Enna/Dalamud
        private static Payload ProcessChunk(BinaryReader reader)
        {
            Payload payload = null;

            reader.ReadByte();  // START_BYTE
            var chunkType = (SeStringChunkType)reader.ReadByte();
            var chunkLen  = GetInteger(reader);

            var packetStart = reader.BaseStream.Position;

            switch (chunkType)
            {
            case SeStringChunkType.Interactable:
            {
                var subType = (EmbeddedInfoType)reader.ReadByte();
                switch (subType)
                {
                case EmbeddedInfoType.PlayerName:
                    payload = new PlayerPayload();
                    break;

                case EmbeddedInfoType.ItemLink:
                    payload = new ItemPayload();
                    break;

                case EmbeddedInfoType.Status:
                    payload = new StatusPayload();
                    break;

                case EmbeddedInfoType.LinkTerminator:
                // this has no custom handling and so needs to fallthrough to ensure it is captured
                default:
                    Log.Verbose("Unhandled EmbeddedInfoType: {0}", subType);
                    // rewind so we capture the Interactable byte in the raw data
                    reader.BaseStream.Seek(-1, SeekOrigin.Current);
                    payload = new RawPayload((byte)chunkType);
                    break;
                }
            }
            break;

            default:
                Log.Verbose("Unhandled SeStringChunkType: {0}", chunkType);
                payload = new RawPayload((byte)chunkType);
                break;
            }

            payload?.ProcessChunkImpl(reader, reader.BaseStream.Position + chunkLen - 1);

            // read through the rest of the packet
            var readBytes = (int)(reader.BaseStream.Position - packetStart);

            reader.ReadBytes(chunkLen - readBytes + 1); // +1 for the END_BYTE marker

            return(payload);
        }
コード例 #3
0
ファイル: xbee.cs プロジェクト: g-zhang/Dronez
    void status_parse(byte[] data, int size)
    {
        StatusPayload payload = ByteArrayToStructure <StatusPayload>(data, size);

        SharedVars.currentGps                  = payload.currentGPS;
        SharedVars.sensorData.currentGPS       = payload.currentGPS;
        SharedVars.sensorData.accelermatorData = payload.accData;
        SharedVars.sensorData.batteryLevel     = payload.batteryLevel;
        SharedVars.sensorData.gyroData         = payload.gyroData;
        SharedVars.sensorData.magData          = payload.magData;
        SharedVars.flightMode                  = payload.flightMode;
        // Console.WriteLine(SharedVars.currentGps.x);
        //  Console.WriteLine(payload.currentGPS.x);
    }
コード例 #4
0
 protected override Task <IEnumerable <ComplianceMessage> > SendMessageAsyncInternal(IEnumerable <ComplianceMessage> messages)
 {
     return(Task.Run <IEnumerable <ComplianceMessage> >(delegate()
     {
         StatusPayload statusPayload = new StatusPayload();
         foreach (ComplianceMessage complianceMessage in messages)
         {
             string tenantName = string.Empty;
             OrganizationId organizationId;
             if (OrganizationId.TryCreateFromBytes(complianceMessage.TenantId, Encoding.UTF8, out organizationId) && organizationId.OrganizationalUnit != null)
             {
                 tenantName = organizationId.OrganizationalUnit.Name;
                 using (IDisposable disposable = (IDisposable)this.GetRpsProvider(tenantName))
                 {
                     byte[] value = ComplianceSerializer.Serialize <ComplianceMessage>(ComplianceMessage.Description, complianceMessage);
                     PSCommand pscommand = new PSCommand();
                     pscommand.AddCommand(new Command("Send-ComplianceMessage", false));
                     pscommand.AddParameter("SerializedComplianceMessage", value);
                     MethodBase method = this.rpsProviderAssembly.RpsProviderType.GetMethod("Execute", new Type[]
                     {
                         typeof(PSCommand),
                         typeof(TimeSpan)
                     });
                     object obj = disposable;
                     object[] array = new object[2];
                     array[0] = pscommand;
                     IEnumerable <PSObject> enumerable = (IEnumerable <PSObject>)method.Invoke(obj, array);
                     if (enumerable != null && enumerable.Count <PSObject>() == 1 && (bool)enumerable.ToArray <PSObject>()[0].BaseObject)
                     {
                         statusPayload.QueuedMessages.Add(complianceMessage.MessageId);
                     }
                 }
             }
         }
         return (IEnumerable <ComplianceMessage>) new ComplianceMessage[]
         {
             new ComplianceMessage
             {
                 Payload = ComplianceSerializer.Serialize <StatusPayload>(StatusPayload.Description, statusPayload)
             }
         };
     }));
 }
コード例 #5
0
        public async Task Status(DateTimeOffset eventDate, StatusPayload payload)
        {
            var updater = new DataUpdater(_contextFactory, _mapper);

            await updater.UpdateRepositories(eventDate, new[] { payload.Repository });

            // Since we only do this here there's no need to add a mapping
            var status = new CommitStatus()
            {
                Context     = payload.Context,
                CreatedAt   = payload.CreatedAt,
                Description = payload.Description,
                Id          = payload.Id,
                State       = payload.State,
                TargetUrl   = payload.TargetUrl,
                UpdatedAt   = payload.UpdatedAt,
            };
            await updater.UpdateCommitStatuses(payload.Repository.Id, payload.Sha, new[] { status });

            await updater.Changes.Submit(_queueClient);
        }
コード例 #6
0
 public async Task <byte[][]> ReceiveMessagesAsync(byte[][] messageBlobs)
 {
     return(await Task.Run <byte[][]>(delegate()
     {
         StatusPayload statusPayload = new StatusPayload();
         foreach (byte[] blob in messageBlobs)
         {
             ComplianceMessage complianceMessage;
             FaultDefinition fault;
             if (ComplianceSerializer.TryDeserialize <ComplianceMessage>(ComplianceMessage.Description, blob, out complianceMessage, out fault, "ReceiveMessagesAsync", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionFabric\\Endpoint\\MessageReceiver.cs", 56))
             {
                 MessageReceiverBase messageReceiverBase;
                 if (Registry.Instance.TryGetInstance <MessageReceiverBase>(RegistryComponent.MessageReceiver, complianceMessage.ComplianceMessageType, out messageReceiverBase, out fault, "ReceiveMessagesAsync", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionFabric\\Endpoint\\MessageReceiver.cs", 58))
                 {
                     if (messageReceiverBase.ReceiveMessage(complianceMessage))
                     {
                         statusPayload.QueuedMessages.Add(complianceMessage.MessageId);
                     }
                 }
                 else if (complianceMessage.ComplianceMessageType == ComplianceMessageType.EchoRequest)
                 {
                     statusPayload.QueuedMessages.Add(complianceMessage.MessageId);
                 }
                 else
                 {
                     ExceptionHandler.FaultMessage(complianceMessage, fault, true);
                 }
             }
         }
         return new byte[][]
         {
             ComplianceSerializer.Serialize <ComplianceMessage>(ComplianceMessage.Description, new ComplianceMessage
             {
                 ComplianceMessageType = ComplianceMessageType.Status,
                 Payload = ComplianceSerializer.Serialize <StatusPayload>(StatusPayload.Description, statusPayload)
             })
         };
     }));
 }
コード例 #7
0
        // Token: 0x0600003D RID: 61 RVA: 0x00002FCC File Offset: 0x000011CC
        public override ComplianceMessage Process(ComplianceMessage input)
        {
            StatusPayload statusPayload = new StatusPayload();

            if (input == null)
            {
                return(new ComplianceMessage
                {
                    Payload = ComplianceSerializer.Serialize <StatusPayload>(StatusPayload.Description, statusPayload)
                });
            }
            statusPayload.QueuedMessages.Add(input.MessageId);
            WorkPayload     workPayload;
            FaultDefinition faultDefinition;
            OrganizationId  orgId;

            if (ComplianceSerializer.TryDeserialize <WorkPayload>(WorkPayload.Description, input.Payload, out workPayload, out faultDefinition, "Process", "f:\\15.00.1497\\sources\\dev\\EDiscovery\\src\\TaskDistributionSystem\\TaskDistributionFabric\\Blocks\\StoreResultsBlock.cs", 47) && OrganizationId.TryCreateFromBytes(input.TenantId, Encoding.UTF8, out orgId))
            {
                Guid correlationId = input.CorrelationId;
                ComplianceJobProvider complianceJobProvider = new ComplianceJobProvider(orgId);
                ComplianceJobStatus   status = ComplianceJobStatus.StatusUnknown;
                switch (workPayload.WorkDefinitionType)
                {
                case WorkDefinitionType.EDiscovery:
                    status = ComplianceJobStatus.Succeeded;
                    break;

                case WorkDefinitionType.Fault:
                    status = ComplianceJobStatus.Failed;
                    break;
                }
                complianceJobProvider.UpdateWorkloadResults(correlationId, input.Payload, ComplianceBindingType.ExchangeBinding, status);
            }
            return(new ComplianceMessage
            {
                Payload = ComplianceSerializer.Serialize <StatusPayload>(StatusPayload.Description, statusPayload)
            });
        }
コード例 #8
0
        private static Payload DecodeChunk(BinaryReader reader)
        {
            Payload payload = null;

            reader.ReadByte();  // START_BYTE
            var chunkType = (SeStringChunkType)reader.ReadByte();
            var chunkLen  = GetInteger(reader);

            var packetStart = reader.BaseStream.Position;

            // any unhandled payload types will be turned into a RawPayload with the exact same binary data
            switch (chunkType)
            {
            case SeStringChunkType.EmphasisItalic:
                payload = new EmphasisItalicPayload();
                break;

            case SeStringChunkType.SeHyphen:
                payload = SeHyphenPayload.Payload;
                break;

            case SeStringChunkType.Interactable:
            {
                var subType = (EmbeddedInfoType)reader.ReadByte();
                switch (subType)
                {
                case EmbeddedInfoType.PlayerName:
                    payload = new PlayerPayload();
                    break;

                case EmbeddedInfoType.ItemLink:
                    payload = new ItemPayload();
                    break;

                case EmbeddedInfoType.MapPositionLink:
                    payload = new MapLinkPayload();
                    break;

                case EmbeddedInfoType.Status:
                    payload = new StatusPayload();
                    break;

                case EmbeddedInfoType.QuestLink:
                    payload = new QuestPayload();
                    break;

                case EmbeddedInfoType.DalamudLink:
                    payload = new DalamudLinkPayload();
                    break;

                case EmbeddedInfoType.LinkTerminator:
                // this has no custom handling and so needs to fallthrough to ensure it is captured
                default:
                    // but I'm also tired of this log
                    if (subType != EmbeddedInfoType.LinkTerminator)
                    {
                        Log.Verbose("Unhandled EmbeddedInfoType: {0}", subType);
                    }

                    // rewind so we capture the Interactable byte in the raw data
                    reader.BaseStream.Seek(-1, SeekOrigin.Current);
                    break;
                }
            }

            break;

            case SeStringChunkType.AutoTranslateKey:
                payload = new AutoTranslatePayload();
                break;

            case SeStringChunkType.UIForeground:
                payload = new UIForegroundPayload();
                break;

            case SeStringChunkType.UIGlow:
                payload = new UIGlowPayload();
                break;

            case SeStringChunkType.Icon:
                payload = new IconPayload();
                break;

            default:
                Log.Verbose("Unhandled SeStringChunkType: {0}", chunkType);
                break;
            }

            payload ??= new RawPayload((byte)chunkType);
            payload.DecodeImpl(reader, reader.BaseStream.Position + chunkLen - 1);

            // read through the rest of the packet
            var readBytes = (uint)(reader.BaseStream.Position - packetStart);

            reader.ReadBytes((int)(chunkLen - readBytes + 1)); // +1 for the END_BYTE marker

            return(payload);
        }
コード例 #9
0
ファイル: Classes.cs プロジェクト: ms2mml/ffxiv-chat-extender
            public static IEnumerable <ColorString> FromStatus(string str, ColorRef color, ColorRef shadowColor, StatusPayload status, TextTypes source)
            {
                yield return(MakeLinkChar(source));

                if (status.Status.Category == 1) // Buff
                {
                    yield return(MakeBuffChar(source));
                }
                else if (status.Status.Category == 2) // Debuff
                {
                    yield return(MakeDebuffChar(source));
                }
                foreach (var s in FromStringSplitDelimiters(str, color, shadowColor, source))
                {
                    yield return(s);
                }
            }
コード例 #10
0
 private void ChangeStatusText(StatusPayload statusPayload)
 {
     Status = null;
     Status = statusPayload;
 }