Пример #1
0
        internal static Dictionary <string, object[]> GenDataTables(int rows, int columns)
        {
            Dictionary <string, object[]> dataTables = new Dictionary <string, object[]>();

            foreach (Table table in TableHelper.DataTableNames)
            {
                dataTables.Add(table.TableName, new object[] { TableHelper.CreateTable(rows, columns), table.TableOperation });
            }

            return(dataTables);
        }
        public Dictionary <string, object[]> LoadMap(String path)
        {
            Dictionary <string, object[]> mapTables = new Dictionary <string, object[]>();

            foreach (Table table in TableHelper.MapTableNames)
            {
                mapTables.Add(table.TableName, new object[] { TableHelper.CreateTable(_rows, _columns), table.TableOperation });
            }

            StreamReader sr;
            string       s;

            sr = File.OpenText(path);
            s  = sr.ReadLine();

            string tableName = string.Empty;

            Int32 row = 0;

            while (s != null)
            {
                s = sr.ReadLine();
                if (!string.IsNullOrEmpty(s))
                {
                    switch (s)
                    {
                    case "Fuel Map":
                        tableName = "MapFuel";
                        TableHelper.ClearTable(TableHelper.GetTable(tableName, mapTables));
                        row = 1;
                        break;

                    case "Timing Map":
                        tableName = "MapTiming";
                        TableHelper.ClearTable(TableHelper.GetTable(tableName, mapTables));
                        row = 1;
                        break;

                    case "Boost Map":
                        tableName = "MapBoost";
                        TableHelper.ClearTable(TableHelper.GetTable(tableName, mapTables));
                        row = 1;
                        break;

                    default:
                        if (s != null)
                        {
                            if (s.Substring(0, 10) == "Map Name:-")
                            {
                                MapName = s.Substring(10, s.Length - 10).Trim("[]".ToCharArray());
                            }
                            else if (s.Substring(0, 14) == "Map Comments:-")
                            {
                                MapComments = s.Substring(14, s.Length - 14).Trim("[]".ToCharArray());
                            }

                            if (!string.IsNullOrEmpty(tableName))
                            {
                                if (row >= 3 && row <= 37)
                                {
                                    PlotUtecMap(s, row - 3, TableHelper.GetTable(tableName, mapTables));
                                }
                                row++;
                            }
                        }

                        break;
                    }
                }
            }
            sr.Close();

            return(mapTables);
        }