示例#1
0
        /// <summary>
        /// Initializes all available partitions looking for valid
        /// file systems.
        /// </summary>
        public static void InitPartitions()
        {
            for (int i = 0; i < Partitions.Count; i++)
            {
                try
                {
                    Partition aPartition = (Partition)Partitions[i];
                    if (!aPartition.Mapped)
                    {
                        //BasicConsole.WriteLine("Attempting to create FAT File System...");
                        FileSystem newFS = null;
                        if (aPartition is Disk.ISO9660.PrimaryVolumeDescriptor)
                        {
                            newFS = new ISO9660.ISO9660FileSystem((Disk.ISO9660.PrimaryVolumeDescriptor)aPartition);
                        }
                        else
                        {
                            newFS = new FOS_System.IO.FAT.FATFileSystem(aPartition);
                        }

                        if (newFS.IsValid)
                        {
                            FOS_System.String mappingPrefix = FOS_System.String.New(3);
                            mappingPrefix[0] = (char)((int)('A') + i);
                            mappingPrefix[1] = ':';
                            mappingPrefix[2] = PathDelimiter;
                            newFS.TheMapping = new FileSystemMapping(mappingPrefix, newFS);
                            FileSystemMappings.Add(newFS.TheMapping);
                            aPartition.Mapped = true;
                        }
                        //else
                        //{
                        //    BasicConsole.WriteLine("Partition not formatted as valid FAT file-system.");
                        //}
                    }
                }
                catch
                {
                    BasicConsole.Write("Error initialising partition: ");
                    BasicConsole.WriteLine(i);
                    BasicConsole.WriteLine(ExceptionMethods.CurrentException.Message);
                    //BasicConsole.DelayOutput(20);
                }
            }
        }
示例#2
0
        /// <summary>
        /// Initializes all available partitions looking for valid 
        /// file systems.
        /// </summary>
        public static void InitPartitions()
        {
            for (int i = 0; i < Partitions.Count; i++)
            {
                try
                {
                    Partition aPartition = (Partition)Partitions[i];
                    if (!aPartition.Mapped)
                    {
                        //BasicConsole.WriteLine("Attempting to create FAT File System...");
                        FileSystem newFS = null;
                        if (aPartition is Disk.ISO9660.PrimaryVolumeDescriptor)
                        {
                            newFS = new ISO9660.ISO9660FileSystem((Disk.ISO9660.PrimaryVolumeDescriptor)aPartition);
                        }
                        else
                        {
                            newFS = new FOS_System.IO.FAT.FATFileSystem(aPartition);
                        }

                        if (newFS.IsValid)
                        {
                            FOS_System.String mappingPrefix = FOS_System.String.New(3);
                            mappingPrefix[0] = (char)((int)('A') + i);
                            mappingPrefix[1] = ':';
                            mappingPrefix[2] = PathDelimiter;
                            newFS.TheMapping = new FileSystemMapping(mappingPrefix, newFS);
                            FileSystemMappings.Add(newFS.TheMapping);
                            aPartition.Mapped = true;
                        }
                        //else
                        //{
                        //    BasicConsole.WriteLine("Partition not formatted as valid FAT file-system.");
                        //}
                    }
                }
                catch
                {
                    BasicConsole.Write("Error initialising partition: ");
                    BasicConsole.WriteLine(i);
                    BasicConsole.WriteLine(ExceptionMethods.CurrentException.Message);
                    //BasicConsole.DelayOutput(20);
                }
            }
        }