예제 #1
0
        public Agv GetAgvData()
        {
            var textData = LocalDataHandler.GetTextData("agv.json");

            return(string.IsNullOrEmpty(textData)
                ? new Agv()
                : JsonConvert.DeserializeObject <Agv>(textData));
        }
예제 #2
0
        public Position GetBaseCupPosition()
        {
            var textData = LocalDataHandler.GetTextData("baseCupPosition.json");

            return(string.IsNullOrEmpty(textData)
                ? Positions["Base2Position"]
                : JsonConvert.DeserializeObject <Position>(textData));
        }
예제 #3
0
        public RealRobot GetRobotData()
        {
            var textData = LocalDataHandler.GetTextData("robot.json");

            return(string.IsNullOrEmpty(textData)
                ? new RealRobot()
                : JsonConvert.DeserializeObject <RealRobot>(textData));
        }
예제 #4
0
        public void SetAvailableDrink(DrinksPageItem drinkToAdd, DrinkPosition position)
        {
            if (drinkToAdd.Clone() is DrinksPageItem newDrink)
            {
                newDrink.DrinkPosition = position;
                AvailableDrinks.RemoveAt((int)position);
                AvailableDrinks.Insert((int)newDrink.DrinkPosition, newDrink);
            }

            LocalDataHandler.SaveTextData("availableDrinks.json",
                                          JsonConvert.SerializeObject(AvailableDrinks, Formatting.Indented));
        }
예제 #5
0
        public List <Sound> GetSoundInfo()
        {
            var textData = LocalDataHandler.GetTextData("sounds.json");

            if (string.IsNullOrEmpty(textData))
            {
                var sounds = GetSounds();
                //SaveSoundInfo(sounds);
                return(sounds);
            }

            return(JsonConvert.DeserializeObject <List <Sound> >(textData));
        }
예제 #6
0
        public JsonDatabaseService()
        {
            Positions =
                JsonConvert.DeserializeObject <Dictionary <string, Position> >(
                    LocalDataHandler.GetTextFromAssembly("Data.positions.json"));
            Poses = JsonConvert.DeserializeObject <Dictionary <string, Pose> >(
                LocalDataHandler.GetTextFromAssembly("Data.poses.json"));
            Tools = JsonConvert.DeserializeObject <Dictionary <string, Gripper> >(
                LocalDataHandler.GetTextFromAssembly("Data.tools.json"));

            Drinks = JsonConvert.DeserializeObject <List <DrinksPageItem> >(
                LocalDataHandler.GetTextFromAssembly("Data.drinks.json"));

            var availableDrinks = "";

            if ((availableDrinks = LocalDataHandler.GetTextData("availableDrinks.json")) == "")
            {
                availableDrinks = LocalDataHandler.GetTextFromAssembly("Data.availableDrinks.json");
            }
            AvailableDrinks = JsonConvert.DeserializeObject <List <DrinksPageItem> >(availableDrinks);
        }
예제 #7
0
 public void SaveBaseCupPosition(Position position)
 {
     LocalDataHandler.SaveTextData("baseCupPosition.json", JsonConvert.SerializeObject(position, Formatting.Indented));
 }
예제 #8
0
 public void SaveSoundInfo(List <Sound> sounds)
 {
     LocalDataHandler.SaveTextData("sounds.json", JsonConvert.SerializeObject(sounds, Formatting.Indented));
 }
예제 #9
0
 public void SaveRobotData(RealRobot data)
 {
     LocalDataHandler.SaveTextData("robot.json", JsonConvert.SerializeObject(data, Formatting.Indented));
 }
예제 #10
0
 public void SaveAgvData(Agv agv)
 {
     LocalDataHandler.SaveTextData("agv.json", JsonConvert.SerializeObject(agv, Formatting.Indented));
 }