public async Task LoadBadXMLFile_RiseErrorAsync() { //arrange Plugin.Plugin plug = new Plugin.Plugin(); //act await plug.LoadDataAsync("bad.xml"); }
public async Task LoadMSAccessFile_RiseErrorAsync() { //arrange Plugin.Plugin plug = new Plugin.Plugin(); //act await plug.LoadDataAsync("Data.accdb"); }
public void LoadBadXMLFile_RiseError() { //arrange Plugin.Plugin plug = new Plugin.Plugin(); //act plug.LoadData("bad.xml"); }
public void LoadMSAccessFile_RiseError() { //arrange Plugin.Plugin plug = new Plugin.Plugin(); //act plug.LoadData("Data.accdb"); }
private void PluginManager_PluginUnload(Plugin.Plugin plugin) { if (plugin.GetType().IsSubclassOf(typeof(DisplayPlugin))) { DisplayPlugin dpp = (DisplayPlugin)plugin; dpp.OnControlUnload(); TabPage tp = _tabMap.FirstOrDefault(p => p.Value == dpp).Key; _tabMap.Remove(tp); } }
/// <summary>Loads a script from the specified file.</summary> /// <param name="file">The file.</param> /// <param name="plugin">The plugin.</param> /// <returns>The script.</returns> internal static Script FromFile(string file, Plugin plugin) { string title = Path.GetFileName(file); string[] lines = File.ReadAllLines(file, Encoding.UTF8); Element element = ParseSyntax(lines, title); Script script = new Script(plugin); Event e = (Event)ParseSemantics(script, element, title); e.Trigger(); return script; }
// --- functions --- /// <summary>Loads all scripts from the specified directory.</summary> /// <param name="directory">The directory.</param> /// <param name="plugin">The plugin.</param> /// <returns>The scripts.</returns> internal static Script[] FromDirectory(string directory, Plugin plugin) { List<Script> scripts = new List<Script>(); string[] files = Directory.GetFiles(directory); foreach (string file in files) { if (file.EndsWith(".script", StringComparison.OrdinalIgnoreCase)) { scripts.Add(FromFile(file, plugin)); } } return scripts.ToArray(); }
public async Task LoadXmlFile_GetRecordsListAsync() { //arrange Plugin.Plugin plug = new Plugin.Plugin(); List <IRecord> realrecords; //act realrecords = (List <IRecord>) await plug.LoadDataAsync("good.xml"); //assert for (int i = 0; i <= 3; i++) { Assert.AreEqual(records[i].Date, realrecords[i].Date); Assert.AreEqual(records[i].Open, realrecords[i].Open); Assert.AreEqual(records[i].Close, realrecords[i].Close); Assert.AreEqual(records[i].High, realrecords[i].High); Assert.AreEqual(records[i].Low, realrecords[i].Low); } }
public void LoadTXTFile_GetRecordsList() { //arrange Plugin.Plugin plug = new Plugin.Plugin(); List <IRecord> realrecords; //act realrecords = (List <IRecord>)plug.LoadData("good.txt"); //assert for (int i = 0; i <= 3; i++) { Assert.AreEqual(records[i].Date, realrecords[i].Date); Assert.AreEqual(records[i].Open, realrecords[i].Open); Assert.AreEqual(records[i].Close, realrecords[i].Close); Assert.AreEqual(records[i].High, realrecords[i].High); Assert.AreEqual(records[i].Low, realrecords[i].Low); } }
public void gotoHttp(string url, Plugin.ApiCurrently nowPlaying) { try { //Add Variable Support to URL passing - mainly useful for filename? var newurl = url; if (url =="") { Logger.Instance().LogDump("HttpSend", "Called - URL Empty: URL: " + url, true); return; } if (nowPlaying.FileName != null) { newurl = url.Replace("%HTTPFILENAME%", Uri.EscapeUriString(nowPlaying.FileName)); } if (nowPlaying.Artist !=null) { newurl = newurl.Replace("%HTTPARTIST%", Uri.EscapeUriString(nowPlaying.Artist)); } if (nowPlaying.Album != null) { newurl = newurl.Replace("%HTTPALBUM%", Uri.EscapeUriString(nowPlaying.Album)); } if (nowPlaying.FanartURL != null) { newurl = newurl.Replace("%HTTPFANARTURL%", Uri.EscapeUriString(nowPlaying.FanartURL)); } if (nowPlaying.MediaType != null) { newurl = newurl.Replace("%HTTPMEDIATYPE%", Uri.EscapeUriString(nowPlaying.MediaType)); } if (nowPlaying.ShowTitle != null) { newurl = newurl.Replace("%HTTPTITLE%", Uri.EscapeUriString(nowPlaying.ShowTitle)); } if (nowPlaying.Plot != null) { newurl = newurl.Replace("%HTTPPLOT%", Uri.EscapeUriString(nowPlaying.Plot)); } newurl = newurl.Replace("%HTTPSEASONNO%", Uri.EscapeUriString(nowPlaying.SeasonNumber.ToString())); newurl = newurl.Replace("%HTTPPROGRESS%", Uri.EscapeUriString(nowPlaying.Progress.ToString())); newurl = newurl.Replace("%HTTPTIME%", Uri.EscapeUriString(nowPlaying.Time.ToString())); newurl = newurl.Replace("%HTTPEPISODENO%", Uri.EscapeUriString(nowPlaying.EpisodeNumber.ToString())); Logger.Instance().LogDump("HttpSend", "Variables " +url + " newURL " + newurl, true); url = newurl; if (_config.HttpUseDigest == false) { Logger.Instance().LogDump("HttpSend", "Using Basic: Url: " + url, true); var logon = _config.HttpUser; var password = _config.HttpPassword; var Auth = "Basic"; Logger.Instance().LogDump("HttpSend", "Using " + Auth + " Authorisation: URL " + url, true); WebRequest request = WebRequest.Create(url); request.Method = WebRequestMethods.Http.Get; NetworkCredential networkCredential = new NetworkCredential(logon, password); // logon in format "domain\username" CredentialCache myCredentialCache = new CredentialCache { { new Uri(url), Auth, networkCredential } }; request.PreAuthenticate = true; request.Credentials = myCredentialCache; using (WebResponse response = request.GetResponse()) { //Console.WriteLine(((HttpWebResponse)response).StatusDescription); Logger.Instance().LogDump("HttpSend", "Response: " + url + " Response: " + (((HttpWebResponse)response).StatusDescription), true); //using (Stream dataStream = response.GetResponseStream()) // { // using (StreamReader reader = new StreamReader(dataStream)) // { // string responseFromServer = reader.ReadToEnd(); // Logger.Instance().LogDump("HttpSend", "url: " + url + " Response: " + responseFromServer, true); //Console.WriteLine(responseFromServer); // } // } } } if (_config.HttpUseDigest == true) { Uri myurl = new Uri(url); string baseurl = myurl.GetComponents(UriComponents.SchemeAndServer | UriComponents.UserInfo, UriFormat.Unescaped); //var baseurl = myurl.Host; var dir = myurl.PathAndQuery; Logger.Instance().LogDump("HttpSend", "Using Digest: Url: " + url + " BaseURL: " +baseurl + " Dir: " + dir, true); DigestAuthFixer digest = new DigestAuthFixer(baseurl, _config.HttpUser, _config.HttpPassword); string strReturn = digest.GrabResponse(dir); } } catch (Exception ex) { Logger.Instance().Log("HttpSend", "ERROR: For URL: " + url + " Exception: " + ex, true); } }
private static void PluginManager_PluginUnload(Plugin plugin) { FunctionInfo current = null; while((current = _networkFunctions.FirstOrDefault(n => n.Instance == plugin)) != null) { UnregisterNetworkFunction(current.Name); } }
private void PluginManager_PluginUnload(Plugin.Plugin plugin) { _control.RefreshPlugins(); }
private void PluginManager_PluginLoad(Plugin.Plugin plugin) { if (plugin.GetType().IsSubclassOf(typeof(DisplayPlugin))) DisplayPlugin((DisplayPlugin)plugin); }