예제 #1
0
        private void LoadDatabases()
        {
            if (!File.Exists(textBoxDatabasePath.Text))
            {
                return;
            }
            XmlSerializer xs = new XmlSerializer(typeof(SmallBasicExtensionList));
            StreamReader  sr = new StreamReader(textBoxDatabasePath.Text);

            extensionList = (SmallBasicExtensionList)xs.Deserialize(sr);
            sr.Close();
            databaseItems.Clear();
            for (int i = 0; i < extensionList.numExtension; i++)
            {
                SmallBasicExtension extension = extensionList.Extensions[i].Extension;
                DatabaseItem        rowItem   = new DatabaseItem
                {
                    Name        = extension.Name,
                    Description = extension.Description,
                    Author      = extension.Author,
                    WebSite     = extension.WebSite,
                    API         = extension.API,
                    ChangeLog   = extension.ChangeLog,
                    SBVersion   = extension.SBVersion,
                    ExtVersion  = extension.ExtVersion,
                    ZipLocation = extension.ZipLocation,
                    dllFiles    = GetFiles(extension.dllFiles),
                    xmlFiles    = GetFiles(extension.xmlFiles),
                    docFiles    = GetFiles(extension.docFiles),
                    sampleFiles = GetFiles(extension.sampleFiles)
                };
                databaseItems.Add(rowItem);
            }
        }
예제 #2
0
        private void SaveDatabases()
        {
            extensionList              = new SmallBasicExtensionList();
            extensionList.Version      = DatabaseVersion;
            extensionList.numExtension = 0;
            for (int i = 0; i < databaseItems.Count; i++)
            {
                DatabaseItem item = databaseItems[i];
                if (null == item.Name || item.Name == "")
                {
                    continue;
                }
                extensionList.numExtension++;
            }
            extensionList.Extensions = new SmallBasicExtensionListExtensions[extensionList.numExtension];
            int index = 0;

            for (int i = 0; i < databaseItems.Count; i++)
            {
                DatabaseItem item = databaseItems[i];
                if (null == item.Name || item.Name == "")
                {
                    continue;
                }
                extensionList.Extensions[index]           = new SmallBasicExtensionListExtensions();
                extensionList.Extensions[index].Extension = new SmallBasicExtension();
                SmallBasicExtension extension = extensionList.Extensions[index].Extension;
                index++;
                extension.Name        = item.Name;
                extension.Description = item.Description;
                extension.Author      = item.Author;
                extension.WebSite     = item.WebSite;
                extension.API         = item.API;
                extension.ChangeLog   = item.ChangeLog;
                extension.SBVersion   = item.SBVersion;
                extension.ExtVersion  = item.ExtVersion;
                extension.ZipLocation = item.ZipLocation;
                extension.dllFiles    = SetFiles(item.dllFiles);
                extension.xmlFiles    = SetFiles(item.xmlFiles);
                extension.docFiles    = SetFiles(item.docFiles);
                extension.sampleFiles = SetFiles(item.sampleFiles);
            }
            XmlSerializer xs = new XmlSerializer(typeof(SmallBasicExtensionList));
            StreamWriter  sw = new StreamWriter(textBoxDatabasePath.Text, false);

            xs.Serialize(sw, extensionList);
            sw.Close();

            LoadDatabases();
        }
예제 #3
0
        /// <summary>
        /// Load WEB assemblies from database
        /// </summary>
        /// <param name="databasePath">The path of the xml database of WEB extensions</param>
        public void Load(string databasePath)
        {
            if (!File.Exists(databasePath))
            {
                return;
            }
            XmlSerializer           xs            = new XmlSerializer(typeof(SmallBasicExtensionList));
            StreamReader            sr            = new StreamReader(databasePath);
            SmallBasicExtensionList extensionList = (SmallBasicExtensionList)xs.Deserialize(sr);

            sr.Close();

            Unload();
            extensions.Clear();

            version = extensionList.Version;
            for (int i = 0; i < extensionList.numExtension; i++)
            {
                extensions.Add(new Extension(extensionList.Extensions[i].Extension));
            }
            extensions.Sort();
        }