Esempio n. 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;
        }
Esempio n. 2
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;
        }