Пример #1
0
    static void Main(string[] args)
    {
        //This is your input json string
        var        inputJson  = @"{
                          'datamapItems': [
                                       {
                                          'paramName': 'VE8321C',
                                          'datamapKey': {
                                                       'module': 1,
                                                       'id': 1391
                                          },
                                          'min': '0',
                                          'max': '40',
                                          'default': 222,
                                          'rateHz': 0,
                                          'timeoutMs': 0,
                                          'dataType': 'uint16'
                                        }
                                     ]
                               }";
        var        result     = JsonConvert.DeserializeObject <Datamap>(inputJson); //Here you can deserialize your json
        DatamapKey datamapKey = new DatamapKey();

        datamapKey._DatamapKeys = new Dictionary <string, JToken>();
        datamapKey._DatamapKeys.Add("module", 1);
        datamapKey._DatamapKeys.Add("id", 1391);
        datamapKey._DatamapKeys.Add("ABC", 123);       //Here I added extra key/value pair to your inner object
        DatamapItem datamapItem = new DatamapItem();

        datamapItem._DatamapItems = new Dictionary <string, JToken>();
        datamapItem._DatamapItems.Add("paramName", "VE8321C");
        datamapItem._DatamapItems.Add("datamapKey", JToken.FromObject(datamapKey));
        datamapItem._DatamapItems.Add("min", "0");
        datamapItem._DatamapItems.Add("max", "40");
        datamapItem._DatamapItems.Add("default", 222);
        datamapItem._DatamapItems.Add("rateHz", 0);
        datamapItem._DatamapItems.Add("timeoutMs", 0);
        datamapItem._DatamapItems.Add("dataType", "uint16");
        datamapItem._DatamapItems.Add("PQR", "123");       //Here I added extra key/value pair to your outer object
        datamapItem._DatamapItems.Add("XYZ", "123");       //Here I added extra key/value pair to your outer object
        Datamap datamap = new Datamap();

        datamap.datamapItems = new List <DatamapItem>();
        datamap.datamapItems.Add(datamapItem);
        string  json   = JsonConvert.SerializeObject(datamap);    //Here you can serialize your custom key/value pair
        JObject parsed = JObject.Parse(json);

        Console.WriteLine(parsed);
        Console.ReadLine();
    }
Пример #2
0
 public DatabaseLoader(Options options, Datamap db)
 {
     this._options     = options;
     this._db          = db;
     this._logger      = new Logger("MainLog.txt", "Nikki.dll : Underground1 DatabaseLoader", true);
     this.materials    = new Block(BinBlockID.Materials);
     this.tpkblocks    = new Block(BinBlockID.TPKBlocks);
     this.cartypeinfos = new Block(BinBlockID.CarTypeInfos);
     this.presetrides  = new Block(BinBlockID.PresetRides);
     this.dbmodelparts = new Block(BinBlockID.DBCarParts);
     this.suninfos     = new Block(BinBlockID.SunInfos);
     this.tracks       = new Block(BinBlockID.Tracks);
     this.fngroups     = new Block(BinBlockID.FEngFiles);
     this.strblocks    = new Block(BinBlockID.STRBlocks);
     this.gcareerraces = new Block(BinBlockID.GCareer_Old);
     this.carskins     = new Block(BinBlockID.CarSkins);
 }
Пример #3
0
 public DatabaseLoader(Options options, Datamap db)
 {
     this._options      = options;
     this._db           = db;
     this._logger       = new Logger("MainLog.txt", "Nikki.dll : Undercover DatabaseLoader", true);
     this.materials     = new Block(BinBlockID.Materials);
     this.tpkblocks     = new Block(BinBlockID.TPKBlocks);
     this.cartypeinfos  = new Block(BinBlockID.CarTypeInfos);
     this.collisions    = new Block(BinBlockID.DBCarBounds);
     this.dbmodelparts  = new Block(BinBlockID.DBCarParts);
     this.suninfos      = new Block(BinBlockID.SunInfos);
     this.tracks        = new Block(BinBlockID.Tracks);
     this.fngroups      = new Block(BinBlockID.FEngFiles);
     this.strblocks     = new Block(BinBlockID.STRBlocks);
     this.slottypes     = new Block(BinBlockID.SlotTypes);
     this.vectorvinyls  = new Block(BinBlockID.VinylSystem);
     this.caranimations = new Block(BinBlockID.CarInfoAnimHookup);
 }
Пример #4
0
 public DatabaseLoader(Options options, Datamap db)
 {
     this._options      = options;
     this._db           = db;
     this._logger       = new Logger("MainLog.txt", "Nikki.dll : Underground2 DatabaseLoader", true);
     this.materials     = new Block(BinBlockID.Materials);
     this.tpkblocks     = new Block(BinBlockID.TPKBlocks);
     this.cartypeinfos  = new Block(BinBlockID.CarTypeInfos);
     this.presetrides   = new Block(BinBlockID.PresetRides);
     this.dbmodelparts  = new Block(BinBlockID.DBCarParts);
     this.suninfos      = new Block(BinBlockID.SunInfos);
     this.tracks        = new Block(BinBlockID.Tracks);
     this.fngroups      = new Block(BinBlockID.FEngFiles);
     this.strblocks     = new Block(BinBlockID.STRBlocks);
     this.slottypes     = new Block(BinBlockID.SlotTypes);
     this.acideffects   = new Block(BinBlockID.AcidEffects);
     this.acidemitters  = new Block(BinBlockID.AcidEmitters);
     this.gcareer       = new Block(BinBlockID.GCareer);
     this.carskins      = new Block(BinBlockID.CarSkins);
     this.caranimations = new Block(BinBlockID.CarInfoAnimHookup);
 }
Пример #5
0
 /// <summary>
 /// Initializes new instance of <see cref="SunInfoManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public SunInfoManager(Datamap db) : base(db)
 {
     this.Extender  = 5;
     this.Alignment = new Alignment(0x8, Alignment.AlignmentType.Actual);
 }
Пример #6
0
 /// <summary>
 /// Initializes new instance of <see cref="MaterialManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public MaterialManager(Datamap db) : base(db)
 {
     this.Extender  = 5;
     this.Alignment = Alignment.Default;
 }
Пример #7
0
 /// <summary>
 /// Initializes new instance of <see cref="SlotOverrideManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public SlotOverrideManager(Datamap db) : base(db)
 {
     this.Extender  = 5;
     this.Alignment = Alignment.Default;
 }
Пример #8
0
 /// <summary>
 /// Initializes new instance of <see cref="DBModelPartManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public DBModelPartManager(Datamap db) : base(db)
 {
     this.Extender  = 5;
     this.Alignment = Alignment.Default;
 }
Пример #9
0
 /// <summary>
 /// Initializes new instance of <see cref="SunInfoManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public SunInfoManager(Datamap db) : base(db)
 {
     this.Extender  = 5;
     this.Alignment = Alignment.Default;
 }
Пример #10
0
 /// <summary>
 /// Initializes new instance of <see cref="FNGroupManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public FNGroupManager(Datamap db) : base(db)
 {
     this.Extender  = 0;
     this.Alignment = Alignment.Default;
 }
Пример #11
0
 /// <summary>
 /// Initializes new instance of <see cref="DBModelPartManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public DBModelPartManager(Datamap db) : base(db)
 {
     this.Extender  = 5;
     this.Alignment = new Alignment(0x4, Alignment.AlignmentType.Actual);
 }
Пример #12
0
 /// <summary>
 /// Initializes new instance of <see cref="VectorVinylManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public VectorVinylManager(Datamap db) : base(db)
 {
     this.Extender  = 1;
     this.Alignment = new Alignment(0x800, Alignment.AlignmentType.Modular);
 }
Пример #13
0
 /// <summary>
 /// Initializes new instance of <see cref="AcidEffectManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public AcidEffectManager(Datamap db) : base(db)
 {
     this.Extender  = 5;
     this.Alignment = Alignment.Default;
 }
Пример #14
0
 /// <summary>
 /// Initializes new instance of <see cref="SlotTypeManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public SlotTypeManager(Datamap db) : base(db)
 {
     this.Extender  = 0;
     this.Alignment = Alignment.Default;
 }
Пример #15
0
 /// <summary>
 /// Initializes new instance of <see cref="PresetSkinManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public PresetSkinManager(Datamap db) : base(db)
 {
     this.Extender  = 5;
     this.Alignment = Alignment.Default;
 }
Пример #16
0
 /// <summary>
 /// Initializes new instance of <see cref="TPKBlockManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public TPKBlockManager(Datamap db) : base(db)
 {
     this.Extender  = 1;
     this.Alignment = new Alignment(0x80, Alignment.AlignmentType.Modular);
 }
Пример #17
0
 public DatabaseSaver(Options options, Datamap db)
 {
     this._options = options;
     this._db      = db;
     this._logger  = new Logger("MainLog.txt", "Nikki.dll : Underground1 DatabaseSaver", true);
 }
Пример #18
0
 /// <summary>
 /// Initializes new instance of <see cref="GCareerRaceManager"/>.
 /// </summary>
 /// <param name="db"><see cref="Datamap"/> to which this manager belongs to.</param>
 public GCareerRaceManager(Datamap db) : base(db)
 {
     this.Extender      = 5;
     this.Alignment     = Alignment.Default;
     this._upgrade_info = new byte[0];
 }