//public void Write(OStream s, uint version) //{ // if (version == VER_KFM_1_0) // { // // handle this case seperately // s += ";Gamebryo KFM File Version 1.0" + Environment.NewLine; // // TODO write the rest of the data // } // else // { // if (version == VER_KFM_1_2_4b) // s.Write(Encoding.ASCII.GetBytes(";Gamebryo KFM File Version 1.2.4b\n"), 0, 34); // else if (version == VER_KFM_2_0_0_0b) // s.Write(Encoding.ASCII.GetBytes(";Gamebryo KFM File Version 2.0.0.0b\n"), 0, 37); // else throw new Exception("Cannot write KFM file of this version."); // } //} // Reads the NIF file and all KF files referred to in this KFM, and returns the root object of the resulting NIF tree. public NiObject MergeActions(string path) { // Read NIF file var nif = Nif.ReadNifTree(path + '\\' + nif_filename); // Read Kf files var kf = new List <NiObject>(); foreach (var it in actions) { var action_filename = path + '\\' + it.action_filename; // Check if the file exists. // Probably we should check some other field in the Kfm file to determine this... var exists = File.Exists(action_filename); // Import it, if it exists. if (exists) { kf.Add(Nif.ReadNifTree(action_filename)); } } // TODO: merge everything into the nif file return(nif); }