Beispiel #1
0
        public void Init(HashTableSettings gSettings, Ribbon mainRibbon)
        {
            ribbon = mainRibbon;

            devSettings = (bool)gSettings["DeveloperMode"];

            appDir = Application.StartupPath + "\\";
            globalSettings = gSettings;

            // load recent files
            if (File.Exists(appDir + "recentFiles.xml"))
            {
                recentFiles = RecentFiles.LoadFromFile(appDir + "recentFiles.xml");
                recentFiles.ClearDeadEntires();
            }
            else
                recentFiles = new RecentFiles();

            RebuildRecentFilesMenu();

            baseDir = /*(string)gSettings["Base.Path"];*/Path.GetFullPath(ConfigurationManager.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"].Replace("%STARTUP%", Application.StartupPath));
            if (!Directory.Exists(baseDir))
                throw new ApplicationException("Base directory does not exist! : " + baseDir);

            cdi = ICommonDeviceInterface.NewInterface((byte)globalSettings["CDI.Adapter"], baseDir);
            cdi.ResourceLoader.RegisterContentLoader(new LayerContentLoader());
            cdi.ResourceLoader.RegisterContentLoader(new BooScriptContentLoader());

            ShowHideGroups(false);
        }
Beispiel #2
0
        public static RecentFiles LoadFromFile(string filename)
        {
            FileStream    file        = new FileStream(filename, FileMode.Open);
            XmlSerializer xs          = new XmlSerializer(typeof(RecentFiles));
            XmlReader     xmlreader   = XmlReader.Create(file);
            RecentFiles   recentFiles = (RecentFiles)xs.Deserialize(xmlreader);

            file.Close();
            return(recentFiles);
        }