Example #1
0
    public BotConstant(string config)
    {
        //read the config
        MemoryStream memStream = new MemoryStream();
        StreamWriter strWriter = new StreamWriter(memStream);

        strWriter.Write(config);
        strWriter.Flush();
        memStream.Position = 0;
        DataContractJsonSerializer playerSerializer = new DataContractJsonSerializer(typeof(BotConstantConfig));
        BotConstantConfig          botCfg           = (BotConstantConfig)playerSerializer.ReadObject(memStream);

        thisErg              = new EasyErgsocket.Erg();
        thisErg.cadence      = botCfg.spm;
        thisErg.calories     = 1;
        thisErg.distance     = 0.0;
        thisErg.ergtype      = EasyErgsocket.ErgType.ROW;
        thisErg.exerciseTime = 10.0;
        thisErg.heartrate    = 0;
        thisErg.name         = botCfg.name;
        thisErg.paceInSecs   = botCfg.pace;
        thisErg.playertype   = EasyErgsocket.PlayerType.BOT;
        thisErg.power        = 0;
        thisErg.ergId        = botCfg.name;

        originalPace = thisErg.paceInSecs;
    }
Example #2
0
    public string GetDefaultPlayerConfig()
    {
        BotConstantConfig          botCfg        = new BotConstantConfig();
        MemoryStream               memStream     = new MemoryStream();
        DataContractJsonSerializer botSerializer = new DataContractJsonSerializer(typeof(BotConstantConfig));

        botSerializer.WriteObject(memStream, botCfg);
        return(Encoding.UTF8.GetString(memStream.ToArray()));
    }