示例#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
文件: Addin.cs 项目: NALSS/Telegraph
 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
文件: Addin.cs 项目: NALSS/Telegraph
 internal void ResetCachedData()
 {
     desc = null;
     addin = null;
 }
		public int CompareVersionTo (AddinInfo other)
		{
			return Addin.CompareVersions (this.version, other.Version);
		}
		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;
		}
		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;
 }