mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Issue reporting autofill + shorthand build checks
This commit is contained in:
parent
b8722f2429
commit
91e2c45f0c
@ -31,6 +31,10 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
public static string Version = Assembly.GetExecutingAssembly().GetName().Version!.ToString()[..^2];
|
public static string Version = Assembly.GetExecutingAssembly().GetName().Version!.ToString()[..^2];
|
||||||
|
|
||||||
|
public static bool IsActionBuild => !String.IsNullOrEmpty(BuildMetadata.CommitRef);
|
||||||
|
|
||||||
|
public static bool IsProductionBuild => IsActionBuild && BuildMetadata.CommitRef.StartsWith("tag", StringComparison.Ordinal);
|
||||||
|
|
||||||
public static readonly MD5 MD5Provider = MD5.Create();
|
public static readonly MD5 MD5Provider = MD5.Create();
|
||||||
|
|
||||||
public static NotifyIconWrapper? NotifyIcon { get; set; }
|
public static NotifyIconWrapper? NotifyIcon { get; set; }
|
||||||
@ -105,10 +109,10 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
Logger.WriteLine(LOG_IDENT, $"Starting {ProjectName} v{Version}");
|
Logger.WriteLine(LOG_IDENT, $"Starting {ProjectName} v{Version}");
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(BuildMetadata.CommitHash))
|
if (IsActionBuild)
|
||||||
Logger.WriteLine(LOG_IDENT, $"Compiled {BuildMetadata.Timestamp.ToFriendlyString()} from {BuildMetadata.Machine}");
|
|
||||||
else
|
|
||||||
Logger.WriteLine(LOG_IDENT, $"Compiled {BuildMetadata.Timestamp.ToFriendlyString()} from commit {BuildMetadata.CommitHash} ({BuildMetadata.CommitRef})");
|
Logger.WriteLine(LOG_IDENT, $"Compiled {BuildMetadata.Timestamp.ToFriendlyString()} from commit {BuildMetadata.CommitHash} ({BuildMetadata.CommitRef})");
|
||||||
|
else
|
||||||
|
Logger.WriteLine(LOG_IDENT, $"Compiled {BuildMetadata.Timestamp.ToFriendlyString()} from {BuildMetadata.Machine}");
|
||||||
|
|
||||||
Logger.WriteLine(LOG_IDENT, $"Loaded from {Paths.Process}");
|
Logger.WriteLine(LOG_IDENT, $"Loaded from {Paths.Process}");
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ namespace Bloxstrap
|
|||||||
var versionComparison = Utilities.CompareVersions(App.Version, releaseInfo.TagName);
|
var versionComparison = Utilities.CompareVersions(App.Version, releaseInfo.TagName);
|
||||||
|
|
||||||
// check if we aren't using a deployed build, so we can update to one if a new version comes out
|
// check if we aren't using a deployed build, so we can update to one if a new version comes out
|
||||||
if (versionComparison == VersionComparison.Equal && App.BuildMetadata.CommitRef.StartsWith("tag") || versionComparison == VersionComparison.GreaterThan)
|
if (versionComparison == VersionComparison.Equal && App.IsProductionBuild || versionComparison == VersionComparison.GreaterThan)
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine(LOG_IDENT, $"No updates found");
|
App.Logger.WriteLine(LOG_IDENT, $"No updates found");
|
||||||
return;
|
return;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
private readonly SemaphoreSlim _semaphore = new(1, 1);
|
private readonly SemaphoreSlim _semaphore = new(1, 1);
|
||||||
private FileStream? _filestream;
|
private FileStream? _filestream;
|
||||||
|
|
||||||
public readonly List<string> Backlog = new();
|
public readonly List<string> History = new();
|
||||||
public bool Initialized = false;
|
public bool Initialized = false;
|
||||||
public bool NoWriteMode = false;
|
public bool NoWriteMode = false;
|
||||||
public string? FileLocation;
|
public string? FileLocation;
|
||||||
@ -55,7 +55,7 @@
|
|||||||
WriteLine(LOG_IDENT, $"Failed to initialize because Bloxstrap cannot write to {directory}");
|
WriteLine(LOG_IDENT, $"Failed to initialize because Bloxstrap cannot write to {directory}");
|
||||||
|
|
||||||
Frontend.ShowMessageBox(
|
Frontend.ShowMessageBox(
|
||||||
String.Format(Resources.Strings.Logger_NoWriteMode, directory),
|
String.Format(Strings.Logger_NoWriteMode, directory),
|
||||||
System.Windows.MessageBoxImage.Warning,
|
System.Windows.MessageBoxImage.Warning,
|
||||||
System.Windows.MessageBoxButton.OK
|
System.Windows.MessageBoxButton.OK
|
||||||
);
|
);
|
||||||
@ -68,8 +68,8 @@
|
|||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
|
|
||||||
if (Backlog.Count > 0)
|
if (History.Count > 0)
|
||||||
WriteToLog(string.Join("\r\n", Backlog));
|
WriteToLog(string.Join("\r\n", History));
|
||||||
|
|
||||||
WriteLine(LOG_IDENT, "Finished initializing!");
|
WriteLine(LOG_IDENT, "Finished initializing!");
|
||||||
|
|
||||||
@ -102,10 +102,12 @@
|
|||||||
{
|
{
|
||||||
string timestamp = DateTime.UtcNow.ToString("s") + "Z";
|
string timestamp = DateTime.UtcNow.ToString("s") + "Z";
|
||||||
string outcon = $"{timestamp} {message}";
|
string outcon = $"{timestamp} {message}";
|
||||||
string outlog = outcon.Replace(Paths.UserProfile, "%UserProfile%");
|
string outlog = outcon.Replace(Paths.UserProfile, "%UserProfile%", StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
|
||||||
Debug.WriteLine(outcon);
|
Debug.WriteLine(outcon);
|
||||||
WriteToLog(outlog);
|
WriteToLog(outlog);
|
||||||
|
|
||||||
|
History.Add(outlog);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteLine(string identifier, string message) => WriteLine($"[{identifier}] {message}");
|
public void WriteLine(string identifier, string message) => WriteLine($"[{identifier}] {message}");
|
||||||
@ -122,10 +124,7 @@
|
|||||||
private async void WriteToLog(string message)
|
private async void WriteToLog(string message)
|
||||||
{
|
{
|
||||||
if (!Initialized)
|
if (!Initialized)
|
||||||
{
|
|
||||||
Backlog.Add(message);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
using System.Media;
|
using System.Media;
|
||||||
|
using System.Web;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
|
||||||
using Windows.Win32;
|
using Windows.Win32;
|
||||||
using Windows.Win32.Foundation;
|
using Windows.Win32.Foundation;
|
||||||
|
|
||||||
using Bloxstrap.Resources;
|
|
||||||
|
|
||||||
namespace Bloxstrap.UI.Elements.Dialogs
|
namespace Bloxstrap.UI.Elements.Dialogs
|
||||||
{
|
{
|
||||||
// hmm... do i use MVVM for this?
|
// hmm... do i use MVVM for this?
|
||||||
@ -26,10 +24,20 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
if (!App.Logger.Initialized)
|
if (!App.Logger.Initialized)
|
||||||
LocateLogFileButton.Content = Strings.Dialog_Exception_CopyLogContents;
|
LocateLogFileButton.Content = Strings.Dialog_Exception_CopyLogContents;
|
||||||
|
|
||||||
string helpMessage = String.Format(Strings.Dialog_Exception_Info_2, "https://github.com/pizzaboxer/bloxstrap/wiki", "https://github.com/pizzaboxer/bloxstrap/issues/new?template=bug_report.yaml");
|
string repoUrl = $"https://github.com/{App.ProjectRepository}";
|
||||||
|
string wikiUrl = $"{repoUrl}/wiki";
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(App.BuildMetadata.CommitHash))
|
string issueUrl = String.Format(
|
||||||
helpMessage = String.Format(Strings.Dialog_Exception_Info_2_Alt, "https://github.com/pizzaboxer/bloxstrap/wiki");
|
"{0}/issues/new?template=bug_report.yaml&title={1}&what-happened={2}",
|
||||||
|
repoUrl,
|
||||||
|
HttpUtility.UrlEncode($"[BUG] {exception.GetType()}: {exception.Message}"),
|
||||||
|
HttpUtility.UrlEncode($"Log:\n```\n{String.Join('\n', App.Logger.History)}\n```")
|
||||||
|
);
|
||||||
|
|
||||||
|
string helpMessage = String.Format(Strings.Dialog_Exception_Info_2, wikiUrl, issueUrl);
|
||||||
|
|
||||||
|
if (!App.IsActionBuild && !App.BuildMetadata.Machine.Contains("pizzaboxer", StringComparison.Ordinal))
|
||||||
|
helpMessage = String.Format(Strings.Dialog_Exception_Info_2_Alt, wikiUrl);
|
||||||
|
|
||||||
HelpMessageMDTextBlock.MarkdownText = helpMessage;
|
HelpMessageMDTextBlock.MarkdownText = helpMessage;
|
||||||
|
|
||||||
@ -38,7 +46,7 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
if (App.Logger.Initialized)
|
if (App.Logger.Initialized)
|
||||||
Process.Start("explorer.exe", $"/select,\"{App.Logger.FileLocation}\"");
|
Process.Start("explorer.exe", $"/select,\"{App.Logger.FileLocation}\"");
|
||||||
else
|
else
|
||||||
Clipboard.SetDataObject(String.Join("\r\n", App.Logger.Backlog));
|
Clipboard.SetDataObject(String.Join("\r\n", App.Logger.History));
|
||||||
};
|
};
|
||||||
|
|
||||||
CloseButton.Click += delegate
|
CloseButton.Click += delegate
|
||||||
|
@ -11,7 +11,7 @@ namespace Bloxstrap.UI.ViewModels.Settings
|
|||||||
public string BuildTimestamp => BuildMetadata.Timestamp.ToFriendlyString();
|
public string BuildTimestamp => BuildMetadata.Timestamp.ToFriendlyString();
|
||||||
public string BuildCommitHashUrl => $"https://github.com/{App.ProjectRepository}/commit/{BuildMetadata.CommitHash}";
|
public string BuildCommitHashUrl => $"https://github.com/{App.ProjectRepository}/commit/{BuildMetadata.CommitHash}";
|
||||||
|
|
||||||
public Visibility BuildInformationVisibility => BuildMetadata.CommitRef.StartsWith("tag") ? Visibility.Collapsed : Visibility.Visible;
|
public Visibility BuildInformationVisibility => App.IsProductionBuild ? Visibility.Collapsed : Visibility.Visible;
|
||||||
public Visibility BuildCommitVisibility => string.IsNullOrEmpty(BuildMetadata.CommitHash) ? Visibility.Collapsed : Visibility.Visible;
|
public Visibility BuildCommitVisibility => App.IsActionBuild ? Visibility.Visible : Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user