codesharpdev / ncrontab

Automatically exported from code.google.com/p/ncrontab
Apache License 2.0
0 stars 0 forks source link

Method NCrontabViewer.MainForm.Diff does not work with DateTime-Strings of specific locales #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The current release implementation (version 0.2) of 
NCrontabViewer.MainForm.Diff does not work with DateTime-Strings of specific 
locales. Example: try to use the application on a computer with German locale. 
Reason: the length of the short weekday name is just 2 (not 3).

Possible workaround:

Change line 138 of MainForm.cs to
var timeString = occurance.ToString("ddd dd, MMM yyyy HH:mm", 
CultureInfo.InvariantCulture);

http://code.google.com/p/ncrontab/source/browse/tags/0.2/src/NCrontabViewer/Main
Form.cs#138

Original issue reported on code.google.com by niklas.e...@gmail.com on 26 Jan 2011 at 10:20

GoogleCodeExporter commented 9 years ago
I tested in a German culture and I get the error shown below. Is this what you 
are seeing and mean by it not working in a culture where weekday names are not 
3 charaters wide?

System.ArgumentOutOfRangeException: Index was out of range. Must be 
non-negative and less than the size of the collection.
Parameter name: startIndex
   at System.Text.StringBuilder.Append(String value, Int32 startIndex, Int32 count)
   at NCrontabViewer.MainForm.Diff(String oldString, String newString, Int32 index, Int32 length, StringBuilder builder) in c:\ncrontab-0.2\src\NCrontabViewer\MainForm.cs:line 189
   at NCrontabViewer.MainForm.DoCrontabbingImpl() in c:\ncrontab-0.2\src\NCrontabViewer\MainForm.cs:line 167
   at NCrontabViewer.MainForm.DoCrontabbing() in c:\ncrontab-0.2\src\NCrontabViewer\MainForm.cs:line 78
   at NCrontabViewer.MainForm.Timer_Tick(Object sender, EventArgs args) in c:\ncrontab-0.2\src\NCrontabViewer\MainForm.cs:line 68
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Original comment by azizatif on 26 Jan 2011 at 9:49

GoogleCodeExporter commented 9 years ago
Exactly!

Original comment by niklas.e...@gmail.com on 27 Jan 2011 at 8:45

GoogleCodeExporter commented 9 years ago

Original comment by azizatif on 28 Jan 2011 at 10:23