|
|
@@ -149,25 +149,25 @@ namespace Shadowsocks.View |
|
|
|
|
|
|
|
private void UpdateContent()
|
|
|
|
{
|
|
|
|
using (StreamReader reader = new StreamReader(new FileStream(filename,
|
|
|
|
FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
|
|
|
{
|
|
|
|
reader.BaseStream.Seek(lastOffset, SeekOrigin.Begin);
|
|
|
|
|
|
|
|
string line = "";
|
|
|
|
bool changed = false;
|
|
|
|
while ((line = reader.ReadLine()) != null)
|
|
|
|
{
|
|
|
|
changed = true;
|
|
|
|
LogMessageTextBox.AppendText(line + Environment.NewLine);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (changed)
|
|
|
|
{
|
|
|
|
LogMessageTextBox.ScrollToCaret();
|
|
|
|
try {
|
|
|
|
using(StreamReader reader = new StreamReader(new FileStream(filename,
|
|
|
|
FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) {
|
|
|
|
reader.BaseStream.Seek(lastOffset, SeekOrigin.Begin);
|
|
|
|
|
|
|
|
string line = "";
|
|
|
|
bool changed = false;
|
|
|
|
while((line = reader.ReadLine()) != null) {
|
|
|
|
changed = true;
|
|
|
|
LogMessageTextBox.AppendText(line + Environment.NewLine);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(changed) {
|
|
|
|
LogMessageTextBox.ScrollToCaret();
|
|
|
|
}
|
|
|
|
|
|
|
|
lastOffset = reader.BaseStream.Position;
|
|
|
|
}
|
|
|
|
|
|
|
|
lastOffset = reader.BaseStream.Position;
|
|
|
|
} catch(FileNotFoundException) {
|
|
|
|
}
|
|
|
|
|
|
|
|
this.Text = I18N.GetString("Log Viewer") +
|
|
|
@@ -247,6 +247,8 @@ namespace Shadowsocks.View |
|
|
|
#region Clean up the content in LogMessageTextBox.
|
|
|
|
private void DoCleanLogs()
|
|
|
|
{
|
|
|
|
Logging.clear();
|
|
|
|
lastOffset = 0;
|
|
|
|
LogMessageTextBox.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|