コード例 #1
0
        /// <summary>
        /// Gets the FATX-formatted drives connected to the computer.
        /// </summary>
        /// <returns>List of all FATX drives connected to the computer</returns>
        public static Drive[] GetFATXDrives()
        {
            // Our drive list
            List<Drive> dL = new List<Drive>();
            int Count = 10;
            try
            {
                ManagementObjectCollection drives = new ManagementObjectSearcher(
             "SELECT Caption, DeviceID FROM Win32_DiskDrive").Get();
                Count = drives.Count;
            }
            catch { Console.WriteLine("Encountered error when trying to open managed object collection: GetFATXDrives();"); }
            for (int i = 0; i < Count; i++)
            {
                Drive d = new Drive(i);
                if (d.IsFATXDrive())
                {
                    dL.Add(d);
                }
            }
            // Sort out our USB/logical drives...
            foreach (string s in Environment.GetLogicalDrives().Where(drive => System.IO.Directory.Exists(drive + "\\Xbox360")))
            {
                List<string> filePaths = new List<string>();
                for (int i = 0; i < 10000; i++)
                {
                    string extra = "";
                    if (i < 10)
                    {
                        extra = "000";
                    }
                    else if (i < 100)
                    {
                        extra = "00";
                    }
                    else if (i < 1000)
                    {
                        extra = "0";
                    }
                    if (System.IO.File.Exists(s + "\\Xbox360\\Data" + extra + i.ToString()))
                    {
                        filePaths.Add(s + "\\Xbox360\\Data" + extra + i.ToString());
                    }
                    else { break; }
                }
                if (filePaths.Count >= 3 && !IsLocked(filePaths[0]))
                {
                    Drive d = new Drive(filePaths.ToArray());
                    dL.Add(d);
                }
            }

            return dL.ToArray();
        }
コード例 #2
0
 public EntryAction(Drive xDrive, Method method, string Path)
 {
     InitializeComponent();
     if (Environment.OSVersion.Version.Build >= 7600)
     {
         Windows7 = true;
     }
     if (Environment.OSVersion.Version.Build >= 6000)
     {
         Aero = true;
     }
     if (Windows7)
     {
         tm = TaskbarManager.Instance;
     }
     this.HandleCreated += new EventHandler(EntryAction_HandleCreated);
     this.FormClosing +=new FormClosingEventHandler(EntryAction_FormClosing);
     m = method;
     OutPath = Path;
     this.xDrive = xDrive;
 }
コード例 #3
0
 void Reload()
 {
     if (Drive != null)
     {
         CLKsFATXLib.Drive d = Drive;
         Clear();
         switch (d.DriveType)
         {
             case DriveType.USB:
                 Drive = new Drive(d.USBPaths);
                 break;
             case DriveType.HardDisk:
                 Drive = new Drive(d.DeviceIndex);
                 break;
             case DriveType.Backup:
                 Drive = new Drive(d.FilePath);
                 break;
         }
         LoadDrive();
     }
 }
コード例 #4
0
 void RecentFileHandler(object sender, EventArgs e)
 {
     Drive = new Drive(((MenuItem)sender).Text);
     LoadDrive();
 }
コード例 #5
0
        private void m_OpenDump_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (Drive != null)
                {
                    Drive.Close();
                }
                Drive = new Drive(ofd.FileName);
                LoadDrive();
                if (Properties.Settings.Default.recentFiles == null)
                {
                    Properties.Settings.Default.recentFiles = new System.Collections.Specialized.StringCollection();
                }
                bool exists = false;
                foreach (string s in Properties.Settings.Default.recentFiles)
                {
                    if (s == ofd.FileName)
                    {
                        exists = true;
                    }
                }
                if (!exists)
                {
                    //string shell32DllPath = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\" + "shell32.dll";
                    Properties.Settings.Default.recentFiles.Insert(0, ofd.FileName);
                    // Change the jumplist
                    //Windows7.DesktopIntegration.JumpListManager jm = this.CreateJumpListManager();
                    if (Properties.Settings.Default.recentFiles.Count == 6)
                    {
                        Properties.Settings.Default.recentFiles.RemoveAt(5);
                    }
                    Properties.Settings.Default.Save();
                    MenuItem i = new MenuItem(ofd.FileName);
                    i.Click += new EventHandler(RecentFileHandler);
                    m_Open.MenuItems.Add(4, i);

                    //jm.AddCustomDestination(new ShellLink
                    //{
                    //    Path = ofd.FileName,
                    //    Title = Drive.Name,
                    //    Category = "Recent Files",
                    //    IconLocation = shell32DllPath,
                    //    IconIndex = 1
                    //});
                    //jm.AddToRecent(Properties.Settings.Default.recentFiles[0]);
                }
            }
        }
コード例 #6
0
 private void menuItem9_Click(object sender, EventArgs e)
 {
     DialogResult dr = DialogResult.No;
     string Path = "";
     if (Aero)
     {
         CommonOpenFileDialog ofd = new CommonOpenFileDialog();
         ofd.IsFolderPicker = true;
         ofd.Multiselect = false;
         if (ofd.ShowDialog() == CommonFileDialogResult.Ok)
         {
             dr = DialogResult.OK;
             Path = ofd.FileName;
         }
     }
     else
     {
         FolderBrowserDialog fbd = new FolderBrowserDialog();
         if (fbd.ShowDialog() == DialogResult.OK)
         {
             Path = fbd.SelectedPath;
         }
     }
     if (dr == DialogResult.OK)
     {
         List<string> filePaths = new List<string>();
         for (int i = 0; i < 10000; i++)
         {
             string extra = "";
             if (i < 10)
             {
                 extra = "000";
             }
             else if (i < 100)
             {
                 extra = "00";
             }
             else if (i < 1000)
             {
                 extra = "0";
             }
             if (System.IO.File.Exists(Path + "\\Data" + extra + i.ToString()))
             {
                 filePaths.Add(Path + "\\Data" + extra + i.ToString());
             }
             else { break; }
         }
         Drive d = new Drive(filePaths.ToArray());
         if (filePaths.Count < 3 || !d.IsFATXDrive())
         {
             if (Aero)
             {
                 Microsoft.WindowsAPICodePack.Dialogs.TaskDialog td = new Microsoft.WindowsAPICodePack.Dialogs.TaskDialog();
                 td.Caption = "Files not valid";
                 td.Text = "The selected path doesn't contain a valid USB backup/dump.";
                 td.InstructionText = "Files Not Valid";
                 td.Icon = TaskDialogStandardIcon.Error;
                 td.ShowDialog(this.Handle);
             }
             else
             {
                 MessageBox.Show("The selected path doesn't contain a valid USB backup/dump.", "Files Not Valid", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             if (Drive != null)
             {
                 Drive.Close();
             }
             Drive = d;
             LoadDrive();
         }
     }
 }
コード例 #7
0
 void listView1_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
         if (Drive != null)
         {
             if (!quickAddMode.Checked)
             {
                 Folder f = (Folder)treeView1.SelectedNode.Tag;
                 Forms.EntryAction ea = new Forms.EntryAction(files, f, Party_Buffalo.Forms.EntryAction.Method.Inject);
                 ea.ShowDialog(this);
             }
             else
             {
                 Forms.EntryAction ea = new Forms.EntryAction(files, Drive, Party_Buffalo.Forms.EntryAction.Method.Inject);
                 ea.ShowDialog(this);
             }
         }
         else if (!(VariousFunctions.IsFolder(files[0])) && files.Length == 1)
         {
             Drive d = new Drive(files[0]);
             if (d.IsFATXDrive())
             {
                 if (Drive != null)
                 {
                     Drive.Close();
                 }
                 Drive = d;
                 LoadDrive();
             }
         }
     }
     else if (e.Data.GetDataPresent(typeof(ListViewItem)))
     {
         return;
     }
 }
コード例 #8
0
 /// <summary>
 /// Provides partition/FAT information
 /// </summary>
 public PartitionFunctions(Entry entry)
 {
     FATXDrive = (Drive)entry.Drive;
     Partition = entry.PartitionInfo;
     //ProcessBootSector();
 }
コード例 #9
0
 public PartitionFunctions(Drive Drive, Geometry.DevOffsets p)
 {
     FATXDrive = Drive;
     Partition.Name = p.ToString();
     Partition.Offset = (long)p;
     ProcessBootSector();
 }
コード例 #10
0
 public PartitionFunctions(Drive Drive, long partitionOffset, long partitionSize)
 {
     FATXDrive = Drive;
     Partition.Name = "Root";
     Partition.Offset = partitionOffset;
     Partition.Size = partitionSize;
     ProcessBootSector();
 }
コード例 #11
0
 /// <summary>
 /// Provides partition/FAT information
 /// </summary>
 public PartitionFunctions(Drive Drive, Folder partition)
 {
     FATXDrive = Drive;
     Partition = partition.PartitionInfo;
     ProcessBootSector();
 }
コード例 #12
0
 /// <summary>
 /// Provides partition/FAT information
 /// </summary>
 public PartitionFunctions(Entry entry)
 {
     FATXDrive = (Drive)entry.Drive;
     Partition = entry.PartitionInfo;
     //ProcessBootSector();
 }
コード例 #13
0
 /// <summary>
 /// Provides partition/FAT information
 /// </summary>
 public PartitionFunctions(Drive Drive, Folder partition)
 {
     FATXDrive = Drive;
     Partition = partition.PartitionInfo;
     ProcessBootSector();
 }
コード例 #14
0
ファイル: EntryTypes.cs プロジェクト: 709881059/party-buffalo
 public File(PartitionInfo Partition, EntryData EntryData, Drive Drive)
     : base(Partition, EntryData, Drive)
 {
 }
コード例 #15
0
ファイル: EntryTypes.cs プロジェクト: 709881059/party-buffalo
 public Entry(PartitionInfo Partition, EntryData EntryData, Drive Drive)
 {
     this.PartitionInfo = Partition;
     this.Drive = Drive;
     this.EntryData = EntryData;
 }
コード例 #16
0
ファイル: EntryTypes.cs プロジェクト: 709881059/party-buffalo
 /// <summary>
 /// Default constructor for the folder class
 /// </summary>
 /// <param name="Partition">Partition information to which this folder belongs to</param>
 /// <param name="EntryData">The entry data for this folder</param>
 /// <param name="Drive">Drive which this folder belongs to</param>
 public Folder(PartitionInfo Partition, EntryData EntryData, Drive Drive)
     : base(Partition, EntryData, Drive)
 {
     ReturnDeletedEntries = false;
 }