Пример #1
0
        public bool Write(object obj, byte[] data, int offset = 0)
        {
            bool   written;
            object toWrite;

            switch (Size)
            {
            case 1:
                toWrite = Convert.ToByte(obj);
                break;

            case 2:
                toWrite = Convert.ToInt16(obj);
                break;

            case 4:
                toWrite = Convert.ToInt32(obj);
                break;

            default:
                return(false);
            }
            written = _internalBlock.Write(toWrite, data, offset);
            if (CopyAddresses == null)
            {
                return(written);
            }
            int oldAddress = Address;

            foreach (int copyAddress in CopyAddresses)
            {
                _internalBlock.Address = copyAddress;
                _internalBlock.Write(toWrite, data, offset);
            }
            _internalBlock.Address = oldAddress;
            return(written);
        }