示例#1
0
        internal static RawWeakPointer ConvertWeakPointer(DataCoreCompiler compiler, DataCoreDatabase database, IDataCorePointer dataCorePointer)
        {
            var rawWeakPointer = new RawWeakPointer();

            rawWeakPointer.StructureIndex = -1;
            rawWeakPointer.VariantIndex   = -1;

            var pointerValue = dataCorePointer;
            var instance     = pointerValue?.InstanceObject;

            if (instance != null)
            {
                var structureType  = instance.GetType();
                var structureIndex = database.ManagedStructureTypes.IndexOf(structureType);

                var structureDataTable = compiler.ManagedDataTable[structureType];
                //TODO: Instead of appending the data, we should rebuild from scratch each time
                if (!structureDataTable.Contains(instance))
                {
                    structureDataTable.Add(instance);
                }
                var variantIndex = structureDataTable.IndexOf(instance);

                rawWeakPointer.StructureIndex = structureIndex;
                rawWeakPointer.VariantIndex   = variantIndex;
            }

            return(rawWeakPointer);
        }
示例#2
0
 internal DataCoreRecord(DataCoreDatabase database, RawRecord record)
 {
     ID            = record.ID;
     Name          = database.RawDatabase.textBlock.GetString(record.NameOffset);
     FileName      = database.RawDatabase.textBlock.GetString(record.FileNameOffset);
     StructureType = database.ManagedStructureTypes[record.StructureIndex];
     Instance      = database.GetRawRecordInstance(record);
 }
示例#3
0
 internal ClassArrayFixup(DataCoreDatabase database, object instance, PropertyInfo info, int firstIndex, int arrayCount)
     : base(database, instance, info, firstIndex, arrayCount)
 {
 }
示例#4
0
 internal StrongPointerFixup(DataCoreDatabase database, object instance, PropertyInfo info, RawStrongPointer pointer)
     : base(database, instance, info)
 {
     Pointer = pointer;
 }