Exemple #1
0
 public static void ClearModuleCache()
 {
     lock (_modulesCache)
     {
         _modulesCache.Clear();
     }
 }
Exemple #2
0
        private void prepareCalculate()
        {
            cellList.clear();
            cellIdMap.Clear();
            for (int i = 0; i < RowSize; i++)
            {
                for (int k = 0; k < ColSize; k++)
                {
                    CellExt o = getCell(i, k);
                    if (!isMerged(i, k))
                    {
                        object obj2 = o;
                        cellIdMap[getId(i, k)] = obj2;
                        if (o != null)
                        {
                            cellList.put(o);
                        }
                    }
                }
            }
            for (int j = 0; j < RowSize; j++)
            {
                for (int m = 0; m < ColSize; m++)
                {
                    if ((j != 0) || (m != 0))
                    {
                        CellExt ext3 = getCell(j, m);
                        if ((ext3 != null) && !isMerged(j, m))
                        {
                            ext3.setLeftHead(method_2(ext3));
                            ext3.setTopHead(method_3(ext3));
                            ext3.prepareCalculate();
                        }
                    }
                }
            }
            CellExt   ext2     = getCell(0, 0);
            ArrayList subCells = ext2.SubCells;

            if (subCells != null)
            {
                subCells.Clear();
                IEnumerator enumerator = cellIdMap.Values.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    CellExt ext = (CellExt)enumerator.Current;
                    if (((ext != null) && (ext.getLeftHead() == ext2)) && (ext.getTopHead() == ext2))
                    {
                        subCells.Add(ext);
                    }
                }
            }
        }
Exemple #3
0
    // Suppress the deprecation warning for _SetId, since the DB is intended to use it
#pragma warning disable 612, 618
    public void UpdateDatabase()
    {
        if (!defaultItem)
        {
            Debug.LogError("Cannot update the database. A default item MUST be assigned.");
            return;
        }

        // Add the default item
        registeredItems.Remove(0);
        defaultItem._SetId(this, 0);
        registeredItems.Add(0, defaultItem);

        // Add new items
        var existingValues = registeredItems.Values;

        foreach (ItemBase newItem in addItems)
        {
            // No double registering
            if (existingValues.Contains(newItem))
            {
                continue;
            }

            newItem._SetId(this, idCounter);
            registeredItems.Add(idCounter, newItem);
            idCounter++;
        }
        addItems.Clear();

        //Remap missing items that have been filled out
        //

        // Remove missing items/ids
        List <uint> missingValues = new List <uint>(10);

        foreach (var pair in registeredItems)
        {
            if (!pair.Value)
            {
                missingValues.Add(pair.Key);
            }
        }
        foreach (uint key in missingValues)
        {
            registeredItems.Remove(key);
        }

        // Add the missing items' ids for remapping
        foreach (uint id in missingValues)
        {
            string name = "Unknown";
            nameMap.TryGetValue(id, out name);

            missingIds.Add(id);
            missingNameMap.Add(id, name);
        }

        // Regenerate name map
        nameMap.Clear();
        foreach (var pair in registeredItems)
        {
            nameMap.Add(pair.Key, pair.Value.GetName());
        }
    }
 public void ClearCache()
 {
     _modulesCache.Clear();
 }
 private void clearCache()
 {
     _formulaIdMap.Clear();
     StringMap.Clear();
     IdStringMap.Clear();
 }