示例#1
0
        public void LoadInstanceData(StructInstance instance, Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            foreach (StructField field in _fields)
            {
                if (field.IsLinked)
                {
                    continue;
                }

                try
                {
                    field.Offset = reader.BaseStream.Position;
                    field.LoadData(reader, instance);
                }
                catch (LoadDataException ex)
                {
                    instance.AddCell(ValueCell.CreateErrorCell(field, ex.Message), false);
                    break;
                }
                catch (IOException ex)
                {
                    instance.AddCell(ValueCell.CreateErrorCell(field, ex.Message), false);
                    break;
                }
            }
            long offset = instance.GetLastRewindOffset();

            if (offset != -1)
            {
                stream.Position = offset;
            }
        }
示例#2
0
        protected StructCell AddCell(StructInstance instance, IConvertible value, int offset)
        {
            StructCell cell = new ValueCell(this, value, offset);

            instance.AddCell(cell, _hidden);
            return(cell);
        }
示例#3
0
        public void LoadInstanceData(StructInstance instance, Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            foreach (StructField field in _fields)
            {
                if (field.IsLinked) continue;

                try
                {
                    field.LoadData(reader, instance);
                }
                catch(LoadDataException ex)
                {
                    instance.AddCell(ValueCell.CreateErrorCell(field, ex.Message), false);
                    break;
                }
                catch(IOException ex)
                {
                    instance.AddCell(ValueCell.CreateErrorCell(field, ex.Message), false);
                    break;
                }
            }
            long offset = instance.GetLastRewindOffset();
            if (offset != -1)
                stream.Position = offset;
        }
示例#4
0
 protected void AddCell(StructInstance instance, Expression expr)
 {
     instance.AddCell(new ExprCell(this, instance, expr), _hidden);
 }
示例#5
0
 protected void AddCell(StructInstance instance, IConvertible value, string displayValue, int offset)
 {
     instance.AddCell(new ValueCell(this, value, displayValue, offset), _hidden);
 }
示例#6
0
 protected void AddCell(StructInstance instance, Expression expr)
 {
     instance.AddCell(new ExprCell(this, instance, expr), _hidden);
 }
示例#7
0
 protected void AddCell(StructInstance instance, IConvertible value, string displayValue, int offset)
 {
     instance.AddCell(new ValueCell(this, value, displayValue, offset), _hidden);
 }
示例#8
0
 protected StructCell AddCell(StructInstance instance, IConvertible value, int offset)
 {
     StructCell cell = new ValueCell(this, value, offset);
     instance.AddCell(cell, _hidden);
     return cell;
 }