private RentTable rentTable; //教室使用情况 #endregion Fields #region Constructors public Classroom(int id, string name, Building building, RentTable rentTable = null) { this.cid = id; this.name = name; this.building = building; this.rentTable = rentTable; }
public static void Initialize() { if (initialized) return; Stream fs; StreamReader srIn; string line; Building currentBuilding = null; try { fs = new MemoryStream(Encoding.UTF8.GetBytes(Properties.Resources.ClassroomList)); //new FileStream("ClassroomList.txt", FileMode.Open); srIn = new StreamReader(fs, Encoding.UTF8); line = srIn.ReadLine(); while (line != null) { string[] str = line.Split('\t'); if (str[0].Length == 2) { currentBuilding = new Building(int.Parse(str[0]), str[1]); AllBuildings.Add(currentBuilding); } else if (str[0].Length == 5) { if (null != currentBuilding) currentBuilding.classrooms.Add(new Classroom(int.Parse(str[0]), str[1], currentBuilding)); } line = srIn.ReadLine(); } } catch { Console.WriteLine("ERROR in Building Initialize"); } initialized = true; }