Exemplo n.º 1
0
 public void SetPaths(modLists.SimpleList<string> NewPaths)
 {
     this.lstPaths.Items.Clear();
     int num2 = NewPaths.Count - 1;
     for (int i = 0; i <= num2; i++)
     {
         this.lstPaths.Items.Add(NewPaths[i]);
     }
 }
Exemplo n.º 2
0
 public clsModel GetModelForPIE(modLists.SimpleList<clsPIE> PIE_List, string PIE_LCaseFileTitle, clsResult ResultOutput)
 {
     if (PIE_LCaseFileTitle != "0")
     {
         clsResult resultToAdd = new clsResult("Loading PIE file " + PIE_LCaseFileTitle);
         int num2 = PIE_List.Count - 1;
         for (int i = 0; i <= num2; i++)
         {
             clsPIE spie = PIE_List[i];
             if (spie.LCaseFileTitle == PIE_LCaseFileTitle)
             {
                 if (spie.Model == null)
                 {
                     spie.Model = new clsModel();
                     try
                     {
                         StreamReader file = new StreamReader(spie.Path);
                         try
                         {
                             resultToAdd.Take(spie.Model.ReadPIE(file, this));
                         }
                         catch (Exception exception1)
                         {
                             ProjectData.SetProjectError(exception1);
                             Exception exception = exception1;
                             file.Close();
                             resultToAdd.WarningAdd(exception.Message);
                             ResultOutput.Add(resultToAdd);
                             clsModel model = spie.Model;
                             ProjectData.ClearProjectError();
                             return model;
                         }
                     }
                     catch (Exception exception3)
                     {
                         ProjectData.SetProjectError(exception3);
                         Exception exception2 = exception3;
                         resultToAdd.WarningAdd(exception2.Message);
                         ProjectData.ClearProjectError();
                     }
                 }
                 ResultOutput.Add(resultToAdd);
                 return spie.Model;
             }
         }
         if (!resultToAdd.HasWarnings)
         {
             resultToAdd.WarningAdd("file is missing");
         }
         ResultOutput.Add(resultToAdd);
     }
     return null;
 }
Exemplo n.º 3
0
 public modLists.SimpleList<string[]> GetRowsWithValue(modLists.SimpleList<string[]> TextLines, string Value)
 {
     IEnumerator enumerator;
     modLists.SimpleList<string[]> list2 = new modLists.SimpleList<string[]>();
     try
     {
         enumerator = TextLines.GetEnumerator();
         while (enumerator.MoveNext())
         {
             string[] current = (string[]) enumerator.Current;
             if (current[0] == Value)
             {
                 list2.Add(current);
             }
         }
     }
     finally
     {
         if (enumerator is IDisposable)
         {
             (enumerator as IDisposable).Dispose();
         }
     }
     return list2;
 }
Exemplo n.º 4
0
 public void SetWallName(modLists.SimpleList<string[]> Names, clsWallType WallType, clsResult Result)
 {
     modLists.SimpleList<string[]> rowsWithValue = this.GetRowsWithValue(Names, WallType.Code);
     if (rowsWithValue.Count == 0)
     {
         Result.WarningAdd("No name for structure type " + WallType.Code + ".");
     }
     else
     {
         WallType.Name = rowsWithValue[0][1];
     }
 }
Exemplo n.º 5
0
 public void SetTemplateName(modLists.SimpleList<string[]> Names, clsDroidTemplate Template, clsResult Result)
 {
     modLists.SimpleList<string[]> rowsWithValue = this.GetRowsWithValue(Names, Template.Code);
     if (rowsWithValue.Count == 0)
     {
         Result.WarningAdd("No name for droid template " + Template.Code + ".");
     }
     else
     {
         Template.Name = rowsWithValue[0][1];
     }
 }
Exemplo n.º 6
0
 public void SetFeatureName(modLists.SimpleList<string[]> Names, clsFeatureType FeatureType, clsResult Result)
 {
     modLists.SimpleList<string[]> rowsWithValue = this.GetRowsWithValue(Names, FeatureType.Code);
     if (rowsWithValue.Count == 0)
     {
         Result.WarningAdd("No name for feature type " + FeatureType.Code + ".");
     }
     else
     {
         FeatureType.Name = rowsWithValue[0][1];
     }
 }
Exemplo n.º 7
0
 public void SetComponentName(modLists.SimpleList<string[]> Names, clsComponent Component, clsResult Result)
 {
     modLists.SimpleList<string[]> rowsWithValue = this.GetRowsWithValue(Names, Component.Code);
     if (rowsWithValue.Count == 0)
     {
         Result.WarningAdd("No name for component " + Component.Code + ".");
     }
     else
     {
         Component.Name = rowsWithValue[0][1];
     }
 }
Exemplo n.º 8
0
 public static Position.XY_dbl CalcUnitsCentrePos(modLists.SimpleList<clsMap.clsUnit> Units)
 {
     Position.XY_dbl _dbl2;
     IEnumerator enumerator;
     _dbl2.X = 0.0;
     _dbl2.Y = 0.0;
     try
     {
         enumerator = Units.GetEnumerator();
         while (enumerator.MoveNext())
         {
             clsMap.clsUnit current = (clsMap.clsUnit) enumerator.Current;
             _dbl2 += current.Pos.Horizontal.ToDoubles();
         }
     }
     finally
     {
         if (enumerator is IDisposable)
         {
             (enumerator as IDisposable).Dispose();
         }
     }
     return (Position.XY_dbl) (_dbl2 / ((double) Units.Count));
 }