public Project(string filename) { p_Filename = filename; //perform restore (if needed) Helpers.Restore(filename); //open the file FileStream fileStream = new FileStream(filename, FileMode.Open); //read the header p_Header = new header(); p_Header.load(fileStream, this); //read the project name p_ProjectName = Helpers.ReadString255(fileStream); //read the build directory p_BuildDirectory = Helpers.ReadString(fileStream); //read the directories int directoryLength = Helpers.DecodeInt32(fileStream); p_Directories = new ProjectEntity[directoryLength]; for (int c = 0; c < directoryLength; c++) { p_Directories[c] = new ProjectDirectory(null, this); p_Directories[c].Load(fileStream); } //read the files int fileLength = Helpers.DecodeInt32(fileStream); p_Files = new ProjectEntity[fileLength]; for (int c = 0; c < fileLength; c++) { p_Files[c] = new ProjectFile(null, this); p_Files[c].Load(fileStream); } //clean up fileStream.Close(); }