Skip to content

Commit

Permalink
Update log.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
BeichenDream authored Jan 29, 2021
1 parent 1211d1a commit 7566860
Showing 1 changed file with 8 additions and 59 deletions.
67 changes: 8 additions & 59 deletions Net/App/log.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Mysql.MysqlData;
using Mysql.MysqlData;
using System;
using System.Collections.Generic;
using System.IO;
Expand All @@ -19,68 +19,17 @@ public static void Write(string a)
logstream.Flush();

}
/*public static void Write(byte[] a)
public static void FileWirte(ref byte[] data, UserInfo userInfo,bool allData)
{
string data = Encoding.UTF8.GetString(a);
logstream.Write(a, 0, a.Length);
logstream.Flush();
Console.WriteLine(data);
}
public static void Write(UserInfo userInfo)
{
string data;
data = string.Format("Username:{0} PassWord:{1} LoadData:{2} Salt{3} Info:{4}", userInfo.username, userInfo.password, userInfo.LoadData.ToString(), userInfo.Salt, userInfo.info);
logstream.Write(Encoding.Default.GetBytes(data), 0, data.Length);
logstream.Flush();
Console.WriteLine(data);
}*/
public static void FileWirte(ref byte[] data, UserInfo userInfo)
{

string file = AppDomain.CurrentDomain.BaseDirectory + userInfo.host + "/";
string[] t = Mysql.Config.GetConfig().File[userInfo.lastFile].Replace('\\', '/').Split('/');
string dataname = t[t.Length - 1];
Directory.CreateDirectory(file);
FileStream datastream = new FileStream(file + dataname, FileMode.Append, FileAccess.Write);
datastream.Write(data, 0, data.Length);
datastream.Flush();
datastream.Dispose();
}
public static void FileWirte(UserInfo userInfo)
{

string file = AppDomain.CurrentDomain.BaseDirectory + userInfo.host + "/";
string[] t = Mysql.Config.GetConfig().File[userInfo.lastFile].Replace('\\', '/').Split('/');
string dataname = t[t.Length - 1];
Directory.CreateDirectory(file);
FileStream datastream = new FileStream(file + dataname, FileMode.Append, FileAccess.Write);
datastream.Write(userInfo.FileDataS.ToArray(), 0, userInfo.FileDataS.Count);
datastream.Flush();
datastream.Dispose();
}
public static void BkFileWirte(ref byte[] data,UserInfo userInfo)
{

string file = AppDomain.CurrentDomain.BaseDirectory + userInfo.host + "/";
string[] t = Mysql.Config.GetConfig().File[userInfo.lastFile].Replace('\\', '/').Split('/');
string dataname = t[t.Length - 1];
Directory.CreateDirectory(file);
FileStream datastream = new FileStream(file + "bk_" + dataname, FileMode.Append, FileAccess.Write);
datastream.Write(data, 0, data.Length);
datastream.Flush();
datastream.Dispose();
userInfo.file.Write(data, 0, data.Length);
userInfo.file.Flush();
}
public static void BkFileWirte(ref UserInfo userInfo)
{

public static void FileWirteInit(UserInfo userInfo) {
string file = AppDomain.CurrentDomain.BaseDirectory + userInfo.host + "/";
string[] t = Mysql.Config.GetConfig().File[userInfo.lastFile].Replace('\\', '/').Split('/');
string dataname = t[t.Length - 1];
Directory.CreateDirectory(file);
FileStream datastream = new FileStream(file + "bk_" + dataname, FileMode.Append, FileAccess.Write);
datastream.Write(userInfo.FileDataS.ToArray(), 0, userInfo.FileDataS.Count);
datastream.Flush();
datastream.Dispose();
Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + userInfo.host + "/");
string filename = t[t.Length - 1];
userInfo.file = new FileStream(file + filename, FileMode.Append, FileAccess.Write);
}
public static string[] FileRead(string file)
{
Expand Down

0 comments on commit 7566860

Please sign in to comment.