Пример #1
0
        internal static AddinInfo ReadFromDescription(AddinDescription description)
        {
            AddinInfo info = new AddinInfo();

            info.id          = description.LocalId;
            info.namspace    = description.Namespace;
            info.name        = description.Name;
            info.version     = description.Version;
            info.author      = description.Author;
            info.copyright   = description.Copyright;
            info.url         = description.Url;
            info.description = description.Description;
            info.category    = description.Category;
            info.baseVersion = description.CompatVersion;

            foreach (Dependency dep in description.MainModule.Dependencies)
            {
                info.Dependencies.Add(dep);
            }

            foreach (ModuleDescription mod in description.OptionalModules)
            {
                foreach (Dependency dep in mod.Dependencies)
                {
                    info.OptionalDependencies.Add(dep);
                }
            }
            return(info);
        }
Пример #2
0
        public static AddinInfo ReadFromAddinFile(StreamReader r)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(r);
            r.Close();

            AddinInfo info = new AddinInfo();

            info.id       = doc.DocumentElement.GetAttribute("id");
            info.namspace = doc.DocumentElement.GetAttribute("namespace");
            info.name     = doc.DocumentElement.GetAttribute("name");
            if (info.id == "")
            {
                info.id = info.name;
            }
            info.version     = doc.DocumentElement.GetAttribute("version");
            info.author      = doc.DocumentElement.GetAttribute("author");
            info.copyright   = doc.DocumentElement.GetAttribute("copyright");
            info.url         = doc.DocumentElement.GetAttribute("url");
            info.description = doc.DocumentElement.GetAttribute("description");
            info.category    = doc.DocumentElement.GetAttribute("category");
            info.baseVersion = doc.DocumentElement.GetAttribute("compatVersion");

            ReadDependencies(info.Dependencies, info.OptionalDependencies, doc.DocumentElement);

            return(info);
        }
Пример #3
0
 internal void ResetCachedData()
 {
     // The domain may have changed
     if (sourceFile != null)
     {
         domain = database.GetFolderDomain(null, Path.GetDirectoryName(sourceFile));
     }
     desc  = null;
     addin = null;
 }
Пример #4
0
 void LoadAddinInfo()
 {
     if (addin == null)
     {
         try {
             AddinDescription m = Description;
             sourceFile = m.AddinFile;
             addin      = AddinInfo.ReadFromDescription(m);
         } catch (Exception ex) {
             throw new InvalidOperationException("Could not read add-in file: " + configFile, ex);
         }
     }
 }
Пример #5
0
 void LoadAddinInfo()
 {
     if (addin == null)
     {
         try {
             AddinDescription m = Description;
             sourceFile = m.AddinFile;
             addin      = AddinInfo.ReadFromDescription(m);
         } catch (Exception ex) {
             throw new InvalidOperationException("Could not read add-in file: " + database.GetDescriptionPath(domain, id), ex);
         }
     }
 }
Пример #6
0
        internal void ResetCachedData()
        {
            // The domain may have changed (?!)

            // This check has been commented out because GetFolderDomain will fail if sourceFile changed
            // or if there is no folder info for the add-in (it may happen when using pre-generated add-in
            // scan data files).
            // A domain change at run-time is an unlikely scenario and not properly supported anyway in
            // other parts of the code. In general, changes in an already loaded add-in are not supported.

//			if (sourceFile != null)
//				domain = database.GetFolderDomain (null, Path.GetDirectoryName (sourceFile));

            desc  = null;
            addin = null;
        }
Пример #7
0
 void LoadAddinInfo()
 {
     if (addin == null) {
         try {
             AddinDescription m = Description;
             sourceFile = m.AddinFile;
             addin = AddinInfo.ReadFromDescription (m);
         } catch (Exception ex) {
             throw new InvalidOperationException ("Could not read add-in file: " + configFile, ex);
         }
     }
 }
Пример #8
0
 internal void ResetCachedData()
 {
     desc = null;
     addin = null;
 }
Пример #9
0
		public int CompareVersionTo (AddinInfo other)
		{
			return Addin.CompareVersions (this.version, other.Version);
		}
Пример #10
0
		internal static AddinInfo ReadFromDescription (AddinDescription description)
		{
			AddinInfo info = new AddinInfo ();
			info.id = description.LocalId;
			info.namspace = description.Namespace;
			info.name = description.Name;
			info.version = description.Version;
			info.author = description.Author;
			info.copyright = description.Copyright;
			info.url = description.Url;
			info.description = description.Description;
			info.category = description.Category;
			info.baseVersion = description.CompatVersion;
			
			foreach (Dependency dep in description.MainModule.Dependencies)
				info.Dependencies.Add (dep);
				
			foreach (ModuleDescription mod in description.OptionalModules) {
				foreach (Dependency dep in mod.Dependencies)
					info.OptionalDependencies.Add (dep);
			}
			return info;
		}
Пример #11
0
		public static AddinInfo ReadFromAddinFile (StreamReader r)
		{
			XmlDocument doc = new XmlDocument ();
			doc.Load (r);
			r.Close ();
			
			AddinInfo info = new AddinInfo ();
			info.id = doc.DocumentElement.GetAttribute ("id");
			info.namspace = doc.DocumentElement.GetAttribute ("namespace");
			info.name = doc.DocumentElement.GetAttribute ("name");
			if (info.id == "") info.id = info.name;
			info.version = doc.DocumentElement.GetAttribute ("version");
			info.author = doc.DocumentElement.GetAttribute ("author");
			info.copyright = doc.DocumentElement.GetAttribute ("copyright");
			info.url = doc.DocumentElement.GetAttribute ("url");
			info.description = doc.DocumentElement.GetAttribute ("description");
			info.category = doc.DocumentElement.GetAttribute ("category");
			info.baseVersion = doc.DocumentElement.GetAttribute ("compatVersion");

			ReadDependencies (info.Dependencies, info.OptionalDependencies, doc.DocumentElement);
		
			return info;
		}
Пример #12
0
		internal void ResetCachedData ()
		{
			// The domain may have changed
			if (sourceFile != null)
				domain = database.GetFolderDomain (null, Path.GetDirectoryName (sourceFile));
			desc = null;
			addin = null;
		}
Пример #13
0
		void LoadAddinInfo ()
		{
			if (addin == null) {
				try {
					AddinDescription m = Description;
					sourceFile = m.AddinFile;
					addin = AddinInfo.ReadFromDescription (m);
				} catch (Exception ex) {
					throw new InvalidOperationException ("Could not read add-in file: " + database.GetDescriptionPath (domain, id), ex);
				}
			}
		}
Пример #14
0
 public bool SupportsVersion(string version)
 {
     return(AddinInfo.SupportsVersion(version));
 }
Пример #15
0
 public int CompareVersionTo(AddinInfo other)
 {
     return(Addin.CompareVersions(this.version, other.Version));
 }
Пример #16
0
 internal void ResetCachedData()
 {
     desc  = null;
     addin = null;
 }