/// <summary> /// Gets the log files from the server (using webclient). /// </summary> /// <param name="server">The server.</param> /// <param name="directory">The directory.</param> /// <returns></returns> /// <author>Jurie.smit</author> /// <date>2013/05/24</date> public IEnumerable <FilePath> GetLogFiles(IEnvironmentModel server, DirectoryPath directory) { LogFiles.Clear(); if (server == null || directory == null) { return(new List <FilePath>()); } var address = String.Format(server.Connection.WebServerUri + "{0}/{1}?DirectoryPath={2}", "Services", "FindDirectoryService", directory.PathToSerialize); var datalistJson = WebClient.UploadString(address, string.Empty); if (datalistJson.Contains("Error")) { var error = "Error: Log directory not found." + Environment.NewLine + datalistJson.GetManagementPayload(); ShowErrorPopup(error); } else { var filePaths = JsonConvert.DeserializeObject <List <FilePath> >(datalistJson); filePaths.ForEach(fp => { if (fp.Title.EndsWith(".wwlfl")) { LogFiles.Add(fp); } }); return(filePaths); } return(new List <FilePath>()); }
private void SortLogFiles() { var key = CurrentFile?.FullPath; LogFiles.Clear(); LogFiles.AddRange(GetAllLogs(_folderFullPath)); if (key != null) { CurrentFile = LogFiles.Single(l => l.FullPath.Equals(key)); } }
/// <summary> /// Deletes all the logs from the selected server directory. /// </summary> /// <author>Jurie.smit</author> /// <date>2013/05/24</date> public void DeleteAll() { var address = String.Format(SelectedServer.Connection.WebServerUri + "{0}/{1}?Directory={2}", "Services", "ClearLogService", LogDirectory.PathToSerialize); var response = WebClient.UploadString(address, string.Empty); if (response.Contains("Success")) { LogFiles.Clear(); } else { ShowError(response); } }