当前位置: 首页>>代码示例>>C#>>正文


C# Trace类代码示例

本文整理汇总了C#中Trace的典型用法代码示例。如果您正苦于以下问题:C# Trace类的具体用法?C# Trace怎么用?C# Trace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Trace类属于命名空间,在下文中一共展示了Trace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

 public int Run()
 {
     _trace = new Trace("ThrowInCatchTest", "0123456");
     _trace.Write("0");
     try 
     {
         _trace.Write("1");
         try 
         {
             _trace.Write("2");
             throw new Exception(".....");
         } 
         catch(Exception e)
         {
             Console.WriteLine(e);
             _trace.Write("3");
             throw new Exception("5");
         }
     } 
     catch(Exception e)
     {
         Console.WriteLine(e);
         _trace.Write("4");
         _trace.Write(e.Message);
     }
     _trace.Write("6");
     return _trace.Match();
 }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:28,代码来源:throwincatch.cs

示例2: initCreatedRefractTrace

        public void initCreatedRefractTrace(Trace refractTrace, UnitVector surfaceNormal, Scientrace.Object3d fromObject3d, Scientrace.Object3d toObject3d)
        {
            double oldrefindex = fromObject3d.materialproperties.refractiveindex(this);
            double newrefindex = toObject3d.materialproperties.refractiveindex(this);
            //for definitions on the parameters below, check fullInternalReflects function.

            UnitVector incoming_trace_direction = this.traceline.direction;
            if (incoming_trace_direction.dotProduct(surfaceNormal) > 0) {
            surfaceNormal = surfaceNormal.negative();
            }

            Scientrace.UnitVector nnorm = surfaceNormal.negative();
            Scientrace.Vector incoming_normal_projection = nnorm*(incoming_trace_direction.dotProduct(nnorm));
            Vector L1 = incoming_trace_direction-incoming_normal_projection;
            double L2 = (oldrefindex/newrefindex)*L1.length;

            if (incoming_trace_direction == incoming_normal_projection) {
            //in case of normal incident light: do not refract.
            refractTrace.traceline.direction = incoming_trace_direction;
            return;
            }

            try {
            refractTrace.traceline.direction = ((nnorm*Math.Sqrt(1 - Math.Pow(L2,2)))
                    +(L1.tryToUnitVector()*L2)).tryToUnitVector();
            } catch (ZeroNonzeroVectorException) {
                Console.WriteLine("WARNING: cannot define direction for refraction trace. Using surface normal instead. (L1: "+incoming_trace_direction.trico()+", L2:"+incoming_normal_projection.trico()+").");
                refractTrace.traceline.direction = nnorm;
            } //end try/catch
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:30,代码来源:Trace-Obsolete_No_Polarisation_Support.cs

示例3: Run

    public int Run()
    {
        _trace = new Trace("TryCatchInFinallyTest", "0123456");
        
        _trace.Write("0");
        try
        {
            _trace.Write("1");
        }
        finally
        {
            _trace.Write("2");
            try
            {
                _trace.Write("3");
                throw new InvalidProgramException();
            }
            catch(InvalidProgramException e)
            {
                Console.WriteLine(e);
                _trace.Write("4");
            }
            _trace.Write("5");
        }
        _trace.Write("6");

        return _trace.Match();
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:28,代码来源:trycatchinfinally.cs

示例4: AssemblyTrace

 public AssemblyTrace(Trace parent, CST.AssemblyDef assembly)
 {
     Parent = parent;
     Assembly = assembly;
     IncludeAssembly = false;
     TypeMap = new Map<CST.TypeName, TypeTrace>();
 }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:7,代码来源:Traces.cs

示例5: Run

 public int Run()
 {
     _trace = new Trace("GoryNativePastTest", "0123456");
     
     _trace.Write("0");
     try
     {
         try 
         {
             foo();
         } 
         catch(Exception e)
         {
             Console.WriteLine(e);
             _trace.Write("4");
             throw;
         }
     }
     catch(Exception e)
     {
         _trace.Write("5");
         _trace.Write(e.Message);
     }
     return _trace.Match();
 }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:25,代码来源:GoryNativePast.cs

示例6: OnTrace

 public override void OnTrace(Trace t) {
     lock (lockObj) {
         Prepare();            
         Write(t);
         file.Flush();
     }
 }
开发者ID:sapo,项目名称:sapo-services-sdk,代码行数:7,代码来源:FileAppender.cs

示例7: ParseResponse

 public static void ParseResponse(Trace trace, HttpResponseMessage response)
 {
     try
     {
         var responseBody = response.Content;
         trace.Response = responseBody.ReadAsStringAsync().Result;
         trace.Status = ((int)response.StatusCode).ToString();
         if (trace.Response.Length > 0 && !trace.Status.Equals("429"))
         {
             trace.ResponseBodyLength = responseBody.Headers.ContentLength;
             var ad = response.RequestMessage.GetActionDescriptor();
             if (ad != null)
             {
                 var action = new ApiDescription
                 {
                     HttpMethod = response.RequestMessage.Method,
                     RelativePath = response.RequestMessage.RequestUri.PathAndQuery.Substring(1)
                 };
                 var fid = action.GetFriendlyId();
                 trace.FriendlyURI = APIUriList.FirstOrDefault(x => x.Equals(fid, StringComparison.OrdinalIgnoreCase));
                 if (string.IsNullOrWhiteSpace(trace.FriendlyURI))
                     trace.FriendlyURI = APIUriList.FirstOrDefault(x => x.StartsWith(fid, StringComparison.OrdinalIgnoreCase));
                 trace.Action = ad.ControllerDescriptor.ControllerName + " / " + ad.ActionName;
             }
             if (TraceList.Count >= 64)
                 TraceList.RemoveAt(0);
             TraceList.Add(trace);
         }
     }
     catch (Exception)
     {
     }
 }
开发者ID:tektak-abhisheksth,项目名称:Web-API,代码行数:33,代码来源:MessageHandler.cs

示例8: Run

    public int Run()
    {
        _trace = new Trace("PendingTest", "0123401235");
            
        try
        {
            f1();
        }
        catch(Exception e) 
        {
            Console.WriteLine(e);
            _trace.Write("4");
        }

        try
        {
            f1();
        }
        catch(Exception e) 
        {
            Console.WriteLine(e);
            _trace.Write("5");
        }

        return _trace.Match();
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:26,代码来源:Pending.cs

示例9: ComputeTraceLength

        public float ComputeTraceLength(Trace trace, int fromPoint, int toPoint)
        {
            var noOfPoints = trace.Points.Count;

              if ((fromPoint < 0 || fromPoint > (noOfPoints - 1))
            || (toPoint < 0 || toPoint > (noOfPoints - 1)))
              {
            //error
              }

              float xDiff, yDiff, pointDistance;
              IList<float> xVec, yVec;
              var outLength = 0f;

              xVec = trace.ChannelX;
              yVec = trace.ChannelY;

              for (var i = fromPoint; i < toPoint; i++)
              {
            xDiff = xVec[i] - xVec[i + 1];
            yDiff = yVec[i] - yVec[i + 1];

            //distance between 2 points
            pointDistance = (float)Math.Sqrt(xDiff * xDiff + yDiff * yDiff);

            outLength += pointDistance;
              }

              return outLength;
        }
开发者ID:nguonly,项目名称:OKHWR,代码行数:30,代码来源:PreProcessing.cs

示例10: TraceConstructorTest

 public void TraceConstructorTest()
 {
     Guid id = Guid.NewGuid();
     string contextId = "ContextID";
     Trace target = new Trace(id, contextId);
     Assert.AreEqual(id, target.Id);
     Assert.AreEqual(contextId, target.ContextId);            
 }
开发者ID:sapo,项目名称:sapo-services-sdk,代码行数:8,代码来源:TraceTest.cs

示例11: ReadFromInkFile

    public TraceGroup ReadFromInkFile(string path)
    {
      var outTraceGroup = new TraceGroup();
      var input = new FileStream(path, FileMode.Open, FileAccess.Read);
      var fileReader = new StreamReader(input);
      var strLine = "";
      char[] splitter = { ' ' };

      var captureDevice = new CaptureDevice { SamplingRate = 100, Latency = 0f };
      while(!fileReader.EndOfStream)
      {
        strLine = fileReader.ReadLine();
        if (strLine == null) continue;
        
        //Read header info
        if (strLine.Contains(".X_POINTS_PER_INCH"))
        {
          var strToken = strLine.Split(splitter, StringSplitOptions.None);
          captureDevice.XDpi = Convert.ToInt32(strToken[1]);
        }

        if (strLine.Contains(".Y_POINTS_PER_INCH"))
        {
          var strToken = strLine.Split(splitter, StringSplitOptions.None);
          captureDevice.YDpi = Convert.ToInt32(strToken[1]);
        }

        if (strLine.Contains(".POINTS_PER_SECOND"))
        {
          var strToken = strLine.Split(splitter, StringSplitOptions.None);
          //use later
        }

        if (!strLine.Trim().Equals(".PEN_DOWN")) continue;
        
        var strCoord = "";

        var trace = new Trace();
        while(!(strCoord = fileReader.ReadLine()?? "").Trim().Equals(".PEN_UP") && !fileReader.EndOfStream)
        {
          
          var strToken = strCoord.Split(splitter, StringSplitOptions.None);

          var x = Convert.ToInt32(strToken[0]);
          var y = Convert.ToInt32(strToken[1]);

          trace.Points.Add(new PenPoint{X=x, Y=y});
        }
        outTraceGroup.Traces.Add(trace);
      }

      fileReader.Close();
      input.Close();

      outTraceGroup.CaptureDevice = captureDevice;

      return outTraceGroup;
    }
开发者ID:nguonly,项目名称:KHWR.kNN,代码行数:58,代码来源:InkFile.cs

示例12: Spot

 public Spot(Scientrace.Location loc, Object3d object3d, double intensity, double intensityFraction, Scientrace.Trace trace)
 {
     this.loc = loc;
     this.object3d = object3d;
     this.object3d.spotted(intensity);
     this.intensity = intensity;
     this.intensityFraction = intensityFraction;
     this.trace = trace;
     this.fillPolVecs();
 }
开发者ID:JoepBC,项目名称:scientrace,代码行数:10,代码来源:Spot.cs

示例13: WordAnalysis

		/// <summary>
		/// Initializes a new instance of the <see cref="WordAnalysis"/> class.
		/// </summary>
		/// <param name="shape">The shape.</param>
		/// <param name="curTrace">The current trace record.</param>
		internal WordAnalysis(PhoneticShape shape, Stratum stratum, Trace curTrace)
		{
			m_shape = shape;
			m_pos = new HCObjectSet<PartOfSpeech>();
			m_mrules = new List<MorphologicalRule>();
			m_mrulesUnapplied = new Dictionary<MorphologicalRule, int>();
			m_rzFeatures = new FeatureValues();
			m_stratum = stratum;
			m_curTrace = curTrace;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:15,代码来源:WordAnalysis.cs

示例14: intersects

        public override Intersection intersects(Trace trace)
        {
            List<Scientrace.FlatShape2d> pgrams = new List<Scientrace.FlatShape2d>();
            //first: add parallelogram circle2d surfaces
            pgrams.Add(new Scientrace.Circle2d(this.loc, this.height, this.width, this.width.length));
            pgrams.Add(new Scientrace.Circle2d(this.loc+this.length.toLocation(), this.height, this.width, this.width.length));
            //TODO: second: add connecting surface

            return this.intersectFlatShapes(trace, pgrams);
        }
开发者ID:JoepBC,项目名称:scientrace,代码行数:10,代码来源:CircularPrism.cs

示例15: Dump

 private static void Dump(Trace[] traces, int style)
 {
     foreach (var trace in traces)
     {
         Cout.WriteLine(trace.ToString(style));
         if (trace.Children.Length > 0)
         {
             Dump(trace.Children, style);
         }
     }
 }
开发者ID:boykathemad,项目名称:xdebug-trace-viewer,代码行数:11,代码来源:Program.cs


注:本文中的Trace类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。