コード例 #1
0
ファイル: FLoggerListener.cs プロジェクト: whztt07/MoCross
 //============================================================
 // <T>格式化。</T>
 //
 // @param buffer 字符串对象
 // @param level 级别
 //============================================================
 public virtual void Format(FString format, ELoggerLevel level, object refer, string method, Exception exception, string message, object[] parameters)
 {
     // 追加时间
     format += RDate.Format(_dateFormat) + ' ';
     // 追加级别
     AppendLevel(format, level);
     // 追加线程编号
     format += ':' + Thread.CurrentThread.ManagedThreadId.ToString("X2");
     // 追加函数信息
     if (refer is Type)
     {
         format += "-<static> [";
         format += ((Type)refer).Name + '.' + method;
     }
     else
     {
         format += "-" + refer.GetHashCode().ToString("X8") + " [";
         format += refer.GetType().Name + '.' + method;
     }
     format.AppendRepeat(' ', LOGGER_SPACE - format.Length);
     format += "] ";
     // 追加信息内容
     if (null != parameters)
     {
         format += String.Format(message, parameters);
     }
     // 追加例外内容
     if (null != exception)
     {
         format.AppendLine();
         RException.MakeMessage(format, exception);
     }
 }
コード例 #2
0
ファイル: FLoggerListener.cs プロジェクト: whztt07/MoCross
 //============================================================
 // <T>格式化。</T>
 //
 // @param buffer 字符串对象
 // @param level 级别
 //============================================================
 public virtual void FormatMessage(FString format, ELoggerLevel level, object refer, string method, Exception exception, string message, object[] parameters)
 {
     // 追加函数信息
     format += "[";
     if (refer is Type)
     {
         format += ((Type)refer).Name + '.' + method;
     }
     else
     {
         format += refer.GetType().Name + '.' + method;
         if (refer != null)
         {
             format += '@' + refer.GetHashCode().ToString("6X").ToUpper();
         }
     }
     format.AppendRepeat(' ', METHOD_SPACE - format.Length);
     format += "] ";
     // 追加信息内容
     if (null != parameters)
     {
         format += String.Format(message, parameters);
     }
     // 追加例外内容
     if (null != exception)
     {
         format.AppendLine();
         RException.MakeMessage(format, exception);
     }
 }
コード例 #3
0
 public static string AssemblyVersion(this Project conf)
 {
     string s = $"{conf.versionMajor}.{conf.versionMinor}";
     try
     {
         if (conf.versionState.ToEnum<VersionState>() == VersionState.alpha)
             s = $"{s}a";
         if (conf.versionState.ToEnum<VersionState>() == VersionState.beta)
             s = $"{s}b";
         if (conf.versionState.ToEnum<VersionState>() == VersionState.gamma)
             s = $"{s}g";
         if (conf.versionState.ToEnum<VersionState>() == VersionState.prerelease)
             s = $"{s}pre";
         if (conf.versionState.ToEnum<VersionState>() == VersionState.release)
             s = $"{s}r";
         s = $"{s}{conf.versionRef}";
     }
     catch
     {
         var d = (IDictionary<string, string>)new Dictionary<string, string>();
         d.Add("Project State", $"§9ACTIVE§f");
         var e = new RException<String, String>("Prop 'versionState' is not valid, check list 'VersionState.yaml'", d);
         Terminal.WriteLine(e);
     }
     return s;
 }