Compare commits
9
Commits
8606362ed7
..
v1.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
baed3c9e08 | ||
|
|
edb3069bb0 | ||
|
|
a5249f8fac | ||
|
|
b4e17972b9 | ||
|
|
65fdcdc12c | ||
|
|
69f5534523 | ||
|
|
4296649dca | ||
|
|
126632b4c9 | ||
|
|
2b40c85203 |
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.29215.179
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "Utils\Utils-4.7.1.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio Version 16
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}"
|
VisualStudioVersion = 16.0.29215.179
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "Utils\Utils.csproj", "{A289C67C-BC49-46A0-8657-B444C605079E}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -9,12 +11,15 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{A289C67C-BC49-46A0-8657-B444C605079E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A289C67C-BC49-46A0-8657-B444C605079E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A289C67C-BC49-46A0-8657-B444C605079E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A289C67C-BC49-46A0-8657-B444C605079E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {A7224DC4-69F1-4273-BE78-3D9DC80A28C5}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
+22
-8
@@ -14,19 +14,25 @@ namespace BlubbFish.Utils
|
|||||||
#region Classes
|
#region Classes
|
||||||
public struct VaildArguments
|
public struct VaildArguments
|
||||||
{
|
{
|
||||||
public VaildArguments(ArgLength length, Boolean required)
|
public VaildArguments(ArgLength length, Boolean required, String @default = "", String description = "")
|
||||||
{
|
{
|
||||||
this.Required = required;
|
this.Required = required;
|
||||||
this.Length = length;
|
this.Length = length;
|
||||||
|
this.Description = description;
|
||||||
|
this.@Default = @default;
|
||||||
}
|
}
|
||||||
public VaildArguments(ArgLength length)
|
public VaildArguments(ArgLength length, String @default = "", String description = "")
|
||||||
{
|
{
|
||||||
this.Required = false;
|
this.Required = false;
|
||||||
this.Length = length;
|
this.Length = length;
|
||||||
|
this.Description = description;
|
||||||
|
this.@Default = @default;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArgLength Length { get; private set; }
|
public ArgLength Length { get; private set; }
|
||||||
public Boolean Required { get; private set; }
|
public Boolean Required { get; private set; }
|
||||||
|
public String Description { get; private set; }
|
||||||
|
public String Default { get; private set; }
|
||||||
}
|
}
|
||||||
private struct ArgTouple
|
private struct ArgTouple
|
||||||
{
|
{
|
||||||
@@ -107,16 +113,18 @@ namespace BlubbFish.Utils
|
|||||||
this.argList.Add(arg);
|
this.argList.Add(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach(KeyValuePair<String, VaildArguments> item in this.argsPosible) {
|
||||||
|
if(!this.HasArgumentType(item.Key) && item.Value.Length == ArgLength.Touple && item.Value.Default != "") {
|
||||||
|
this.argList.Add(new ArgTouple(item.Key, item.Value.Default));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Menge der angegebenen Komandozeilen-Argumente
|
/// Menge der angegebenen Komandozeilen-Argumente
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Menge</returns>
|
/// <returns>Menge</returns>
|
||||||
public Int32 GetArgsLength()
|
public Int32 GetArgsLength() => this.argList.Count;
|
||||||
{
|
|
||||||
return this.argList.Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gibt zurück ob ein Argument angegeben wurde
|
/// Gibt zurück ob ein Argument angegeben wurde
|
||||||
@@ -165,7 +173,10 @@ namespace BlubbFish.Utils
|
|||||||
String opt = "";
|
String opt = "";
|
||||||
foreach (KeyValuePair<String, VaildArguments> item in this.argsPosible) {
|
foreach (KeyValuePair<String, VaildArguments> item in this.argsPosible) {
|
||||||
if (item.Value.Required) {
|
if (item.Value.Required) {
|
||||||
req += item.Key + " " + ((item.Value.Length == ArgLength.Touple) ? " [data]\n" : "\n");
|
req += item.Key + " " + ((item.Value.Length == ArgLength.Touple) ? (item.Value.Default != "" ? " " + item.Value.Default + "\n" : " [data]\n") : "\n");
|
||||||
|
if(item.Value.Description != "") {
|
||||||
|
req += "\t" + item.Value.Description + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (req != "") {
|
if (req != "") {
|
||||||
@@ -173,7 +184,10 @@ namespace BlubbFish.Utils
|
|||||||
}
|
}
|
||||||
foreach (KeyValuePair<String, VaildArguments> item in this.argsPosible) {
|
foreach (KeyValuePair<String, VaildArguments> item in this.argsPosible) {
|
||||||
if (!item.Value.Required) {
|
if (!item.Value.Required) {
|
||||||
opt += item.Key + " " + ((item.Value.Length == ArgLength.Touple) ? " [data]\n" : "\n");
|
opt += item.Key + " " + ((item.Value.Length == ArgLength.Touple) ? (item.Value.Default != "" ? " " + item.Value.Default + "\n" : " [data]\n") : "\n");
|
||||||
|
if (item.Value.Description != "") {
|
||||||
|
opt += "\t" + item.Value.Description + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opt != "") {
|
if (opt != "") {
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ namespace BlubbFish.Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class UpdaterFailEventArgs : EventArgs {
|
public class UpdaterFailEventArgs : EventArgs {
|
||||||
public UpdaterFailEventArgs(Exception e) {
|
public UpdaterFailEventArgs(Exception e) => this.Except = e;
|
||||||
this.Except = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Exception Except { get; private set; }
|
public Exception Except { get; private set; }
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-8
@@ -9,7 +9,7 @@ namespace BlubbFish.Utils
|
|||||||
{
|
{
|
||||||
public class FileLogger
|
public class FileLogger
|
||||||
{
|
{
|
||||||
private static Dictionary<String, FileLogger> instances = new Dictionary<String, FileLogger>();
|
private static readonly Dictionary<String, FileLogger> instances = new Dictionary<String, FileLogger>();
|
||||||
private static String logDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar;
|
private static String logDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar;
|
||||||
private readonly StreamWriter file;
|
private readonly StreamWriter file;
|
||||||
private FileLogger(String filename, Boolean append)
|
private FileLogger(String filename, Boolean append)
|
||||||
@@ -18,7 +18,7 @@ namespace BlubbFish.Utils
|
|||||||
if (!File.Exists(filename)) {
|
if (!File.Exists(filename)) {
|
||||||
String folder = Path.GetDirectoryName(Path.GetFullPath(filename));
|
String folder = Path.GetDirectoryName(Path.GetFullPath(filename));
|
||||||
if (!Directory.Exists(folder)) {
|
if (!Directory.Exists(folder)) {
|
||||||
Directory.CreateDirectory(folder);
|
_ = Directory.CreateDirectory(folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.file = new StreamWriter(filename, append, Encoding.UTF8) {
|
this.file = new StreamWriter(filename, append, Encoding.UTF8) {
|
||||||
@@ -40,11 +40,11 @@ namespace BlubbFish.Utils
|
|||||||
if (Directory.Exists(v)) {
|
if (Directory.Exists(v)) {
|
||||||
logDir = v;
|
logDir = v;
|
||||||
} else {
|
} else {
|
||||||
Directory.CreateDirectory(v);
|
_ = Directory.CreateDirectory(v);
|
||||||
logDir = v;
|
logDir = v;
|
||||||
}
|
}
|
||||||
if (logDir.Substring(logDir.Length - 1) != Path.DirectorySeparatorChar.ToString()) {
|
if (logDir.Substring(logDir.Length - 1) != Path.DirectorySeparatorChar.ToString()) {
|
||||||
logDir = logDir + Path.DirectorySeparatorChar;
|
logDir += Path.DirectorySeparatorChar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,9 +59,6 @@ namespace BlubbFish.Utils
|
|||||||
this.file.WriteLine(text);
|
this.file.WriteLine(text);
|
||||||
this.file.Flush();
|
this.file.Flush();
|
||||||
}
|
}
|
||||||
public void SetLine(String text, DateTime d)
|
public void SetLine(String text, DateTime d) => this.SetLine(d.ToString("[yyyy-MM-dd HH:mm:ss.ffff] ") + text);
|
||||||
{
|
|
||||||
this.SetLine(d.ToString("[yyyy-MM-dd HH:mm:ss.ffff] ") + text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -25,7 +25,9 @@ namespace BlubbFish.Utils
|
|||||||
public void SetName(String name)
|
public void SetName(String name)
|
||||||
{
|
{
|
||||||
String path = AppDomain.CurrentDomain.BaseDirectory;
|
String path = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
this.filename = path + String.Join(String.Empty, Array.ConvertAll(new SHA512Managed().ComputeHash(Encoding.UTF8.GetBytes(name)), b => b.ToString("X2"))) + ".lock.txt";
|
SHA512Managed sha = new SHA512Managed();
|
||||||
|
this.filename = path + String.Join(String.Empty, Array.ConvertAll(sha.ComputeHash(Encoding.UTF8.GetBytes(name)), b => b.ToString("X2"))) + ".lock.txt";
|
||||||
|
sha.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean Create()
|
public Boolean Create()
|
||||||
@@ -35,7 +37,7 @@ namespace BlubbFish.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.file = new StreamWriter(this.filename);
|
this.file = new StreamWriter(this.filename);
|
||||||
InitFile();
|
this.InitFile();
|
||||||
return File.Exists(this.filename) && this.file != null;
|
return File.Exists(this.filename) && this.file != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +66,7 @@ namespace BlubbFish.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
Dispose(true);
|
this.Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-26
@@ -17,10 +17,7 @@ namespace BlubbFish.Utils {
|
|||||||
|
|
||||||
public static Object GetProperty(this Object o, String name) {
|
public static Object GetProperty(this Object o, String name) {
|
||||||
PropertyInfo prop = o.GetType().GetProperty(name);
|
PropertyInfo prop = o.GetType().GetProperty(name);
|
||||||
if (prop.CanRead) {
|
return prop.CanRead ? prop.GetValue(o) : null;
|
||||||
return prop.GetValue(o);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetProperty(this Object o, String name, String value) {
|
public static void SetProperty(this Object o, String name, String value) {
|
||||||
@@ -47,6 +44,21 @@ namespace BlubbFish.Utils {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region FieldHelper
|
||||||
|
public static Object GetField(this Object o, String name) {
|
||||||
|
FieldInfo field = o.GetType().GetField(name);
|
||||||
|
return field.IsPublic ? field.GetValue(o) : null;
|
||||||
|
}
|
||||||
|
public static Object GetField(this Type o, String name) {
|
||||||
|
FieldInfo field = o.GetField(name);
|
||||||
|
return field.IsPublic ? field.GetValue(o) : null;
|
||||||
|
}
|
||||||
|
public static T GetEvent<T>(this Object o, String name) {
|
||||||
|
FieldInfo field = o.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
return (T)field?.GetValue(o);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region InterfaceHelper
|
#region InterfaceHelper
|
||||||
public static Boolean HasInterface(this Type o, Type interf) {
|
public static Boolean HasInterface(this Type o, Type interf) {
|
||||||
foreach (Type item in o.GetInterfaces()) {
|
foreach (Type item in o.GetInterfaces()) {
|
||||||
@@ -57,36 +69,17 @@ namespace BlubbFish.Utils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean HasAbstract(this Type o, Type type) {
|
public static Boolean HasAbstract(this Type o, Type type) => o.BaseType == type;
|
||||||
if (o.BaseType == type) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region StringHelper
|
#region StringHelper
|
||||||
public static String GetEnumDescription(Enum value) {
|
public static String GetEnumDescription(Enum value) {
|
||||||
FieldInfo fi = value.GetType().GetField(value.ToString());
|
FieldInfo fi = value.GetType().GetField(value.ToString());
|
||||||
|
|
||||||
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||||
|
return attributes != null && attributes.Length > 0 ? attributes[0].Description : value.ToString();
|
||||||
if (attributes != null && attributes.Length > 0) {
|
|
||||||
return attributes[0].Description;
|
|
||||||
} else {
|
|
||||||
return value.ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String ToUpperLower(this String s) {
|
public static String ToUpperLower(this String s) => s.Length == 0 ? "" : s.Length == 1 ? s.ToUpper() : s[0].ToString().ToUpper() + s[1..].ToLower();
|
||||||
if (s.Length == 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (s.Length == 1) {
|
|
||||||
return s.ToUpper();
|
|
||||||
}
|
|
||||||
return s[0].ToString().ToUpper() + s.Substring(1).ToLower();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void WriteError(String text) {
|
public static void WriteError(String text) {
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
|
|||||||
+16
-31
@@ -10,15 +10,13 @@ namespace BlubbFish.Utils {
|
|||||||
private Dictionary<String, Dictionary<String, String>> inifile;
|
private Dictionary<String, Dictionary<String, String>> inifile;
|
||||||
private readonly FileSystemWatcher k;
|
private readonly FileSystemWatcher k;
|
||||||
private readonly String filename;
|
private readonly String filename;
|
||||||
private static List<String> search_path = new List<String>() {
|
private static readonly List<String> search_path = new List<String>() {
|
||||||
Directory.GetCurrentDirectory()
|
Directory.GetCurrentDirectory()
|
||||||
};
|
};
|
||||||
|
|
||||||
private static Dictionary<String, InIReader> instances = new Dictionary<String, InIReader>();
|
private static readonly Dictionary<String, InIReader> instances = new Dictionary<String, InIReader>();
|
||||||
|
|
||||||
public static void SetSearchPath(List<String> directorys) {
|
public static void SetSearchPath(List<String> directorys) => search_path.AddRange(directorys);
|
||||||
search_path.AddRange(directorys);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Boolean ConfigExist(String filename) {
|
public static Boolean ConfigExist(String filename) {
|
||||||
foreach (String path in search_path) {
|
foreach (String path in search_path) {
|
||||||
@@ -54,7 +52,7 @@ namespace BlubbFish.Utils {
|
|||||||
throw new ArgumentException(filename + " not found!");
|
throw new ArgumentException(filename + " not found!");
|
||||||
}
|
}
|
||||||
this.k.Changed += new FileSystemEventHandler(this.ReadAgain);
|
this.k.Changed += new FileSystemEventHandler(this.ReadAgain);
|
||||||
LoadFile();
|
this.LoadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -70,10 +68,7 @@ namespace BlubbFish.Utils {
|
|||||||
return instances[filename];
|
return instances[filename];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReadAgain(Object sender, EventArgs e)
|
private void ReadAgain(Object sender, EventArgs e) => this.LoadFile();
|
||||||
{
|
|
||||||
this.LoadFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadFile()
|
private void LoadFile()
|
||||||
{
|
{
|
||||||
@@ -123,7 +118,7 @@ namespace BlubbFish.Utils {
|
|||||||
} else {
|
} else {
|
||||||
List<String> ret = new List<String>();
|
List<String> ret = new List<String>();
|
||||||
foreach (String item in this.inifile.Keys) {
|
foreach (String item in this.inifile.Keys) {
|
||||||
ret.Add(item.Substring(1, item.Length - 2));
|
ret.Add(item[1..^1]);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -147,15 +142,9 @@ namespace BlubbFish.Utils {
|
|||||||
this.Changed();
|
this.Changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<String, String> GetSection(String section) {
|
public Dictionary<String, String> GetSection(String section) => this.inifile.Keys.Contains(section) ?
|
||||||
if(this.inifile.Keys.Contains(section)) {
|
this.inifile[section] : this.inifile.Keys.Contains("[" + section + "]") ?
|
||||||
return this.inifile[section];
|
this.inifile["[" + section + "]"] : new Dictionary<String, String>();
|
||||||
}
|
|
||||||
if(this.inifile.Keys.Contains("["+section+"]")) {
|
|
||||||
return this.inifile["[" + section + "]"];
|
|
||||||
}
|
|
||||||
return new Dictionary<String, String>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gibt einen einzelnen Wert zurück
|
/// Gibt einen einzelnen Wert zurück
|
||||||
@@ -168,12 +157,7 @@ namespace BlubbFish.Utils {
|
|||||||
if (!section.StartsWith("[")) {
|
if (!section.StartsWith("[")) {
|
||||||
section = "[" + section + "]";
|
section = "[" + section + "]";
|
||||||
}
|
}
|
||||||
if (this.inifile.Keys.Contains(section)) {
|
return this.inifile.Keys.Contains(section) && this.inifile[section].Keys.Contains(key) ? this.inifile[section][key] : null;
|
||||||
if (this.inifile[section].Keys.Contains(key)) {
|
|
||||||
return this.inifile[section][key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -205,8 +189,8 @@ namespace BlubbFish.Utils {
|
|||||||
private void Changed()
|
private void Changed()
|
||||||
{
|
{
|
||||||
this.k.Changed -= null;
|
this.k.Changed -= null;
|
||||||
SaveSettings();
|
this.SaveSettings();
|
||||||
LoadFile();
|
this.LoadFile();
|
||||||
this.k.Changed += new FileSystemEventHandler(this.ReadAgain);
|
this.k.Changed += new FileSystemEventHandler(this.ReadAgain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +199,7 @@ namespace BlubbFish.Utils {
|
|||||||
StreamWriter file = new StreamWriter(this.filename);
|
StreamWriter file = new StreamWriter(this.filename);
|
||||||
file.BaseStream.SetLength(0);
|
file.BaseStream.SetLength(0);
|
||||||
file.BaseStream.Flush();
|
file.BaseStream.Flush();
|
||||||
file.BaseStream.Seek(0, SeekOrigin.Begin);
|
_ = file.BaseStream.Seek(0, SeekOrigin.Begin);
|
||||||
foreach (KeyValuePair<String, Dictionary<String, String>> cap in this.inifile) {
|
foreach (KeyValuePair<String, Dictionary<String, String>> cap in this.inifile) {
|
||||||
file.WriteLine(cap.Key);
|
file.WriteLine(cap.Key);
|
||||||
foreach (KeyValuePair<String, String> sub in cap.Value) {
|
foreach (KeyValuePair<String, String> sub in cap.Value) {
|
||||||
@@ -258,10 +242,11 @@ namespace BlubbFish.Utils {
|
|||||||
if (!this.inifile.Keys.Contains(name)) {
|
if (!this.inifile.Keys.Contains(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.inifile.Remove(name);
|
_ = this.inifile.Remove(name);
|
||||||
this.Changed();
|
this.Changed();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(Boolean disposing) {
|
protected virtual void Dispose(Boolean disposing) {
|
||||||
if (disposing) {
|
if (disposing) {
|
||||||
this.k.Dispose();
|
this.k.Dispose();
|
||||||
@@ -269,7 +254,7 @@ namespace BlubbFish.Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
Dispose(true);
|
this.Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-13
@@ -1,21 +1,10 @@
|
|||||||
using System;
|
namespace BlubbFish.Utils {
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace BlubbFish.Utils
|
|
||||||
{
|
|
||||||
public abstract class OwnController
|
public abstract class OwnController
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Führt den Controller aus.
|
/// Führt den Controller aus.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Execute()
|
public void Execute() => this.Init();
|
||||||
{
|
|
||||||
this.Init();
|
|
||||||
}
|
|
||||||
abstract protected void Init();
|
abstract protected void Init();
|
||||||
abstract public void Dispose();
|
abstract public void Dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-22
@@ -1,25 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BlubbFish.Utils
|
namespace BlubbFish.Utils {
|
||||||
{
|
|
||||||
public abstract class OwnModel<T> where T : class
|
public abstract class OwnModel<T> where T : class
|
||||||
{
|
{
|
||||||
private static readonly Lazy<T> _instance = new Lazy<T>(() => CreateInstanceOfT());
|
private static readonly Lazy<T> _instance = new Lazy<T>(() => CreateInstanceOfT());
|
||||||
private readonly List<OwnView> observer = new List<OwnView>();
|
private readonly List<OwnView> observer = new List<OwnView>();
|
||||||
public static T Instance
|
public static T Instance => _instance.Value;
|
||||||
{
|
private static T CreateInstanceOfT() => Activator.CreateInstance(typeof(T), true) as T;
|
||||||
get {
|
|
||||||
return _instance.Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static T CreateInstanceOfT()
|
|
||||||
{
|
|
||||||
return Activator.CreateInstance(typeof(T), true) as T;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetObserver(OwnView view)
|
public void SetObserver(OwnView view)
|
||||||
{
|
{
|
||||||
@@ -27,13 +15,10 @@ namespace BlubbFish.Utils
|
|||||||
view.Update();
|
view.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveObserver(OwnView view) {
|
public void RemoveObserver(OwnView view) => _ = this.observer.Remove(view);
|
||||||
this.observer.Remove(view);
|
protected void Update() => this.observer.ForEach(delegate (OwnView view) {
|
||||||
}
|
view.Update();
|
||||||
protected void Update()
|
});
|
||||||
{
|
|
||||||
this.observer.ForEach(delegate (OwnView view) { view.Update(); });
|
|
||||||
}
|
|
||||||
abstract protected void Init();
|
abstract protected void Init();
|
||||||
abstract public void Dispose();
|
abstract public void Dispose();
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-21
@@ -21,21 +21,17 @@ namespace BlubbFish.Utils
|
|||||||
/// Formates a LogMessage to a String
|
/// Formates a LogMessage to a String
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Formated String</returns>
|
/// <returns>Formated String</returns>
|
||||||
public override String ToString() {
|
public override String ToString() => "[" + this.Date.ToString("R") + "]: " + this.Level.ToString() + " " + this.Location + ", " + this.Message;
|
||||||
return "[" + this.Date.ToString("R") + "]: " + this.Level.ToString() + " "+ this.Location + ", " + this.Message;
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Formates a LogMessage to a String
|
/// Formates a LogMessage to a String
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="classNames">Enables the output of the location</param>
|
/// <param name="classNames">Enables the output of the location</param>
|
||||||
/// <param name="timeStamps">Enables the output of the date</param>
|
/// <param name="timeStamps">Enables the output of the date</param>
|
||||||
/// <returns>Formated String</returns>
|
/// <returns>Formated String</returns>
|
||||||
public String ToString(Boolean classNames, Boolean timeStamps) {
|
public String ToString(Boolean classNames, Boolean timeStamps) => (timeStamps ? "[" + this.Date.ToString("R") + "]: " + this.Level.ToString() + " " : "") + (classNames ? this.Location + ", " : "") + this.Message;
|
||||||
return (timeStamps ? "[" + this.Date.ToString("R") + "]: " + this.Level.ToString() + " " : "") + (classNames ? this.Location + ", " : "") + this.Message;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LogObject> loglist = new List<LogObject>();
|
private readonly List<LogObject> loglist = new List<LogObject>();
|
||||||
|
|
||||||
public delegate void LogEvent(Object sender, LogEventArgs e);
|
public delegate void LogEvent(Object sender, LogEventArgs e);
|
||||||
public enum LogLevel : Int32 {
|
public enum LogLevel : Int32 {
|
||||||
@@ -72,10 +68,7 @@ namespace BlubbFish.Utils
|
|||||||
/// <param name="location">Where the event arrives</param>
|
/// <param name="location">Where the event arrives</param>
|
||||||
/// <param name="message">The logmessage itselfs</param>
|
/// <param name="message">The logmessage itselfs</param>
|
||||||
/// <param name="level">Level of the message</param>
|
/// <param name="level">Level of the message</param>
|
||||||
protected void AddLog(String location, String message, LogLevel level)
|
protected void AddLog(String location, String message, LogLevel level) => this.AddLog(location, message, level, DateTime.Now);
|
||||||
{
|
|
||||||
this.AddLog(location, message, level, DateTime.Now);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Put a message in the log
|
/// Put a message in the log
|
||||||
@@ -87,20 +80,20 @@ namespace BlubbFish.Utils
|
|||||||
protected void AddLog(String location, String message, LogLevel level, DateTime date)
|
protected void AddLog(String location, String message, LogLevel level, DateTime date)
|
||||||
{
|
{
|
||||||
LogEventArgs e = new LogEventArgs(location, message, level, date);
|
LogEventArgs e = new LogEventArgs(location, message, level, date);
|
||||||
if (EventDebug != null && level >= LogLevel.Debug) {
|
if (level >= LogLevel.Debug) {
|
||||||
EventDebug(this, e);
|
EventDebug?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
if (EventNotice != null && level >= LogLevel.Notice) {
|
if (level >= LogLevel.Notice) {
|
||||||
EventNotice(this, e);
|
EventNotice?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
if (EventInfo != null && level >= LogLevel.Info) {
|
if (level >= LogLevel.Info) {
|
||||||
EventInfo(this, e);
|
EventInfo?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
if (EventWarn != null && level >= LogLevel.Warn) {
|
if (level >= LogLevel.Warn) {
|
||||||
EventWarn(this, e);
|
EventWarn?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
if (EventError != null && level >= LogLevel.Error) {
|
if (level >= LogLevel.Error) {
|
||||||
EventError(this, e);
|
EventError?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
EventLog?.Invoke(this, e);
|
EventLog?.Invoke(this, e);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace BlubbFish.Utils {
|
||||||
|
public abstract class OwnSingeton<T> where T : class {
|
||||||
|
private static readonly Lazy<T> _instance = new Lazy<T>(() => CreateInstanceOfT());
|
||||||
|
public static T Instance => _instance.Value;
|
||||||
|
private static T CreateInstanceOfT() => Activator.CreateInstance(typeof(T), true) as T;
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-7
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace BlubbFish.Utils {
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BlubbFish.Utils {
|
|
||||||
public abstract class OwnView {
|
public abstract class OwnView {
|
||||||
|
|
||||||
protected OwnView() { }
|
protected OwnView() { }
|
||||||
|
|||||||
+18
-38
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
|
||||||
using System.Security;
|
|
||||||
using System.Security.Permissions;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace BlubbFish.Utils {
|
namespace BlubbFish.Utils {
|
||||||
@@ -35,17 +32,10 @@ namespace BlubbFish.Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Boolean IsWritable(String filename) {
|
private Boolean IsWritable(String filename) {
|
||||||
FileIOPermission writePermission = new FileIOPermission(FileIOPermissionAccess.Write, filename);
|
|
||||||
PermissionSet p = new PermissionSet(PermissionState.None);
|
|
||||||
p.AddPermission(writePermission);
|
|
||||||
if (!p.IsSubsetOf(AppDomain.CurrentDomain.PermissionSet)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
using (FileStream fstream = new FileStream(filename, FileMode.Append))
|
using FileStream fstream = new FileStream(filename, FileMode.Append);
|
||||||
using (TextWriter writer = new StreamWriter(fstream)) {
|
using TextWriter writer = new StreamWriter(fstream);
|
||||||
writer.Write("");
|
writer.Write("");
|
||||||
}
|
|
||||||
} catch (UnauthorizedAccessException) {
|
} catch (UnauthorizedAccessException) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -75,13 +65,13 @@ namespace BlubbFish.Utils {
|
|||||||
private void DisattachToFw() {
|
private void DisattachToFw() {
|
||||||
this.stdout.WriteEvent -= this.fw.Write;
|
this.stdout.WriteEvent -= this.fw.Write;
|
||||||
this.stdout.WriteLineEvent -= this.fw.WriteLine;
|
this.stdout.WriteLineEvent -= this.fw.WriteLine;
|
||||||
this.errout.WriteEvent -= this.fw.WriteLine;
|
this.errout.WriteEvent -= this.fw.Write;
|
||||||
this.errout.WriteLineEvent -= this.fw.WriteLine;
|
this.errout.WriteLineEvent -= this.fw.WriteLine;
|
||||||
}
|
}
|
||||||
private void AttachToFw() {
|
private void AttachToFw() {
|
||||||
this.stdout.WriteEvent += this.fw.Write;
|
this.stdout.WriteEvent += this.fw.Write;
|
||||||
this.stdout.WriteLineEvent += this.fw.WriteLine;
|
this.stdout.WriteLineEvent += this.fw.WriteLine;
|
||||||
this.errout.WriteEvent += this.fw.WriteLine;
|
this.errout.WriteEvent += this.fw.Write;
|
||||||
this.errout.WriteLineEvent += this.fw.WriteLine;
|
this.errout.WriteLineEvent += this.fw.WriteLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,11 +81,11 @@ namespace BlubbFish.Utils {
|
|||||||
public FileWriter(String path) : base(path) {
|
public FileWriter(String path) : base(path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Encoding Encoding { get { return Encoding.UTF8; } }
|
public override Encoding Encoding => Encoding.UTF8;
|
||||||
public override Boolean AutoFlush { get { return true; } set { base.AutoFlush = value; } }
|
public override Boolean AutoFlush { get => true; set => base.AutoFlush = value; }
|
||||||
|
|
||||||
private void Write(String value, TextWriter origstream, ConsoleWriterEventArgs.ConsoleType type) {
|
private void Write(String value, TextWriter origstream, ConsoleWriterEventArgs.ConsoleType type) {
|
||||||
String text = "";
|
String text;
|
||||||
if (this.newline) {
|
if (this.newline) {
|
||||||
text = "[" + DateTime.Now.ToString("o") + "]-" + type.ToString() + ": " + value;
|
text = "[" + DateTime.Now.ToString("o") + "]-" + type.ToString() + ": " + value;
|
||||||
this.newline = false;
|
this.newline = false;
|
||||||
@@ -108,25 +98,16 @@ namespace BlubbFish.Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void WriteLine(String value, TextWriter origstream, ConsoleWriterEventArgs.ConsoleType type) {
|
private void WriteLine(String value, TextWriter origstream, ConsoleWriterEventArgs.ConsoleType type) {
|
||||||
String text = "";
|
String text = this.newline ? "[" + DateTime.Now.ToString("o") + "]-" + type.ToString() + ": " + value : value;
|
||||||
if (this.newline) {
|
|
||||||
text = "[" + DateTime.Now.ToString("o") + "]-" + type.ToString() + ": " + value;
|
|
||||||
} else {
|
|
||||||
text = value;
|
|
||||||
}
|
|
||||||
this.newline = true;
|
this.newline = true;
|
||||||
origstream.WriteLine(text);
|
origstream.WriteLine(text);
|
||||||
base.WriteLine(text);
|
base.WriteLine(text);
|
||||||
base.Flush();
|
base.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Write(Object sender, ConsoleWriterEventArgs e) {
|
internal void Write(Object sender, ConsoleWriterEventArgs e) => this.Write(e.Value, e.Writer, e.StreamType);
|
||||||
this.Write(e.Value, e.Writer, e.StreamType);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void WriteLine(Object sender, ConsoleWriterEventArgs e) {
|
internal void WriteLine(Object sender, ConsoleWriterEventArgs e) => this.WriteLine(e.Value, e.Writer, e.StreamType);
|
||||||
this.WriteLine(e.Value, e.Writer, e.StreamType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ConsoleWriterEventArgs : EventArgs {
|
internal class ConsoleWriterEventArgs : EventArgs {
|
||||||
@@ -155,15 +136,14 @@ namespace BlubbFish.Utils {
|
|||||||
this.streamtype = type;
|
this.streamtype = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Encoding Encoding { get { return Encoding.UTF8; } }
|
public override Encoding Encoding => Encoding.UTF8;
|
||||||
public override void Write(String value) {
|
|
||||||
this.WriteEvent?.Invoke(this, new ConsoleWriterEventArgs(value, this.stream, this.streamtype));
|
public override void Write(String value) => this.WriteEvent?.Invoke(this, new ConsoleWriterEventArgs(value, this.stream, this.streamtype));
|
||||||
base.Write(value);
|
//base.Write(value);
|
||||||
}
|
|
||||||
public override void WriteLine(String value) {
|
public override void WriteLine(String value) => this.WriteLineEvent?.Invoke(this, new ConsoleWriterEventArgs(value, this.stream, this.streamtype));
|
||||||
this.WriteLineEvent?.Invoke(this, new ConsoleWriterEventArgs(value, this.stream, this.streamtype));
|
//base.WriteLine(value);
|
||||||
base.WriteLine(value);
|
|
||||||
}
|
|
||||||
public event EventHandler<ConsoleWriterEventArgs> WriteEvent;
|
public event EventHandler<ConsoleWriterEventArgs> WriteEvent;
|
||||||
public event EventHandler<ConsoleWriterEventArgs> WriteLineEvent;
|
public event EventHandler<ConsoleWriterEventArgs> WriteLineEvent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
using System.Reflection;
|
#if !NETCOREAPP
|
||||||
using System.Runtime.CompilerServices;
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||||
// die mit einer Assembly verknüpft sind.
|
// die mit einer Assembly verknüpft sind.
|
||||||
[assembly: AssemblyTitle("Utils")]
|
[assembly: AssemblyTitle("Utils")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("Provides useful classes for other projects")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("BlubbFish")]
|
||||||
[assembly: AssemblyProduct("Utils")]
|
[assembly: AssemblyProduct("Utils")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014 - 02.10.2018")]
|
[assembly: AssemblyCopyright("Copyright © BlubbFish 2014 - 10.04.2021")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("BlubbFish")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
[assembly: NeutralResourcesLanguage("de-DE")]
|
||||||
|
|
||||||
|
|
||||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||||
@@ -32,9 +35,11 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
// übernehmen, indem Sie "*" eingeben:
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.4.0")]
|
[assembly: AssemblyVersion("1.5.0")]
|
||||||
[assembly: AssemblyFileVersion("1.4.0")]
|
[assembly: AssemblyFileVersion("1.5.0")]
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 1.5.0 Add GetEvent so you can call events by string; Add OwnSingeton class
|
||||||
* 1.4.0 Add Helper to Utils
|
* 1.4.0 Add Helper to Utils
|
||||||
*/
|
*/
|
||||||
|
|||||||
+5
-2
@@ -58,7 +58,7 @@ namespace BlubbFish.Utils {
|
|||||||
while (this.t.ThreadState == ThreadState.Running) { }
|
while (this.t.ThreadState == ThreadState.Running) { }
|
||||||
if(exceuteUpdate) {
|
if(exceuteUpdate) {
|
||||||
if(File.Exists("update.bat")) {
|
if(File.Exists("update.bat")) {
|
||||||
System.Diagnostics.Process.Start("update.bat");
|
_ = System.Diagnostics.Process.Start("update.bat");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,6 +90,7 @@ namespace BlubbFish.Utils {
|
|||||||
xml.Flush();
|
xml.Flush();
|
||||||
file.Flush();
|
file.Flush();
|
||||||
file.Close();
|
file.Close();
|
||||||
|
xml.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -114,7 +115,9 @@ namespace BlubbFish.Utils {
|
|||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
try {
|
try {
|
||||||
Stream stream = WebRequest.Create(this.url + "version.xml").GetResponse().GetResponseStream();
|
Stream stream = WebRequest.Create(this.url + "version.xml").GetResponse().GetResponseStream();
|
||||||
String content = new StreamReader(stream).ReadToEnd();
|
StreamReader sr = new StreamReader(stream);
|
||||||
|
String content = sr.ReadToEnd();
|
||||||
|
sr.Close();
|
||||||
Boolean update = false;
|
Boolean update = false;
|
||||||
XmlDocument doc = new XmlDocument();
|
XmlDocument doc = new XmlDocument();
|
||||||
doc.LoadXml(content);
|
doc.LoadXml(content);
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>BlubbFish.Utils</RootNamespace>
|
||||||
|
<AssemblyName>Utils</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="CmdArgs.cs" />
|
||||||
|
<Compile Include="EventArgsHelper.cs" />
|
||||||
|
<Compile Include="FileLogger.cs" />
|
||||||
|
<Compile Include="FileMutex.cs" />
|
||||||
|
<Compile Include="Helper.cs" />
|
||||||
|
<Compile Include="InIReader.cs" />
|
||||||
|
<Compile Include="OwnController.cs" />
|
||||||
|
<Compile Include="OwnModel.cs" />
|
||||||
|
<Compile Include="OwnObject.cs" />
|
||||||
|
<Compile Include="OwnView.cs" />
|
||||||
|
<Compile Include="ProgramLogger.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Updater.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="..\CHANGELOG.md" />
|
||||||
|
<Content Include="..\CONTRIBUTING.md" />
|
||||||
|
<Content Include="..\LICENSE" />
|
||||||
|
<Content Include="..\README.md" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
+31
-58
@@ -1,66 +1,39 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>BlubbFish.Utils</RootNamespace>
|
|
||||||
<AssemblyName>Utils</AssemblyName>
|
<AssemblyName>Utils</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
<RootNamespace>BlubbFish.Utils</RootNamespace>
|
||||||
<FileAlignment>512</FileAlignment>
|
<Description>Provides useful classes for other projects</Description>
|
||||||
<TargetFrameworkProfile />
|
<Company>BlubbFish</Company>
|
||||||
</PropertyGroup>
|
<Authors>BlubbFish</Authors>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PackageId>Utils.BlubbFish</PackageId>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<Copyright>Copyright © BlubbFish 2014 - 10.04.2021</Copyright>
|
||||||
<DebugType>full</DebugType>
|
<AssemblyVersion>1.5.0</AssemblyVersion>
|
||||||
<Optimize>false</Optimize>
|
<FileVersion>1.5.0</FileVersion>
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
<NeutralLanguage>de-DE</NeutralLanguage>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<PackageProjectUrl>http://git.blubbfish.net/vs_utils/Utils</PackageProjectUrl>
|
||||||
<WarningLevel>4</WarningLevel>
|
<RepositoryUrl>http://git.blubbfish.net/vs_utils/Utils.git</RepositoryUrl>
|
||||||
</PropertyGroup>
|
<RepositoryType>git</RepositoryType>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<Version>1.5.0</Version>
|
||||||
<DebugType>pdbonly</DebugType>
|
<PackageReleaseNotes>
|
||||||
<Optimize>true</Optimize>
|
1.5.0 Add GetEvent so you can call events by string; Add OwnSingeton class
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
1.4.0 Add Helper to Utils
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
</PackageReleaseNotes>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Content Include="../CHANGELOG.md" />
|
||||||
<Reference Include="System.Core" />
|
<Content Include="../CONTRIBUTING.md" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Content Include="../LICENSE" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Content Include="../README.md" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="CmdArgs.cs" />
|
<None Include="..\LICENSE">
|
||||||
<Compile Include="EventArgsHelper.cs" />
|
<Pack>True</Pack>
|
||||||
<Compile Include="FileLogger.cs" />
|
<PackagePath></PackagePath>
|
||||||
<Compile Include="FileMutex.cs" />
|
</None>
|
||||||
<Compile Include="Helper.cs" />
|
|
||||||
<Compile Include="InIReader.cs" />
|
|
||||||
<Compile Include="OwnController.cs" />
|
|
||||||
<Compile Include="OwnModel.cs" />
|
|
||||||
<Compile Include="OwnObject.cs" />
|
|
||||||
<Compile Include="OwnView.cs" />
|
|
||||||
<Compile Include="ProgramLogger.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="Updater.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
|
||||||
<Target Name="BeforeBuild">
|
|
||||||
</Target>
|
|
||||||
<Target Name="AfterBuild">
|
|
||||||
</Target>
|
|
||||||
-->
|
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user