예제 #1
0
 public string WriteString(stCore.IMessage iLog = null)
 {
     if (this._rss == null)
     {
         return(String.Empty);
     }
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof(RSSFeedRoot));
         using (StringWriter sw = new StringWriter())
         {
             using (XmlWriter xw = XmlWriter.Create(sw, new XmlWriterSettings()
             {
                 Encoding = new UTF8Encoding(false),
                 Indent = true,
                 NewLineOnAttributes = true,
             })
                    )
             {
                 serializer.Serialize(xw, this._rss);
                 return(sw.ToString());
             }
         }
     }
     catch (Exception e)
     {
         if (iLog != null)
         {
             iLog.LogError(e.Message);
         }
     }
     return(String.Empty);
 }
예제 #2
0
 public SysLog(string name, string evname, stCore.IMessage iMsg)
     : base()
 {
     this._SysLog(
         name,
         evname,
         iMsg
         );
 }
예제 #3
0
 public SysLog(stCore.IMessage iMsg)
     : base()
 {
     this._SysLog(
         null,
         null,
         iMsg
         );
 }
예제 #4
0
        private void _SysLog(string name, string evname, stCore.IMessage iMsg)
        {
            this.InitAttrDefaults();

            this.appName = ((string.IsNullOrWhiteSpace(name)) ? this.appName : name);
            this.evName  = ((string.IsNullOrWhiteSpace(evname)) ? this.evName : evname);
            this.IMsg    = ((iMsg == null) ? (new stCore.IMessage()) : iMsg);
            this.Start();
        }
예제 #5
0
 public static void Error(Exception ex, stCore.IMessage iLog)
 {
     if (iLog != null)
     {
         iLog.LogError(ex.Message);
         return;
     }
     else
     {
         throw ex;
     }
 }
예제 #6
0
 public static void ErrorToLog(stCore.IMessage iMsg)
 {
     foreach (string toLog in (List <string>)stLog.UnhandledExcept.UList)
     {
         if (!string.IsNullOrWhiteSpace(toLog))
         {
             iMsg.Log(toLog);
         }
     }
     stLog.UnhandledExcept.UList.Clear();
     stLog.UnhandledExcept.UList = null;
 }
예제 #7
0
 public static void Error(string err, stCore.IMessage iLog)
 {
     err = ((string.IsNullOrWhiteSpace(err)) ? "-nonrecoverable errors-" : err);
     if (iLog != null)
     {
         iLog.LogError(err);
         return;
     }
     else
     {
         throw new ArgumentException(err);
     }
 }
예제 #8
0
        private void _GeoFilter(Action <int, int, int, string, bool> pb, bool loaddb, stCore.IMessage ilog)
        {
            this._iLog      = ((ilog == null) ? new stCore.IMessage() : ilog);
            this._geobase   = new List <stGeoRange>();
            this._dbwatcher = new FileSystemWatcher();
            this._dbwatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime | NotifyFilters.Size | NotifyFilters.FileName;
            this._loadgeobase            = loaddb;

            if (pb != null)
            {
                this._iLog.ProgressBar = pb;
            }
            MaxMindUtil.iMsg = this._iLog;
        }
예제 #9
0
 public bool WriteStream(Stream stm, stCore.IMessage iLog = null)
 {
     if (this._rss == null)
     {
         return(false);
     }
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof(RSSFeedRoot));
         serializer.Serialize(stm, this._rss);
         return(true);
     }
     catch (Exception e)
     {
         if (iLog != null)
         {
             iLog.LogError(e.Message);
         }
         return(false);
     }
 }
예제 #10
0
        private void _Init(string dbname, string dbopt, string key, string clantag, string curlexe, string rootpath, stCore.IMessage ilog, bool isnotify)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(dbname))
                {
                    dbname = CoCAPI._dbName;
                }
                this._ilog     = ilog;
                this._key      = key;
                this._clantag  = clantag;
                this._curlexe  = curlexe;
                this._rootpath = ((string.IsNullOrWhiteSpace(rootpath)) ?
                                  stCore.IOBaseAssembly.BaseDataDir() : rootpath
                                  );
                this._dbm = new stSqlite.Wrapper(dbname, dbopt);
                if (this._dbm == null)
                {
                    throw new ArgumentNullException(
                              string.Format(
                                  Properties.Resources.CoCInitError, typeof(stSqlite.Wrapper).Name, 0
                                  )
                              );
                }
                this._dbm.RegisterFunction(typeof(SelectLeagueIcoFunction));
                this._dbm.RegisterFunction(typeof(SelectBadgeIcoFunction));
                this._dbm.RegisterFunction(typeof(SelectFlagIcoFunction));
                this._dbm.RegisterFunction(typeof(ComputePasswordHashFunction));

                this._cocProcess = new stCoCAPI.CoCAPI.CoCProcess(this);
                if (this._cocProcess == null)
                {
                    throw new ArgumentNullException(
                              string.Format(
                                  Properties.Resources.CoCInitError, typeof(CoCProcess).Name, 1
                                  )
                              );
                }
                this._cocProcess.CheckTable();

                this._cocInformer = new stCoCAPI.CoCAPI.CoCInformer(this);
                if (this._cocInformer == null)
                {
                    throw new ArgumentNullException(
                              string.Format(
                                  Properties.Resources.CoCInitError, typeof(CoCInformer).Name, 2
                                  )
                              );
                }

                if (isnotify)
                {
                    this._cocRrd = new CoCRrd(this);
                    if (this._cocRrd == null)
                    {
                        throw new ArgumentNullException(
                                  string.Format(
                                      Properties.Resources.CoCInitError, typeof(CoCRrd).Name, 3
                                      )
                                  );
                    }
                    this._cocNotifier = new CoCNotify(this);
                    if (this._cocNotifier == null)
                    {
                        throw new ArgumentNullException(
                                  string.Format(
                                      Properties.Resources.CoCInitError, typeof(CoCNotify).Name, 4
                                      )
                                  );
                    }
                }

#if DEBUG_PRNTABLE
                DataTable dt1 = this._dbm.Query("SELECT * FROM clanwar");
                dt1.DataTableToPrint();
#endif
            }
            catch (Exception e)
            {
                stCore.LogException.Error(e, this._ilog);
                return;
            }
        }
예제 #11
0
 public CoCAPI(string dbname, string dbopt, string key, string clantag, string curlexe, string rootpath, stCore.IMessage ilog, bool isnotify = true)
 {
     this._Init(dbname, dbopt, key, clantag, curlexe, rootpath, ilog, isnotify);
 }
예제 #12
0
 public CoCAPI(string dbname, string dbopt, string key, stCore.IMessage ilog, bool isnotify = true)
 {
     this._Init(dbname, dbopt, key, null, null, null, ilog, isnotify);
 }
예제 #13
0
 public GeoFilter(stCore.IMessage ilog, bool loaddb = true)
 {
     this._GeoFilter(null, loaddb, ilog);
 }