Beispiel #1
0
 public ObjectBuilder openTemplate(String filename)
 {
     Recent.newRecentFile(filename, filename);
     ObjectBuilder newOb = null;
     using (System.IO.Stream file = File.Open(filename, FileMode.Open))
     {
         using (System.IO.BinaryReader br = new System.IO.BinaryReader(file))
         {
             Version v = new Version();
             v.deserialize(br);
             newOb = new ObjectBuilder(Data);
             newOb.deserialize(br);
         }
     }
     return newOb;
 }
Beispiel #2
0
        public void loadTemplate(ProjectTemplateFile projectFile)
        {
            ObjectBuilder selected;
            if (isLoaded(projectFile, out selected))
            {
                Templates.Template = selected;
                return;
            }
            using (System.IO.Stream file = File.Open(projectFile.Name, FileMode.Open))
            {
                if (file != null)
                {
                    file.Position = 0;
                    System.IO.BinaryReader br = new System.IO.BinaryReader(file);
                    Version v = new Version();
                    v.deserialize(br);
                    ObjectBuilder newOb = m_templates.newTemplate("");
                    newOb.deserialize(br);
                    MainWindow mw = MainWindow as MainWindow;
                    mw.TemplateTab.SelectedIndex = m_templates.Templates.Count - 1;
                    selectObjectBuilder(mw.TemplateTab.SelectedIndex);

                    file.Close();
                }
            }
        }