コード例 #1
0
ファイル: Log.cs プロジェクト: eyedia/idpe
        public Log(string title, string fileName)
        {
            InitializeComponent();
            this.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
            this.Text = title;
            var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            var sr = new StreamReader(fs);

            LogReader = new StreamReader(sr.BaseStream);
            txtLog.LoadFile(LogReader.BaseStream, RichTextBoxStreamType.PlainText);
            txtLog.SelectionStart = txtLog.Text.Length;
            txtLog.ScrollToCaret();

            var monitor = new LogFileMonitor(fileName, "\n");

            monitor.OnLine += (s, e) =>
            {
                if (this.IsDisposed)
                {
                    return;
                }
                txtLog.AppendText(e.Line);
            };

            monitor.Start();
        }
コード例 #2
0
        public frmMain()
        {
            InitializeComponent(); hideSubMenu();
            var monitor = new LogFileMonitor(rustlocation, "\r\n");

            monitor.OnLine += (s, e) =>
            {
                pullfile();
            };
            monitor.Start();
        }