Пример #1
0
		protected virtual void OnValueChanged(NuGenTargetEventArgs e)
		{
			NuGenTargetEventHandler handler = (NuGenTargetEventHandler)this.Events[_valueChanged];

			if (handler != null)
			{
				handler(this, e);
			}
		}
Пример #2
0
		private void counter_ValueChanged(object sender, NuGenTargetEventArgs e)
		{
			if (this.SplitLogFile && this.fileStreamWriter != null && this.fileStreamWriter.BaseStream != null)
			{
				if (this.fileStreamWriter.BaseStream.Length >= (this.MaxLogFileSize << 0xa))
				{
					this.fileStreamWriter.Dispose();
					this.fileStreamWriter = null;
				}
			}

			if (this.fileStreamWriter == null)
			{
				this.fileStreamWriter = this.GetStreamWriter(new FileInfo(this.LogOutput));
			}

			this.Log(this.fileStreamWriter, e);
		}
Пример #3
0
		/*
		 * Log
		 */

		private void Log(StreamWriter sw, NuGenTargetEventArgs e)
		{
			Debug.Assert(sw != null, "sw != null");
			Debug.Assert(e.Target is INuGenCounter, "e.Target is INuGenCounter");
			Debug.Assert(e.TargetData is float, "e.TargetData is float");

			if (e.Target is INuGenCounter && e.TargetData is float)
			{
				INuGenCounter counter = (INuGenCounter)e.Target;
				float counterValue = (float)e.TargetData;

				sw.WriteLine("\n------------- {0} -------------", counter.Name);
				sw.WriteLine("DATE: {0}", DateTime.Now.ToShortDateString());
				sw.WriteLine("TIME: {0}.{1}", DateTime.Now.ToLongTimeString(), DateTime.Now.Millisecond.ToString());
				sw.WriteLine("MACHINE: {0}", counter.MachineName);
				sw.WriteLine("CATEGORY: {0}", counter.CategoryName);
				sw.WriteLine("NAME: {0}", counter.CounterName);
				sw.WriteLine("INSTANCE: {0}", counter.InstanceName);
				sw.WriteLine("VALUE: {0}{1}", counterValue, counter.CounterFormat);
			}
		}