129 |
} |
} |
130 |
public void SetLogText(string value) |
public void SetLogText(string value) |
131 |
{ |
{ |
|
//if (txtLog.InvokeRequired) |
|
|
//{ |
|
|
// this.Invoke(HandleSetLogText, new object[] { value }); |
|
|
//} |
|
|
//else |
|
|
//{ |
|
|
// txtLog.AppendText(value); |
|
|
//} |
|
132 |
FileStream fs = new FileStream(LOG_PATH, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); |
FileStream fs = new FileStream(LOG_PATH, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); |
133 |
StreamWriter writer = new StreamWriter(fs); |
StreamWriter writer = new StreamWriter(fs); |
134 |
writer.AutoFlush = true; |
writer.AutoFlush = true; |
135 |
if (value == Log.NewLine) { writer.Write(System.Environment.NewLine); } |
if (value == Log.NewLine) { writer.Write(System.Environment.NewLine); } |
136 |
else { writer.Write(value); } |
else { writer.Write(value); } |
137 |
writer.Close(); |
writer.Close(); |
138 |
sw.Write(value); |
//string text = value.Replace(System.Environment.NewLine,""); |
139 |
|
string text = value.Replace(System.Environment.NewLine, Log.NewLine); |
140 |
|
if (text.StartsWith(Log.NewLine)) |
141 |
|
{ |
142 |
|
text = text.Remove(0, Log.NewLine.Length); |
143 |
|
} |
144 |
|
sw.Write(text); |
145 |
Application.DoEvents(); |
Application.DoEvents(); |
146 |
} |
} |
147 |
|
|
197 |
{ |
{ |
198 |
if (_text_writer == null) return; |
if (_text_writer == null) return; |
199 |
|
|
200 |
if (message.EndsWith("\n")) |
if (message.EndsWith(this.NewLine)) |
201 |
{ |
{ |
202 |
|
strMessage.Append(System.Environment.NewLine); |
203 |
//_text_writer.SetLogText(string.Format("{0}", strMessage.ToString())); |
//_text_writer.SetLogText(string.Format("{0}", strMessage.ToString())); |
204 |
while (_text_writer.logupdater.IsBusy) |
while (_text_writer.logupdater.IsBusy) |
205 |
{ |
{ |