示例#1
0
        public override bool Equals(object obj)
        {
            bool result = false;

            if (obj is ConsoleState)
            {
                ConsoleState other = (ConsoleState)obj;
                result = Id.Equals(other.Id) &&
                         Connected.Equals(other.Connected) &&
                         TelemetryState.Equals(other.TelemetryState) &&
                         TelemetryInterval.Equals(other.TelemetryInterval) &&
                         ConsoleColor.Equals(other.ConsoleColor);
            }
            return(result);
        }
示例#2
0
        public LifxBulb(string json, LifxManager manager)
        {
            JToken bulbData = JObject.Parse(json);

            this.manager = manager;
            id           = bulbData.Value <string>("id");
            Uuid         = bulbData.Value <string>("uuid");
            Label        = bulbData.Value <string>("label");
            Connected    = bulbData.Value <bool>("connected") ? "Online" : "Offline";
            Power        = bulbData.Value <string>("power").Equals("on") && Connected.Equals("Online") ? true : false;
            Brightness   = bulbData.Value <float>("brightness");
            Color        = new LifxColor(bulbData.Value <JToken>("color").ToString());
            Group        = new LifxGroup(bulbData.Value <JToken>("group").ToString(), manager);
            Location     = new LifxLocation(bulbData.Value <JToken>("location").ToString(), manager);
            ProductName  = bulbData.Value <string>("product_name");
            //Capabilities = new LifxCapability(bulbData.Value<JToken>("capabilities").ToString());
            LastSeen         = bulbData.Value <string>("last_seen");
            SecondsSinceSeen = bulbData.Value <double>("seconds_since_seen");
        }