2010-08-20 9 views
0

어떤 종류의 사람이 컴파일하지 않은 .Net Reflector v6.5의 출력을 분류 할 수 있습니까? 내 생각 엔 상징이 허풍이지만 세계적인 검색과 교체로 해결할 수 있다고 생각합니다. 저는 이상한 클래스 정의를 얻지 못합니다. 아이디어? 이런 식으로 사용잘못된 리플렉터가 잘못된 토큰 오류로 디 컴파일됩니다.

[CompilerGenerated] 
    private sealed class <ApplicationTaskIterator>d__0 : IEnumerable<ApplicationTask>, IEnumerable, IEnumerator<ApplicationTask>, IEnumerator, IDisposable 
    { 
     private int <>1__state; 
     private ApplicationTask <>2__current; 
     public SessionMetrics <>3__sm; 
     public Dictionary<int, ThreadMetrics> <>7__wrap3; 
     public Dictionary<int, ThreadMetrics>.ValueCollection.Enumerator <>7__wrap4; 
     public ApplicationTask <currentTask>5__1; 
     public ThreadMetrics <tm>5__2; 
     public SessionMetrics sm; 

     [DebuggerHidden] 
     public <ApplicationTaskIterator>d__0(int <>1__state) 
     { 
      this.<>1__state = <>1__state; 
     } 

     private bool MoveNext() 
     { 
      try 
      { 
       switch (this.<>1__state) 
       { 
        case 0: 
         this.<>1__state = -1; 
         Monitor.Enter(this.<>7__wrap3 = ThreadMetrics._allThreadMetrics); 
         this.<>1__state = 1; 
         this.<>7__wrap4 = ThreadMetrics._allThreadMetrics.Values.GetEnumerator(); 
         this.<>1__state = 2; 
         while (this.<>7__wrap4.MoveNext()) 
         { 
          this.<tm>5__2 = this.<>7__wrap4.Current; 
          if ((((this.<tm>5__2._managedThread.ThreadState == System.Threading.ThreadState.Stopped) || object.ReferenceEquals(this.<tm>5__2._managedThread, Thread.CurrentThread)) || ((this.<currentTask>5__1 = this.<tm>5__2.CurrentApplicationTask) == null)) || ((this.sm != null) && !this.<currentTask>5__1.CurrentSessionMetrics.SessionGUID.Equals(this.sm.SessionGUID))) 
          { 
           continue; 
          } 
          this.<currentTask>5__1.Active = !this.<tm>5__2.Suspended; 
          this.<>2__current = this.<currentTask>5__1; 
          this.<>1__state = 3; 
          return true; 
         Label_010C: 
          this.<>1__state = 2; 
         } 
         this.<>1__state = 1; 
         this.<>7__wrap4.Dispose(); 
         this.<>1__state = -1; 
         Monitor.Exit(this.<>7__wrap3); 
         break; 

        case 3: 
         goto Label_010C; 
       } 
       return false; 
      } 
      fault 
      { 
       ((IDisposable) this).Dispose(); 
      } 
     } 
    } 

:

C# 컴파일러가 yield return 문을 포함하는 방법을 변환 무엇 단순히이다
internal static IEnumerable<ApplicationTask> ApplicationTaskIterator(SessionMetrics sm) 
    { 
     return new <ApplicationTaskIterator>d__0(-2) { <>3__sm = sm }; 
    } 
+0

. 나는 그게 무슨 뜻인지 궁금해. – Gqqnbig

답변

1

.

코드를 컴파일하려면 메서드가 수행하는 작업을 해독하고 yield return 문을 사용하여 원래 버전을 다시 만들거나, 또는 클래스와 모든 멤버의 이름을 올바른 C# 이름으로 바꿀 수 있습니다.


원래 방법

아마이처럼 보였다 : 나는 또한 흥미로운 오류 키워드를 찾을 수

internal static IEnumerable<ApplicationTask> ApplicationTaskIterator(SessionMetrics sm) 
{ 
    lock (ThreadMetrics._allThreadMetrics) 
    { 
     foreach (var tm in ThreadMetrics._allThreadMetrics.Values) 
     { 
      if (tm._managedThread.ThreadState != ThreadState.Stopped) 
      { 
       if (!object.ReferenceEquals(tm._managedThread, Thread.CurrentThread)) 
       { 
        ApplicationTask currentTask; 
        if ((currentTask = tm.CurrentApplicationTask) != null) 
        { 
         if (sm == null || !currentTask.CurrentSessionMetrics.SessionGUID.Equals(sm.SessionGUID)) 
         { 
          currentTask.Active = !tm.Suspended; 
          yield return currentTask; 
         } 
        } 
       } 
      } 
     } 
    } 
} 
+0

와우, yield 키워드가 좋습니다. 반복기를 사용해야했습니다. 정보와 새로운 아이디어에 감사드립니다. -Myke –

+0

BTW, 컴파일러 생성 클래스를 바꾸고 스텁 메서드를 호출하여 메서드를 호출했습니다. 다시 한번 감사드립니다. –

+0

제쳐두고, 우리 (레드 게이트)는 리플 렉터가 현재 수익률 수익률을 처리하지 못하고 있다는 사실을 알고 있습니다. –

관련 문제