small code refactoring

This commit is contained in:
Schedel Pascal
2024-06-19 08:10:16 +02:00
parent 20770bed31
commit c9216ac79b
93 changed files with 2753 additions and 5835 deletions

View File

@@ -1,35 +1,28 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Pilz.Updating.Administration.GUI
namespace Pilz.Updating.Administration.GUI;
public static class General
{
public static class General
private static string myAppPath = string.Empty;
public static UpdateProject CurProject { get; set; } = null;
public static string MyAppPath
{
private static string myAppPath = string.Empty;
public static UpdateProject CurProject { get; set; } = null;
public static string MyAppPath
get
{
get
{
if (string.IsNullOrEmpty(myAppPath))
Path.GetDirectoryName(IO.Extensions.GetExecutablePath());
return myAppPath;
}
}
public static void SetProxyConfig()
{
if (CurProject.ProxyConfig.UseProxyAuth)
WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(CurProject.ProxyConfig.Username, CurProject.ProxyConfig.Password);
else
WebRequest.DefaultWebProxy.Credentials = null;
if (string.IsNullOrEmpty(myAppPath))
Path.GetDirectoryName(IO.Extensions.GetExecutablePath());
return myAppPath;
}
}
public static void SetProxyConfig()
{
if (CurProject.ProxyConfig.UseProxyAuth)
WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(CurProject.ProxyConfig.Username, CurProject.ProxyConfig.Password);
else
WebRequest.DefaultWebProxy.Credentials = null;
}
}