public static DateTime?ToDateTime(string value) { try { if (string.IsNullOrEmpty(value)) { return(null); } return(Convert.ToDateTime(value)); } catch (Exception ex) { LogContent logContent = new LogContent { SourceType = "ConvertHelper", Action = "ToDateTime", CreateBy = "ConvertHelper", Message = ex.Message, RequestUrl = string.Format("Convert {0} to datetime object failed.", value), StackTrace = ex.ToString() }; LogUnity.Error(logContent); } try { return(ToDateTime(value, "zh-sg")); } catch (Exception ex) { LogContent logContent = new LogContent { SourceType = "ConvertHelper", Action = "ToDateTime", CreateBy = "ConvertHelper", Message = ex.Message, RequestUrl = string.Format("Convert {0} to datetime object failed, by cultrue zh-sg.", value), StackTrace = ex.ToString() }; LogUnity.Error(logContent); } return(null); }
private void Awake() { Data = GetComponent <MoveUnitData>(); if (!Data) { enabled = false; return; } TakeDamage taken = GetComponent <TakeDamage>(); if (taken) { taken.Damage += GetDamage; } damageBehaviour = GetComponent <DamageBehaviour>(); InitFSM(); if (UseLog) { LogUnity.Add(fsm); } }
public static DateTime ToDateTimeExtract(String value, String format = "dd/MM/yyyy") { try { return(DateTime.ParseExact(value, format, CultureInfo.InvariantCulture)); } catch (Exception exception) { LogContent logContent = new LogContent { SourceType = "ConvertHelper", Action = "ToDateTimeExtract", CreateBy = "ConvertHelper", Message = exception.Message, RequestUrl = string.Format("Convert {0} to datetime object failed.", value), StackTrace = exception.ToString() }; LogUnity.Error(logContent); throw; } }