Skip to content

Commit 0dd6c9d

Browse files
committed
Code optimizations
1 parent 10b220f commit 0dd6c9d

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
## v1.0.5.1
55

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

811
## v1.0.5.0

LoxStatDataPoint.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ public override string ToString()
106106
{
107107
try
108108
{
109-
return string.Format("{0}[{1}]", LoxStatFile, Index);
109+
//return string.Format("{0}[{1}]", LoxStatFile, Index);
110+
return string.Format("{0} {1}", "Index", Index);
110111
}
111112
catch (Exception ex)
112113
{

MsFileInfo.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ public static IList<MsFileInfo> Load(Uri uri)
4646
int.TryParse(groups[1].Value, out int size);
4747

4848
DateTime dateTime;
49-
if (DateTime.TryParseExact(groups[2].Value.Replace(" ", " "), "MMM dd HH:mm",
50-
CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) ;
51-
else if (DateTime.TryParseExact(groups[2].Value.Replace(" ", " "), "MMM dd yyyy",
52-
CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) ;
53-
else if (DateTime.TryParseExact(groups[2].Value.Replace(" ", " "), "MMM d HH:mm",
54-
CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) ;
55-
else if (DateTime.TryParseExact(groups[2].Value.Replace(" ", " "), "MMM d yyyy",
56-
CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) ;
49+
string dateString = Regex.Replace(groups[2].Value, @"\s+", " ");
50+
string[] formats = { "MMM dd HH:mm", "MMM dd yyyy", "MMM d HH:mm", "MMM d yyyy" };
51+
52+
if (!DateTime.TryParseExact(dateString, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
53+
{
54+
// Handle the case where none of the formats match
55+
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);
56+
57+
return null;
58+
}
5759

5860
var fileName = groups[3].Value;
5961

0 commit comments

Comments
 (0)