• R/O
  • SSH
  • HTTPS

ewatch: Commit


Commit MetaInfo

Revision98 (tree)
Zeit2019-02-27 21:36:39
Autorbananajinn

Log Message

読もうとしたイベントログが空っぽの時に InvalidOperationException で落ちてしまうのを回避

Ändern Zusammenfassung

Diff

--- trunk/EWatch/EWatch/Properties/AssemblyInfo.cs (revision 97)
+++ trunk/EWatch/EWatch/Properties/AssemblyInfo.cs (revision 98)
@@ -28,6 +28,6 @@
2828 //
2929 // You can specify all the values or you can use the default the Revision and
3030 // Build Numbers by using the '*' as shown below:
31-[assembly: AssemblyVersion("1.0.28")]
31+[assembly: AssemblyVersion("1.0.29")]
3232
3333 //[assembly: log4net.Config.XmlConfigurator(ConfigFile=@"Log4net.Config.xml", Watch=true)]
\ No newline at end of file
--- trunk/EWatch/EWatch/Watchers/EventLogWatcher.cs (revision 97)
+++ trunk/EWatch/EWatch/Watchers/EventLogWatcher.cs (revision 98)
@@ -32,17 +32,27 @@
3232 public override void Watch()
3333 {
3434 using (var reader = new EventLogReader(name)) {
35+
3536 if (bookmark != null) {
3637 reader.Seek(bookmark, 1);
3738 } else {
3839 reader.Seek(System.IO.SeekOrigin.End, 0);
39- var record = reader.ReadEvent();
40- if(record != null)
41- bookmark = record.Bookmark;
40+ try {
41+ var record = reader.ReadEvent();
42+ if(record != null)
43+ bookmark = record.Bookmark;
44+ } catch(InvalidOperationException){
45+ /* EOF(empty?) */
46+ }
4247 }
4348
4449 while (true) {
45- var record = reader.ReadEvent();
50+ EventRecord record = null;
51+ try {
52+ record = reader.ReadEvent();
53+ } catch(InvalidOperationException){
54+ /* EOF(empty?) */
55+ }
4656 if (record == null)
4757 break;
4858 bookmark = record.Bookmark;
--- trunk/EWatch/EWatchCLI/Properties/AssemblyInfo.cs (revision 97)
+++ trunk/EWatch/EWatchCLI/Properties/AssemblyInfo.cs (revision 98)
@@ -28,4 +28,4 @@
2828 //
2929 // You can specify all the values or you can use the default the Revision and
3030 // Build Numbers by using the '*' as shown below:
31-[assembly: AssemblyVersion("1.0.28")]
31+[assembly: AssemblyVersion("1.0.29")]
--- trunk/EWatch/EWatchUI/Properties/AssemblyInfo.cs (revision 97)
+++ trunk/EWatch/EWatchUI/Properties/AssemblyInfo.cs (revision 98)
@@ -28,4 +28,4 @@
2828 //
2929 // You can specify all the values or you can use the default the Revision and
3030 // Build Numbers by using the '*' as shown below:
31-[assembly: AssemblyVersion("1.0.28")]
31+[assembly: AssemblyVersion("1.0.29")]
--- trunk/EWatch/EWatchView/Properties/AssemblyInfo.cs (revision 97)
+++ trunk/EWatch/EWatchView/Properties/AssemblyInfo.cs (revision 98)
@@ -28,4 +28,4 @@
2828 //
2929 // You can specify all the values or you can use the default the Revision and
3030 // Build Numbers by using the '*' as shown below:
31-[assembly: AssemblyVersion("1.0.28")]
31+[assembly: AssemblyVersion("1.0.29")]
Show on old repository browser