Example #1
0
 public override object Accept(EventVisitor visitor)
 {
     return(visitor.Visit(this));
 }
Example #2
0
 public override object Accept(EventVisitor visitor)
 {
     return visitor.Visit (this);
 }
Example #3
0
 public abstract object Accept(EventVisitor visitor);
Example #4
0
 public abstract object Accept(EventVisitor visitor);
Example #5
0
		public LogBuffer (string fileName, EventVisitor visitor)
		{
			this.fileName = fileName;
			this.Visitor = visitor;
			
	//		thread = new Thread (delegate () {
			
				long position = 0;
//				while (running) {
					bool shouldUpdate = false;
//					lock (fileLock) {
						do {
							try {
								stream = new FileStream (fileName, FileMode.Open, FileSystemRights.Read, FileShare.Read, 1024, FileOptions.RandomAccess);
							} catch (Exception) {
						//		Thread.Sleep (100);
							}
						} while (running && stream == null);
						if (!running)
							return;
						reader = new BinaryReader (stream);
						
						if (this.Header == null) {
								try {
									stream.Position = 0;
									this.Header = Header.Read (reader);
									position = reader.BaseStream.Position;
								} catch (Exception e) {
									System.Console.WriteLine (e);
									Thread.Sleep (200);
//									continue;
								}
						}
						stream.Position = position;
						while (stream.Position < stream.Length) {
							try {
								var buffer = Buffer.Read (reader);
								bufferPositions.Add (position);
								position = stream.Position;
								if (Visitor != null) {
									Visitor.CurrentBuffer = buffer;
									buffer.Events.ForEach (e => e.Accept (Visitor));
								}
								shouldUpdate = true;
							} catch (Exception e) {
								System.Console.WriteLine (e);
								Thread.Sleep (200);
								continue;
							}
						}
//						reader.Close ();
//						stream.Close ();
//					}
					if (shouldUpdate)
						OnUpdated (EventArgs.Empty);
//					Thread.Sleep (1000);
//				}
//			});
//			thread.IsBackground = true;
//			thread.Start ();
		}
Example #6
0
 public void RunVisitor(EventVisitor visitor)
 {
     Events.ForEach (e => e.Accept (visitor));
 }
Example #7
0
        public LogBuffer(string fileName, EventVisitor visitor)
        {
            this.fileName = fileName;
            this.Visitor  = visitor;

            //		thread = new Thread (delegate () {

            long position = 0;
//				while (running) {
            bool shouldUpdate = false;

//					lock (fileLock) {
            do
            {
                try {
                    stream = new FileStream(fileName, FileMode.Open, FileSystemRights.Read, FileShare.Read, 1024, FileOptions.RandomAccess);
                } catch (Exception) {
                    //		Thread.Sleep (100);
                }
            } while (running && stream == null);
            if (!running)
            {
                return;
            }
            reader = new BinaryReader(stream);

            if (this.Header == null)
            {
                try {
                    stream.Position = 0;
                    this.Header     = Header.Read(reader);
                    position        = reader.BaseStream.Position;
                } catch (Exception e) {
                    System.Console.WriteLine(e);
                    Thread.Sleep(200);
//									continue;
                }
            }
            stream.Position = position;
            while (stream.Position < stream.Length)
            {
                try {
                    var buffer = Buffer.Read(reader);
                    bufferPositions.Add(position);
                    position = stream.Position;
                    if (Visitor != null)
                    {
                        Visitor.CurrentBuffer = buffer;
                        buffer.Events.ForEach(e => e.Accept(Visitor));
                    }
                    shouldUpdate = true;
                } catch (Exception e) {
                    System.Console.WriteLine(e);
                    Thread.Sleep(200);
                    continue;
                }
            }
//						reader.Close ();
//						stream.Close ();
//					}
            if (shouldUpdate)
            {
                OnUpdated(EventArgs.Empty);
            }
//					Thread.Sleep (1000);
//				}
//			});
//			thread.IsBackground = true;
//			thread.Start ();
        }
Example #8
0
 public void RunVisitor(EventVisitor visitor)
 {
     Events.ForEach(e => e.Accept(visitor));
 }