• R/O
  • SSH
  • HTTPS

ewatch: Commit


Commit MetaInfo

Revision104 (tree)
Zeit2019-10-25 19:29:20
Autorbananajinn

Log Message

非Windows環境の対応

Ändern Zusammenfassung

Diff

--- trunk/EWatch/EWatch/EWService.cs (revision 103)
+++ trunk/EWatch/EWatch/EWService.cs (revision 104)
@@ -17,6 +17,8 @@
1717 using EWatch.Watchers;
1818 using log4net;
1919 using log4net.Config;
20+using System.Security.Cryptography.X509Certificates;
21+using System.Net.Security;
2022
2123 namespace EWatch
2224 {
@@ -45,8 +47,9 @@
4547 {
4648 _instance = this;
4749 Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
48- XmlConfigurator.Configure(new FileInfo("Log4net.Config.xml"));
49- log= LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
50+ string config = File.Exists("etc/log4net.config.xml") ? "etc/log4net.config.xml" : "log4net.config.xml";
51+ XmlConfigurator.Configure(new FileInfo(config));
52+ log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
5053 }
5154
5255 protected override void OnStart(string[] args)
@@ -106,6 +109,10 @@
106109 public void Initialize()
107110 {
108111 config = new Configuration(true, ConfigFile);
112+ System.Net.ServicePointManager.ServerCertificateValidationCallback =
113+ delegate(object s, X509Certificate cert, X509Chain chain, SslPolicyErrors errors){
114+ return true;
115+ };
109116 }
110117
111118 public void StartWatch()
--- trunk/EWatch/EWatch/Watchers/WatchThread.cs (revision 103)
+++ trunk/EWatch/EWatch/Watchers/WatchThread.cs (revision 104)
@@ -73,13 +73,15 @@
7373
7474 private void CreateWatchers()
7575 {
76- watchers = new List<BaseWatcher>();
77- Dictionary<string,List<ActionTable>> eventlogs = config.EventLog;
78- foreach(string name in eventlogs.Keys){
79- BaseWatcher watcher = new EventLogWatcher(name, eventlogs[name]);
80- watchers.Add(watcher);
81- }
82- Dictionary<string,List<ActionTable>> files = config.File;
76+ watchers = new List<BaseWatcher>();
77+ if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
78+ Dictionary<string, List<ActionTable>> eventlogs = config.EventLog;
79+ foreach (string name in eventlogs.Keys) {
80+ BaseWatcher watcher = new EventLogWatcher(name, eventlogs[name]);
81+ watchers.Add(watcher);
82+ }
83+ }
84+ Dictionary<string,List<ActionTable>> files = config.File;
8385 foreach(string path in files.Keys){
8486 var fileAndEncoding = FileAndEncoding.Parse(path);
8587 BaseWatcher watcher = new FileWatcher(fileAndEncoding.File, fileAndEncoding.Encoding, files[path]);
--- trunk/EWatch/pack.bat (nonexistent)
+++ trunk/EWatch/pack.bat (revision 104)
@@ -0,0 +1,12 @@
1+set WORKDIR=pack
2+
3+rd /S /Q %WORKDIR%
4+md %WORKDIR%
5+md %WORKDIR%\EWatch
6+md %WORKDIR%\EWatch\etc
7+xcopy EWatch\bin\Release\*.dll %WORKDIR%\EWatch
8+xcopy EWatch\bin\Release\EWatch.exe %WORKDIR%\EWatch
9+xcopy EWatchCLI\bin\Release\EWatchCLI.exe %WORKDIR%\EWatch
10+xcopy EWatch\etc\notWindows\*.* %WORKDIR%\EWatch\etc
11+
12+pause
\ No newline at end of file
Show on old repository browser