Beispiel #1
0
        public void SetColumn(MetaColumn metaColumn, Column newColumn)
        {
            //add missing columns if the meta column index does not fit in table's column list
            int missingColumnCount = metaColumn.Index - m_Columns.Count + 1;

            if (missingColumnCount > 0)
            {
                m_Columns.AddRange(Enumerable.Range(0, missingColumnCount).Select(x => (Column)null));
            }
            if (metaColumn.Type.scriptingType != null)
            {
                IExpandColumn newExpandColumn = (IExpandColumn)Database.Operation.ColumnCreator.CreateColumn(typeof(ExpandColumnTyped <>), metaColumn.Type.scriptingType);
                newExpandColumn.Initialize(this, newColumn, metaColumn.Index);
                m_Columns[metaColumn.Index] = (Column)newExpandColumn;
            }
            else
            {
                m_Columns[metaColumn.Index] = new ColumnError(this);
                Debug.LogError("Cannot create column '" + GetName() + "." + metaColumn.Name + "'. Type is unknown (null)");
            }
        }
        static ObjectTable()
        {
            s_Meta = new Database.MetaTable[(int)ObjectMetaType.Count];

            var metaManaged = new Database.MetaTable();
            var metaNative  = new Database.MetaTable();

            s_Meta[(int)ObjectMetaType.Managed] = metaManaged;
            s_Meta[(int)ObjectMetaType.Native]  = metaNative;
            s_Meta[(int)ObjectMetaType.All]     = metaManaged;

            metaManaged.name        = TableName;
            metaManaged.displayName = TableDisplayName;
            metaNative.name         = TableName;
            metaNative.displayName  = TableDisplayName;

            var metaColIndex        = new Database.MetaColumn("Index", "Index", typeof(int), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.first, typeof(int)), 40);
            var metaColName         = new Database.MetaColumn("Name", "Name", typeof(string), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.first, typeof(string)), 200);
            var metaColValue        = new Database.MetaColumn("Value", "Value", typeof(string), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.first, typeof(string)), 180);
            var metaColType         = new Database.MetaColumn("Type", "Type", typeof(string), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.first, typeof(string)), 250);
            var metaColDataType     = new Database.MetaColumn("DataType", "Data Type", typeof(string), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.first, typeof(string)), 150);
            var metaColNOName       = new Database.MetaColumn("NativeObjectName", "Native Object Name", typeof(string), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.first, typeof(string)), 125);
            var metaColLength       = new Database.MetaColumn("Length", "Length", typeof(int), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.sumpositive, typeof(int)), 50);
            var metaColStatic       = new Database.MetaColumn("Static", "Static", typeof(bool), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.first, typeof(bool)), 50);
            var metaColRefCount     = new Database.MetaColumn("RefCount", "RefCount", typeof(int), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.sumpositive, typeof(int)), 50);
            var metaColOwnerSize    = new Database.MetaColumn("OwnedSize", "Owned Size", typeof(long), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.sumpositive, typeof(long)), 50);
            var metaColTargetSize   = new Database.MetaColumn("TargetSize", "Target Size", typeof(long), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.sumpositive, typeof(long)), 50);
            var metaColNativeSize   = new Database.MetaColumn("NativeSize", "Native Size", typeof(long), false, Grouping.groupByDuplicate, Grouping.GetMergeAlgo(Grouping.MergeAlgo.sumpositive, typeof(long)), 75);
            var metaColNativeId     = new Database.MetaColumn("NativeInstanceId", "Native Instance ID", typeof(int), false, Grouping.groupByDuplicate, null, 75);
            var metaColAddress      = new Database.MetaColumn("Address", "Address", typeof(ulong), false, Grouping.groupByDuplicate, null, 75);
            var metaColUniqueString = new Database.MetaColumn("UniqueString", "Unique String", typeof(string), true, Grouping.groupByDuplicate, null, 250);

            var metaManagedCol = new List <Database.MetaColumn>();

            metaManagedCol.Add(metaColIndex);
            metaManagedCol.Add(metaColName);
            metaManagedCol.Add(metaColValue);
            metaManagedCol.Add(metaColType);
            metaManagedCol.Add(metaColDataType);
            metaManagedCol.Add(metaColNOName);
            metaManagedCol.Add(metaColLength);
            metaManagedCol.Add(metaColStatic);
            metaManagedCol.Add(metaColRefCount);
            metaManagedCol.Add(metaColOwnerSize);
            metaManagedCol.Add(metaColTargetSize);
            metaManagedCol.Add(metaColNativeSize);
            metaManagedCol.Add(metaColNativeId);
            metaManagedCol.Add(metaColAddress);
            metaManagedCol.Add(metaColUniqueString);
            var metaNativeCol = new List <Database.MetaColumn>();

            metaNativeCol.Add(new Database.MetaColumn(metaColIndex));
            metaNativeCol.Add(new Database.MetaColumn(metaColName));
            metaNativeCol.Add(new Database.MetaColumn(metaColValue));
            metaNativeCol.Add(new Database.MetaColumn(metaColType));
            metaNativeCol.Add(new Database.MetaColumn(metaColNOName));
            metaNativeCol.Add(new Database.MetaColumn(metaColDataType));
            metaNativeCol.Add(new Database.MetaColumn(metaColRefCount));
            metaNativeCol.Add(new Database.MetaColumn(metaColOwnerSize));
            metaNativeCol.Add(new Database.MetaColumn(metaColTargetSize));
            metaNativeCol.Add(new Database.MetaColumn(metaColNativeId));
            metaNativeCol.Add(new Database.MetaColumn(metaColAddress));
            metaNativeCol.Add(new Database.MetaColumn(metaColUniqueString));

            metaManaged.SetColumns(metaManagedCol.ToArray());
            metaNative.SetColumns(metaNativeCol.ToArray());
        }
 public void AddColumn(MetaColumn col)
 {
     m_Columns.Add(col);
     col.Index = m_Columns.Count - 1;
     m_ColumnsByName.Add(col.Name, col);
 }