Beispiel #1
0
 internal static System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <object, object> > GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet <string> exclusions = null, global::System.Collections.Generic.HashSet <string> inclusions = null)
 {
     return((null == instance || instance.Count == 0) ?
            Enumerable.Empty <System.Collections.Generic.KeyValuePair <object, object> >() :
            instance.Keys.OfType <object>()
            .Where(key =>
                   !(true == exclusions?.Contains(key?.ToString())) &&
                   (false != inclusions?.Contains(key?.ToString())))
            .Select(key => new System.Collections.Generic.KeyValuePair <object, object>(key, instance[key])));
 }
Beispiel #2
0
 internal static System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <object, object> > GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet <string> exclusions = null, global::System.Collections.Generic.HashSet <string> inclusions = null)
 {
     // new global::System.Collections.Generic.HashSet<string>(System.StringComparer.InvariantCultureIgnoreCase)
     return((null == instance || !instance.Properties.Any()) ?
            Enumerable.Empty <System.Collections.Generic.KeyValuePair <object, object> >() :
            instance.Properties
            .Where(property =>
                   !(true == exclusions?.Contains(property.Name)) &&
                   (false != inclusions?.Contains(property.Name)))
            .Select(property => new System.Collections.Generic.KeyValuePair <object, object>(property.Name, property.Value)));
 }
Beispiel #3
0
 ComponentUpdateDeserialize(global::System.UInt32 componentId,
                            global::System.UIntPtr userData,
                            global::Improbable.Worker.CInterop.SchemaComponentUpdate source,
                            out global::System.UIntPtr handleOut)
 {
     handleOut = global::System.UIntPtr.Zero;
     try
     {
         var data               = new Update();
         var fieldsToClear      = new global::System.Collections.Generic.HashSet <uint>();
         var fieldsToClearCount = source.GetClearedFieldCount();
         for (uint i = 0; i < fieldsToClearCount; ++i)
         {
             fieldsToClear.Add(source.IndexClearedField(i));
         }
         var fields = source.GetFields();
         if (fields.GetObjectCount(1) > 0)
         {
             global::Improbable.WorkerRequirementSet field;
             {
                 field = global::Improbable.WorkerRequirementSet_Internal.Read(fields.GetObject(1));
             }
             data.readAcl.Set(field);
         }
         if (fields.GetObjectCount(2) > 0 || fieldsToClear.Contains(2))
         {
             global::Improbable.Collections.Map <uint, global::Improbable.WorkerRequirementSet> field;
             {
                 var _count = fields.GetObjectCount(2);
                 field = new global::Improbable.Collections.Map <uint, global::Improbable.WorkerRequirementSet>((int)_count);
                 for (uint _i = 0; _i < _count; ++_i)
                 {
                     var _pair = fields.IndexObject(2, _i);
                     field.Add(_pair.GetUint32(1), global::Improbable.WorkerRequirementSet_Internal.Read(_pair.GetObject(2)));
                 }
             }
             data.componentWriteAcl.Set(field);
         }
         var handle = global::Improbable.Worker.Internal.ClientHandles.HandleAlloc();
         *handle   = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
         handleOut = (global::System.UIntPtr)handle;
     }
     catch (global::System.Exception e)
     {
         global::Improbable.Worker.ClientError.LogClientException(e);
         return(false);
     }
     return(true);
 }
 ComponentUpdateDeserialize(global::System.UInt32 componentId,
                            global::System.UIntPtr userData,
                            global::Improbable.Worker.CInterop.SchemaComponentUpdate source,
                            out global::System.UIntPtr handleOut)
 {
     handleOut = global::System.UIntPtr.Zero;
     try
     {
         var data               = new Update();
         var fieldsToClear      = new global::System.Collections.Generic.HashSet <uint>();
         var fieldsToClearCount = source.GetClearedFieldCount();
         for (uint i = 0; i < fieldsToClearCount; ++i)
         {
             fieldsToClear.Add(source.IndexClearedField(i));
         }
         var fields = source.GetFields();
         if (fields.GetInt64Count(1) > 0 || fieldsToClear.Contains(1))
         {
             global::Improbable.Collections.List <global::Improbable.EntityId> field;
             {
                 var _count = fields.GetInt64Count(1);
                 field = new global::Improbable.Collections.List <global::Improbable.EntityId>((int)_count);
                 for (uint _i = 0; _i < _count; ++_i)
                 {
                     field.Add(new global::Improbable.EntityId(fields.IndexInt64(1, _i)));
                 }
             }
             data.neighborList.Set(field);
         }
         var handle = global::Improbable.Worker.Internal.ClientHandles.HandleAlloc();
         *handle   = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
         handleOut = (global::System.UIntPtr)handle;
     }
     catch (global::System.Exception e)
     {
         global::Improbable.Worker.ClientError.LogClientException(e);
         return(false);
     }
     return(true);
 }
 ClientDeserialize(global::System.UInt32 componentId,
                   global::System.Byte handleType,
                   global::Improbable.Worker.Internal.Pbio.Object *root,
                   global::Improbable.Worker.Internal.ComponentProtocol.ClientHandle **handleOut)
 {
     *handleOut = null;
     try
     {
         *handleOut = global::Improbable.Worker.Internal.ClientHandles.HandleAlloc();
         if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Update)
         {
             var data               = new Update();
             var fieldsToClear      = new global::System.Collections.Generic.HashSet <uint>();
             var fieldsToClearCount = global::Improbable.Worker.Internal.Pbio.GetUint32Count(root, /* fields to clear */ 1);
             for (uint i = 0; i < fieldsToClearCount; ++i)
             {
                 fieldsToClear.Add(global::Improbable.Worker.Internal.Pbio.IndexUint32(root, /* fields to clear */ 1, i));
             }
             var stateObject = global::Improbable.Worker.Internal.Pbio.GetObject(
                 global::Improbable.Worker.Internal.Pbio.GetObject(root, /* entity_state */ 2), 197717);
             if (global::Improbable.Worker.Internal.Pbio.GetFloatCount(stateObject, 2) > 0 || fieldsToClear.Contains(2))
             {
                 global::Improbable.Collections.List <float> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetFloatCount(stateObject, 2);
                     field = new global::Improbable.Collections.List <float>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexFloat(stateObject, 2, _i));
                     }
                 }
                 data.field2.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetInt32Count(stateObject, 4) > 0 || fieldsToClear.Contains(4))
             {
                 global::Improbable.Collections.List <int> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetInt32Count(stateObject, 4);
                     field = new global::Improbable.Collections.List <int>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexInt32(stateObject, 4, _i));
                     }
                 }
                 data.field4.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetInt64Count(stateObject, 5) > 0 || fieldsToClear.Contains(5))
             {
                 global::Improbable.Collections.List <long> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetInt64Count(stateObject, 5);
                     field = new global::Improbable.Collections.List <long>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexInt64(stateObject, 5, _i));
                     }
                 }
                 data.field5.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetDoubleCount(stateObject, 6) > 0 || fieldsToClear.Contains(6))
             {
                 global::Improbable.Collections.List <double> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetDoubleCount(stateObject, 6);
                     field = new global::Improbable.Collections.List <double>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexDouble(stateObject, 6, _i));
                     }
                 }
                 data.field6.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetBytesCount(stateObject, 7) > 0 || fieldsToClear.Contains(7))
             {
                 global::Improbable.Collections.List <string> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetBytesCount(stateObject, 7);
                     field = new global::Improbable.Collections.List <string>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::System.Text.Encoding.UTF8.GetString(global::Improbable.Worker.Bytes.CopyOf(global::Improbable.Worker.Internal.Pbio.IndexBytes(stateObject, 7, _i), global::Improbable.Worker.Internal.Pbio.IndexBytesLength(stateObject, 7, _i)).BackingArray));
                     }
                 }
                 data.field7.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetUint32Count(stateObject, 8) > 0 || fieldsToClear.Contains(8))
             {
                 global::Improbable.Collections.List <uint> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetUint32Count(stateObject, 8);
                     field = new global::Improbable.Collections.List <uint>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexUint32(stateObject, 8, _i));
                     }
                 }
                 data.field8.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetUint64Count(stateObject, 9) > 0 || fieldsToClear.Contains(9))
             {
                 global::Improbable.Collections.List <ulong> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetUint64Count(stateObject, 9);
                     field = new global::Improbable.Collections.List <ulong>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexUint64(stateObject, 9, _i));
                     }
                 }
                 data.field9.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetSint32Count(stateObject, 10) > 0 || fieldsToClear.Contains(10))
             {
                 global::Improbable.Collections.List <int> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetSint32Count(stateObject, 10);
                     field = new global::Improbable.Collections.List <int>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexSint32(stateObject, 10, _i));
                     }
                 }
                 data.field10.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetSint64Count(stateObject, 11) > 0 || fieldsToClear.Contains(11))
             {
                 global::Improbable.Collections.List <long> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetSint64Count(stateObject, 11);
                     field = new global::Improbable.Collections.List <long>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexSint64(stateObject, 11, _i));
                     }
                 }
                 data.field11.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetFixed32Count(stateObject, 12) > 0 || fieldsToClear.Contains(12))
             {
                 global::Improbable.Collections.List <uint> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetFixed32Count(stateObject, 12);
                     field = new global::Improbable.Collections.List <uint>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexFixed32(stateObject, 12, _i));
                     }
                 }
                 data.field12.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetFixed64Count(stateObject, 13) > 0 || fieldsToClear.Contains(13))
             {
                 global::Improbable.Collections.List <ulong> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetFixed64Count(stateObject, 13);
                     field = new global::Improbable.Collections.List <ulong>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexFixed64(stateObject, 13, _i));
                     }
                 }
                 data.field13.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetSfixed32Count(stateObject, 14) > 0 || fieldsToClear.Contains(14))
             {
                 global::Improbable.Collections.List <int> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetSfixed32Count(stateObject, 14);
                     field = new global::Improbable.Collections.List <int>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexSfixed32(stateObject, 14, _i));
                     }
                 }
                 data.field14.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetSfixed64Count(stateObject, 15) > 0 || fieldsToClear.Contains(15))
             {
                 global::Improbable.Collections.List <long> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetSfixed64Count(stateObject, 15);
                     field = new global::Improbable.Collections.List <long>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Worker.Internal.Pbio.IndexSfixed64(stateObject, 15, _i));
                     }
                 }
                 data.field15.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetInt64Count(stateObject, 16) > 0 || fieldsToClear.Contains(16))
             {
                 global::Improbable.Collections.List <global::Improbable.EntityId> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetInt64Count(stateObject, 16);
                     field = new global::Improbable.Collections.List <global::Improbable.EntityId>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(new global::Improbable.EntityId(global::Improbable.Worker.Internal.Pbio.IndexInt64(stateObject, 16, _i)));
                     }
                 }
                 data.field16.Set(field);
             }
             if (global::Improbable.Worker.Internal.Pbio.GetObjectCount(stateObject, 17) > 0 || fieldsToClear.Contains(17))
             {
                 global::Improbable.Collections.List <global::Improbable.Gdk.Tests.SomeType> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetObjectCount(stateObject, 17);
                     field = new global::Improbable.Collections.List <global::Improbable.Gdk.Tests.SomeType>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         field.Add(global::Improbable.Gdk.Tests.SomeType_Internal.Read(global::Improbable.Worker.Internal.Pbio.IndexObject(stateObject, 17, _i)));
                     }
                 }
                 data.field17.Set(field);
             }
             **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
         }
         else if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Snapshot)
         {
             var data = new Data(global::Improbable.Gdk.Tests.ExhaustiveRepeatedData_Internal.Read(
                                     global::Improbable.Worker.Internal.Pbio.GetObject(root, 197717)));
             **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
         }
         else if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Request)
         {
             var data = new global::Improbable.Worker.Internal.GenericCommandObject();
             **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
             return(0);
         }
         else if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Response)
         {
             var data = new global::Improbable.Worker.Internal.GenericCommandObject();
             **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
             return(0);
         }
     }
     catch (global::System.Exception e)
     {
         global::Improbable.Worker.ClientError.LogClientException(e);
         return(0);
     }
     return(1);
 }
Beispiel #6
0
 ClientDeserialize(global::System.UInt32 componentId,
                   void *userData,
                   global::System.Byte handleType,
                   global::Improbable.Worker.Internal.Pbio.Object *root,
                   global::Improbable.Worker.Internal.ComponentProtocol.ClientHandle **handleOut)
 {
     *handleOut = null;
     try
     {
         *handleOut = global::Improbable.Worker.Internal.ClientHandles.HandleAlloc();
         if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Update)
         {
             var data               = new Update();
             var fieldsToClear      = new global::System.Collections.Generic.HashSet <uint>();
             var fieldsToClearCount = global::Improbable.Worker.Internal.Pbio.GetUint32Count(root, /* fields to clear */ 1);
             for (uint i = 0; i < fieldsToClearCount; ++i)
             {
                 fieldsToClear.Add(global::Improbable.Worker.Internal.Pbio.IndexUint32(root, /* fields to clear */ 1, i));
             }
             var stateObject = global::Improbable.Worker.Internal.Pbio.GetObject(
                 global::Improbable.Worker.Internal.Pbio.GetObject(root, /* entity_state */ 2), 58);
             if (global::Improbable.Worker.Internal.Pbio.GetObjectCount(stateObject, 1) > 0 || fieldsToClear.Contains(1))
             {
                 global::Improbable.Collections.Map <uint, global::Improbable.ComponentInterest> field;
                 {
                     var _count = global::Improbable.Worker.Internal.Pbio.GetObjectCount(stateObject, 1);
                     field = new global::Improbable.Collections.Map <uint, global::Improbable.ComponentInterest>((int)_count);
                     for (uint _i = 0; _i < _count; ++_i)
                     {
                         var _pair = global::Improbable.Worker.Internal.Pbio.IndexObject(stateObject, 1, _i);
                         field.Add(global::Improbable.Worker.Internal.Pbio.GetUint32(_pair, 1), global::Improbable.ComponentInterest_Internal.Read(global::Improbable.Worker.Internal.Pbio.GetObject(_pair, 2)));
                     }
                 }
                 data.componentInterest.Set(field);
             }
             **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
         }
         else if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Snapshot)
         {
             var data = new Data(global::Improbable.InterestData_Internal.Read(
                                     global::Improbable.Worker.Internal.Pbio.GetObject(root, 58)));
             **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
         }
         else if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Request)
         {
             var data = new global::Improbable.Worker.Internal.GenericCommandObject();
             **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
             return(0);
         }
         else if (handleType == (byte)global::Improbable.Worker.Internal.ComponentProtocol.ClientHandleType.Response)
         {
             var data = new global::Improbable.Worker.Internal.GenericCommandObject();
             **handleOut = global::Improbable.Worker.Internal.ClientHandles.Instance.CreateHandle(data);
             return(0);
         }
     }
     catch (global::System.Exception e)
     {
         global::Improbable.Worker.ClientError.LogClientException(e);
         return(0);
     }
     return(1);
 }