Exemple #1
0
        public List <Device> GetDevices()
        {
            string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

            if (!File.Exists(path + "/Config.json"))
            {
                Console.WriteLine("Config file does not exist");
                return(null);
            }

            string       content = File.ReadAllText(path + "/Config.json");
            DeviceObject tim     = JsonConvert.DeserializeObject <DeviceObject>(content);

            return(tim.Devices);
        }
Exemple #2
0
        public bool SetDevices(List <Device> items)
        {
            Console.WriteLine("SetDevices");
            if (!VerifyContent(items))
            {
                return(false);
            }
            string       path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            DeviceObject obj  = new DeviceObject();

            obj.Devices = items;
            string content = JsonConvert.SerializeObject(obj);

            File.WriteAllText(path + "/Config.json", content);
            return(true);
        }