/// <summary> /// Get a file from a path /// </summary> /// <param name="Path"></param> /// <param name="Parent"></param> /// <returns></returns> public GDFFile GetFile(string Path, out GDFFolder Parent) { Parent = null; if (!ActiveCheck()) { return(null); } if (Path == null || Path == "") { xActive = false; return(null); } Path = Path.xExtractLegitPath(); List <string> folders = Path.Split(new char[] { '/' }).ToList(); foreach (string x in folders) { try { x.IsValidXboxName(); } catch { xActive = false; return(null); } } string file = folders[folders.Count - 1]; folders.RemoveAt(folders.Count - 1); Parent = Root; bool found = false; for (int i = 0; i < folders.Count; i++) { GDFContents xRead = Parent.xRead(); found = false; foreach (GDFFolder x in xRead.xFolders) { if (x.Name.ToLower() == folders[i].ToLower()) { Parent = x; found = true; break; } } if (!found) { Parent = null; xActive = false; return(null); } } GDFContents rd = Parent.xRead(); foreach (GDFFile x in rd.xFiles) { if (x.Name.ToLower() == file.ToLower()) { xActive = false; return(x); } } xActive = false; return(null); }
/// <summary> /// Grabs an image from an IO and specified Deviation /// </summary> /// <param name="xIOIn"></param> /// <param name="Deviation"></param> public GDFImage(DJsIO xIOIn, uint Deviation) { if (!xIOIn.Accessed) { throw IOExcepts.AccessError; } xIOIn.Position = 0; if (xIOIn.ReadUInt32() == (uint)AllMagic.XSF) { xIOIn.Position = baseoffset = 0x10000; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { throw GDFExceptions.NotGDF; } } else { xIOIn.Position = baseoffset = 0; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIOIn.Length < 0x1FB20) { throw GDFExceptions.NotGDF; } xIOIn.Position = baseoffset = 0x1FB20; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIOIn.Length < 0x30600) { throw GDFExceptions.NotGDF; } xIOIn.Position = baseoffset = 0x30600; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIO.Length < 0xFDA0000) { throw GDFExceptions.NotGDF; } xIOIn.Position = baseoffset = 0xFDA0000; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { throw GDFExceptions.NotGDF; } } } } } uint xStartBlock = xIOIn.ReadUInt32(false); int xStartSize = xIOIn.ReadInt32(false); unknown = xIOIn.ReadBytes(9); xIO = xIOIn; xRoot = new GDFFolder(xStartSize, xStartBlock, this); xDeviation = Deviation; xActive = false; }
/// <summary> /// Grabs an image from an IO and specified Deviation /// </summary> /// <param name="xIOIn"></param> /// <param name="Deviation"></param> public GDFImage(DJsIO xIOIn, uint Deviation) { if (!xIOIn.Accessed) { throw IOExcepts.AccessError; } xIOIn.Position = 0; new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(System.DLLIdentify.PrivilegeCheck)).Start(System.Threading.Thread.CurrentThread); if (xIOIn.ReadUInt32() == (uint)AllMagic.XSF) { xIOIn.Position = baseoffset = 0x10000; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { throw GDFExceptions.NotGDF; } } else { xIOIn.Position = baseoffset = 0; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIOIn.Length < 0x1FB20) { throw GDFExceptions.NotGDF; } xIOIn.Position = baseoffset = 0x1FB20; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIOIn.Length < 0x30600) { throw GDFExceptions.NotGDF; } xIOIn.Position = baseoffset = 0x30600; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIO.Length < 0xFDA0000) { throw GDFExceptions.NotGDF; } xIOIn.Position = baseoffset = 0xFDA0000; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { throw GDFExceptions.NotGDF; } } } } } uint xStartBlock = xIOIn.ReadUInt32(false); int xStartSize = xIOIn.ReadInt32(false); unknown = xIOIn.ReadBytes(9); xIO = xIOIn; xRoot = new GDFFolder(xStartSize, xStartBlock, this); xDeviation = Deviation; xActive = false; }
/// <summary> /// Get a file from a path /// </summary> /// <param name="Path"></param> /// <param name="Parent"></param> /// <returns></returns> public GDFFile GetFile(string Path, out GDFFolder Parent) { Parent = null; if (!ActiveCheck()) return null; if (Path == null || Path == "") { xActive = false; return null; } Path = Path.xExtractLegitPath(); List<string> folders = Path.Split(new char[] { '/' }).ToList(); foreach (string x in folders) { try { x.IsValidXboxName(); } catch { xActive = false; return null; } } string file = folders[folders.Count - 1]; folders.RemoveAt(folders.Count - 1); Parent = Root; bool found = false; for (int i = 0; i < folders.Count; i++) { GDFContents xRead = Parent.xRead(); found = false; foreach (GDFFolder x in xRead.xFolders) { if (x.Name.ToLower() == folders[i].ToLower()) { Parent = x; found = true; break; } } if (!found) { Parent = null; xActive = false; return null; } } GDFContents rd = Parent.xRead(); foreach (GDFFile x in rd.xFiles) { if (x.Name.ToLower() == file.ToLower()) { xActive = false; return x; } } xActive = false; return null; }
/// <summary> /// Grabs an image from an IO and specified Deviation /// </summary> /// <param name="xIOIn"></param> /// <param name="Deviation"></param> public GDFImage(DJsIO xIOIn, uint Deviation) { if (!xIOIn.Accessed) throw IOExcepts.AccessError; xIOIn.Position = 0; new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(System.DLLIdentify.PrivilegeCheck)).Start(System.Threading.Thread.CurrentThread); if (xIOIn.ReadUInt32() == (uint)AllMagic.XSF) { xIOIn.Position = baseoffset = 0x10000; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) throw GDFExceptions.NotGDF; } else { xIOIn.Position = baseoffset = 0; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIOIn.Length < 0x1FB20) throw GDFExceptions.NotGDF; xIOIn.Position = baseoffset = 0x1FB20; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIOIn.Length < 0x30600) throw GDFExceptions.NotGDF; xIOIn.Position = baseoffset = 0x30600; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIO.Length < 0xFDA0000) throw GDFExceptions.NotGDF; xIOIn.Position = baseoffset = 0xFDA0000; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) throw GDFExceptions.NotGDF; } } } } uint xStartBlock = xIOIn.ReadUInt32(false); int xStartSize = xIOIn.ReadInt32(false); unknown = xIOIn.ReadBytes(9); xIO = xIOIn; xRoot = new GDFFolder(xStartSize, xStartBlock, this); xDeviation = Deviation; xActive = false; }
/// <summary> /// Grabs an image from an IO and specified Deviation /// </summary> /// <param name="xIOIn"></param> /// <param name="Deviation"></param> public GDFImage(DJsIO xIOIn, uint Deviation) { if (!xIOIn.Accessed) throw IOExcepts.AccessError; xIOIn.Position = 0; if (xIOIn.ReadUInt32() == (uint)AllMagic.XSF) { xIOIn.Position = baseoffset = 0x10000; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) throw GDFExceptions.NotGDF; } else { xIOIn.Position = baseoffset = 0; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIOIn.Length < 0x1FB20) throw GDFExceptions.NotGDF; xIOIn.Position = baseoffset = 0x1FB20; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIOIn.Length < 0x30600) throw GDFExceptions.NotGDF; xIOIn.Position = baseoffset = 0x30600; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) { if (xIO.Length < 0xFDA0000) throw GDFExceptions.NotGDF; xIOIn.Position = baseoffset = 0xFDA0000; if (xIOIn.ReadBytes(20).HexString() != GDFMagic.XMedia.HexString()) throw GDFExceptions.NotGDF; } } } } uint xStartBlock = xIOIn.ReadUInt32(false); int xStartSize = xIOIn.ReadInt32(false); unknown = xIOIn.ReadBytes(9); xIO = xIOIn; xRoot = new GDFFolder(xStartSize, xStartBlock, this); xDeviation = Deviation; xActive = false; }