/// <summary> /// 得到某个Node /// </summary> /// <param name="fileName"></param> /// <param name="path"></param> /// <param name="name"></param> /// <returns></returns> public XmlNode ReadNodeFromNodeListByNodeAttr(XmlNodeList nodeList, string attrName, string attrValue) { try { foreach (XmlNode xn in nodeList) { if (attrName == "") { return(null); } string factAttr = NodeAtt(xn, attrName); if (factAttr != "") { if (factAttr.Equals(attrValue)) { return(xn); } } } return(null); } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "读取xml出错" + exception.ToString()); } return(null); }
/// <summary> /// Writes Logs to log4net library. /// </summary> /// <param name="logEntry">The log entry.</param> private void LogToLog4Net(IAppLog logEntry) { string msg = logEntry.AppLogTypeID.ToString(); log4netLogger.Info(msg); //switch (logEntry.LogType) //{ // case LogTypeEnum.Info: // log4netLogger.Info(logEntry.Message); // break; // case LogTypeEnum.Fatal: // log4netLogger.Fatal(logEntry.Message); // break; // case LogTypeEnum.Error: // if (logEntry.ExceptionClass == null) // log4netLogger.Error(logEntry.Message + "\r\n----\r\n" + logEntry.StackTrace); // else // log4netLogger.Error(logEntry.Message, logEntry.ExceptionClass); // break; // case LogTypeEnum.Warn: // log4netLogger.Warn(logEntry.Message); // break; // case LogTypeEnum.Debug: // log4netLogger.Debug(logEntry.Message); // break; // default: // break; //} }
/// <summary> /// 得到某个Node /// </summary> /// <param name="fileName"></param> /// <param name="path"></param> /// <param name="name"></param> /// <returns></returns> public XmlNode ReadNodeFromNodeListByNodeName(XmlNodeList nodeList, string nodeName) { try { foreach (XmlNode xn in nodeList) { if (nodeName == "") { return(xn); } if (nodeName.Equals(xn.Name)) { return(xn); } } return(null); } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "读取xml出错" + exception.ToString()); } return(null); }
/// <summary> /// 读取某个文件某个路径下的某个属性值 /// </summary> /// <param name="fileName"></param> /// <param name="path"></param> /// <param name="name"></param> /// <returns></returns> public string ReadAttrFromFile(string fileName, string path, string name) { string XMLFileName = System.AppDomain.CurrentDomain.BaseDirectory + @"config\" + fileName; try { XmlDocument xd = new System.Xml.XmlDocument(); xd.Load(XMLFileName); foreach (XmlNode xn in xd.SelectNodes(path)) { if (name == "") { return(""); } string attrName = NodeAtt(xn, name); if (attrName != "") { return(attrName); } } return(null); } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "读取!" + fileName + "出错" + exception.ToString()); } return(null); }
// AppLog is always first service added so other services can log initialization errors public static ServiceManager Instantiate(IAppLog appLog) { if (GameServices != null) { throw new System.Exception("Trying to instantiate ServiceManager more than once"); } GameServices = new ServiceManager(appLog); return((ServiceManager)GameServices); }
public DownloadExpression(IAppLog appLog, IPageParser parser, IAppController appController, IFileDownloader downloader, IComicPath comicPath, IFileProxy file, IWebClientProxy webClient, IAppSettings appSettings, IComicStore comicStore) : base(appLog, webClient) { this.parser = parser; this.comicStore = comicStore; this.appSettings = appSettings; this.file = file; this.comicPath = comicPath; this.downloader = downloader; this.appController = appController; }
void Awake() { appLog_ = ServiceManager.GameServices.GetAppLog(); gameManager_ = ServiceManager.GameServices.GetGameManager(); appLog_.LogInfo("Splash.Awake"); PanelContent.SetActive(false); appLog_.LogInfo("Splash: Initializing FB, first try"); facebook_.Initialize(OnFacebookInitialized); }
static AppLogProxy() { instance_AppLog = new AppLog(); //启动日志定时保存服务 alss = new AppLogSaveService(); ThreadStart threadStartForAppLogSaveService = new ThreadStart(alss.StartService); threadForAppLogSaveService = new Thread(threadStartForAppLogSaveService); threadForAppLogSaveService.IsBackground = true; threadForAppLogSaveService.Start(); }
public MainPresenter(IAppController appController, IUiThread uiThread, IComicStore comicStore, IAppLog appLog, IComicViewModelMapper mapper, IComicPath comicPath, IDirectoryProxy directory, IUserSettings settings, IAppInfo appInfo, IAppSettings appSettings) { this.appController = appController; this.appSettings = appSettings; this.appInfo = appInfo; this.settings = settings; this.directory = directory; this.comicPath = comicPath; this.mapper = mapper; this.appLog = appLog; this.comicStore = comicStore; this.uiThread = uiThread; }
public void UpdateBySql(string sqlUpdate) { try { System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(sqlUpdate, managerDB.OpenApp()); command.CommandType = System.Data.CommandType.Text; command.ExecuteNonQuery(); } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "更新数据出错!" + exception.ToString()); } }
public object ScalarBySql(string sql) { object dr = null; try { System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(sql, managerDB.OpenApp()); dr = command.ExecuteScalar(); } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "查询数据出错!" + exception.ToString()); } return(dr); }
/// <summary> /// 根据条件(传入的DataSet)查询数据 /// </summary> /// <param name="ds"></param> /// <returns></returns> public DataSet SelectByCondition(String table, string where) { DataSet ds = new DataSet(); try { string querySql = table + where; System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(querySql, managerDB.OpenApp()); adapter.Fill(ds, table); } catch (System.Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "查询数据表" + table + "出错!" + exception.ToString()); } return(ds); }
public void UpdateByProcedure(string procedureName, System.Data.OleDb.OleDbParameter[] sqlParameter) { try { System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(procedureName, managerDB.OpenApp()); command.CommandType = System.Data.CommandType.StoredProcedure; for (int i = 0; i < sqlParameter.Length; i++) { command.Parameters.Add(sqlParameter[i]); } command.ExecuteNonQuery(); } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "执行存储过程出错!" + exception.ToString()); } }
private void SetDefaultLogEntryProperties(IAppLog logEntry) { logEntry.InsertDate = DateTime.UtcNow; if (FWUtils.ConfigUtils.IsInWebContext()) { if (string.IsNullOrEmpty(logEntry.IPAddress)) { logEntry.IPAddress = FWUtils.WebUIUtils.GetRequestIPAddress(); } } if (logEntry.UserID.HasValue == false) { if (FWUtils.SecurityUtils.IsUserAuthenticated()) { logEntry.UserID = FWUtils.SecurityUtils.GetCurrentUserIDLong(); } } }
/// <summary> /// 得到某个Node下所有的NodeList /// </summary> /// <param name="fileName"></param> /// <param name="path"></param> /// <param name="name"></param> /// <returns></returns> public XmlNodeList ReadNodeListFromNode(XmlNode node) { try { if (node.HasChildNodes == false) { return(null); } else { return(node.ChildNodes); } } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "根据Node得NodeList出错!" + exception.ToString()); } return(null); }
public System.Data.OleDb.OleDbDataReader SelectByProcedure(string procedureName, System.Data.SqlClient.SqlParameter[] sqlParameter) { System.Data.OleDb.OleDbDataReader dr = null; try { System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(procedureName, managerDB.OpenApp()); command.CommandType = System.Data.CommandType.StoredProcedure; for (int i = 0; i < sqlParameter.Length; i++) { command.Parameters.Add(sqlParameter[i]); } dr = command.ExecuteReader(); } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "执行存储过程" + procedureName + "查询数据出错!" + exception.ToString()); } return(dr); }
/// <summary> /// 得到NodeList /// </summary> /// <param name="fileName"></param> /// <param name="path"></param> /// <param name="name"></param> /// <returns></returns> public XmlNodeList ReadNodeListFromFile(string fileName, string path) { string XMLFileName = System.AppDomain.CurrentDomain.BaseDirectory + @"config\" + fileName; try { XmlDocument xd = new System.Xml.XmlDocument(); xd.Load(XMLFileName); System.Xml.XmlNode nodeFirst = xd.SelectSingleNode(path); System.Xml.XmlNodeList nodeList = nodeFirst.ChildNodes; return(nodeList); } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "读取!" + fileName + "出错" + exception.ToString()); } return(null); }
/// <summary> /// 取得数据库连接 /// </summary> override public System.Data.OleDb.OleDbConnection OpenApp() { string connectStr = null; try { if (connect == null) { connectStr = "Provider=MSDAORA;User ID=" + this.ServerApplicationUserID + ";Data Source=" + this.ServerApplicationDB + ";Password="******"连接SqlServer数据库失败!连接字符串:" + connectStr + exception.ToString()); } return(connect); }
public void WriteLogTest() { Logger target = FWUtils.ExpLogUtils.Logger; IAppLog logEntry = (IAppLog)EntityFactory.GetEntityObject(AppLog.EntityName, GetSourceTypeEnum.Table); logEntry.AppLogTypeID = -1000; logEntry.ExtraGuid = Guid.NewGuid(); logEntry.ExtraDouble = TestUtils.RandomUtils.RandomDouble(); logEntry.ExtraString1 = TestUtils.RandomUtils.RandomStringMaxLength(50, null); logEntry.ExtraString2 = TestUtils.RandomUtils.RandomStringMaxLength(50, null); bool expected = true; bool actual; actual = target.WriteLog(logEntry); Assert.AreEqual(expected, actual); FilterExpression filter = new FilterExpression(new Filter(AppLog.ColumnNames.ExtraGuid, logEntry.ExtraGuid)); IServiceBase logService = EntityFactory.GetEntityServiceByName(AppLog.EntityName, ""); Assert.AreEqual(1, logService.GetCount(filter)); }
public LocalizationManager(string resource) { appLog_ = ServiceManager.GameServices.GetAppLog(); var textAsset = Resources.Load <TextAsset>(resource); appLog_.LogErrorIfNull(textAsset, resource); var lines = textAsset.text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < lines.Length; ++i) { if (string.IsNullOrEmpty(lines[i])) { continue; } List <string> header = new List <string>(); var items = lines[i].Split('\t'); if (i == 0) { header.AddRange(items); for (int j = 1; j < items.Length; ++j) { string lang = header[j]; languageMap_[lang] = new Dictionary <string, string>(); } } else { string key = items[0]; for (int j = 1; j < items.Length; ++j) { string lang = header[j]; string value = items[j]; languageMap_[lang][key] = value; } } } }
/// <summary> /// 取得数据库连接 /// </summary> override public System.Data.OleDb.OleDbConnection OpenApp() { string connectStr = null; try { if (connect == null) { connectStr = "Provider=SQLOLEDB.1;Persist Security Info=True;"; connectStr += "Data Source=" + this.DbServer + "; Initial Catalog=" + this.ServerApplicationDB; connectStr += ";User ID=" + this.ServerApplicationUserID + "; Password="******"连接SqlServer数据库失败!连接字符串:" + connectStr + exception.ToString()); } return(connect); }
/// <summary> /// 读取某个节点下的某个属性值 /// </summary> /// <param name="node"></param> /// <param name="path"></param> /// <param name="name"></param> /// <returns></returns> public string ReadAttrFromPath(XmlNode node, string path, string name) { if (node.HasChildNodes == false) { string attrName = NodeAtt(node, name); if (attrName != "") { return(attrName); } else { return(""); } } try { foreach (XmlNode xn in node.SelectNodes(path)) { if (name == "") { return(""); } string attrName = NodeAtt(xn, name); if (attrName != "") { return(attrName); } } return(null); } catch (Exception exception) { IAppLog log = (IAppLog)AppLogFactory.LogProduct(); log.writeLog(this.GetType().Name, "读取!" + path + "出错" + exception.ToString()); } return(null); }
private ServiceManager(IAppLog appLog) { appLog_ = appLog; }
public Informes_PedidosManager() { _appLog = new AppLog(); }
public MatchExpression(IAppLog appLog, IWebClientProxy webClient, IPageParser parser) : base(appLog, webClient) { this.parser = parser; }
public LogController(IAppLog appLog) { _appLog = appLog; }
//#region Singleton Pattern //static readonly object padlock = new object(); //private static Logger _Instance; ///// <summary> ///// Gets the instance. ///// </summary> ///// <value> ///// The instance. ///// </value> //public static Logger Instance //{ // get // { // lock (padlock) // { // if (_Instance == null) // _Instance = new Logger(); // return _Instance; // } // } //} //#endregion //#region Properties //private ILogWriter _LogWriter; ///// <summary> ///// Gets or sets the log writer. ///// </summary> ///// <value> ///// The log writer. ///// </value> //public ILogWriter LogWriter //{ // get { return _LogWriter; } // set { _LogWriter = value; } //} //private ILogWriter _BackupLogWriter; ///// <summary> ///// Gets or sets the backup log writer. It will be used if the main log writer failed to act. ///// </summary> ///// <value> ///// The backup log writer. ///// </value> //public ILogWriter BackupLogWriter //{ // get { return _BackupLogWriter; } // set { _BackupLogWriter = value; } //} //#endregion #region Methods /// <summary> /// Writes the log. /// </summary> /// <param name="logEntry">The log entry.</param> /// <returns></returns> public bool WriteLog(IAppLog logEntry) { var appSettings = FWUtils.ConfigUtils.GetAppSettings(); if (appSettings.Log.Enabled == false) { return(false); } SetDefaultLogEntryProperties(logEntry); // first we use log4Net that is more reliable if (appSettings.Log.WriteToLog4NetEnabled) { LogToLog4Net(logEntry); } try { _AppLogService.Insert(logEntry, new InsertParameters()); } catch (Exception ex) { FWUtils.ExpLogUtils.ExceptionLogger.LogError(ex, null); } return(true); //// then we try to write on the first media, and if it was not successful, we will use the second media. //bool logWrited = false; // If the log is written or not //Exception WritingException = null; // The exception that happened in the first log writer //try //{ // if (this.LogWriter != null) // { // this.LogWriter.WriteLog(logEntry); // logWrited = true; // } //} //catch (Exception ex) //{ // logWrited = false; // FWUtils.ExceptionLogger.LogError(ex, null); //} //if (logWrited == false) // if we couldn't write on the first media //{ // if (this.BackupLogWriter != null) // { // try // { // // first we log the main log // BackupLogWriter.WriteLog(logEntry); // logWrited = true; // } // catch (Exception ex) // { // FWUtils.ExceptionLogger.LogError(ex, null); // } // } //} //return logWrited; }
public WarnExpression(IAppLog appLog) : base(appLog) { }
public LogExpression(IAppLog appLog) : base(appLog) { }
protected BaseWebExpression(IAppLog appLog, IWebClientProxy webClient) : base(appLog) { this.webClient = webClient; }