private void AddIdentity(string name, string version, string hintPath) { if (name.Length == 0) { throw new System.ArgumentException("Identity needs a name"); } for (int i = 0; i < name.Length; i++) { char c = name[i]; if (!char.IsLetterOrDigit(c) && c != '.' && c != '_') { throw new System.ArgumentException("Identity name contains invalid character: '" + c + "'"); } } System.Version value = AddInReference.ParseVersion(version, hintPath); if (this.primaryVersion == null) { this.primaryVersion = value; } if (this.primaryIdentity == null) { this.primaryIdentity = name; } this.identities.Add(name, value); }
public static AddInReference Create(Properties properties, string hintPath) { AddInReference reference = new AddInReference(properties["addin"]); string version = properties["version"]; if (version != null && version.Length > 0) { int pos = version.IndexOf('-'); if (pos > 0) { reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath); reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath); } else { reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath); } if (reference.Name == "SharpDevelop") { // HACK: SD 2.1 AddIns work with SharpDevelop 2.2 // Because some 2.1 AddIns restrict themselves to SD 2.1, we extend the // supported SD range. if (reference.maximumVersion == new Version("2.1")) { reference.maximumVersion = new Version("2.2"); } } } return(reference); }
void AddIdentity(string name, string version, string hintPath) { if (name.Length == 0) { throw new AddInLoadException("Identity needs a name"); } foreach (char c in name) { if (!char.IsLetterOrDigit(c) && c != '.' && c != '_') { throw new AddInLoadException("Identity name contains invalid character: '" + c + "'"); } } Version v = AddInReference.ParseVersion(version, hintPath); if (primaryVersion == null) { primaryVersion = v; } if (primaryIdentity == null) { primaryIdentity = name; } identities.Add(name, v); }
public static AddInReference Create(Properties properties, string hintPath) { AddInReference reference = new AddInReference(properties["addin"]); string version = properties["version"]; if (version != null && version.Length > 0) { int pos = version.IndexOf('-'); if (pos > 0) { reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath); reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath); } else { reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath); } if (reference.Name == "SharpDevelop") { // HACK: SD 3.0 AddIns work with SharpDevelop 3.1 // Because some 3.0 AddIns restrict themselves to SD 3.0, we extend the // supported SD range. if (reference.maximumVersion == new Version("3.0") || reference.maximumVersion == new Version("3.1")) { reference.maximumVersion = new Version(RevisionClass.MainVersion); } } } reference.requirePreload = string.Equals(properties["requirePreload"], "true", StringComparison.OrdinalIgnoreCase); return(reference); }
public static AddInReference Create(Properties properties, string hintPath) { AddInReference addInReference = new AddInReference(properties["addin"]); string text = properties["version"]; if (text != null && text.Length > 0) { int num = text.IndexOf('-'); if (num > 0) { addInReference.minimumVersion = AddInReference.ParseVersion(text.Substring(0, num), hintPath); addInReference.maximumVersion = AddInReference.ParseVersion(text.Substring(num + 1), hintPath); } else { addInReference.maximumVersion = (addInReference.minimumVersion = AddInReference.ParseVersion(text, hintPath)); } if (addInReference.Name == "SharpDevelop" && (addInReference.maximumVersion == new System.Version("3.0") || addInReference.maximumVersion == new System.Version("3.1"))) { addInReference.maximumVersion = new System.Version("3.2"); } } addInReference.requirePreload = string.Equals(properties["requirePreload"], "true", System.StringComparison.OrdinalIgnoreCase); return(addInReference); }
public override bool Equals(object obj) { if (!(obj is AddInReference)) { return(false); } AddInReference addInReference = (AddInReference)obj; return(this.name == addInReference.name && this.minimumVersion == addInReference.minimumVersion && this.maximumVersion == addInReference.maximumVersion); }
public override bool Equals(object obj) { if (!(obj is AddInReference)) { return(false); } AddInReference b = (AddInReference)obj; return(name == b.name && minimumVersion == b.minimumVersion && maximumVersion == b.maximumVersion); }
public static AddInReference Create(Properties properties, string hintPath) { AddInReference reference = new AddInReference(properties["addin"]); string version = properties["version"]; if (version != null && version.Length > 0) { int pos = version.IndexOf('-'); if (pos > 0) { reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath); reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath); } else { reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath); } } return reference; }
public void ReadManifestSection(XmlReader reader, string hintPath) { if (reader.AttributeCount != 0) { throw new AddInLoadException("Manifest node cannot have attributes."); } if (reader.IsEmptyElement) { throw new AddInLoadException("Manifest node cannot be empty."); } while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.EndElement: if (reader.LocalName == "Manifest") { return; } break; case XmlNodeType.Element: string nodeName = reader.LocalName; Properties properties = Properties.ReadFromAttributes(reader); switch (nodeName) { case "Identity": AddIdentity(properties["name"], properties["version"], hintPath); break; case "Dependency": dependencies.Add(AddInReference.Create(properties, hintPath)); break; case "Conflict": conflicts.Add(AddInReference.Create(properties, hintPath)); break; default: throw new AddInLoadException("Unknown node in Manifest section:" + nodeName); } break; } } }
public void ReadManifestSection(XmlReader reader, string hintPath) { if (reader.AttributeCount != 0) { throw new System.ArgumentException("Manifest node cannot have attributes."); } if (reader.IsEmptyElement) { throw new System.ArgumentException("Manifest node cannot be empty."); } while (reader.Read()) { XmlNodeType nodeType = reader.NodeType; if (nodeType == XmlNodeType.Element) { string localName = reader.LocalName; Properties properties = Properties.ReadFromAttributes(reader); string a; if ((a = localName) != null) { if (a == "Identity") { this.AddIdentity(properties["name"], properties["version"], hintPath); continue; } if (a == "Dependency") { this.dependencies.Add(AddInReference.Create(properties, hintPath)); continue; } if (a == "Conflict") { this.conflicts.Add(AddInReference.Create(properties, hintPath)); continue; } } throw new System.ArgumentException("Unknown node in Manifest section:" + localName); } if (nodeType == XmlNodeType.EndElement && reader.LocalName == "Manifest") { return; } } }
public static AddInReference Create(Properties properties, string hintPath) { AddInReference reference = new AddInReference(properties["addin"]); string version = properties["version"]; if (version != null && version.Length > 0) { int pos = version.IndexOf('-'); if (pos > 0) { reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath); reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath); } else { reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath); } } return(reference); }
public static AddInReference Create(Properties properties, string hintPath) { AddInReference reference = new AddInReference(properties["addin"]); string version = properties["version"]; if (version != null && version.Length > 0) { int pos = version.IndexOf('-'); if (pos > 0) { reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath); reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath); } else { reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath); } } reference.requirePreload = string.Equals(properties["requirePreload"], "true", StringComparison.OrdinalIgnoreCase); return(reference); }
public AddInDependency(AddInReference reference) { if (reference != null) { Id = reference.Name; // Hint: An absolutely minimal or maximal version means no version constraint at all! Version absMinimumVersion = new Version(0, 0, 0, 0); Version absMaximumVersion = new Version(Int32.MaxValue, Int32.MaxValue); if ((reference.MinimumVersion != null) && (reference.MinimumVersion != absMinimumVersion)) { MinimumVersion = reference.MinimumVersion; } if ((reference.MaximumVersion != null) && (reference.MaximumVersion != absMaximumVersion)) { MaximumVersion = reference.MaximumVersion; } IncludeMinimumVersion = true; IncludeMaximumVersion = true; } }
public static AddInReference Create(Properties properties, string hintPath) { AddInReference reference = new AddInReference(properties["addin"]); string version = properties["version"]; if (version != null && version.Length > 0) { int pos = version.IndexOf('-'); if (pos > 0) { reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath); reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath); } else { reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath); } if (reference.Name == "SharpDevelop") { // HACK: SD 2.1 AddIns work with SharpDevelop 2.2 // Because some 2.1 AddIns restrict themselves to SD 2.1, we extend the // supported SD range. if (reference.maximumVersion == new Version("2.1")) { reference.maximumVersion = new Version("2.2"); } } } return reference; }
public static AddInReference Create(Properties properties, string hintPath) { AddInReference reference = new AddInReference(properties["addin"]); string version = properties["version"]; if (version != null && version.Length > 0) { int pos = version.IndexOf('-'); if (pos > 0) { reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath); reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath); } else { reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath); } } reference.requirePreload = string.Equals(properties["requirePreload"], "true", StringComparison.OrdinalIgnoreCase); return reference; }
public static AddInReference Create(Properties properties, string hintPath) { AddInReference reference = new AddInReference(properties["addin"]); string version = properties["version"]; if (version != null && version.Length > 0) { int pos = version.IndexOf('-'); if (pos > 0) { reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath); reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath); } else { reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath); } if (reference.Name == "SharpDevelop") { // HACK: SD 4.1/4.2 AddIns work with SharpDevelop 4.3 // Because some 4.1 AddIns restrict themselves to SD 4.1, we extend the // supported SD range. if (reference.maximumVersion == new Version("4.1") || reference.maximumVersion == new Version("4.2")) { reference.maximumVersion = new Version("4.3"); } } } reference.requirePreload = string.Equals(properties["requirePreload"], "true", StringComparison.OrdinalIgnoreCase); return reference; }
bool AddDependencyRow(Dictionary<string, Version> addInDict, AddInReference dep, int rowIndex, string requiredByName) { string text = requiredByName ?? GetDisplayName(dep.Name); Version versionFound; Label label = new Label(); label.AutoSize = true; label.Text = text; PictureBox box = new PictureBox(); box.BorderStyle = BorderStyle.None; box.Size = new Size(16, 16); bool isOK = dep.Check(addInDict, out versionFound); box.SizeMode = PictureBoxSizeMode.CenterImage; //box.Image = isOK ? ResourceService.GetBitmap("Icons.16x16.OK") : ResourceService.GetBitmap("Icons.16x16.DeleteIcon"); dependencyTable.Controls.Add(label, 1, rowIndex); dependencyTable.Controls.Add(box, 0, rowIndex); return isOK; }