Beispiel #1
0
        private void SetVolumeDescriptor(byte[] systemId, byte[] volumeId, ulong volumeSpaceSize, ulong pathTableSize,
                                         uint typeLPathTable, uint typeMPathTable, DirectoryRecord rootDirRecord,
                                         AsciiDateRecord creationDate, AsciiDateRecord modificationDate,
                                         AsciiDateRecord expirationDate, AsciiDateRecord effectiveDate)
        {
            if (m_volumeDescriptor == null)
            {
                m_volumeDescriptor = new VolumeDescriptor();
            }

            m_volumeDescriptor.VolumeDescType = (byte)m_volumeDescriptorType;

            systemId.CopyTo(m_volumeDescriptor.SystemId, 0);
            volumeId.CopyTo(m_volumeDescriptor.VolumeId, 0);
            m_volumeDescriptor.VolumeSpaceSize = volumeSpaceSize;
            m_volumeDescriptor.PathTableSize   = pathTableSize;
            m_volumeDescriptor.TypeLPathTable  = typeLPathTable;
            m_volumeDescriptor.TypeMPathTable  = typeMPathTable;

            m_volumeDescriptor.RootDirRecord = rootDirRecord;
            m_rootDirRecord = new DirectoryRecordWrapper(rootDirRecord);

            m_volumeDescriptor.CreationDate = creationDate;
            m_creationDate = new DateWrapper(creationDate);

            m_volumeDescriptor.ModificationDate = modificationDate;
            m_modificationDate = new DateWrapper(modificationDate);

            m_volumeDescriptor.ExpirationDate = expirationDate;
            m_expirationDate = new DateWrapper(expirationDate);

            m_volumeDescriptor.EffectiveDate = effectiveDate;
            m_effectiveDate = new DateWrapper(effectiveDate);
        }
Beispiel #2
0
 public void BackupVolume(VolumeDescriptor vdesc)
 {
     if (vdesc.Volume != null)
     {
         mSpineThread.ForceBackup(vdesc.Volume);
     }
 }
Beispiel #3
0
 void eventController_VolumeDescriptorActiveStateChanged_WinThread(VolumeDescriptor volume, bool isActive)
 {
     if (VolumeNeedsRefreshing != null)
     {
         VolumeNeedsRefreshing(volume, isActive);
     }
 }
Beispiel #4
0
        private void mButtonNext_Click(object sender, EventArgs e)
        {
            try
            {
                VolumeSource source  = CreateSource();
                BaseArchive  archive = CreateArchive();

                string vidFilename = mObject.StoragePath + PWLib.Platform.Windows.Path.DirectorySeparatorChar + mObject.Name + ".vol";

                VolumeDescriptor vdesc = VolumeDescriptorList.Instance.AddNewDescriptor(mObject.Name, vidFilename, source, archive);
                if (mObject.RevisionsToKeep > 0)
                {
                    vdesc.RevisionsToKeep = mObject.RevisionsToKeep;
                }
                else
                {
                    vdesc.TimePeriodToMonitor = mObject.TimePeriodToKeep;
                }

                if (mStartBackupNow.Checked)
                {
                    Log.WriteLine(LogType.TextLogVerbose, "Backing up volume by adding it through GUI");
                    MainForm.Instance.BackupVolume(vdesc);
                }
            }
            catch (System.Exception ex)
            {
                Log.WriteException("Add new volume failed", ex);
            }

            MainForm.Instance.ControlSwitcher.SwitchUserControl(FormControlType.Welcome, FormControlSwitchType.Finish);
        }
Beispiel #5
0
 public void Print()
 {
     for (int i = 0; i < VolumeDescriptors.Count; i++)
     {
         VolumeDescriptor desciptor = (VolumeDescriptor)VolumeDescriptors[i];
         desciptor.Print();
     }
 }
Beispiel #6
0
 public InternalRootObject(VolumeDescriptor vid, int iconIndex, int busyIconIndex, string alternativeName)
     : base(null)
 {
     mVolumeDescriptor = vid;
     mIconIndex        = iconIndex;
     mBusyIconIndex    = busyIconIndex;
     mAlternativeName  = alternativeName;
 }
        void mTreeView_RemoveVolumeMenuClicked( VolumeDescriptor vid )
        {
            RemoveVolumeForm removeVolumeForm = new RemoveVolumeForm( vid.VolumeName );

            DialogResult dr = removeVolumeForm.ShowDialog( this );
            if ( dr == DialogResult.Yes )
            {
                MainForm.Instance.RemoveVolume( vid, removeVolumeForm.DeleteAllData );
            }
        }
        void mTreeView_RemoveVolumeMenuClicked(VolumeDescriptor vid)
        {
            RemoveVolumeForm removeVolumeForm = new RemoveVolumeForm(vid.VolumeName);

            DialogResult dr = removeVolumeForm.ShowDialog(this);

            if (dr == DialogResult.Yes)
            {
                MainForm.Instance.RemoveVolume(vid, removeVolumeForm.DeleteAllData);
            }
        }
Beispiel #9
0
 InternalRootObject FindRootObject(VolumeDescriptor vid)
 {
     foreach (InternalRootObject rootObj in this.mVolumeListView.Objects)
     {
         if (rootObj.VolumeDescriptor.IsAvailable && rootObj.VolumeDescriptor.Equals(vid))
         {
             return(rootObj);
         }
     }
     return(null);
 }
Beispiel #10
0
        public ISO9660(Hardware.Devices.DiskDevice disk)
        {
            byte[]           data      = disk.NewBlockArray(1);
            VolumeDescriptor desciptor = null;
            uint             sector    = 0x10;

            do
            {
                disk.ReadBlock(sector, 1, data);
                desciptor = VolumeDescriptor.CreateDescriptor(disk, sector, 1);
                VolumeDescriptors.Add(desciptor);

                sector++;
            }while (desciptor.Code != VolumeDescriptor.TypeCodes.SetTerminator);
        }
Beispiel #11
0
        public Iso9660(Stream stream)
        {
            VolumeDescriptor volume  = VolumeDescriptor.Create(stream, 2);
            bool             unicode = false;

            if (volume == null)
            {
                volume = VolumeDescriptor.Create(stream, 1);
            }
            else
            {
                unicode = true;
            }

            if (volume == null)
            {
                throw new FormatException();
            }

            MemoryStream rootmem    = new MemoryStream(volume.root);
            EndianReader rootreader = new EndianReader(rootmem, Endianness.BigEndian);
            //List<PathTableEntry> entries = new List<PathTableEntry>();
            PathTableEntry root = new PathTableEntry();

            rootreader.Position  = OffsetExtended;
            root.ExtendedSectors = rootreader.ReadByte();
            rootreader.Position  = OffsetSector;
            root.Sector          = rootreader.ReadUInt32();
            root.Name            = "";

            /*
             * entries.Add(root);
             *
             * uint pathtable = volume.path_table_be;
             * uint pathtablelen = volume.path_table_len_be;
             * SeekSector(stream, pathtable);
             * stream.Position += PathTableEntrySize + 2;
             *
             * for (ushort i = 1; i < 0xFFFF && stream.Position < (pathtable * SectorSize + pathtablelen); i++) {
             *      PathTableEntry entry = PathTableEntry.Create(stream, unicode);
             *      PathTableEntry parent = entries[entry.Parent - 1];
             *      parent.Children.Add(entry);
             *
             *      entries.Add(entry);
             * }
             */
            Root = Stat(new EndianReader(stream, Endianness.BigEndian), root, unicode);
        }
Beispiel #12
0
 private void tvSectors_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Node.Parent != null && e.Node.Parent.Name == "nodeVolumeDescriptors")
     {
         this.pnlPrimaryVolumeDescriptor.Controls.Clear();
         VolumeDescriptor        vd     = (VolumeDescriptor)e.Node.Tag;
         VolumeDescriptorControl pvdctl = new VolumeDescriptorControl(vd);
         this.pnlPrimaryVolumeDescriptor.Controls.Add(pvdctl);
     }
     else if (e.Node.Parent != null && e.Node.Parent.Name == "nodeDirectoryRecords")
     {
         this.pnlDirectoryRecord.Controls.Clear();
         DirectoryRecord        dr    = (DirectoryRecord)e.Node.Tag;
         DirectoryRecordControl drctl = new DirectoryRecordControl(dr);
         this.pnlDirectoryRecord.Controls.Add(drctl);
     }
 }
        public virtual void Process(Audio item, AudioInfo info)
        {
            //build amplitude envelope
            var s = Build(info.Samples);
            //resample
            var resampler = Factory.CreateResampler();
            var resampled = resampler.Resample(s, info.Samples.Bitrate * ((float)EnvelopeLength / info.Samples.Values.Length));

            //build packed array
            var envelope = new Envelope(resampled);
            //save into audio item
            item.Data.Add(envelope);

            //build volumeDescriptor
            var volDesc = new VolumeDescriptor();
            volDesc.Build(s.Values);

            item.Data.Add(volDesc);
        }
Beispiel #14
0
        public void SetVolumeAsBusy(VolumeDescriptor vid, bool busy)
        {
            InternalRootObject rootObj = FindRootObject(vid);

            if (rootObj != null)
            {
                if (rootObj.IsBusy && !busy)
                {
                    rootObj.Dirty = true;                     // operation has just finished, contents may have changed
                }
                rootObj.IsBusy    = busy;
                rootObj.IsChecked = false;

//				Log.WriteLine( "Setting " + rootObj.VolumeIdentifier.Name + " to " + ( busy ? "busy" : "not busy" ) );
                this.mVolumeListView.RefreshObject(rootObj);
            }

            LockInterface(mInterfaceLockedOverride);
        }
Beispiel #15
0
        private void SetVolumeDescriptor(string systemId, string volumeId, uint volumeSpaceSize, uint pathTableSize,
                                         uint typeLPathTable, uint typeMPathTable, DirectoryRecordWrapper rootDir, DateTime creationDate, DateTime modificationDate, sbyte timeZone)
        {
            byte[] lSystemId;
            byte[] lVolumeId;

            if (VolumeDescriptorType == VolumeType.Primary)
            {
                lSystemId = IsoAlgorithm.StringToByteArray(systemId, IsoAlgorithm.SystemIdLength);
                lVolumeId = IsoAlgorithm.StringToByteArray(volumeId, IsoAlgorithm.VolumeIdLength);
            }
            else if (VolumeDescriptorType == VolumeType.Suplementary)
            {
                lSystemId = IsoAlgorithm.AsciiToUnicode(systemId, IsoAlgorithm.SystemIdLength);
                lVolumeId = IsoAlgorithm.AsciiToUnicode(volumeId, IsoAlgorithm.VolumeIdLength);
            }
            else
            {
                if (m_volumeDescriptor == null)
                {
                    m_volumeDescriptor = new VolumeDescriptor();
                }
                m_volumeDescriptor.VolumeDescType = (byte)m_volumeDescriptorType;
                return;
            }

            ulong lVolumeSpaceSize = IsoAlgorithm.BothEndian(volumeSpaceSize);
            ulong lPathTableSize   = IsoAlgorithm.BothEndian(pathTableSize);

            // typeLPathTable remains unchanged, but typeMPathTable has to change byte order.
            uint        lTypeMPathTable = IsoAlgorithm.ChangeEndian(typeMPathTable);
            DateWrapper lCreationDate   = new DateWrapper(creationDate, timeZone);

            DateWrapper lModificationDate = new DateWrapper(modificationDate, timeZone);

            DateWrapper bufferDate = new DateWrapper(IsoAlgorithm.NoDate);

            SetVolumeDescriptor(lSystemId, lVolumeId, lVolumeSpaceSize, lPathTableSize, typeLPathTable, lTypeMPathTable,
                                rootDir.Record, lCreationDate.AsciiDateRecord, lModificationDate.AsciiDateRecord,
                                bufferDate.AsciiDateRecord, bufferDate.AsciiDateRecord);
        }
        public virtual void Process(Audio item, AudioInfo info)
        {
            //build amplitude envelope
            var s = Build(info.Samples);
            //resample
            var resampler = Factory.CreateResampler();
            var resampled = resampler.Resample(s, info.Samples.Bitrate * ((float)EnvelopeLength / info.Samples.Values.Length));

            //build packed array
            var envelope = new Envelope(resampled);

            //save into audio item
            item.Data.Add(envelope);

            //build volumeDescriptor
            var volDesc = new VolumeDescriptor();

            volDesc.Build(s.Values);

            item.Data.Add(volDesc);
        }
        private void SetVolumeDescriptor(byte[] systemId, byte[] volumeId, UInt64 volumeSpaceSize, UInt64 pathTableSize,
                                         UInt32 typeLPathTable, UInt32 typeMPathTable, DirectoryRecord rootDirRecord,
                                         byte[] volumeSetId, byte[] publisherId, byte[] preparerId, byte[] applicationId,
                                         byte[] copyrightFileId, byte[] abstractFileId, byte[] bibliographicFieldId,
                                         AsciiDateRecord creationDate, AsciiDateRecord modificationDate,
                                         AsciiDateRecord expirationDate, AsciiDateRecord effectiveDate)
        {
            if (m_volumeDescriptor == null)
            {
                m_volumeDescriptor = new VolumeDescriptor();
            }

            volumeSetId.CopyTo(m_volumeDescriptor.VolumeSetId, 0);
            publisherId.CopyTo(m_volumeDescriptor.PublisherId, 0);
            preparerId.CopyTo(m_volumeDescriptor.PreparerId, 0);
            applicationId.CopyTo(m_volumeDescriptor.ApplicationId, 0);
            copyrightFileId.CopyTo(m_volumeDescriptor.CopyrightFileId, 0);
            abstractFileId.CopyTo(m_volumeDescriptor.AbstractFileId, 0);
            bibliographicFieldId.CopyTo(m_volumeDescriptor.BibliographicFileId, 0);

            this.SetVolumeDescriptor(systemId, volumeId, volumeSpaceSize, pathTableSize, typeLPathTable, typeMPathTable,
                                     rootDirRecord, creationDate, modificationDate, expirationDate, effectiveDate);
        }
Beispiel #18
0
            public static VolumeDescriptor Create(Stream stream)
            {
                VolumeDescriptor vd = new VolumeDescriptor();

                EndianReader reader = new EndianReader(stream, Endianness.BigEndian);

                vd.id = reader.ReadUInt64();
                reader.ReadBytes(vd.system_id);
                reader.ReadBytes(vd.volume_id);
                vd.zero            = reader.ReadUInt64();
                vd.total_sector_le = reader.ReadUInt32(Endianness.LittleEndian);
                vd.total_sect_be   = reader.ReadUInt32();
                reader.ReadBytes(vd.zero2);

                vd.volume_set_size   = reader.ReadUInt32();
                vd.volume_seq_nr     = reader.ReadUInt32();
                vd.sector_size_le    = reader.ReadUInt16(Endianness.LittleEndian);
                vd.sector_size_be    = reader.ReadUInt16();
                vd.path_table_len_le = reader.ReadUInt32(Endianness.LittleEndian);
                vd.path_table_len_be = reader.ReadUInt32();
                vd.path_table_le     = reader.ReadUInt32(Endianness.LittleEndian);
                vd.path_table_2nd_le = reader.ReadUInt32(Endianness.LittleEndian);
                vd.path_table_be     = reader.ReadUInt32();
                vd.path_table_2nd_be = reader.ReadUInt32();

                reader.ReadBytes(vd.root);
                reader.ReadBytes(vd.volume_set_id);
                reader.ReadBytes(vd.publisher_id);
                reader.ReadBytes(vd.data_preparer_id);
                reader.ReadBytes(vd.application_id);

                reader.ReadBytes(vd.copyright_file_id);
                reader.ReadBytes(vd.abstract_file_id);
                reader.ReadBytes(vd.bibliographical_file_id);

                return(vd);
            }
 InternalRootObject FindRootObject( VolumeDescriptor vid )
 {
     foreach ( InternalRootObject rootObj in this.mVolumeListView.Objects )
     {
         if ( rootObj.VolumeDescriptor.IsAvailable && rootObj.VolumeDescriptor.Equals( vid ) )
             return rootObj;
     }
     return null;
 }
 void mTreeView_TransferVolumeMenuClicked( VolumeDescriptor vid )
 {
     MainForm.Instance.ControlSwitcher.SwitchUserControl( FormControlType.TransferVolume1, FormControlSwitchType.Start, vid );
 }
 public InternalRootObject( VolumeDescriptor vid, int iconIndex, int busyIconIndex, string alternativeName )
     : base(null)
 {
     mVolumeDescriptor = vid;
     mIconIndex = iconIndex;
     mBusyIconIndex = busyIconIndex;
     mAlternativeName = alternativeName;
 }
 void mTreeView_AddNewVolumeMenuClicked( VolumeDescriptor vid )
 {
     MainForm.Instance.ControlSwitcher.SwitchUserControl( FormControlType.AddVolume2, FormControlSwitchType.Start );
 }
Beispiel #23
0
 public void BackupVolume( VolumeDescriptor vdesc )
 {
     if ( vdesc.Volume != null )
         mSpineThread.ForceBackup( vdesc.Volume );
 }
 void eventController_VolumeDescriptorActiveStateChanged( VolumeDescriptor volume, bool isActive )
 {
     mInvokeControl.Invoke( new VolumeDescriptorChangedHandler( eventController_VolumeDescriptorActiveStateChanged_WinThread ), volume, isActive );
 }
 public VolumeDescriptorControl(VolumeDescriptor volumedescriptor) : this()
 {
     vd = volumedescriptor;
     RefreshPVDInfo();
 }
 void mTreeView_AddNewVolumeMenuClicked(VolumeDescriptor vid)
 {
     MainForm.Instance.ControlSwitcher.SwitchUserControl(FormControlType.AddVolume2, FormControlSwitchType.Start);
 }
Beispiel #27
0
 public void TransferVolume(VolumeDescriptor vid, PWLib.UsbDrive.UsbDriveInfo newDrive)
 {
     mSpineThread.TransferVolume(vid, newDrive);
 }
Beispiel #28
0
 public void RestoreVolume(VolumeDescriptor vid, VolumeSnapshotRevision revision, string onDiskPath)
 {
     mSpineThread.RestoreVolume(vid, revision, onDiskPath);
 }
Beispiel #29
0
 public void RemoveVolume(VolumeDescriptor desc, bool removeAllData)
 {
     mSpineThread.RemoveVolume(desc, removeAllData);
 }
Beispiel #30
0
 public void TransferVolume( VolumeDescriptor vid, PWLib.UsbDrive.UsbDriveInfo newDrive )
 {
     mSpineThread.TransferVolume( vid, newDrive );
 }
Beispiel #31
0
 public void RemoveVolume( VolumeDescriptor desc, bool removeAllData )
 {
     mSpineThread.RemoveVolume( desc, removeAllData );
 }
        public void SetVolumeAsBusy( VolumeDescriptor vid, bool busy )
        {
            InternalRootObject rootObj = FindRootObject( vid );
            if ( rootObj != null )
            {
                if ( rootObj.IsBusy && !busy )
                    rootObj.Dirty = true; // operation has just finished, contents may have changed
                rootObj.IsBusy = busy;
                rootObj.IsChecked = false;

            //				Log.WriteLine( "Setting " + rootObj.VolumeIdentifier.Name + " to " + ( busy ? "busy" : "not busy" ) );
                this.mVolumeListView.RefreshObject( rootObj );
            }

            LockInterface( mInterfaceLockedOverride );
        }
Beispiel #33
0
 void EventController_VolumeDescriptorActiveChanged(VolumeDescriptor volume, bool isActive)
 {
     Reset();
 }
Beispiel #34
0
 void eventController_VolumeDescriptorActiveStateChanged(VolumeDescriptor volume, bool isActive)
 {
     mInvokeControl.Invoke(new VolumeDescriptorChangedHandler(eventController_VolumeDescriptorActiveStateChanged_WinThread), volume, isActive);
 }
 void eventController_VolumeDescriptorActiveStateChanged_WinThread( VolumeDescriptor volume, bool isActive )
 {
     if ( VolumeNeedsRefreshing != null )
         VolumeNeedsRefreshing( volume, isActive );
 }
 void mTreeView_RestoreVolumeMenuClicked(VolumeDescriptor vid)
 {
     MainForm.Instance.ControlSwitcher.SwitchUserControl(FormControlType.RestoreVolume1, FormControlSwitchType.Start, vid);
 }
Beispiel #37
0
 public void RestoreVolume( VolumeDescriptor vid, VolumeSnapshotRevision revision, string onDiskPath )
 {
     mSpineThread.RestoreVolume( vid, revision, onDiskPath );
 }
 void EventController_VolumeDescriptorActiveChanged( VolumeDescriptor volume, bool isActive )
 {
     mTreeView.Reset();
 }