Exemplo n.º 1
0
        private void PrepareDataTypeAndParams(CoreDataType dataType, int length, int decimals)
        {
            switch (dataType)
            {
            case CoreDataType.INT:
                DataType           = "int";
                DataTypeParameters = "";
                Length             = 0;
                Decimals           = 0;
                break;

            case CoreDataType.DATE:
            case CoreDataType.TIME:
            case CoreDataType.DATETIME:
                DataType           = "datetime";
                DataTypeParameters = "";
                break;

            case CoreDataType.VARCHAR:
                DataType           = "varchar";
                DataTypeParameters = $"({length})";
                Length             = length;
                Decimals           = 0;
                break;

            case CoreDataType.DECIMAL:
                DataType           = "decimal";
                DataTypeParameters = $"({length},{decimals})";
                Length             = length;
                Decimals           = decimals;
                break;
            }
        }
Exemplo n.º 2
0
        private object DataTypeToString(CoreDataType dataType)
        {
            switch (dataType)
            {
            case CoreDataType.INT:
                return("int");

            case CoreDataType.DECIMAL:
                return("decimal");

            case CoreDataType.VARCHAR:
                return("varchar");

            case CoreDataType.DATE:
                return("date");

            case CoreDataType.DATETIME:
                return("datetime");

            case CoreDataType.TIME:
                return("time");

            default:
                throw new InvalidDataTypeException();
            }
        }
Exemplo n.º 3
0
        public string GetByDataType(CoreDataType dataType)
        {
            switch (dataType)
            {
            case CoreDataType.Customs:
                return(Customs);

            case CoreDataType.Drones:
                return(Drones);

            case CoreDataType.Flavour:
                return(Flavour);

            case CoreDataType.FusionBundles:
                return(FusionBundles);

            case CoreDataType.Gear:
                return(Gear);

            case CoreDataType.Keys:
                return(Keys);

            case CoreDataType.Recipes:
                return(Recipes);

            case CoreDataType.Regions:
                return(Recipes);

            case CoreDataType.RelicArcane:
                return(RelicArcane);

            case CoreDataType.Resources:
                return(Resources);

            case CoreDataType.Sentinels:
                return(Sentinels);

            case CoreDataType.SortieRewards:
                return(SortieRewards);

            case CoreDataType.Upgrades:
                return(Upgrades);

            case CoreDataType.Warframes:
                return(Warframes);

            case CoreDataType.Weapons:
                return(Weapons);

            case CoreDataType.Manifest:
                return(Manifest);

            default:
                throw new ArgumentOutOfRangeException(nameof(dataType), dataType, null);
            }
        }
Exemplo n.º 4
0
 public ILAttribute(string name, CoreDataType dataType, int length, int decimals, bool primaryKey)
 {
     Name         = name;
     IsPrimaryKey = primaryKey;
     PrepareDataTypeAndParams(dataType, length, decimals);
     if (IsPrimaryKey)
     {
         DataTypeParameters += " not null";
     }
 }
Exemplo n.º 5
0
        public async Task <string> GetData(CoreDataType dataType)
        {
            var task = _client.GetAsync(_index.GetByDataType(dataType));

            task.Wait();
            var response = task.Result;

            using (response)
            {
                return(await response.Content.ReadAsStringAsync());
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new <see cref="CoreDataFieldDescription"/> instance
 /// </summary>
 /// <param name="Position">The peer-relative position of the field</param>
 /// <param name="Name">The name of the field</param>
 /// <param name="DataType">The <see cref="CoreDataType"/> of the field</param>
 /// <param name="DataFacets">The applicable <see cref="CoreDataFacets"/></param>
 /// <param name="Documentation">Describes the purposes of the field</param>
 public CoreDataFieldDescription
 (
     int Position,
     string Name,
     CoreDataType DataType,
     CoreDataFacets DataFacets = null,
     string Documentation      = null
 )
 {
     this.Position      = Position;
     this.Name          = Name;
     this.DataType      = DataType;
     this.Documentation = Documentation ?? String.Empty;
     this.DataFacets    = DataFacets;
 }
Exemplo n.º 7
0
        public void SaveData(CoreDataType dataType, string targetFileLocation)
        {
            var data    = GetData(dataType);
            var dir     = Path.GetDirectoryName(targetFileLocation);
            var dirInfo = new DirectoryInfo(dir);

            if (!dirInfo.Exists)
            {
                dirInfo.Create();
            }

            using (var fs = new FileStream(targetFileLocation, FileMode.Create))
            {
                using (var sw = new StreamWriter(fs))
                {
                    sw.Write(data);
                }
            }
        }
Exemplo n.º 8
0
        public static string GetSqlDataType(CoreDataType dataType)
        {
            switch (dataType)
            {
            case CoreDataType.DATE:
                return("date");

            case CoreDataType.DATETIME:
                return("datetime");

            case CoreDataType.DECIMAL:
                return("decimal");

            case CoreDataType.INT:
                // Achtung: Sonderfall: ID in Faktentabllen ist BigInt !!!
                return("int");

            case CoreDataType.VARCHAR:
                return("varchar");

            default:
                throw new InvalidDataTypeException($"Ungültiger Datentyp: {dataType.ToString()}");
            }
        }
 public CoreDataChangedEventArgs(CoreDataType key)
 {
     this.key = key;
 }
Exemplo n.º 10
0
 public void SaveData(CoreDataType dataType)
 {
     _client.SaveData(dataType, Path.Combine(_rootDirectory, dataType.ToString() + ".json"));
 }
Exemplo n.º 11
0
 public BLDataType(CoreDataType core)
 {
     this.Core = core;
 }