Example #1
0
 public Form1()
 {
     InitializeComponent();
     textBox2.Text           = 5.ToString();
     textBox3.Text           = 10000.ToString();
     textBox4.Text           = @"\log.txt";
     logBuffer               = new LogBuffer((Application.StartupPath.ToString() + textBox4.Text), Int32.Parse(textBox2.Text), Int32.Parse(textBox3.Text));
     logBuffer.MessageEvent += o => MessageBox.Show(o);
     logBuffer.ShowLogList  += o => { listBox1.Items.Clear();
                                      o.ForEach(b => listBox1.Items.Add(b)); };
     logBuffer.ShowQuantityitemsInBuffer += o => Invoke(new Action(() => label1.Text = "Количество строк в буфере " + o.ToString()));
 }
Example #2
0
        static void Main(string[] args)
        {
            LogBuffer buf = new LogBuffer();


            for (int i = 1; i <= 10000; i++)
            {
                buf.Add(i.ToString());
            }
            Console.WriteLine("Ready.");

            Console.ReadKey();
        }
Example #3
0
        static void Main(string[] args)
        {
            if (args.Length != 3)
            {
                throw new ArgumentException("Path to file should be passed");
            }

            StorageFile = args[0];
            int.TryParse(args[1], out int bufferSize);
            int.TryParse(args[2], out int releaseTime);

            using (Lb = new LogBuffer(bufferSize, releaseTime, StorageFile))
            {
                TestLogBuffer();
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            LogBuffer buf = new LogBuffer(30, 10000);

            //buf.Add("ПРивет  1");
            //buf.Add("ПРивет  2 ");
            //buf.Add("Привет 3");

            for (int i = 1; i <= 10000; i++)
            {
                buf.Add(i.ToString());
            }
            Console.WriteLine("Ready, Enter...");
            Console.ReadLine();

            Tester test1 = new Tester();

            Console.WriteLine("File is correct " + test1.IsCorrect());
            Console.ReadLine();
        }
Example #5
0
        static void Main(string[] args)
        {
            TaskDelegate[] tasks = new TaskDelegate[5];
            for (int i = 0; i < 5; i++)
            {
                int temp = i;
                tasks[i] = delegate { Console.WriteLine("Task {0} working...", temp); };
            }
            Parallel.WaitAll(tasks);
            Console.WriteLine("All tasks done");

            LogBuffer logBuffer = new LogBuffer("logFile.txt", 20, 5000);
            int       counter   = 0;

            while (counter < 20)
            {
                Thread.Sleep(2000);
                logBuffer.Add($"Message {counter}");
                counter++;
            }
            Console.WriteLine("LogBuffer stoppped.");
            Console.ReadLine();
        }