Skip to content

Commit

Permalink
Merge pull request #28 from Mijo-Software/mjohne-patch-1
Browse files Browse the repository at this point in the history
Add files via upload
  • Loading branch information
mjohne authored Nov 23, 2023
2 parents 52e5b07 + bae7077 commit c7eaeb1
Show file tree
Hide file tree
Showing 17 changed files with 4,183 additions and 4,276 deletions.
8 changes: 4 additions & 4 deletions AppInfoForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ private void ClearStatusbar()
/// <param name="e"></param>
private void AppInfoForm_Load(object sender, EventArgs e)
{
labelTitle.Text = new AssemblyInfo().AssemblyProduct;
labelVersion.Text = string.Format(format: I10nStrings.VersionTemplate, arg0: new AssemblyInfo().AssemblyVersion);
labelDescription.Text = new AssemblyInfo().AssemblyDescription;
labelCopyright.Text = new AssemblyInfo().AssemblyCopyright;
labelTitle.Text = AssemblyInfo.AssemblyProduct;
labelVersion.Text = string.Format(format: I10nStrings.VersionTemplate, arg0: AssemblyInfo.AssemblyVersion);
labelDescription.Text = AssemblyInfo.AssemblyDescription;
labelCopyright.Text = AssemblyInfo.AssemblyCopyright;
}

/// <summary>
Expand Down
60 changes: 28 additions & 32 deletions AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace Planetoid_DB
{
/// <summary>
///
/// Provide some assembly information
/// </summary>
[DebuggerDisplay(value: "{" + nameof(GetDebuggerDisplay) + "(),nq}")]

public class AssemblyInfo
public static class AssemblyInfo
{
#region Assemblyattributaccessoren
#region Assembly attribute accessors

/// <summary>
///
/// Return the title of the assembly
/// </summary>
public string AssemblyTitle
public static string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyTitleAttribute), inherit: false);
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyTitleAttribute), inherit: false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
AssemblyTitleAttribute titleAttribute = attributes[0] as AssemblyTitleAttribute;
if (!string.IsNullOrEmpty(value: titleAttribute.Title))
{
return titleAttribute.Title;
Expand All @@ -33,64 +32,61 @@ public string AssemblyTitle
}

/// <summary>
///
/// Return the version of the assembly
/// </summary>
public string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString();
public static string AssemblyVersion => Assembly.GetExecutingAssembly().GetName().Version.ToString();

/// <summary>
///
/// Return the description of the assembly
/// </summary>
public string AssemblyDescription
public static string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyDescriptionAttribute), inherit: false);
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyDescriptionAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}

/// <summary>
///
/// Return the product name of the assembly
/// </summary>
public string AssemblyProduct
public static string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyProductAttribute), inherit: false);
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyProductAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyProductAttribute)attributes[0]).Product;
}
}

/// <summary>
///
/// Return the copyright of the assembly
/// </summary>
public string AssemblyCopyright
public static string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyCopyrightAttribute), inherit: false);
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyCopyrightAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}

/// <summary>
///
/// Return the company name of the assembly
/// </summary>
public string AssemblyCompany
public static string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(attributeType: typeof(AssemblyCompanyAttribute), inherit: false);
object[] attributes = Assembly.GetExecutingAssembly()
.GetCustomAttributes(attributeType: typeof(AssemblyCompanyAttribute), inherit: false);
return attributes.Length == 0 ? string.Empty : ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}

/// <summary>
///
/// </summary>
/// <returns></returns>
private string GetDebuggerDisplay() => ToString();

#endregion
}
}
}
19 changes: 9 additions & 10 deletions CheckMpcorbDatForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.IO;
using System.Net;
using Krypton.Toolkit;

Expand Down Expand Up @@ -66,23 +67,21 @@ private void ClearStatusbar()
/// <returns></returns>
private static DateTime GetLastModified(Uri uri)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requestUri: uri);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
resp.Close();
return resp.LastModified;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUri: uri);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
return response.StatusCode == HttpStatusCode.OK ? response.LastModified : new DateTime(year: 0, month: 0, day: 0, hour: 0, minute: 0, second: 0);
}

/// <summary>
///
/// </summary>
/// <param name="uri"></param>
/// <returns></returns>
private static long GetContentLength(Uri uri)
/// <returns></returns>
private long GetContentLength(Uri uri)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requestUri: uri);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
resp.Close();
return Convert.ToInt64(value: resp.ContentLength);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUri: uri);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
return response.StatusCode == HttpStatusCode.OK ? Convert.ToInt64(value: response.ContentLength) : 0;
}

#endregion
Expand Down
Loading

0 comments on commit c7eaeb1

Please sign in to comment.