예제 #1
0
 public ReferenceNode(ObjectMapReader map, int type, bool inverse)
 {
     this.map     = map;
     this.type    = type;
     TypeName     = map.GetTypeName(type);
     this.inverse = inverse;
 }
        public void FillType(ObjectMapReader file, string typeName)
        {
            this.typeName = typeName;
            this.file     = file;
            store.Clear();
            boxFilter.Visible = false;
            treeview.Columns [TreeColRefs].Visible     = InverseReferences;
            treeview.Columns [TreeColRefs + 1].Visible = InverseReferences;
            treeview.Columns [TreeColRefs + 2].Visible = InverseReferences;
            TreeIter iter = InternalFillType(file, file.GetTypeFromName(typeName));

            treeview.ExpandRow(store.GetPath(iter), false);
        }
        public void FillAllTypes(ObjectMapReader file)
        {
            this.file         = file;
            this.typeName     = null;
            boxFilter.Visible = true;
            treeview.Columns [TreeColRefs].Visible     = InverseReferences;
            treeview.Columns [TreeColRefs + 1].Visible = InverseReferences;
            treeview.Columns [TreeColRefs + 2].Visible = InverseReferences;

            if (loading)
            {
                // If the tree is already being loaded, notify that loading
                // has to start again, since the file has changed.
                reloadRequested = true;
                return;
            }

            loading = true;
            store.Clear();
            int n = 0;

            foreach (int t in file.GetTypes())
            {
                if (++n == 20)
                {
                    if (ProgressEvent != null)
                    {
                        ProgressEvent(n, file.GetTypeCount(), null);
                    }
                    while (Gtk.Application.EventsPending())
                    {
                        Gtk.Application.RunIteration();
                    }
                    if (reloadRequested)
                    {
                        loading         = false;
                        reloadRequested = false;
                        FillAllTypes(this.file);
                        return;
                    }
                    n = 0;
                }
                if (file.GetObjectCountForType(t) > 0)
                {
                    InternalFillType(file, t);
                }
            }
            loading = false;
        }
예제 #4
0
 public void RemoveData(ObjectMapReader otherReader)
 {
     types           = (TypeInfo[])types.Clone();
     filteredObjects = new bool [numObjects];
     for (int n = 0; n < otherReader.numObjects; n++)
     {
         int i = Array.BinarySearch(objectCodes, otherReader.objects[n].Code);
         if (i >= 0)
         {
             i = objectIndices [i];
             filteredObjects [i] = true;
             int t = objects[i].Type;
             types [t].ObjectCount--;
             types [t].TotalSize -= objects[i].Size;
             this.objectCount--;
             this.totalMemory -= objects[i].Size;
         }
     }
 }
예제 #5
0
        public static ObjectMapReader GetDiff(ObjectMapReader oldMap, ObjectMapReader newMap)
        {
            ObjectMapReader dif = new ObjectMapReader();

            dif.fieldNames      = newMap.fieldNames;
            dif.fieldReferences = newMap.fieldReferences;
            dif.inverseRefs     = newMap.inverseRefs;
            dif.numFields       = newMap.numFields;
            dif.numObjects      = newMap.numObjects;
            dif.numReferences   = newMap.numReferences;
            dif.numTypes        = newMap.numTypes;
            dif.objectCount     = newMap.objectCount;
            dif.objectIndices   = newMap.objectIndices;
            dif.objects         = newMap.objects;
            dif.objectCodes     = newMap.objectCodes;
            dif.references      = newMap.references;
            dif.totalMemory     = newMap.totalMemory;
            dif.typeIndices     = newMap.typeIndices;
            dif.types           = newMap.types;
            dif.RemoveData(oldMap);
            return(dif);
        }
        TreeIter InternalFillType(ObjectMapReader file, int type)
        {
            ReferenceNode node = file.GetReferenceTree(type, checkInverse.Active);

            return(AddNode(TreeIter.Zero, node));
        }