示例#1
0
        public RecordFile(DiskUtil disk, long offset,int index)
        {
            this.disk = disk;
            this.Offset = offset;
            disk.Position = offset;
            device = new RecordDevice(disk);
            if (device.IsValid == false) return;

            disk.Read(dataChannel, 0, 512);

            string tag = ASCIIEncoding.ASCII.GetString(dataChannel, 0, 4);

            if (tag != " chn") return;

            int channelNum = dataChannel[4];
            eventWaits = new EventWaitHandle[channelNum];

            for (int i = 0; i < channelNum; i++)
            {
                AutoResetEvent autoEvent = new AutoResetEvent(false);
                SignalChannel info = new SignalChannel(this,autoEvent, dataChannel, 5 + 128 * i);
                eventWaits[i] = autoEvent;
                listChannel.Add(info);
            }

            this.FileIndex = index+1;
        }
示例#2
0
        public RecordControl(DiskUtil disk)
        {
            this.IsValid = false;

            disk.Read(data, 0, data.Length);

            this.Tag = Encoding.ASCII.GetString(data, 0, 4);

            if (this.Tag != "ctrl") return;

            this.IsValid = true;

            this.TotalSector = BitConverter.ToInt32(data, 4);
            this.UsedSector = BitConverter.ToInt32(data, 8);
        }
示例#3
0
        public RecordDevice(DiskUtil disk)
        {
            this.IsValid = false;
            disk.Read(sectorData, 0, 512);

            this.Tag = Encoding.ASCII.GetString(sectorData, 0, 4);

            if (this.Tag != " dev") return;

            this.IsValid = true;

            this.Time = new DateTime(sectorData[4] +2000, sectorData[5], sectorData[6], sectorData[7], sectorData[8], sectorData[9]);

            this.devInfo = new DeviceInfo(sectorData, 10);

            this.UsedSector = BitConverter.ToInt32(sectorData, 138);
            this.UsedRate = BitConverter.ToInt16(sectorData, 142);
            this.Overflow = BitConverter.ToInt32(sectorData, 144);
        }