Ejemplo n.º 1
0
            /// <summary>
            /// Returns an array of valid FATXDrives
            /// </summary>
            public FATX.FATXDrive[] GetFATXDrives(int range)
            {
                List <FATX.FATXDrive> driveList = new List <FATX.FATXDrive>();

                try
                {
                    ///Gets physical disks
                    for (int i = 0; i < range; i++)
                    {
                        try
                        {
                            //Start reading the physical drive
                            fs = fs_diskStream(i);
                            br = br_diskReader(i);
                            //Seek to the FATX partition
                            try
                            {
                                br.BaseStream.Position = (long)FATX.Info.HDDFATX.Partitions.Data;
                                //Read the header
                                byte[] header = br.ReadBytes(0x4);
                                //Convert the header to a string, check if it's fatx
                                if (Encoding.ASCII.GetString(header) == "XTAF")
                                {
                                    FATX.FATXDrive drive = new FATXDrive(i, FATX.Info.DriveType.HDD);
                                    driveList.Add(drive);
                                }
                                // Check to see if it's a dev drive...
                                else
                                {
                                    br.BaseStream.Position = (long)FATX.Info.HDDFATX.DevOffsets.Content;
                                    // Read the header
                                    byte[] devheader = br.ReadBytes(0x4);
                                    // Convert header to a string, check to see if it's fatx
                                    if (Encoding.ASCII.GetString(devheader) == "XTAF")
                                    {
                                        FATX.FATXDrive drive = new FATXDrive(i, FATX.Info.DriveType.HDD);
                                        drive.IsDev = true;
                                        driveList.Add(drive);
                                    }
                                }
                            }
                            catch { br.Close(); fs.Close(); diskDrive.Close(); continue; }
                            br.Close();
                            fs.Close();
                            diskDrive.Close();
                            bool closed = diskDrive.IsClosed;
                        }
                        catch { fs.Close(); br.Close(); diskDrive.Close(); continue; }
                    }
                    ///Gets usb drives
                    DriveInfo[] drives = DriveInfo.GetDrives();
                    ///Check to see if the drive has a subdirectory of "Xbox360"
                    foreach (DriveInfo drive in drives)
                    {
                        if (drive.Name == @"A:\" || drive.Name == @"B:\" ||
                            drive.DriveType == DriveType.NoRootDirectory || drive.DriveType == DriveType.CDRom ||
                            drive.DriveType == DriveType.Network || drive.DriveType == DriveType.Unknown)
                        {
                            continue;
                        }

                        //If the directory does not exist
                        DirectoryInfo di = new DirectoryInfo(drive.Name + "Xbox360");
                        if (!di.Exists)
                        {
                            continue;
                        }
                        else
                        {
                            //Check to make sure that there's actually files in that directory..
                            FileInfo[] fi    = di.GetFiles();
                            bool       found = false;
                            foreach (FileInfo file in fi)
                            {
                                string name = file.Name.ToLower();
                                if (name == "data0000" || name == "data0001" || name == "data0002")
                                {
                                    found = true;
                                    break;
                                }
                            }
                            if (!found)
                            {
                                continue;
                            }
                        }
                        driveList.Add(new FATXDrive(drive.Name + "Xbox360", Info.DriveType.USB, drive.VolumeLabel));
                    }
                    return(driveList.ToArray());
                }
                catch { return(driveList.ToArray()); }
            }
Ejemplo n.º 2
0
 public Entry(FATXDrive xDrive, PartitionInfo partinfo)
 {
     drive    = xDrive;
     PartInfo = partinfo;
 }
Ejemplo n.º 3
0
 public File(FATXDrive DRIVE, PartitionInfo partition) : base(DRIVE, partition)
 {
     e    = new Entries(this);
     Misc = new Misc();
 }
Ejemplo n.º 4
0
 public Folder(FATXDrive DRIVE, PartitionInfo partition) : base(DRIVE, partition)
 {
     e        = new Entries(this);
     Misc     = new Misc();
     IsFolder = true;
 }