public static McdObject ReadMcdFromFile(string filename) { try { using (FileStream f = File.Open(filename, FileMode.Open)) { using (BinaryReader br = new BinaryReader(f)) { BinaryInputStream bs = new BinaryInputStream(br); bs.ReadInt32(0x434D4432); bs.ReadInt32(2); bs.ReadInt32(0); McdObject mcd = new McdObject(); mcd.Read(bs); return mcd; } } } catch { return null; } }
public void LinkRootFolder(string path) { this.root_folder = path; if (resources.Count != 1 || !(resources[0] is ActResourceChipObject)) { MessageBox.Show("unsupported resource type"); return; } string mcd_rel_path = ((ActResourceChipObject)resources[0]).properties.stChipFile; string mcd_path = Path.Combine(path, mcd_rel_path); McdObject mcd = McdFile.ReadMcdFromFile(mcd_path); if (mcd == null) { MessageBox.Show("can not open mcd file"); return; } this.mcd = mcd; this.bitmap_cache.Clear(); }