Skip to content

Commit

Permalink
Code optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-manuel committed Jul 19, 2024
1 parent 10b220f commit 0dd6c9d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

## v1.0.5.1

* Added: Show with cursor change that the `Index` column cannot be changed
* Changed: Code optimizations
* Changed: Fixed the problem when inserting the timestamp with `CTRL + V`
* Changed: Fixed a bug introduced with `v1.0.5.0` that cell formatting (colors/styles) where not shown anymore

## v1.0.5.0
Expand Down
3 changes: 2 additions & 1 deletion LoxStatDataPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public override string ToString()
{
try
{
return string.Format("{0}[{1}]", LoxStatFile, Index);
//return string.Format("{0}[{1}]", LoxStatFile, Index);
return string.Format("{0} {1}", "Index", Index);
}
catch (Exception ex)
{
Expand Down
18 changes: 10 additions & 8 deletions MsFileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ public static IList<MsFileInfo> Load(Uri uri)
int.TryParse(groups[1].Value, out int size);

DateTime dateTime;
if (DateTime.TryParseExact(groups[2].Value.Replace(" ", " "), "MMM dd HH:mm",
CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) ;
else if (DateTime.TryParseExact(groups[2].Value.Replace(" ", " "), "MMM dd yyyy",
CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) ;
else if (DateTime.TryParseExact(groups[2].Value.Replace(" ", " "), "MMM d HH:mm",
CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) ;
else if (DateTime.TryParseExact(groups[2].Value.Replace(" ", " "), "MMM d yyyy",
CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) ;
string dateString = Regex.Replace(groups[2].Value, @"\s+", " ");
string[] formats = { "MMM dd HH:mm", "MMM dd yyyy", "MMM d HH:mm", "MMM d yyyy" };

if (!DateTime.TryParseExact(dateString, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
{
// Handle the case where none of the formats match
MessageBox.Show($"The date \"{dateString}\" could not be matched with one of the following formats:\n{string.Join("\n", formats)}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

return null;
}

var fileName = groups[3].Value;

Expand Down

0 comments on commit 0dd6c9d

Please sign in to comment.