Exemple #1
0
 public void SaveDatabase(string filename)
 {
     using (var stream = File.Create(filename))
     {
         StoredProgramFolder.Create(stream, this);
     }
 }
Exemple #2
0
        public static StoredProgramFolder Create(Stream stream, IProgramFolder source)
        {
            var result = new StoredProgramFolder();

            result.Create(stream);
            stream.WriteString(source.Name);
            var programs    = source.Programs.ToArray();
            var folders     = source.Folders.ToArray();
            var programData = StreamArray <StoredProgram> .Create(stream, programs.Length);

            var folderData = StreamArray <StoredProgramFolder> .Create(stream, folders.Length);

            programData.Value = programs.Select(p => StoredProgram.Create(stream, p)).ToArray();
            folderData.Value  = folders.Select(p => StoredProgramFolder.Create(stream, p)).ToArray();
            return(result);
        }