Ejemplo n.º 1
0
 public static void Generate()
 {
     if (BaseGen.working)
     {
         Log.Error("Cannot call Generate() while already generating. Nested calls are not allowed.", false);
         return;
     }
     BaseGen.working = true;
     try
     {
         if (BaseGen.symbolStack.Empty)
         {
             Log.Warning("Symbol stack is empty.", false);
         }
         else if (BaseGen.globalSettings.map == null)
         {
             Log.Error("Called BaseGen.Resolve() with null map.", false);
         }
         else
         {
             int num  = BaseGen.symbolStack.Count - 1;
             int num2 = 0;
             while (!BaseGen.symbolStack.Empty)
             {
                 num2++;
                 if (num2 > 100000)
                 {
                     Log.Error("Error in BaseGen: Too many iterations. Infinite loop?", false);
                     break;
                 }
                 Pair <string, ResolveParams> toResolve = BaseGen.symbolStack.Pop();
                 if (BaseGen.symbolStack.Count == num)
                 {
                     BaseGen.globalSettings.mainRect = toResolve.Second.rect;
                     num--;
                 }
                 try
                 {
                     BaseGen.Resolve(toResolve);
                 }
                 catch (Exception ex)
                 {
                     Log.Error(string.Concat(new object[]
                     {
                         "Error while resolving symbol \"",
                         toResolve.First,
                         "\" with params=",
                         toResolve.Second,
                         "\n\nException: ",
                         ex
                     }), false);
                 }
             }
         }
     }
     catch (Exception arg)
     {
         Log.Error("Error in BaseGen: " + arg, false);
     }
     finally
     {
         BaseGen.working = false;
         BaseGen.symbolStack.Clear();
         BaseGen.globalSettings.Clear();
     }
 }
Ejemplo n.º 2
0
 public static void Generate()
 {
     if (BaseGen.working)
     {
         Log.Error("Cannot call Generate() while already generating. Nested calls are not allowed.");
     }
     else
     {
         BaseGen.working = true;
         try
         {
             if (BaseGen.symbolStack.Empty)
             {
                 Log.Warning("Symbol stack is empty.");
             }
             else if (BaseGen.globalSettings.map == null)
             {
                 Log.Error("Called BaseGen.Resolve() with null map.");
             }
             else
             {
                 int num  = BaseGen.symbolStack.Count - 1;
                 int num2 = 0;
                 while (true)
                 {
                     if (!BaseGen.symbolStack.Empty)
                     {
                         num2++;
                         if (num2 <= 100000)
                         {
                             Pair <string, ResolveParams> toResolve = BaseGen.symbolStack.Pop();
                             if (BaseGen.symbolStack.Count == num)
                             {
                                 GlobalSettings obj    = BaseGen.globalSettings;
                                 ResolveParams  second = toResolve.Second;
                                 obj.mainRect = second.rect;
                                 num--;
                             }
                             try
                             {
                                 BaseGen.Resolve(toResolve);
                             }
                             catch (Exception ex)
                             {
                                 Log.Error("Error while resolving symbol \"" + toResolve.First + "\" with params=" + toResolve.Second + "\n\nException: " + ex);
                             }
                             continue;
                         }
                         break;
                     }
                     return;
                 }
                 Log.Error("Error in BaseGen: Too many iterations. Infinite loop?");
             }
         }
         catch (Exception arg)
         {
             Log.Error("Error in BaseGen: " + arg);
         }
         finally
         {
             BaseGen.working = false;
             BaseGen.symbolStack.Clear();
             BaseGen.globalSettings.Clear();
         }
     }
 }