/// <summary> ///[PluginManagerInfoAttribute] ///public class Plugin : IPlugin { } /// </summary> /// <param name="plugin"></param> /// <returns></returns> public static PackageInfo Create(ExtendedPlugin plugin) { var instanceType = plugin.Instance.GetType(); var attributeType = plugin.Assembly.GetType(instanceType.Namespace + ".PackageInfoAttribute"); if (attributeType != null) { PackageInfo attribute; try { attribute = PackageInfo.Create(instanceType.GetCustomAttribute(attributeType)); } catch { attribute = null; } if (attribute != null) { return(attribute); } } return(null); }
public static void Register() { ExtendedPlugin plugin; bool success; foreach (var library in Settings.Instance.WatchList) { plugin = new ExtendedPlugin(library.Name, out success); if (success) { if (string.IsNullOrEmpty(library.Version)) { library.Version = plugin.FileVersion; } if (library.LastUpdate == null) { library.LastUpdate = DateTime.MinValue; } m_plugins.Add(plugin); } } }
private static async Task <Serialization.GitHubAPI.Release> GetGitHubReleasAsync(ExtendedPlugin plugin) { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format(RepositoryURL, plugin.Info.UserName, plugin.Info.RepositoryName)); request.KeepAlive = false; request.UserAgent = ".NET Framework"; request.ContentType = "application/json"; var response = (HttpWebResponse)(await request.GetResponseAsync()); if (response.StatusCode == HttpStatusCode.OK) { using (Stream webStream = response.GetResponseStream()) return(Serialization.GitHubAPI.Release.Deserialize(webStream)); } } catch { } return(null); }