Esempio n. 1
0
        private object DeepClone(object original)
        {
            if (original is List <object> )
            {
                return(new List <object>());
            }
            UArrayProperty uArrayProperty = original as UArrayProperty;

            if (uArrayProperty != null && (string)uArrayProperty.ArrayType == "StructProperty")
            {
                throw new NotImplementedException("Arrays with StructProperties are not supported");
            }
            object obj = Activator.CreateInstance(original.GetType());

            PropertyInfo[] array = (from x in original.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
                                    select(x) into x
                                    where x.CanWrite
                                    select x).ToArray();
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i].PropertyType.IsValueType || array[i].PropertyType.IsPrimitive || array[i].PropertyType == typeof(string))
                {
                    array[i].SetValue(obj, array[i].GetValue(original));
                }
                else
                {
                    array[i].SetValue(obj, DeepClone(array[i].GetValue(original)));
                }
            }
            return(obj);
        }
Esempio n. 2
0
        public static FPropertyTag PropertyVisitor(BinaryReader reader, FPropertyTag baseTag, FPackageFileSummary summary)
        {
            USetProperty uSetProperty = LSerializer.Deserialize <USetProperty>(reader);

            uSetProperty.Ref(summary);
            long position = reader.BaseStream.Position;

            uSetProperty.Entries       = UArrayProperty.GetEntries(uSetProperty.Count, uSetProperty.ArrayType, reader, summary);
            reader.BaseStream.Position = position + uSetProperty.Size - 8;
            return(uSetProperty);
        }
Esempio n. 3
0
        public static FPropertyTag PropertyVisitor(BinaryReader reader, FPropertyTag baseTag, FPackageFileSummary summary)
        {
            var instance = LSerializer.Deserialize <USetProperty>(reader);

            instance.Ref(summary);
            var @base = reader.BaseStream.Position;

            instance.Entries           = UArrayProperty.GetEntries(instance.Count, instance.ArrayType, reader, summary);
            reader.BaseStream.Position = @base + instance.Size - 8;
            return(instance);
        }
Esempio n. 4
0
        public static FPropertyTag PropertyVisitor(BinaryReader reader, FPropertyTag baseTag, FPackageFileSummary summary)
        {
            UArrayProperty uArrayProperty = LSerializer.Deserialize <UArrayProperty>(reader);

            uArrayProperty.Ref(summary);
            long position = reader.BaseStream.Position;

            uArrayProperty.Entries = GetEntries(uArrayProperty.ArraySize, uArrayProperty.ArrayType, reader, summary);
            long position2 = reader.BaseStream.Position;

            if (position + uArrayProperty.Size - 4 != position2)
            {
                Console.WriteLine("WARNING: ARRAY SIZE OFFSHOOT!");
            }
            reader.BaseStream.Position = position + uArrayProperty.Size - 4;
            return(uArrayProperty);
        }
Esempio n. 5
0
 public override object GetValue()
 {
     return(UArrayProperty.Unwrap(Struct));
 }