Example #1
0
 private void addFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog ofd = new OpenFileDialog();
     ofd.Multiselect = true;
     ofd.Title = "Open Xbox Live Packages";
     ofd.Filter = "";
     if (ofd.ShowDialog() != DialogResult.OK)
         return;
     menuStrip1.Enabled = groupPanel1.Enabled = listBox1.Enabled = false;
     progressBarX1.Value = 0;
     progressBarX1.Maximum = ofd.FileNames.Length;
     foreach (string x in ofd.FileNames)
     {
         DJsIO y = null;
         try { y = new DJsIO(x, DJFileMode.Open, true); }
         catch { progressBarX1.Value++; continue; }
         if (!y.Accessed)
         {
             progressBarX1.Value++;
             continue;
         }
         y.Position = 0;
         if (y.ReadUInt32() == (uint)AllMagic.CON)
             listBox1.Items.Add(x);
         y.Dispose();
         if (checkBoxX3.Checked)
             fix(listBox1.Items.Count - 1);
         progressBarX1.Value++;
     }
     menuStrip1.Enabled = groupPanel1.Enabled = listBox1.Enabled = true;
 }
        internal Package(STFSPackage pk, bool readData = true, DJsIO dj = null)
        {
            this.package = pk;
            this.dj = dj;

            ReadData(readData, this);
        }
 /// <summary>
 /// Initializes this object
 /// </summary>
 /// <param name="FileLocale"></param>
 public MusicFile(string FileLocale)
 {
     xActive = true;
     DJsIO xIO = new DJsIO(FileLocale, DJFileMode.Open, true);
     if (!xIO.Accessed)
         throw STFSExcepts.ParseError;
     try
     {
         xIO.Position = 0;
         xIO.IsBigEndian = true;
         if (xIO.ReadUInt32() != 0x464D494D)
             throw MusicExcepts.NotMusic;
         xIO.Position = 0xC;
         so = xIO.ReadString(StringForm.Unicode, 0x100);
         al = xIO.ReadString(StringForm.Unicode, 0x100);
         ar = xIO.ReadString(StringForm.Unicode, 0x100);
         xIO.Position += 0x200;
         ge = xIO.ReadString(StringForm.Unicode, 0x100);
         IO = xIO;
         xActive = false;
     }
     catch { xIO.Dispose(); throw STFSExcepts.ParseError; }
 }
Example #4
0
 private void listView1_DragDrop(object sender, DragEventArgs e)
 {
     List<string> xData = new List<string>((string[])e.Data.GetData(DataFormats.FileDrop));
     List<DJsIO> xIO = new List<DJsIO>();
     for (int i = 0; i < xData.Count; i++)
     {
         DJsIO blah = new DJsIO(xData[i], DJFileMode.Open, true);
         if (blah.Accessed)
             xIO.Add(blah);
     }
     if (xIO.Count == 0)
         return;
     if (MessageBox.Show("Are you sure you want to add " + ((xIO.Count == 1) ? "this accessed file?" : ("these " + xIO.Count.ToString() + " accessed files?")), "Rawr?", MessageBoxButtons.YesNo) != DialogResult.Yes)
         return;
     foreach (DJsIO x in xIO)
         xPackage.MakeFile(x.FileNameShort, x, ((FolderEntry)advTree1.SelectedNode.DataKey).EntryID, AddType.NoOverWrite);
     xReturn_NodeClick(advTree1.SelectedNode, null);
 }
Example #5
0
 private void addFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DJsIO x = new DJsIO(DJFileMode.Open, "Open", "", true);
     if (!x.Accessed)
         return;
     Renamer rename = new Renamer(x.FileNameShort, true);
     if (rename.ShowDialog() != DialogResult.OK)
     {
         x.Close();
         return;
     }
     xPackage.MakeFile(rename.FileName, x, ((FolderEntry)advTree1.SelectedNode.DataKey).EntryID, AddType.NoOverWrite);
     Log("Done adding");
 }
Example #6
0
 /// <summary>
 /// Runs a Kerberos implemented RC4 decryption
 /// </summary>
 /// <param name="xConfounder">The confounder input</param>
 /// <param name="xPayload">The payload input</param>
 /// <param name="x">RC4 reference</param>
 /// <param name="xData">Data to be decrypted</param>
 /// <param name="xConLen">Length of the Confounder</param>
 /// <returns></returns>
 public static bool KerberosDecrypt(this RC4 x, byte[] xData, out byte[] xConfounder, int xConLen, out byte[] xPayload)
 {
     xPayload = new byte[0];
     xConfounder = new byte[0];
     try
     {
         DJsIO xOut = new DJsIO(x.RunAlgorithm(xData), true);
         xOut.Position = 0;
         xConfounder = xOut.ReadBytes(xConLen);
         xPayload = xOut.ReadBytes(xData.Length - xConLen);
         xOut.Dispose();
     }
     catch { return false; }
     return true;
 }
Example #7
0
 bool xExtract(string xOut, bool Sub)
 {
     if (!VariousFunctions.xCheckDirectory(xOut))
         return false;
     FATXReadContents xread = xRead();
     if (xread == null)
         return false;
     foreach (FATXFileEntry x in xread.Files)
     {
         DJsIO xIOOut = new DJsIO(xOut + "/" + x.Name, DJFileMode.Create, true);
         if (!xIOOut.Accessed)
             continue;
         x.xExtract(ref xIOOut);
         xIOOut.Dispose();
     }
     if (!Sub)
         return true;
     foreach (FATXFolderEntry x in xread.Folders)
         x.xExtract(xOut + "/" + x.Name, Sub);
     return true;
 }
Example #8
0
 /// <summary>
 /// Adds a file
 /// </summary>
 /// <param name="FileName"></param>
 /// <param name="FileLocation"></param>
 /// <param name="xType"></param>
 /// <returns></returns>
 public bool AddFile(string FileName, string FileLocation, AddType xType)
 {
     FileName.IsValidXboxName();
     if (xDrive.ActiveCheck())
         return false;
     DJsIO xIOIn = null;
     try { xIOIn = new DJsIO(FileLocation, DJFileMode.Open, true); }
     catch { return (xDrive.xActive = false); }
     try
     {
         FATXReadContents xconts = xRead();
         foreach (FATXFileEntry x in xconts.xfiles)
         {
             if (x.Name == FileName)
             {
                 bool xreturn = false;
                 if (xType == AddType.NoOverWrite)
                      return (xDrive.xActive = false);
                 else if (xType == AddType.Inject)
                     xreturn = x.xInject(xIOIn);
                 else xreturn = x.xReplace(xIOIn);
                 return (xreturn & !(xDrive.xActive = false));
             }
         }
         uint xnew = 0;
         long xpos = GetNewEntryPos(out xnew);
         if (xpos == -1)
             return (xDrive.xActive = false);
         uint[] blocks = Partition.xTable.GetNewBlockChain(xIOIn.BlockCountFATX(Partition), xnew + 1);
         if (blocks.Length == 0)
             return (xDrive.xActive = false);
         if (!Partition.WriteFile(blocks, ref xIOIn))
             return (xDrive.xActive = false);
         FATXEntry y = new FATXEntry(FileName, blocks[0], (int)xIOIn.Length, xpos, false, ref xDrive);
         if (!y.xWriteEntry())
             return (xDrive.xActive = false);
         if (xnew > 0)
         {
             List<uint> fileblocks = new List<uint>(Partition.xTable.GetBlocks(xStartBlock));
             fileblocks.Add(xnew);
             uint[] xtemp = fileblocks.ToArray();
             if (!Partition.xTable.WriteChain(ref xtemp))
                 return (xDrive.xActive = false);
         }
         if (!Partition.xTable.WriteChain(ref blocks))
             return (xDrive.xActive = false);
         if (Partition.WriteAllocTable())
             return !(xDrive.xActive = false);
         return (xDrive.xActive = false);
     }
     catch { xIOIn.Close(); return (xDrive.xActive = false); }
 }
Example #9
0
 internal bool xInject(DJsIO xIOIn)
 {
     List<uint> blocks = new List<uint>(Partition.xTable.GetBlocks(xStartBlock));
     if (blocks.Count == 0)
         throw new Exception();
     uint xct = xIOIn.BlockCountFATX(Partition);
     if (blocks.Count < xct)
     {
         uint[] blocks2 = Partition.xTable.GetNewBlockChain((uint)(xct - blocks.Count), 1);
         if (blocks2.Length == 0)
             throw new Exception();
         blocks.AddRange(blocks2);
         uint[] x = blocks.ToArray();
         if (!Partition.xTable.WriteChain(ref x))
             throw new Exception();
     }
     else if (blocks.Count > xct)
     {
         uint[] xUnneeded = new uint[blocks.Count - xct];
         for (uint i = xct; i < blocks.Count; i++)
         {
             xUnneeded[(int)i] = i;
             blocks.RemoveAt((int)i--);
         }
         if (!Partition.xTable.DC(ref xUnneeded))
             throw new Exception();
     }
     xIOIn.Position = 0;
     xDrive.GetIO();
     foreach (uint i in blocks)
     {
         xDrive.xIO.Position = Partition.BlockToOffset(i);
         xDrive.xIO.Write(xIOIn.ReadBytes(Partition.xBlockSize));
     }
     if ((xSize == 0 || (uint)(((xSize - 1) / Partition.xBlockSize) + 1) != xct) &&
         !Partition.WriteAllocTable())
         throw new Exception();
     xSize = (int)xIOIn.Length;
     xIOIn.Close();
     return xWriteEntry();
 }
 bool extractimg(DJsIO xIOOut)
 {
     extthrd(xIOOut);
     //System.Threading.Thread x = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(extthrd));
     // x.Start(xIOOut);
     //while (x.IsAlive)
     //    System.Windows.Forms.Application.DoEvents();
     if (xactive)
         return (xactive = false);
     return (!xactive);
 }
 public void GetIO()
 {
     if (IsDriveIO && xType != DriveTypes.USBFlashDrive)
     {
         // Close previous handle
         if (xIO != null)
         {
             xIO.Close();
             // Make a new handle to a drive
             xIO.OpenAgain();
         }
         else
             xIO = new DriveIO(ref xDrive, true);
     }
     else if (xType == DriveTypes.USBFlashDrive && xIO == null || !xIO.Accessed)
     {
         List<string> files = new List<string>();
         for (int i = 0; i <= 9999; i++)
         {
             string file = xDrive.DeviceName + @"\Xbox360\Data" + i.ToString("000#");
             if (File.Exists(file))
                 files.Add(file);
             else
                 break;
         }
         xIO = new MultiFileIO(files.ToArray(), true);
     }
 }
 /// <summary>
 /// Extract a binary image of your FATX Drive
 /// </summary>
 /// <param name="xIOOut"></param>
 /// <returns></returns>
 public bool ExtractImage(DJsIO xIOOut)
 {
     if (ActiveCheck())
         return false;
     return extractimg(xIOOut);
 }
 /// <summary>
 /// Extracts the image via a file location
 /// </summary>
 /// <param name="fileOut"></param>
 /// <returns></returns>
 public bool ExtractImage(string fileOut)
 {
     if (ActiveCheck())
         return false;
     DJsIO xIOOut = null;
     try { xIOOut = new DJsIO(fileOut, DJFileMode.Create, true); }
     catch { return xactive = false; }
     if (!xIOOut.Accessed)
         return xactive = false;
     bool result = extractimg(xIOOut);
     xIOOut.Dispose();
     return result;
 }
 /// <summary>
 /// Read a FATX Image
 /// </summary>
 /// <param name="xImage"></param>
 public FATXDrive(DJsIO xImage)
 {
     if (xImage == null || !xImage.Accessed)
         return;
     if (!FATXManagement.IsFATX(ref xImage, out xType))
         throw new Exception("Drive is not FATX");
     xIO = xImage;
     LoadPartitions();
 }
 /// <summary>
 /// Load FATX from an Image
 /// </summary>
 /// <param name="FileLocale"></param>
 public FATXDrive(string FileLocale)
 {
     DJsIO xImage = new DJsIO(FileLocale, DJFileMode.Open, true);
     if (xImage == null || !xImage.Accessed)
         return;
     if (!FATXManagement.IsFATX(ref xImage, out xType))
         throw new Exception("Drive is not FATX");
     xactive = true;
     xIO = xImage;
     LoadPartitions();
 }
Example #16
0
 /// <summary>
 /// Replace the file
 /// </summary>
 /// <param name="FileIn"></param>
 /// <returns></returns>
 public bool Replace(string FileIn)
 {
     if (xDrive.ActiveCheck())
         return false;
     DJsIO xIOIn = null;
     try { xIOIn = new DJsIO(FileIn, DJFileMode.Open, true); }
     catch { return (xDrive.xActive = false); }
     if (xIOIn == null || !xIOIn.Accessed)
         return (xDrive.xActive = false);
     return xReplace(xIOIn) & !(xDrive.xActive = false);
 }
Example #17
0
 internal bool xExtract(ref DJsIO xIOOut)
 {
     try
     {
         xIOOut.Position = 0;
         uint[] xChain = Partition.xTable.GetBlocks(xStartBlock);
         uint xct = (uint)(((xSize - 1) / Partition.xBlockSize) + 1);
         if (xChain.Length < xct)
             return false;
         xDrive.GetIO();
         for (uint i = 0; i < xct - 1; i++)
         {
             xDrive.xIO.Position = Partition.BlockToOffset(xChain[(int)i]);
             xIOOut.Write(xDrive.xIO.ReadBytes(Partition.xBlockSize));
         }
         int xleft = (int)(((xSize - 1) % Partition.xBlockSize) + 1);
         xDrive.xIO.Position = Partition.BlockToOffset(xChain[(int)xct - 1]);
         xIOOut.Write(xDrive.xIO.ReadBytes(xleft));
         xIOOut.Flush();
         return true;
     }
     catch { return false; }
 }
        public bool AddFile(string FileName, byte[] fileData, AddType xType)
        {
            if (!VariousFunctions.IsValidXboxName(FileName))
                return false;

            if (xDrive.ActiveCheck())
                return false;

            DJsIO xIOIn = null;
            byte[] b = fileData;
            xIOIn = new DJsIO(b, true);

            try
            {
                FATXReadContents xconts = xRead();
                foreach (FATXFileEntry x in xconts.xfiles)
                {
                    if (string.Compare(x.Name, FileName, true) == 0)
                    {
                        bool xreturn = false;
                        if (xType == AddType.NoOverWrite)
                        {
                            xIOIn.Close();
                            return (xDrive.xActive = false);
                        }
                        else if (xType == AddType.Inject)
                        {
                            xreturn = x.xInject(xIOIn);
                        }
                        else
                        {
                            xreturn = x.xReplace(xIOIn);
                        }
                        xIOIn.Close();
                        return (xreturn & !(xDrive.xActive = false));
                    }
                }
                uint xnew = 0;
                long xpos = GetNewEntryPos(out xnew);
                if (xpos == -1)
                    return (xDrive.xActive = false);

                var count = xIOIn.BlockCountFATX(Partition);

                uint[] blocks = Partition.xTable.GetNewBlockChain(count, xnew + 1);

                if (blocks.Length == 0)
                    return (xDrive.xActive = false);

                if (!Partition.WriteFile(blocks, ref xIOIn))
                    return (xDrive.xActive = false);

                FATXEntry y = new FATXEntry(this,
                    FileName,
                    blocks[0], (int)xIOIn.Length,
                    xpos, false, ref xDrive);

                if (!y.xWriteEntry())
                    return (xDrive.xActive = false);

                if (xnew > 0)
                {
                    var filebx = Partition.xTable.GetBlocks(xStartBlock);
                    List<uint> fileblocks = new List<uint>(filebx);

                    fileblocks.Add(xnew);

                    uint[] xtemp = fileblocks.ToArray();

                    if (!Partition.xTable.WriteChain(ref xtemp))
                        return (xDrive.xActive = false);
                }

                if (!Partition.xTable.WriteChain(ref blocks))
                    return (xDrive.xActive = false);

                if (Partition.WriteAllocTable())
                    return !(xDrive.xActive = false);

                return (xDrive.xActive = false);
            }
            catch { xIOIn.Close(); return (xDrive.xActive = false); }
        }
Example #19
0
 internal bool xReplace(DJsIO xIOIn)
 {
     uint bu = xStartBlock;
     int size = xSize;
     try
     {
         uint[] curblocks = Partition.xTable.GetBlocks(xStartBlock);
         uint[] blocks = Partition.xTable.GetNewBlockChain(xIOIn.BlockCountFATX(Partition), 1);
         if (blocks.Length == 0)
             throw new Exception();
         if (!Partition.xTable.WriteChain(ref blocks))
             throw new Exception();
         if (!Partition.xTable.DC(ref curblocks))
             throw new Exception();
         xIOIn.Position = 0;
         xDrive.GetIO();
         if (!Partition.WriteFile(blocks, ref xIOIn))
             throw new Exception();
         if (!Partition.WriteAllocTable())
             throw new Exception();
         base.xStartBlock = blocks[0];
         base.xSize = (int)xIOIn.Length;
         xIOIn.Close();
         return xWriteEntry();
     }
     catch { xIOIn.Close(); base.xStartBlock = bu; base.xSize = size; return false; }
 }
        /* Note: Have plans for safer and better manipulation to prevent
         * minimal block loss to human error */
        /// <summary>
        /// Adds a folder
        /// </summary>
        /// <param name="FolderName"></param>
        /// <returns></returns>
        public bool AddFolder(string FolderName)
        {
            if (!VariousFunctions.IsValidXboxName(FolderName))
                return false;

            if (xDrive.ActiveCheck())
                return false;
            try
            {
                FATXReadContents xconts = xRead();
                if (xconts == null)
                    return false;
                foreach (FATXFolderEntry x in xconts.xfolds)
                {
                    if (string.Compare(x.Name , FolderName,true)==0)
                        return (xDrive.xActive = false);
                }

                var b = new byte[Partition.xBlockSize];
                for (int x = 0; x < 4; x++)
                    b[x] = 0x00;

                for (int x = 4; x < b.Length; x++)
                {
                    b[x] = 0xFF;
                }
                DJsIO xIOIn = new DJsIO(b, true);
                uint xnew = 0;
                long xpos = GetNewEntryPos(out xnew);
                if (xpos == -1)
                    return (xDrive.xActive = false);

                var blockCount = xIOIn.BlockCountFATX(Partition);
                var xnewIndex = xnew + 1;

                uint[] blocks = Partition.xTable.GetNewBlockChain(blockCount, xnewIndex);
                if (blocks.Length == 0)
                    return (xDrive.xActive = false);

                if (!Partition.WriteFile(blocks, ref xIOIn))
                    return (xDrive.xActive = false);

                FATXEntry y = new FATXEntry(this, FolderName, blocks[0],
                    (int)xIOIn.Length, xpos, true, ref xDrive);

                //y.FatEntry = new FATXEntry64(xData);

                y.SetAtts(this.Partition);
                if (!y.xWriteEntry())
                    return (xDrive.xActive = false);

                if (xnew > 0)
                {
                    var fileblocks = Partition.xTable.GetBlocks(xStartBlock).ToList();
                    fileblocks.Add(xnew);

                    uint[] xtemp = fileblocks.ToArray();

                    if (!Partition.xTable.WriteChain(ref xtemp))
                        return (xDrive.xActive = false);
                }

                if (!Partition.xTable.WriteChain(ref blocks))
                    return (xDrive.xActive = false);

                if (Partition.WriteAllocTable())
                    return !(xDrive.xActive = false);

                return (xDrive.xActive = false);
            }
            catch { return xDrive.xActive = false; }
        }
Example #21
0
 /* Note: Have plans for safer and better manipulation to prevent
  * minimal block loss to human error */
 /// <summary>
 /// Adds a folder
 /// </summary>
 /// <param name="FolderName"></param>
 /// <returns></returns>
 public bool AddFolder(string FolderName)
 {
     FolderName.IsValidXboxName();
     if (xDrive.ActiveCheck())
         return false;
     try
     {
         FATXReadContents xconts = xRead();
         foreach (FATXFolderEntry x in xconts.xfolds)
         {
             if (x.Name == FolderName)
                 return (xDrive.xActive = false);
         }
         DJsIO xIOIn = new DJsIO(new byte[Partition.xBlockSize], true);
         uint xnew = 0;
         long xpos = GetNewEntryPos(out xnew);
         if (xpos == -1)
             return (xDrive.xActive = false);
         uint[] blocks = Partition.xTable.GetNewBlockChain(xIOIn.BlockCountFATX(Partition), xnew + 1);
         if (blocks.Length == 0)
             return (xDrive.xActive = false);
         if (!Partition.WriteFile(blocks, ref xIOIn))
             return (xDrive.xActive = false);
         FATXEntry y = new FATXEntry(FolderName, blocks[0], (int)xIOIn.Length, xpos, true, ref xDrive);
         if (!y.xWriteEntry())
             return (xDrive.xActive = false);
         if (xnew > 0)
         {
             List<uint> fileblocks = new List<uint>(Partition.xTable.GetBlocks(xStartBlock));
             fileblocks.Add(xnew);
             uint[] xtemp = fileblocks.ToArray();
             if (!Partition.xTable.WriteChain(ref xtemp))
                 return (xDrive.xActive = false);
         }
         if (!Partition.xTable.WriteChain(ref blocks))
             return (xDrive.xActive = false);
         if (Partition.WriteAllocTable())
             return !(xDrive.xActive = false);
         return (xDrive.xActive = false);
     }
     catch { return xDrive.xActive = false; }
 }
        public byte[] xExtractBytes()
        {
            byte[] ret = null;

            var xIO = new DJsIO(true);
            try
            {
                if (xExtract(ref xIO))
                {
                    xIO.Position = 0;
                    ret = xIO.GetBytes();
                }
            }
            catch
            {
                ret = null;
            }
            xIO.Close();

            return ret;
        }
Example #23
0
 internal FATXEntry(long Pos, byte[] xData, ref FATXDrive xdrive)
 {
     xDrive = xdrive;
     xOffset = Pos;
     try
     {
         DJsIO xIO = new DJsIO(xData, true);
         xNLen = xIO.ReadByte();
         if (xNLen == 0xE5 || xNLen == 0xFF || xNLen == 0 || xNLen > 0x2A)
             return;
         byte xatt = (byte)((xIO.ReadByte() >> 4) & 1);
         byte xLen = (byte)(xNLen & 0x3F);
         xName = xIO.ReadString(StringForm.ASCII, xLen);
         xName.IsValidXboxName();
         xIO.Position = 0x2C;
         xStartBlock = xIO.ReadUInt32();
         if (xStartBlock == Constants.FATX32End)
             return;
         xSize = xIO.ReadInt32();
         xT1 = xIO.ReadInt32();
         xT2 = xIO.ReadInt32();
         xT3 = xIO.ReadInt32();
         if (xatt == 1)
             xIsFolder = true;
         else if (xSize == 0)
             return;
         xIsValid = true;
     }
     catch { xIsValid = false; }
 }
 /// <summary>
 /// Initializes from an IO
 /// </summary>
 /// <param name="x"></param>
 /// <param name="LogIn"></param>
 public ProfilePackage(ref DJsIO x, LogRecord LogIn)
     : base(x, LogIn)
 {
     if (Header.ThisType == PackageType.Profile)
         LoadProfile(true);
 }
Example #25
0
        /// <summary>
        /// Attempts to find the type of the file
        /// </summary>
        /// <param name="FileLocale"></param>
        /// <returns></returns>
        public static XboxFileType ReadFileType(string FileLocale)
        {
            /* ADD FATX SUPPORT */
            DJsIO xIO = new DJsIO(FileLocale, DJFileMode.Open, true);
            try
            {
                XboxFileType xReturn = XboxFileType.None;
                xIO.Position = 0;
                uint sig = xIO.ReadUInt32();
                switch (sig)
                {
                    case (uint)AllMagic.CON:
                    case (uint)AllMagic.LIVE:
                    case (uint)AllMagic.PIRS:
                        {
                            if (xIO.Length < 0x37C)
                                break;
                            xIO.Position = 0x379;
                            byte[] desc = xIO.ReadBytes(3);
                            if (desc[0] == 0x24 && desc[1] == 0 &&
                                (desc[2] == 0 || desc[2] == 1 || desc[2] == 2))
                                xReturn = XboxFileType.STFS;
                            else if (desc[0] == 0x24 && desc[1] == 5 &&
                                desc[2] == 5)
                                xReturn = XboxFileType.SVOD;
                        }
                        break;

                    case (uint)AllMagic.Music: { xReturn = XboxFileType.Music; } break;

                    case (uint)AllMagic.XDBF: { xReturn = XboxFileType.GPD; } break;

                    case 0:
                        {
                            if (xIO.Length < 0x130EB0004)
                                break;
                            xIO.Position = 0x130EB0000;
                            if (xIO.ReadUInt32() != (uint)AllMagic.FATX)
                                break;
                            xReturn = XboxFileType.FATX;
                        }
                        break;

                    case (uint)AllMagic.XSF: { xReturn = XboxFileType.GDF; } break;

                    default: break;
                }
                if (xReturn == XboxFileType.None)
                {
                    try
                    {
                        xIO.Position = 0;
                        if (xIO.ReadBytes(20).HexString() != GDFX.GDFMagic.XMedia.HexString())
                        {
                            xIO.Position = 0x1FB20;
                            if (xIO.ReadBytes(20).HexString() != GDFX.GDFMagic.XMedia.HexString())
                            {
                                xIO.Position = 0x30600;
                                if (xIO.ReadBytes(20).HexString() != GDFX.GDFMagic.XMedia.HexString())
                                {
                                    xIO.Position = 0x7FF000;
                                    if (xIO.ReadUInt32() != (uint)AllMagic.FATX)
                                    {
                                        xIO.Position = 0xFDA0000;
                                        if (xIO.ReadBytes(20).HexString() != GDFX.GDFMagic.XMedia.HexString())
                                        {
                                            xIO.Position = 0x130EB0000;
                                            if (xIO.ReadUInt32() == (uint)AllMagic.FATX)
                                                xReturn = XboxFileType.FATX;
                                        }
                                        else xReturn = XboxFileType.GDF;
                                    }
                                    else xReturn = XboxFileType.FATX;
                                }
                                else xReturn = XboxFileType.GDF;
                            }
                            else xReturn = XboxFileType.GDF;
                        }
                        else xReturn = XboxFileType.GDF;
                    }
                    catch { }
                }
                xIO.Dispose();
                return xReturn;
            }
            catch (Exception x) { xIO.Close(); throw x; }
        }
Example #26
0
 internal bool WriteFile(uint[] xChain, ref DJsIO xIOIn)
 {
     try
     {
         xdrive.GetIO();
         for (int i = 0; i < xChain.Length; i++)
         {
             xdrive.xIO.Position = BlockToOffset(xChain[i]);
             xIOIn.Position = (i * xBlockSize);
             xdrive.xIO.Write(xIOIn.ReadBytes(xBlockSize));
             xdrive.xIO.Flush();
         }
         return true;
     }
     catch { return false; }
 }
Example #27
0
 private void injectFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedIndices.Count == 0)
         return;
     FileEntry xent = (FileEntry)listView1.SelectedItems[0].Tag;
     DJsIO xio = new DJsIO(DJFileMode.Open, "Open a File", "", true);
     if (!xio.Accessed)
         return;
     Log("Injecting file...");
     if (!xent.Inject(xio))
     {
         Log("Error in injecting");
         return;
     }
     Log("Finished");
 }
Example #28
0
 public AllocationTable(DJsIO xIOIn, uint xCount, FATXType xType)
 {
     xAllocTable = xIOIn;
     BlockCount = xCount;
     PartitionType = xType;
 }
        public void importfromprofile()
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Title = "Open a xbox 360 profile";
            dialog.Filter = "Xbox 360 profile|*.*";
            DialogResult result = dialog.ShowDialog();
            if (result == DialogResult.OK) // Test result.
            {

                try
                {
                    DJsIO io = new DJsIO(dialog.FileName, DJFileMode.Open, true);


                    io.Position = 0x371;
                    this.Profileid = io.ReadHexString(8);
                    io.Close();

                    //xPackage3.STFS.Package sts = new xPackage3.STFS.Package(dialog.FileName);

                    STFSPackage stfs = new STFSPackage(dialog.FileName, null);
                    ProfilePackage xFile = new ProfilePackage(ref stfs);
                    string gamertag = xFile.UserFile.GetGamertag();
                    this.ProfileName = gamertag;
                    xFile.CloseIO();
                    stfs.CloseIO();
                    //this.Profileid = stfs.Header.Title_Package;
                }
                catch (Exception e) { }
            }
        }
Example #30
0
 /// <summary>
 /// Extract the file
 /// </summary>
 /// <param name="OutLocation"></param>
 /// <returns></returns>
 public bool Extract(string OutLocation)
 {
     if (xDrive.ActiveCheck())
         return false;
     bool xReturn = false;
     DJsIO xIO = new DJsIO(true);
     try
     {
         xReturn = xExtract(ref xIO);
         xIO.Close();
         if (xReturn)
             xReturn = VariousFunctions.MoveFile(xIO.FileNameLong, OutLocation);
     }
     catch
     {
         xIO.Close();
         xReturn = false;
     }
     VariousFunctions.DeleteFile(xIO.FileNameLong);
     xDrive.xActive = false;
     return xReturn;
 }