public static void Save_To_XML(string filename, List <LevelEditorObject> list) { root MainObject = null; rootObject[] Objects = null; int cnt = 0; MainObject = new root(); Objects = new rootObject[list.Count]; foreach (LevelEditorObject le in list) { rootObject tmp = new rootObject(); tmp.X = le.x; tmp.Y = le.y; tmp.OName = le.name; tmp.Int1 = le.ParamInt[0]; tmp.Int2 = le.ParamInt[1]; tmp.Int3 = le.ParamInt[2]; tmp.Bool1 = le.Parambool[0]; tmp.Bool2 = le.Parambool[1]; tmp.Bool3 = le.Parambool[2]; Objects[cnt++] = tmp; } MainObject.Object = Objects; StreamWriter SW = new StreamWriter(filename); XmlSerializer xSer = new XmlSerializer(typeof(root)); xSer.Serialize(SW, MainObject); SW.Close(); }
public static void Save_To_XML(string filename,List<LevelEditorObject> list) { root MainObject = null; rootObject[] Objects = null; int cnt = 0; MainObject = new root(); Objects = new rootObject[list.Count]; foreach (LevelEditorObject le in list) { rootObject tmp = new rootObject(); tmp.X = le.x; tmp.Y = le.y; tmp.OName = le.name; tmp.Int1 = le.ParamInt[0]; tmp.Int2 = le.ParamInt[1]; tmp.Int3 = le.ParamInt[2]; tmp.Bool1 = le.Parambool[0]; tmp.Bool2 = le.Parambool[1]; tmp.Bool3 = le.Parambool[2]; Objects[cnt++] = tmp; } MainObject.Object = Objects; StreamWriter SW = new StreamWriter(filename); XmlSerializer xSer = new XmlSerializer(typeof(root)); xSer.Serialize(SW, MainObject); SW.Close(); }