Exemple #1
0
 public override object Accept(EventVisitor visitor)
 {
     return(visitor.Visit(this));
 }
Exemple #2
0
 public override object Accept(EventVisitor visitor)
 {
     return visitor.Visit (this);
 }
Exemple #3
0
 public abstract object Accept(EventVisitor visitor);
Exemple #4
0
 public abstract object Accept(EventVisitor visitor);
Exemple #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 ();
		}
Exemple #6
0
 public void RunVisitor(EventVisitor visitor)
 {
     Events.ForEach (e => e.Accept (visitor));
 }
Exemple #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 ();
        }
Exemple #8
0
 public void RunVisitor(EventVisitor visitor)
 {
     Events.ForEach(e => e.Accept(visitor));
 }