Ejemplo n.º 1
0
        public bool Identify(IMediaImage imagePlugin, Partition partition)
        {
            if (partition.Start > 0)
            {
                return(false);
            }

            if (partition.End < 8)
            {
                return(false);
            }

            byte[] sector = imagePlugin.ReadSector(6);

            if (sector.Length != 128)
            {
                return(false);
            }

            VolumeLabel vol    = new VolumeLabel();
            IntPtr      volPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vol));

            Marshal.Copy(sector, 0, volPtr, Marshal.SizeOf(vol));
            vol = (VolumeLabel)Marshal.PtrToStructure(volPtr, typeof(VolumeLabel));
            Marshal.FreeHGlobal(volPtr);

            return(ecma67_magic.SequenceEqual(vol.labelIdentifier) && vol.labelNumber == 1 && vol.recordLength == 0x31);
        }
Ejemplo n.º 2
0
        public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
                                   Encoding encoding)
        {
            Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
            byte[] sector = imagePlugin.ReadSector(6);

            StringBuilder sbInformation = new StringBuilder();

            VolumeLabel vol    = new VolumeLabel();
            IntPtr      volPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vol));

            Marshal.Copy(sector, 0, volPtr, Marshal.SizeOf(vol));
            vol = (VolumeLabel)Marshal.PtrToStructure(volPtr, typeof(VolumeLabel));
            Marshal.FreeHGlobal(volPtr);

            sbInformation.AppendLine("ECMA-67");

            sbInformation.AppendFormat("Volume name: {0}", Encoding.ASCII.GetString(vol.volumeIdentifier)).AppendLine();
            sbInformation.AppendFormat("Volume owner: {0}", Encoding.ASCII.GetString(vol.owner)).AppendLine();

            XmlFsType = new FileSystemType
            {
                Type        = "ECMA-67",
                ClusterSize = 256,
                Clusters    = (long)(partition.End - partition.Start + 1),
                VolumeName  = Encoding.ASCII.GetString(vol.volumeIdentifier)
            };

            information = sbInformation.ToString();
        }
        private void OnVolumeChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            var norm = e.NewValue / VolumeSlider.Maximum;

            vm?.HandleVolumeChanged(norm);
            VolumeLabel?.SetValue(ContentProperty, $"{(int) (norm * 100)}");
        }
Ejemplo n.º 4
0
        public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
                                   Encoding encoding)
        {
            Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
            byte[] sector = imagePlugin.ReadSector(6);

            StringBuilder sbInformation = new StringBuilder();

            VolumeLabel vol = Marshal.ByteArrayToStructureLittleEndian <VolumeLabel>(sector);

            sbInformation.AppendLine("ECMA-67");

            sbInformation.AppendFormat("Volume name: {0}", Encoding.ASCII.GetString(vol.volumeIdentifier)).AppendLine();
            sbInformation.AppendFormat("Volume owner: {0}", Encoding.ASCII.GetString(vol.owner)).AppendLine();

            XmlFsType = new FileSystemType
            {
                Type        = "ECMA-67",
                ClusterSize = 256,
                Clusters    = partition.End - partition.Start + 1,
                VolumeName  = Encoding.ASCII.GetString(vol.volumeIdentifier)
            };

            information = sbInformation.ToString();
        }
Ejemplo n.º 5
0
        public void TestMethod_VolumeLabel()
        {
            var grid = new Grid();

            VolumeLabel.Show(grid, 1);
            VolumeLabel.Changed(grid, 1);
            VolumeLabel.Hide(grid);
            VolumeLabel.Changed(grid, 1);
        }
Ejemplo n.º 6
0
        public bool Identify(IMediaImage imagePlugin, Partition partition)
        {
            if (partition.Start > 0)
            {
                return(false);
            }

            if (partition.End < 8)
            {
                return(false);
            }

            byte[] sector = imagePlugin.ReadSector(6);

            if (sector.Length != 128)
            {
                return(false);
            }

            VolumeLabel vol = Marshal.ByteArrayToStructureLittleEndian <VolumeLabel>(sector);

            return(ecma67_magic.SequenceEqual(vol.labelIdentifier) && vol.labelNumber == 1 && vol.recordLength == 0x31);
        }
Ejemplo n.º 7
0
 public void VolumeSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     // Променяме звука.
     VolumeLabel.Changed(VolumeGrid, VolumeSlider.Value);
     MediaViewModel.SetVolumeToPlayer();
 }
Ejemplo n.º 8
0
 public void HideVolumeNumber(object sender, MouseButtonEventArgs e)
 {
     VolumeLabel.Hide(VolumeGrid);
 }
Ejemplo n.º 9
0
 public void ShowVolumeNumber(object sender, MouseButtonEventArgs e)
 {
     VolumeLabel.Show(VolumeGrid, VolumeSlider.Value);
     MediaViewModel.Volume = VolumeState.On;
 }