Esempio n. 1
0
        internal void AddCell(StructCell cell, bool hidden)
        {
            if (hidden || _hideAddedCells)
            {
                if (_allCells == null)
                {
                    _allCells = new List <StructCell>();
                    _allCells.AddRange(_cells);
                }
                _allCells.Add(cell);
            }
            else
            {
                _cells.Add(cell);
                if (_allCells != null)
                {
                    _allCells.Add(cell);
                }
            }

            foreach (CellHandler handler in _addedCellHandlers)
            {
                handler(cell);
            }
        }
Esempio n. 2
0
 internal void RegisterCellSize(StructCell cell, int size)
 {
     if (_cellSizes == null)
     {
         _cellSizes = new Dictionary <StructCell, int>();
     }
     _cellSizes[cell] = size;
 }
Esempio n. 3
0
 public static CellUI GetUI(StructCell cell)
 {
     if (cell is BlobCell)
     {
         return new BlobCellUI((BlobCell) cell);
     }
     return null;
 }
Esempio n. 4
0
 public static NodeUI GetNodeUI(StructCell cell)
 {
     if (cell is ImageCell)
     {
         return new ImageNodeUI((ImageCell) cell);
     }
     return null;
 }
Esempio n. 5
0
        public virtual int GetInstanceDataSize(StructCell cell, StructInstance instance)
        {
            int?cellSize = instance.GetCellSize(cell);

            if (cellSize.HasValue)
            {
                return(cellSize.Value);
            }
            return(GetDataSize());
        }
Esempio n. 6
0
        internal int?GetCellSize(StructCell cell)
        {
            int result;

            if (_cellSizes != null && _cellSizes.TryGetValue(cell, out result))
            {
                return(result);
            }
            return(null);
        }
Esempio n. 7
0
        public IConvertible EvaluateSymbol(string symbol)
        {
            StructCell cell = FindSymbolCell(symbol);

            if (cell != null)
            {
                return(cell.GetValue());
            }

            return(EvaluateGlobalOrFunction(symbol));
        }
Esempio n. 8
0
        internal StructCell FindSymbolCellBefore(string symbol, StructCell anchor)
        {
            var cellList = _allCells ?? _cells;
            int index    = cellList.IndexOf(anchor);

            if (index == 0)
            {
                return(null);
            }
            index = cellList.FindLastIndex(index - 1, aCell => aCell.GetStructDef().Id == symbol || aCell.Tag == symbol);
            return(index >= 0 ? cellList[index] : null);
        }
Esempio n. 9
0
 private void calcChecksum(IConvertible value, StructCell cell)
 {
     if (Utils.IsNumeric(value))
     {
         this._checksum += long.Parse(value.ToString());
     }
     else if (value.GetTypeCode() == TypeCode.String && this.Offset < this.Stream.Length - 34)
     {
         byte[] buffer = Utils.ToBytes(value);
         this._checksum += ((StrField)cell.GetStructDef()).GetWide() ? buffer.Length / 2 : buffer.Length;
         for (int j = 0; j < buffer.Length; j++)
         {
             this._checksum += buffer[j];
         }
     }
     else
     {
         var a = 10;
     }
 }
Esempio n. 10
0
        private void UpdateDependency(StructCell cell)
        {
            var dataSize = cell.GetStructDef().GetInstanceDataSize(cell, _instance);

            if (_dependencyStartOffset < 0)
            {
                _dependencyStartOffset = cell.Offset;
                _dependencySize        = dataSize;
            }
            // include only adjacent cells in dependency range calculation
            else if (cell.Offset + dataSize == _dependencyStartOffset)
            {
                _dependencyStartOffset = cell.Offset;
                _dependencySize       += dataSize;
            }
            else if (cell.Offset == _dependencyStartOffset + _dependencySize)
            {
                _dependencySize += dataSize;
            }
        }
Esempio n. 11
0
 public DependencyTrackingContext(StructInstance instance, StructCell cell)
     : base(instance)
 {
     _instance = instance;
     _cell     = cell;
 }
Esempio n. 12
0
        internal void AddCell(StructCell cell, bool hidden)
        {
            if (hidden || _hideAddedCells)
            {
                if (_allCells == null)
                {
                    _allCells = new List<StructCell>();
                    _allCells.AddRange(_cells);
                }
                _allCells.Add(cell);
            }
            else
            {
                _cells.Add(cell);
                if (_allCells != null)
                    _allCells.Add(cell);
            }

            foreach(CellHandler handler in _addedCellHandlers)
            {
                handler(cell);
            }
        }
Esempio n. 13
0
 internal int? GetCellSize(StructCell cell)
 {
     int result;
     if (_cellSizes != null && _cellSizes.TryGetValue(cell, out result))
         return result;
     return null;
 }
Esempio n. 14
0
 internal void RegisterCellSize(StructCell cell, int size)
 {
     if (_cellSizes == null)
         _cellSizes = new Dictionary<StructCell, int>();
     _cellSizes[cell] = size;
 }
Esempio n. 15
0
 public virtual int GetInstanceDataSize(StructCell cell, StructInstance instance)
 {
     int? cellSize = instance.GetCellSize(cell);
     if (cellSize.HasValue)
         return cellSize.Value;
     return GetDataSize();
 }
Esempio n. 16
0
 public CellSelectedEventArgs(StructCell cell)
 {
     _cell = cell;
 }
Esempio n. 17
0
 internal StructCell FindSymbolCellBefore(string symbol, StructCell anchor)
 {
     var cellList = _allCells ?? _cells;
     int index = cellList.IndexOf(anchor);
     if (index == 0) return null;
     index = cellList.FindLastIndex(index - 1, aCell => aCell.GetStructDef().Id == symbol || aCell.Tag == symbol);
     return index >= 0 ? cellList[index] : null;
 }