private void ReadSuppliers(byte[] fiPath_, byte[] flPath_) { //filesList filesList = MakiExtended.ConvertBufferToStringArray(flPath_, Encoding.UTF8).Select(x => x.ToLower().TrimEnd()).ToArray(); uint fsIndex = 0; FsFileLength = new List <uint>(); for (int i = 0; i < filesList.Length; i++) { if (string.IsNullOrWhiteSpace(filesList[i])) { continue; } FSarch.Add(filesList[i], new FI() { Entry = (uint)i, LengthOfUnpackedFile = BitConverter.ToUInt32(fiPath_, (int)fsIndex), LocationInFS = BitConverter.ToUInt32(fiPath_, (int)fsIndex + 4), LZSS = BitConverter.ToUInt32(fiPath_, (int)fsIndex + 8) }); fsIndex += 12; FsFileLength.Add(BitConverter.ToUInt32(fsBuffer, (int)FSarch.Last().Value.LocationInFS) + 4); } }
private void openFieldfsToolStripMenuItem_Click(object sender, EventArgs e) { fs = new FS(); if (fs.FSarch.Count < 1) { toolStripStatusLabel1.Text = "Bad field.fs"; return; } //string[] FsFiles = fs.GetFileList().Select(x => MakiExtended.getFilename_dirty(x).EndsWith(".fs",StringComparison.CurrentCulture)).ToArray(); List <string> FsFiles = (from a in fs.GetFileList() where a.EndsWith(".fs") select MakiExtended.getFilename_dirty_withoutExtension(a)).ToList(); FS mapData = fs.GetArchive(fs.FindFile("mapdata.fs")); string[] maplistFileList = MakiExtended.ConvertBufferToStringArray(mapData.GetFile(mapData.FindFile("maplist")), Encoding.UTF8); for (int i = 0; i < FsFiles.Count; i++) { if (!maplistFileList.Contains(FsFiles[i])) { FsFiles.RemoveAt(FsFiles.IndexOf(FsFiles[i])); i--; } } listBox1.DataSource = FsFiles; toolStripStatusLabel1.Text = $"FS ready at : {listBox1.Items.Count} entries"; }
unsafe public CharaOne(byte[] buffer) { this.buffer = buffer; int bitIndex = 0; characterEntries = BitConverter.ToUInt16(buffer, 0); if (buffer[3] != 0 || buffer[2] != 0) { return; } if (buffer[0] == 0) { return; } bitIndex += 4; charEntries = new CharEntry[characterEntries]; for (int i = 0; i < characterEntries; i++) { charEntries[i].Header = new CharHeader() { Offset = BitConverter.ToUInt32(buffer, bitIndex), Length = BitConverter.ToUInt32(buffer, bitIndex + 4), Length2 = BitConverter.ToUInt32(buffer, bitIndex + 8), CharacterID = BitConverter.ToUInt16(buffer, bitIndex + 12), CharacterFlag = BitConverter.ToUInt16(buffer, bitIndex + 14), TypeMark = BitConverter.ToUInt32(buffer, bitIndex + 16) }; bitIndex += sizeof(CharHeader); int typeMark = (int)charEntries[i].Header.TypeMark; if (typeMark == -1) { //is pet charEntries[i].Char = new CharPO() { Unk = BitConverter.ToUInt32(buffer, bitIndex), Name = MakiExtended.GetStringRawBuffer(buffer, bitIndex + 4, 4).ToCharArray(), Unk2 = BitConverter.ToUInt32(buffer, bitIndex + 8), Unk3 = BitConverter.ToUInt32(buffer, bitIndex + 12) }; bitIndex += 16; } else if (typeMark == 0) { charEntries[i].Char = new CharD() { Name = MakiExtended.GetStringRawBuffer(buffer, bitIndex, 4).ToCharArray(), Unk = BitConverter.ToUInt32(buffer, bitIndex + 8), Unk2 = BitConverter.ToUInt32(buffer, bitIndex + 12) }; bitIndex += 12; } else { //is pet charEntries[i].Char = new CharPO() { Unk = BitConverter.ToUInt32(buffer, bitIndex + 4), Name = MakiExtended.GetStringRawBuffer(buffer, bitIndex + 8, 4).ToCharArray(), Unk2 = BitConverter.ToUInt32(buffer, bitIndex + 12), Unk3 = BitConverter.ToUInt32(buffer, bitIndex + 16) }; bitIndex += 24; } } string[] Dcollection = charEntries.Where(x => x.Char.GetType() == typeof(CharD)).Select(x => new string(((CharD)x.Char).Name)).OrderBy(x => x).ToArray(); //.OrderBy(x => x.Name).ToArray(); string[] POcollection = charEntries.Where(x => x.Char.GetType() == typeof(CharPO)).Select(x => new string(((CharPO)x.Char).Name)).OrderBy(x => x).ToArray(); //.OrderBy(x => x.Name).ToArray(); GetNames = Dcollection.Concat(POcollection).ToArray(); }