有人能帮忙一起搞定一下以下的代码片断吗?这是Code Rush中的SmartTemplate的核心部分

bool flag1;
            
string text1;
            
string text2;
            
string text3;
            Method method1;
            Property property1;
            DateTime time1;
            TimeSpan span1;
            TimeSpan span2;
            LanguageElementType type1;
            MethodTypeEnum enum1;
            LanguageElement element1 
= CodeRush.Source.ActiveMethodOrPropertyAccessor;
            
if (element1 != null)
            
{
                
goto Label_0213;
            }

            
goto Label_00FA;
        Label_0016:
            text3 
= string.Concat(text3, ";");
            
goto Label_0158;
        Label_0029:
            text2 
= string.Concat("«BlockAnchor»", text2, "«Cursor»");
            
goto Label_019C;
        Label_003F:
            text3 
= string.Concat(text3, "return");
            
goto Label_009D;
        Label_0052:
            
if (time1.Second > 43)
            
{
                
goto Label_0287;
            }

            
goto Label_0145;
        Label_0065:
            
goto Label_0241;
        Label_006A:
            
if (!flag1)
            
{
                
goto Label_0158;
            }

            
goto Label_0016;
            
return;
            
do
            
{
                text1 
= property1.MemberType;
                text2 
= this.a(property1, text1);
                
if (text2 == "")
                
{
                    
goto Label_024C;
                }

                
goto Label_0029;
            Label_009D:
                
if (text3 != "")
                
{
                    
goto Label_006A;
                }

                
goto Label_01B0;
            Label_00B3:
                span1 
= DateTime.op_Subtraction(DateTime.Now, new DateTime(200461));
                
if (span1.TotalSeconds >= 0f)
                
{
                    
goto Label_0257;
                }

                
return;
            Label_00E6:
                text3 
= string.Concat(text3, "return ", text2);
                
goto Label_006A;
            Label_00FA:
                Log.SendError(
"Can't expand smart return inside anything but a method or a property accessor.");
                
return;
            Label_0105:
                
goto Label_009D;
            Label_0107:
                method1 
= ((Method) element1);
                enum1 
= method1.MethodType;
                
switch (enum1)
                
{
                    
case MethodTypeEnum.Constructor:
                    
case MethodTypeEnum.Void:
                    
case MethodTypeEnum.Destructor:
                    
{
                        
goto Label_003F;
                    }

                }

                
goto Label_0105;
            Label_0132:
                text2 
= string.Concat("«BlockAnchor»", text2, "«Cursor»");
                
goto Label_00E6;
            Label_0145:
                
if (time1.Second < 23)
                
{
                    
goto Label_0287;
                }

                
goto Label_00B3;
            Label_0158:
                time1 
= DateTime.Now;
                
if (time1.DayOfWeek == DayOfWeek.Sunday)
                
{
                    
goto Label_00B3;
                }

                
goto Label_01EB;
            Label_0170:
                text3 
= string.Concat(text3, "return");
                
goto Label_006A;
            Label_0183:
                property1 
= ((Property) element1.Parent);
            }

            
while ((property1 != null));
            
goto Label_0208;
        Label_019C:
            text3 
= string.Concat(text3, "return ", text2);
            
goto Label_006A;
        Label_01B0:
            text1 
= method1.MemberType;
            text2 
= this.a(method1, text1);
            
if (text2 == "")
            
{
                
goto Label_01FD;
            }

            
goto Label_0132;
        Label_01D4:
            
switch (type1)
            
{
                
case LanguageElementType.PropertyAccessorGet:
                
{
                    
goto Label_0183;
                }

                
case LanguageElementType.PropertyAccessorSet:
                
{
                    
goto Label_0170;
                }

            }

            
goto Label_0065;
        Label_01EB:
            
if (time1.DayOfWeek != DayOfWeek.Thursday)
            
{
                
goto Label_0287;
            }

            
goto Label_0052;
        Label_01FD:
            text2 
= "«Cursor»";
            
goto Label_00E6;
        Label_0208:
            Log.SendError(
"Invalid LanguageElement returned. Can't expand smart return inside anything but a method or a property accessor.");
            
return;
        Label_0213:
            flag1 
= (CodeRush.Caret.CharRight != ';');
            text3 
= "";
            type1 
= element1.ElementType;
            
if (type1 == LanguageElementType.Method)
            
{
                
goto Label_0107;
            }

            
goto Label_01D4;
        Label_0241:
            Log.SendError(
"Invalid LanguageElement returned. Can't expand smart return inside anything but a method or a property accessor.");
            
return;
        Label_024C:
            text2 
= "«Cursor»";
            
goto Label_019C;
        Label_0257:
            span2 
= DateTime.op_Subtraction(DateTime.Now, new DateTime(2004730));
            
if (span2.TotalSeconds > 0f)
            
{
                
return;
            }

        Label_0287:
            CodeRush.Templates.InsertExpansion(text3);
        }

        
private string a(LanguageElement A_0, string A_1)
        
{
            LanguageElement element1;
            
string text1;
            IEnumerator enumerator1;
            IDisposable disposable1;
            ClipboardEntry entry1 
= CodeRush.Clipboard.LastEntry;
            
if (entry1 != null)
            
{
                
goto Label_0028;
            }

        Label_0013:
            enumerator1 
= CodeRush.Source.Identifiers.GetEnumerator();
            
goto Label_0048;
        Label_0028:
            
if (entry1.BestGuessType != A_1)
            
{
                
goto Label_0013;
            }

            
goto Label_0041;
        Label_003B:
            
return "";
        Label_0041:
            
return entry1.Text;
        Label_0048:
            
try
            
{
            Label_004A:
                
if (enumerator1.MoveNext())
                
{
                    
goto Label_006F;
                }

                
goto Label_003B;
            Label_0057:
                
if (((Member) element1).MemberType != A_1)
                
{
                    
goto Label_004A;
                }

                
goto Label_0088;
            Label_006F:
                element1 
= ((LanguageElement) enumerator1.Current);
                
if ((element1 as Member) == null)
                
{
                    
goto Label_004A;
                }

                
goto Label_0091;
            Label_0088:
                
return element1.Name;
            Label_0091:
                
if (element1 == A_0)
                
{
                    
goto Label_004A;
                }

                
goto Label_0057;
                
goto Label_003B;
            }

            
finally
            
{
                disposable1 
= (enumerator1 as IDisposable);
                
if (disposable1 != null)
                
{
                    disposable1.Dispose();
                }

            }

            
return text1;

如果能够解决,那么大家就可以免费使用smartTemplate了。
原文地址:https://www.cnblogs.com/William_Fire/p/21814.html