static void DownloadIronWASPFile(string FileName, string PseudoName) { Request IronWASPFileFetchReq = new Request(IronWASPDownloadBaseUrl + PseudoName); IronWASPFileFetchReq.Source = RequestSource.Stealth; Response IronWASPFileFetchRes = IronWASPFileFetchReq.Send(); if (!IronWASPFileFetchRes.IsSslValid) { throw new Exception("Invalid SSL Certificate provided by the server"); } if (IronWASPFileFetchRes.Code != 200) { throw new Exception("Downloading updated IronWASP version failed"); } if (FileName.Equals("Updater.exe")) { try { File.Delete(Config.Path + "\\Updater.exe"); } catch { } IronWASPFileFetchRes.SaveBody(Config.Path + "\\Updater.exe"); } else { IronWASPFileFetchRes.SaveBody(Config.Path + "\\updates\\ironwasp\\" + FileName); } NewUpdateAvailable = true; }
static void DownloadModule(string ModuleName, string PseudoName) { Request ModuleFetchReq = new Request(ModuleDownloadBaseUrl + "/" + PseudoName); ModuleFetchReq.Source = RequestSource.Stealth; Response ModuleFetchRes = ModuleFetchReq.Send(); if (!ModuleFetchRes.IsSslValid) { throw new Exception("Invalid SSL Certificate provided by the server"); } if (ModuleFetchRes.Code != 200) { throw new Exception("Downloading updated modules failed"); } try { ModuleFetchRes.SaveBody(Config.Path + "\\updates\\modules\\" + ModuleName + ".zip"); using (ZipFile ZF = ZipFile.Read(Config.Path + "\\updates\\modules\\" + ModuleName + ".zip")) { ZF.ExtractAll(Config.Path + "\\updates\\modules\\"); } NewUpdateAvailable = true; } catch (Exception Exp) { IronException.Report(string.Format("Error Downloading Module: {0} - {1} ", ModuleName, PseudoName), Exp); } }
static void DownloadPlugin(string PluginType, string FileName, string PseudoName) { Request PluginFetchReq = new Request(PluginDownloadBaseUrl + PluginType + "/" + PseudoName); PluginFetchReq.Source = RequestSource.Stealth; Response PluginFetchRes = PluginFetchReq.Send(); if (!PluginFetchRes.IsSslValid) { throw new Exception("Invalid SSL Certificate provided by the server"); } if (PluginFetchRes.Code != 200) { throw new Exception("Downloading updated plugins failed"); } try { PluginFetchRes.SaveBody(Config.Path + "\\updates\\plugins\\" + PluginType + "\\" + FileName); NewUpdateAvailable = true; } catch (Exception Exp) { IronException.Report(string.Format("Error Downloading Plugin: {0} - {1} - {2}", PluginType, FileName, PseudoName), Exp); } }