public FATXEntry(FATXEntry parent, ref FATXEntry xEntry) { this.Parent = parent; //Debug.WriteLine("fatx entry ref"); xOffset = xEntry.xOffset; xNLen = xEntry.xNLen; xName = xEntry.xName; xStartBlock = xEntry.xStartBlock; xSize = xEntry.xSize; xT1 = xEntry.xT1; xT2 = xEntry.xT2; xT3 = xEntry.xT3; xIsValid = xEntry.xIsValid; xIsFolder = xEntry.IsFolder; xPart = xEntry.xPart; xDrive = xEntry.xDrive; fatType = xEntry.fatType; this.xPart = xEntry.xPart; this.FatEntry = xEntry.FatEntry; }
public FATXEntry(FATXType fatType, long Pos, byte[] xData, ref FATXDrive xdrive) { FatEntry = new FATXEntry64(xData); this.fatType = fatType; this.xDrive = xdrive; this.xIsFolder = FatEntry.Attribute != 0xFF && ((FatEntry.Attribute & 0x10) == 0x10); this.xName = FatEntry.FileNameStr; this.xNLen = FatEntry.FileNameSize; this.xStartBlock = FatEntry.FirstCluster; this.xSize = FatEntry.FileSize; this.xT1 = FatEntry.ModDate; this.xT2 = FatEntry.CreateDate; this.xT3 = FatEntry.AccessedDate; this.fatType = fatType; xDrive = xdrive; xOffset = Pos; xIsValid = this.FatEntry.IsValid; /* 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 (fatType == FATXType.FATX32) { if (xStartBlock == Constants.FATX32End) return; }else if (fatType == FATXType.FATX16) { if (xStartBlock == Constants.FATX16End) 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; }*/ }
public static FATXEntry64 Read(byte[] b) { var ret = new FATXEntry64(); if (b == null || b.Length < 64) return ret; ret.originalData = b; ret.FileNameSize = b[0]; ret.Attribute = b[1]; fixed (byte* p = b) { for (int x = 0; x < 42; x++) { ret.FileName[x] = b[2 + x]; } ret.FirstCluster = BitConv.ToUInt32(p, 44, true); ret.FileSize = BitConv.ToInt32(p, 48, true); ret.ModDate = BitConv.ToInt32(p, 52, true); ret.CreateDate = BitConv.ToInt32(p, 56, true); ret.AccessedDate = BitConv.ToInt32(p, 60, true); } return ret; }