Exemplo n.º 1
0
 public static void Write(UnsafeWriter writer, InjectedHlslLocationInfo value)
 {
     UnsafeMarshallers.FileSystemPathMarshaller.Marshal(writer, value.FileSystemPath);
     writer.Write(value.Range.StartOffset);
     writer.Write(value.Range.EndOffset);
     writer.WriteEnum(value.ProgramType);
 }
Exemplo n.º 2
0
        public void WriteValue(SerializationCtx context, UnsafeWriter writer)
        {
            Assertion.Assert(!myHandler.IsSendWithoutContexts, "!myHandler.IsWritingOwnMessages");
            var value = Context.Value;

            if (value == null)
            {
                InternId.Write(writer, InternId.Invalid);
                writer.Write(false);
            }
            else
            {
                using (myHandler.CreateSendWithoutContextsCookie())
                {
                    if (!myProtocolValueSet.Contains(value))
                    {
                        Assertion.Require(Proto.Scheduler.IsActive, "Attempting to use previously unused context value {0} on a background thread for key {1}", value, Context.Key);
                        myProtocolValueSet.Add(Context.Value);
                    }

                    var internedId = myInternRoot.Intern(value);
                    InternId.Write(writer, internedId);
                    if (!internedId.IsValid)
                    {
                        writer.Write(true);
                        Context.WriteDelegate(context, writer, value);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private static void Write(UnsafeWriter writer, AssetDocumentHierarchyElement value)
        {
            writer.Write(value.myOtherBoxedElements.Count);
            writer.Write(value.myGameObjectHierarchies.Count);
            writer.Write(value.myTransformElements.Count);
            writer.Write(value.myScriptComponentElements.Count);
            writer.Write(value.myComponentElements.Count);

            foreach (var v in value.myOtherBoxedElements)
            {
                WriteHierarchyElement(writer, v);
            }

            foreach (var v in value.myGameObjectHierarchies)
            {
                GameObjectHierarchy.Write(writer, v);
            }

            foreach (var v in value.myTransformElements)
            {
                TransformHierarchy.Write(writer, v);
            }

            foreach (var v in value.myScriptComponentElements)
            {
                ScriptComponentHierarchy.Write(writer, v);
            }

            foreach (var v in value.myComponentElements)
            {
                ComponentHierarchy.Write(writer, v);
            }
        }
Exemplo n.º 4
0
        public void WriteValue(SerializationCtx context, UnsafeWriter writer)
        {
            Assertion.Assert(!myHandler.IsSendWithoutContexts, "!myHandler.IsWritingOwnMessages");
            var value = Context.Value;

            if (value == null)
            {
                InternId.Write(writer, InternId.Invalid);
                writer.Write(false);
            }
            else
            {
                using (myHandler.CreateSendWithoutContextsCookie())
                {
                    AddValueToProtocolValueSetImpl(value);

                    var internedId = myInternRoot.Intern(value);
                    InternId.Write(writer, internedId);
                    if (!internedId.IsValid)
                    {
                        writer.Write(true);
                        Context.WriteDelegate(context, writer, value);
                    }
                }
            }
        }
Exemplo n.º 5
0
 private static void WriteSet(UnsafeWriter writer, JetHashSet <string> list)
 {
     writer.Write(list.Count);
     foreach (var value in list)
     {
         writer.Write(value);
     }
 }
Exemplo n.º 6
0
 public void Write(UnsafeWriter writer)
 {
     writer.Write(Name);
     writer.Write(Type);
     writer.Write(IsOptional);
     writer.Write(Description);
     writer.Write(DefaultValue);
 }
 private static void Write(UnsafeWriter writer, GameObjectHierarchy value)
 {
     writer.WritePolymorphic(value.Location);
     writer.Write(value.Name);
     writer.WritePolymorphic(value.PrefabInstance);
     writer.WritePolymorphic(value.CorrespondingSourceObject);
     writer.Write(value.IsStripped);
 }
Exemplo n.º 8
0
 private static void WriteAnchors([NotNull] UnsafeWriter writer, LocalList <long> anchors)
 {
     writer.Write(anchors.Count);
     foreach (var anchor in anchors)
     {
         writer.Write(anchor);
     }
 }
Exemplo n.º 9
0
 public void Write(UnsafeWriter writer)
 {
     writer.Write(Name);
     writer.Write(Type);
     writer.Write(IsOptional);
     writer.Write(Description);
     writer.Write(DefaultValue);
 }
Exemplo n.º 10
0
 private static void WriteStateNames([NotNull] UnsafeWriter writer,
                                     [NotNull, ItemNotNull] ICollection <string> stateNames)
 {
     writer.Write(stateNames.Count);
     foreach (var stateName in stateNames)
     {
         writer.Write(stateName);
     }
 }
Exemplo n.º 11
0
 public void Marshal(UnsafeWriter writer, SpecflowStepsUsagesCacheEntries value)
 {
     writer.Write(value.Count);
     foreach (var entry in value)
     {
         writer.Write((int)entry.StepKind);
         writer.Write(entry.StepText);
     }
 }
Exemplo n.º 12
0
 private static void Write(UnsafeWriter writer, GameObjectHierarchyElement value)
 {
     value.Id.WriteTo(writer);
     value.CorrespondingSourceObject.WriteTo(writer);
     value.PrefabInstance.WriteTo(writer);
     writer.Write(value.IsStripped);
     value.TransformId.WriteTo(writer);
     writer.Write(value.Name);
 }
Exemplo n.º 13
0
 public void WriteTo([NotNull] UnsafeWriter writer)
 {
     Location.WriteTo(writer);
     writer.Write(AnimationName);
     writer.Write(SampleRate);
     writer.Write(FunctionName);
     writer.Write(Time);
     writer.Write(Guid);
 }
Exemplo n.º 14
0
        private void WriteStateMachineBehavioursAnchors([NotNull] UnsafeWriter writer)
        {
            var stateMachineBehavioursAnchors = ScriptsAnchors;

            writer.Write(stateMachineBehavioursAnchors.Count);
            foreach (var anchor in stateMachineBehavioursAnchors)
            {
                writer.Write(anchor);
            }
        }
Exemplo n.º 15
0
 public void WriteTo(UnsafeWriter writer)
 {
     writer.WritePolymorphic(Location);
     writer.Write(MethodName);
     writer.Write(TextRange.StartOffset);
     writer.Write(TextRange.EndOffset);
     writer.Write((int)Mode);
     writer.Write(Type);
     writer.WritePolymorphic(TargetScriptReference);
 }
Exemplo n.º 16
0
 private static void Write(UnsafeWriter writer, TransformHierarchy value)
 {
     writer.WritePolymorphic(value.Location);
     writer.WritePolymorphic(value.GameObjectReference);
     writer.WritePolymorphic(value.Parent);
     writer.Write(value.RootIndex);
     writer.WritePolymorphic(value.PrefabInstance);
     writer.WritePolymorphic(value.CorrespondingSourceObject);
     writer.Write(value.IsStripped);
 }
Exemplo n.º 17
0
 private static void WriteChildToParentMap([NotNull] UnsafeWriter writer,
                                           [NotNull] IDictionary <long, long> childToParent)
 {
     writer.Write(childToParent.Count);
     foreach (var(child, parent) in childToParent)
     {
         writer.Write(child);
         writer.Write(parent);
     }
 }
Exemplo n.º 18
0
 private static void WriteGuidToAnchorsEntry([NotNull] UnsafeWriter writer,
                                             Guid guid,
                                             [NotNull] ICollection <long> anchors)
 {
     writer.Write(guid);
     writer.Write(anchors.Count);
     foreach (var anchor in anchors)
     {
         writer.Write(anchor);
     }
 }
Exemplo n.º 19
0
 public void WriteTo(UnsafeWriter writer)
 {
     writer.Write(Name);
     OwningScriptLocation.WriteTo(writer);
     ScriptReference.WriteTo(writer);
     writer.Write(Calls.Count);
     foreach (var call in Calls)
     {
         call.WriteTo(writer);
     }
 }
Exemplo n.º 20
0
 private static void WriteAnchorToUsagesEntry <T>([NotNull] UnsafeWriter writer,
                                                  long anchor,
                                                  [NotNull][ItemNotNull] ICollection <T> usages)
     where T : IAnimatorScriptUsage
 {
     writer.Write(anchor);
     writer.Write(usages.Count);
     foreach (var usage in usages)
     {
         usage.WriteTo(writer);
     }
 }
        public static void Write(UnsafeWriter writer, PrefabInstanceHierarchy prefabInstanceHierarchy)
        {
            prefabInstanceHierarchy.Location.WriteTo(writer);
            prefabInstanceHierarchy.ParentTransform.WriteTo(writer);

            writer.Write(prefabInstanceHierarchy.PrefabModifications.Count);
            foreach (var prefabModification in prefabInstanceHierarchy.PrefabModifications)
            {
                writer.WritePolymorphic(prefabModification);
            }

            writer.Write(prefabInstanceHierarchy.SourcePrefabGuid);
        }
Exemplo n.º 22
0
 public void Marshal([NotNull] UnsafeWriter writer, [NotNull] LinkedNamesData value)
 {
     writer.Write(value.Count);
     foreach (var map in value)
     {
         writer.Write(map.Key);
         writer.Write(map.Value.Count);
         foreach (var name in map.Value)
         {
             writer.Write(name);
         }
     }
 }
Exemplo n.º 23
0
        public static void WriteCollection <T>(this UnsafeWriter writer, CtxWriteDelegate <T> itemWriter, SerializationCtx ctx, ICollection <T> value)
        {
            if (value == null)
            {
                writer.Write(-1);
                return;
            }

            writer.Write(value.Count);
            foreach (var item in value)
            {
                itemWriter(ctx, writer, item);
            }
        }
Exemplo n.º 24
0
 public static void Write(SerializationCtx ctx, UnsafeWriter writer, RdProperty <T> value)
 {
     Assertion.Assert(!value.RdId.IsNil, "!value.RdId.IsNil");
     writer.Write(value.RdId);
     if (value.HasValue())
     {
         writer.Write(true);
         value.WriteValueDelegate(ctx, writer, value.Value);
     }
     else
     {
         writer.Write(false);
     }
 }
Exemplo n.º 25
0
        public static void WriteArray <T>(this UnsafeWriter writer, CtxWriteDelegate <T> itemWriter, SerializationCtx ctx, T[] value)
        {
            if (value == null)
            {
                writer.Write(-1);
                return;
            }

            writer.Write(value.Length);
            // ReSharper disable once ForCanBeConvertedToForeach
            for (var i = 0; i < value.Length; i++)
            {
                itemWriter(ctx, writer, value[i]);
            }
        }
 private static void Write(UnsafeWriter writer, InspectorVariableUsage value)
 {
     value.Location.WriteTo(writer);
     value.ScriptReference.WriteTo(writer);
     writer.Write(value.Name);
     writer.WritePolymorphic(value.Value);
 }
Exemplo n.º 27
0
 private static void WriteTestAnchorToUsageEntry([NotNull] UnsafeWriter writer,
                                                 long anchor,
                                                 [NotNull] IAnimatorScriptUsage usage)
 {
     writer.Write(anchor);
     usage.WriteTo(writer);
 }
Exemplo n.º 28
0
        public void Write <T>(SerializationCtx ctx, UnsafeWriter writer, T value)
        {
#if !NET35
            myBackgroundRegistrar.WaitForEmpty();
#endif

            if (value == null)
            {
                // ReSharper disable once ImpureMethodCallOnReadonlyValueField
                RdId.Nil.Write(writer);
                return;
            }

            RdId typeId;
            var  type = value.GetType();
            if (!myTypeMapping.TryGetValue(type, out typeId))
            {
                myPolymorphicCatalog?.TryDiscoverRegister(type, this);
                if (!myTypeMapping.TryGetValue(type, out typeId))
                {
                    throw new KeyNotFoundException($"Type {type.FullName} have not registered");
                }
            }
            typeId.Write(writer);

            // Don't dispose this cookie, otherwise it will delete all written data
            var cookie = new UnsafeWriter.Cookie(writer);
            writer.Write(0);

            var writerDelegate = myWriters[typeId];
            writerDelegate(ctx, writer, value);

            cookie.WriteIntLengthToCookieStart();
        }
 public static void Write(UnsafeWriter writer, TransformHierarchy transformHierarchy)
 {
     transformHierarchy.Location.WriteTo(writer);
     transformHierarchy.OwningGameObject.WriteTo(writer);
     transformHierarchy.ParentTransform.WriteTo(writer);
     writer.Write(transformHierarchy.myRootIndex);
 }
Exemplo n.º 30
0
 public void WriteTo(UnsafeWriter writer)
 {
     Location.WriteTo(writer);
     writer.Write(Name);
     WriteAnchors(writer, ScriptsAnchors);
     WriteAnchors(writer, ChildStateMachinesAnchors);
     WriteAnchors(writer, ChildStatesAnchors);
 }
 private static void Write(UnsafeWriter writer, AssetMethodsDataElement value)
 {
     writer.Write(value.Methods.Count);
     foreach (var v in value.Methods)
     {
         v.WriteTo(writer);
     }
 }
 private static void Write(UnsafeWriter writer, AngularJsCacheItems value)
 {
     writer.Write<Directive, ICollection<Directive>>((w, directive) => directive.Write(w), value.Directives.ToList());
     writer.Write<Filter, ICollection<Filter>>((w, filter) => filter.Write(w), value.Filters.ToList());
 }
Exemplo n.º 33
0
 public void Write(UnsafeWriter writer)
 {
     writer.Write(OriginalName);
     writer.Write(Name);
     writer.Write(Restrictions);
     writer.Write(UnsafeWriter.StringDelegate, Tags);
     writer.Write(Offset);
     writer.Write<Parameter, ICollection<Parameter>>((w, parameter) => parameter.Write(w), Parameters.ToList());
 }
Exemplo n.º 34
0
 public void Write(UnsafeWriter writer)
 {
     writer.Write(Name);
     writer.Write(Offset);
 }