public void DownloadNewClientVersion(UpdateServer server, ClientInstaller installer) { string sourcePath = $"//{server.Address}/aplikacja/instalator/{installer.FileName}"; string destinationPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}\\{installer.FileName}"; File.Copy(sourcePath, destinationPath, true); }
public WindowsUpdateClient(UpdateServer updateServerSelection) : this(updateServerSelection, new UpdateSession { ClientApplicationID = "Microsoft.Management.WindowsUpdate.Client" }) { }
public static void Generate() { Logger.LogAllLine("Generate update server================>"); //copy all res to server! SystemTool.ClearDirectory(PathManager.UpdateServerPath); SystemTool.CopyDirectory(PathManager.OutputPath, PathManager.UpdateServerPath); Logger.LogAllLine("Copy all res to UpdateServer!"); var server = new UpdateServer { Status = PublishTarget.Current.UpdateServerStatus, MinVersion = PublishTarget.Current.UpdateServerMinClientVersion.ToProtoVersion(), CurVersion = PublishTarget.Current.ClientVersion.ToProtoVersion(), Description = PublishTarget.Current.UpdateServerDescription }; //save using (var file = File.Open(PathManager.UpdateServerConfigPath.FullName, FileMode.Create, FileAccess.ReadWrite)) { Serializer.Serialize(file, server); } //FileSystemGenerator.FileListGenerator.CodeFile(PathManager.UpdateServerConfigPath); Logger.LogAllLine("Generate:\t{0}", PathManager.UpdateServerConfigPath.FullName); }
public static bool StopServer() { try { UpdateModBus.CloseModBus(); if (_iedServer != null) { if (_iedServer.IsRunning()) { _iedServer.Stop(); _iedServer.Destroy(); _iedServer = null; } } ServerModel.Model?.Clear(); UpdateServer.Clear(); Log.Log.Write(@"ServerIEC61850.StopServer: ServerIEC61850 stoped", @"Stop"); } catch { Log.Log.Write(@"ServerIEC61850.StopServer: No valid ServerIEC61850 found!", @"Error"); Log.Log.Write(@"ServerIEC61850.StopServer: ServerIEC61850 stoped", @"Stop"); return(false); } return(true); }
protected override void OnLoaded() { if (UpdateServer.IsNullOrEmpty()) { UpdateServer = "http://x.newlifex.com/"; } base.OnLoaded(); }
protected override void OnLoaded() { if (UpdateServer.IsNullOrEmpty()) { UpdateServer = "http://www.newlifex.com/showtopic-260.aspx"; } base.OnLoaded(); }
public ClientInstaller GetLatestInstaller(UpdateServer server) { var groupingInstallers = server.Installers .GroupBy(i => i.Version) .OrderByDescending(i => i.Key) .FirstOrDefault(); return(groupingInstallers.FirstOrDefault()); }
public HttpResult Put(UpdateServer request) { int result = Db.Update((Server)request.SanitizeDtoHtml()); if (result == 0) throw new HttpError(HttpStatusCode.NotFound, new ArgumentException("Server {0} does not exist. ".Fmt(request.Id))); return new HttpResult { StatusCode = HttpStatusCode.NoContent }; }
public async Task <ServerUpdateAppInfo> GetServerUpdateAppInfo(UpdateServer server) { var response = await client.GetAsync(UrlBuilder(server)); response.EnsureSuccessStatusCode(); var responseBody = await response.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <ServerUpdateAppInfo>(responseBody)); }
protected override void OnLoaded() { if (UpdateServer.IsNullOrEmpty() || UpdateServer.EqualIgnoreCase("http://x.newlifex.com/")) { UpdateServer = NewLife.Setting.Current.PluginServer; } base.OnLoaded(); }
public static void Shutdown() { if (UpdateServer.IsRunning) { UpdateServer.Stop(); } Singleton.AllowClose = true; Application.Current.Shutdown(); }
void timer_Tick(object sender, EventArgs e) { DispatcherTimer timer = sender as DispatcherTimer; if (!((UpdateServer.ServerThread != null) && UpdateServer.ServerThread.IsAlive)) { timer.Stop(); UpdateServer.Start(); } }
private Uri UrlBuilder(UpdateServer server) { UriBuilder builder = new UriBuilder(); builder.Host = server.Host; builder.Fragment = server.UpdateFileName; builder.Port = server.Port; builder.UserName = server.UserName; builder.Password = server.Password; return(builder.Uri); }
public IEnumerable <ClientInstaller> GetInstallers(UpdateServer server) { List <ClientInstaller> installers = new List <ClientInstaller>(); string[] paths = Directory.GetFiles($"//{server.Address}/aplikacja/instalator/", "*.EXE", SearchOption.AllDirectories) .Select(fileName => Path.GetFullPath(fileName)) .AsEnumerable() .ToArray(); foreach (var path in paths) { var fileInfo = new FileInfo(path); var version = new Version(FileVersionInfo.GetVersionInfo(path).ProductVersion); installers.Add(new ClientInstaller(fileInfo.Name, version)); } return(installers); }
public static bool ConfigServer() { try { Directory.CreateDirectory(@"vmd-filestore" + "\\"); _iedModel = IedModel.CreateFromFile(ServerConfig.NameModelFile); _iedServer = new IedServer(_iedModel); } catch { Log.Log.Write("ServerIEC61850: Model file incorrect", "Error"); return(false); } UpdateServer.SetParams(_iedServer, _iedModel); //Устаовка UpdateServer.InitUpdate(_iedServer, _iedModel); //Заполнение данными UpdateServer.InitHandlers(_iedServer, _iedModel); //Установка оброботчиков событий UpdateModBus.ConfigModBusPort(); return(true); }
private void buttonRestart_Click(object sender, RoutedEventArgs e) { restartWhenStopped = true; UpdateServer.Stop(); }
public Task <ServerUpdateAppInfo> GetServerUpdateAppInfo(UpdateServer server) { throw new NotImplementedException(); }
public Task DownloadFiles(UpdateServer server, List <string> fileUrls, string localPath) { throw new NotImplementedException(); }
public Task DownloadFile(UpdateServer server, string fileUrl, string localPath) { throw new NotImplementedException(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { UpdateServer.Started += new EventHandler(UpdateServer_Started); UpdateServer.Start(); }
private void buttonStop_Click(object sender, RoutedEventArgs e) { UpdateServer.Stop(); }
void UpdateServer_Started(object sender, EventArgs e) { UpdateServer.Started -= UpdateServer_Started; UpdateServer.Stopped += new EventHandler(UpdateServer_Stopped); UpdateServer.Stop(); }
public WindowsUpdateClient(UpdateServer updateServerSelection, IUpdateSession3 session) { this.session = session; this.UpdateServerSelection = updateServerSelection; }
void UpdateServer_Stopped(object sender, EventArgs e) { UpdateServer.Stopped -= UpdateServer_Stopped; UpdateServer.Start(); }