internal bool xExtract(string OutLocation, bool SubItems) { if (OutLocation == null || OutLocation == "") { return(false); } OutLocation = OutLocation.xExtractLegitPath(); if (!VariousFunctions.xCheckDirectory(OutLocation)) { return(false); } GDFContents xConts = xRead(); foreach (GDFFile x in xConts.Files) { DJsIO y = new DJsIO(true); try { if (x.xExtract(y)) { y.Close(); VariousFunctions.MoveFile(y.FileNameLong, OutLocation + "/" + x.Name); } } catch { y.Close(); } VariousFunctions.DeleteFile(y.FileNameLong); } foreach (GDFFolder x in xConts.xFolders) { try { x.xExtract(OutLocation + "/" + x.Name, SubItems); } catch { } } return(true); }
/// <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> /// Reads the folder /// </summary> /// <returns></returns> public GDFContents Read() { if (!xref.ActiveCheck()) { return(new GDFContents()); } GDFContents xReturn = xRead(); xref.xActive = false; return(xReturn); }
internal GDFContents ReadFolder(uint xBlock, int size) { List <GDFEntry> xents = new List <GDFEntry>(); List <ushort> numz = new List <ushort>(new ushort[] { 0 }); long offset = GenerateDataOffset(xBlock); long barrier = offset + size; for (int i = 0; i < numz.Count; i++) { long pos = (offset + (4 * numz[i])); if (pos > barrier) { continue; } xIO.Position = pos; ushort num = xIO.ReadUInt16(false); if (!numz.Contains(num)) { numz.Add(num); } num = xIO.ReadUInt16(false); if (!numz.Contains(num)) { numz.Add(num); } try { xents.Add(new GDFEntry(this)); } catch { } } GDFContents xReturn = new GDFContents(); foreach (GDFEntry x in xents) { if ((x.EntryAttributes & GDFAttributes.Directory) == GDFAttributes.Directory) { xReturn.xFolders.Add(new GDFFolder(x)); } else { xReturn.xFiles.Add(new GDFFile(x)); } } return(xReturn); }
internal GDFContents ReadFolder(uint xBlock, int size) { List<GDFEntry> xents = new List<GDFEntry>(); List<ushort> numz = new List<ushort>(new ushort[] { 0 }); long offset = GenerateDataOffset(xBlock); long barrier = offset + size; for (int i = 0; i < numz.Count; i++) { long pos = (offset + (4 * numz[i])); if (pos > barrier) continue; xIO.Position = pos; ushort num = xIO.ReadUInt16(false); if (!numz.Contains(num)) numz.Add(num); num = xIO.ReadUInt16(false); if (!numz.Contains(num)) numz.Add(num); try { xents.Add(new GDFEntry(this)); } catch { } } GDFContents xReturn = new GDFContents(); foreach (GDFEntry x in xents) { if ((x.EntryAttributes & GDFAttributes.Directory) == GDFAttributes.Directory) xReturn.xFolders.Add(new GDFFolder(x)); else xReturn.xFiles.Add(new GDFFile(x)); } return xReturn; }