Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by $$anonymous$$ · Mar 31, 2017 at 10:01 AM · unity 5coroutinesdecompilereverse engineering

How can I get back the original code from this enumerator decompilation?

I am trying to decompile some code from an old unity project for which only the build is available (after an accident involving data loss). Most of the code is decompiled relatively well, but enumerators provide code like this:

    [CompilerGenerated]
     private sealed class <LoadFileTables>c__Iterator8 : IDisposable, IEnumerator, IEnumerator<object>
     {
         internal object $current;
         internal int $PC;
         internal DesignFileTableLoader<> f__this;
     internal IEnumerator<iter> __1;
     internal TableLoaderWorker<worker> __0;
 
     [DebuggerHidden]
     public void Dispose()
     {
         this.$PC = -1;
     }
 
     public bool MoveNext()
     {
         uint num = (uint)this.$PC;
         this.$PC = -1;
         switch (num)
         {
             case 0:
                 this.< worker > __0 = new TableLoaderWorker(this.<> f__this.TableReader);
                 this.< iter > __1 = this.<> f__this.LoadTable(this.< worker > __0, this.<> f__this._file.ElementTable, this.<> f__this.ElementTableStrategy);
                 break;
 
             case 1:
                 break;
 
             case 2:
                 goto Label_00EB;
 
             case 3:
                 goto Label_0145;
 
             case 4:
                 goto Label_019F;
 
             case 5:
                 goto Label_01F9;
 
             default:
                 goto Label_0210;
         }
         if (this.< iter > __1.MoveNext())
         {
             this.$current = null;
             this.$PC = 1;
             goto Label_0212;
         }
         this.< iter > __1 = this.<> f__this.LoadTable(this.< worker > __0, this.<> f__this._file.LayerTable, this.<> f__this.LayerTableStrategy);
     Label_00EB:
         while (this.< iter > __1.MoveNext())
         {
             this.$current = null;
             this.$PC = 2;
             goto Label_0212;
         }
         this.< iter > __1 = this.<> f__this.LoadTable(this.< worker > __0, this.<> f__this._file.SceneTable, this.<> f__this.SceneTableStrategy);
     Label_0145:
         while (this.< iter > __1.MoveNext())
         {
             this.$current = null;
             this.$PC = 3;
             goto Label_0212;
         }
         this.< iter > __1 = this.<> f__this.LoadTable(this.< worker > __0, this.<> f__this._file.MaterialTable, this.<> f__this.MaterialTableStrategy);
     Label_019F:
         while (this.< iter > __1.MoveNext())
         {
             this.$current = null;
             this.$PC = 4;
             goto Label_0212;
         }
         this.< iter > __1 = this.<> f__this.LoadTable(this.< worker > __0, this.<> f__this._file.StatisticsTable, this.<> f__this.StatisticsTableStrategy);
     Label_01F9:
         while (this.< iter > __1.MoveNext())
         {
             this.$current = null;
             this.$PC = 5;
             goto Label_0212;
         }
         this.$PC = -1;
     Label_0210:
         return false;
     Label_0212:
         return true;
     }
 
     [DebuggerHidden]
     public void Reset()
     {
         throw new NotSupportedException();
     }
 
     object IEnumerator<object>.Current =>
         this.$current;
 
         object IEnumerator.Current =>
             this.$current;
     }
 
 [CompilerGenerated]
 private sealed class <LoadTable>c__Iterator9 : IDisposable, IEnumerator, IEnumerator<object>
     {
         internal object $current;
         internal int $PC;
         internal ITableLoadStrategy<$> strategy;
 internal IDesignFileTable<$> table;
 internal TableLoaderWorker<$> worker;
 internal Exception<exception> __0;
 internal ITableLoadStrategy strategy;
 internal IDesignFileTable table;
 internal TableLoaderWorker worker;
 
 [DebuggerHidden]
 public void Dispose()
 {
     this.$PC = -1;
 }
 
 public bool MoveNext()
 {
     uint num = (uint)this.$PC;
     this.$PC = -1;
     switch (num)
     {
         case 0:
             this.worker.StartLoadingTable(this.table, this.strategy);
             break;
 
         case 1:
             break;
 
         default:
             return false;
 
     }
     if (!this.worker.IsFinished)
     {
         this.$current = null;
         this.$PC = 1;
         return true;
     }
     this.< exception > __0 = this.worker.BackgroundThreadException;
     if (this.< exception > __0 != null)
     {
         throw this.< exception > __0;
     }
     this.$PC = -1;        
 }
 
 [DebuggerHidden]
 public void Reset()
 {
     throw new NotSupportedException();
 }
 
 object IEnumerator<object>.Current =>
     this.$current;
 
         object IEnumerator.Current =>
             this.$current;
     }
 }


I don't really understand how it works or how to rewrite it, what's going on with those dollared variables and gotos?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

143 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity MVC animation coroutine 0 Answers

I cant make a stoplight delay from green to yellow, then to red, when my boolean is off. How can I make it delay and actually get yellow to show? 0 Answers

How to interrupt wait coroutine in a loop? 0 Answers

Fade out / fade in scene w/ loading screen 0 Answers

how to add a texture for a mesh? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges