/// <summary> /// Save network to file /// </summary> /// <param name="filepath">full file path</param> public override void Save(string filepath) { FileStream stream = new FileStream(filepath, FileMode.Create, FileAccess.Write); BinaryWriter writer = new BinaryWriter(stream); try { ComponentIO.save_component(writer, this); } finally { writer.Close(); stream.Close(); } }
public override void Save(BinaryWriter writer) { Global.Debugf("iodetail", "<componentlist>"); // write start tag BinIO.string_write(writer, "<componentlist>"); // write array length BinIO.string_write(writer, data.Length().ToString()); // write components for (int i = 0; i < data.Length(); i++) { if (data[i] != null) { Global.Debugf("iodetail", " {0}", data[i].Name); } ComponentIO.save_component(writer, data[i]); } // write end tag BinIO.string_write(writer, "</componentlist>"); Global.Debugf("iodetail", "</componentlist>"); }
public override void Save(BinaryWriter writer) { ComponentIO.save_component(writer, data.GetComponent()); }