Block | Unblock | UserUpdate | Deleted | ListCreated | ListUpdated | Unfollow),
}
+ public static string GetErrorLogPath()
+ {
+ return Path.Combine(Path.GetDirectoryName(MyCommon.EntryAssembly.Location), "ErrorLogs");
+ }
+
public static void TraceOut(Exception ex, string Message)
{
var buf = ExceptionOutMessage(ex);
lock (LockObj)
{
if (!OutputFlag) return;
+
+ var logPath = MyCommon.GetErrorLogPath();
+ if (!Directory.Exists(logPath))
+ Directory.CreateDirectory(logPath);
+
var now = DateTime.Now;
var fileName = string.Format("{0}Trace-{1:0000}{2:00}{3:00}-{4:00}{5:00}{6:00}.log", GetAssemblyName(), now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
+ fileName = Path.Combine(logPath, fileName);
using (var writer = new StreamWriter(fileName))
{
lock (LockObj)
{
var IsTerminatePermission = true;
+
+ var logPath = MyCommon.GetErrorLogPath();
+ if (!Directory.Exists(logPath))
+ Directory.CreateDirectory(logPath);
+
var now = DateTime.Now;
var fileName = string.Format("{0}-{1:0000}{2:00}{3:00}-{4:00}{5:00}{6:00}.log", GetAssemblyName(), now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
+ fileName = Path.Combine(logPath, fileName);
using (var writer = new StreamWriter(fileName))
{
/// マルチバイト文字のコードはUTF-8またはUnicodeで自動的に判断します。
/// </newpara>
/// </summary>
- /// <param name = input>エンコード対象のURL</param>
+ /// <param name="_input">エンコード対象のURL</param>
/// <returns>マルチバイト文字の部分をUTF-8/%xx形式でエンコードした文字列を返します。</returns>
public static string urlEncodeMultibyteChar(string _input)
public static T CreateDataFromJson<T>(string content)
{
T data;
- using (var stream = new MemoryStream())
+ var buf = Encoding.Unicode.GetBytes(content);
+ using (var stream = new MemoryStream(buf))
{
- var buf = Encoding.Unicode.GetBytes(content);
- stream.Write(Encoding.Unicode.GetBytes(content), offset: 0, count: buf.Length);
- stream.Seek(offset: 0, loc: SeekOrigin.Begin);
data = (T)((new DataContractJsonSerializer(typeof(T))).ReadObject(stream));
}
return data;