Exemplo n.º 1
0
 protected DashboardFile(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
     //if (!HasEntry(EntryType.Setting, (int)SettingId.GamercardZone)) Settings.Set(SettingId.GamercardZone, 0);
     //if (!HasEntry(EntryType.Setting, (int)SettingId.GamercardRegion)) Settings.Set(SettingId.GamercardRegion, 2);
     //if (!HasEntry(EntryType.Setting, (int)SettingId.YearsOnLive)) Settings.Set(SettingId.YearsOnLive, 0);
     //if (!HasEntry(EntryType.Setting, (int)SettingId.GamercardMotto)) Settings.Set(SettingId.GamercardMotto, String.Empty);
     //if (!HasEntry(EntryType.Setting, (int)SettingId.GamercardUserLocation)) Settings.Set(SettingId.GamercardUserLocation, String.Empty);
     //if (!HasEntry(EntryType.Setting, (int)SettingId.GamercardUserName)) Settings.Set(SettingId.GamercardUserName, String.Empty);
     //if (!HasEntry(EntryType.Setting, (int)SettingId.GamercardUserBio)) Settings.Set(SettingId.GamercardUserBio, String.Empty);
     //if (!HasEntry(EntryType.Setting, (int)SettingId.GamercardRep)) Settings.Set(SettingId.GamercardRep, (float)0.0);
 }
Exemplo n.º 2
0
 public OffsetTable Clone(int shift)
 {
     var newTable = new OffsetTable {IsDynamic = IsDynamic};
     if (!IsDynamic) newTable._size = Size;
     newTable.Properties = new Dictionary<string, BinaryLocation>();
     foreach (var kvp in Properties)
     {
         newTable.Properties.Add(kvp.Key, kvp.Value == null ? null : new BinaryLocation(kvp.Value.Offset + shift, kvp.Value.Length));
     }
     return newTable;
 }
Exemplo n.º 3
0
        public OffsetTable Clone(int shift)
        {
            var newTable = new OffsetTable {
                IsDynamic = IsDynamic
            };

            if (!IsDynamic)
            {
                newTable._size = Size;
            }
            newTable.Properties = new Dictionary <string, BinaryLocation>();
            foreach (var kvp in Properties)
            {
                newTable.Properties.Add(kvp.Key, kvp.Value == null ? null : new BinaryLocation(kvp.Value.Offset + shift, kvp.Value.Length));
            }
            return(newTable);
        }
Exemplo n.º 4
0
        protected BinaryModelBase(OffsetTable offsetTable, BinaryContainer binary, int startOffset)
        {
            CacheEnabled = true;
            _offsetTable = offsetTable;
            StartOffset  = startOffset;
            BinMap       = new BinMap();

            //HACK
            if (offsetTable == null)
            {
                return;
            }

            Binary = binary ?? new BinaryContainer(offsetTable.Size);

            EnsureNullTerminatedStrings();

            //Temp
            if (binary != null)
            {
                offsetTable.MapOffsets(BinMap, GetType().BaseType);
            }
        }
Exemplo n.º 5
0
 public AvatarAwardEntry(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 6
0
 public ProgressCache(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 7
0
 public FileEntry(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
     Files = new List<FileEntry>();
     Folders = new List<FileEntry>();
 }
Exemplo n.º 8
0
 public ProfileEmbeddedContent(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 9
0
 public HashEntry(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 10
0
 public PackageSignature(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 11
0
 public SyncData(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 12
0
 public AchievementEntry(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 13
0
 public SvodVolumeDescriptor(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 14
0
 public TitleEntry(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
     TitleCode = TitleId.ToHex();
 }
Exemplo n.º 15
0
 public XdbfFreeSpaceEntry(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 16
0
 public AvatarItemMediaInfo(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 17
0
        private static OffsetTable CalculateOffsetTable(Type type)
        {
            var offsetTable  = new OffsetTable();
            var flags        = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
            var declaredOnly = type.HasAttribute <DeclaredOnlyAttribute>();

            if (declaredOnly)
            {
                flags |= BindingFlags.DeclaredOnly;
            }
            var properties = type.GetProperties(flags);
            var offset     = 0;

            foreach (var property in properties)
            {
                var attribute = property.GetAttribute <BinaryDataAttribute>(!declaredOnly);
                if (attribute == null)
                {
                    continue;
                }

                if (attribute.Offset != -1)
                {
                    offset = attribute.Offset;
                }
                var location = new BinaryLocation(offset);
                offsetTable.Add(property.Name, location);

                var propertyType = property.PropertyType;
                int length;

                if (attribute.Length.HasValue)
                {
                    if (propertyType.IsArray && BinaryModelBase.BaseType.IsAssignableFrom(propertyType.GetElementType()))
                    {
                        var size = GetOffsetTable(propertyType.GetElementType()).Size;
                        length = attribute.Length.Value * size;
                    }
                    else
                    {
                        length = attribute.Length.Value;
                    }
                }
                else if (BinaryModelBase.BaseType.IsAssignableFrom(propertyType))
                {
                    length = GetOffsetTable(propertyType).Size;
                }
                else if (attribute.StringReadOptions == StringReadOptions.NullTerminated)
                {
                    offsetTable.IsDynamic = true;
                    length = 1;
                }
                else if (propertyType == typeof(DateTime))
                {
                    length = 8;
                }
                else
                {
                    var valueType = propertyType.IsEnum ? Enum.GetUnderlyingType(propertyType) : propertyType;
                    length = valueType.IsValueType ? Marshal.SizeOf(valueType) : 0;
                }
                offset         += length;
                location.Length = length;
            }
            return(offsetTable);
        }
Exemplo n.º 18
0
 public Certificate(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 19
0
        //private byte[] CONFOUNDER = new byte[] { 0x56, 0x65, 0x6C, 0x6F, 0x63, 0x69, 0x74, 0x79 };

        public Account(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
        {
        }
Exemplo n.º 20
0
 public CachedUserFlags(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }
Exemplo n.º 21
0
 public VideoMediaInfo(OffsetTable offsetTable, BinaryContainer binary, int startOffset) : base(offsetTable, binary, startOffset)
 {
 }