public static IDevice ReadLocation(IPhysicalData physicalData) { IDevice device = null; if (Uri.IsWellFormedUriString(physicalData.XmlDescriptionPath, UriKind.RelativeOrAbsolute)) { HttpWebRequest request = WebRequest.Create(physicalData.XmlDescriptionPath) as HttpWebRequest; Task <WebResponse> async_response = request.GetResponseAsync(); async_response.Wait(); WebResponse response = async_response.Result; var stream = response.GetResponseStream(); int length = (int)response.ContentLength; byte[] buffer = new byte[length]; int received = 0; while (received < length) { received += stream.Read(buffer, received, length - received); } XDocument doc = XDocument.Parse(Encoding.UTF8.GetString(buffer, 0, length)); if (isBoseSoundTouchDevice(doc, DeviceType.MediaRenderer)) { device = new BoseSoundTouchDevice(physicalData, doc); } else { device = new Device(physicalData, doc); } } return(device); }
public BoseSoundTouchDevice(IPhysicalData physicalData, XDocument xDoc) : base(physicalData, xDoc) { m_services = new Dictionary <Type, object>(); RegisterService(typeof(Services.GET_now_playing)); RegisterService(typeof(Services.GET_volume)); RegisterService(typeof(Services.GET_presets)); m_cancelToken = new CancellationTokenSource(); m_updateServices = new List <object>(); prepareUpdater(); }
public void ApplyPhysics(IPhysicalData data, Table table) { var mat = table.GetMaterial(data.GetPhysicsMaterial()); if (mat != null && !data.GetOverwritePhysics()) { SetElasticity(mat.Elasticity, mat.ElasticityFalloff); SetFriction(mat.Friction); SetScatter(MathF.DegToRad(mat.ScatterAngle)); } else { SetElasticity(data.GetElasticity(), data.GetElasticityFalloff()); SetFriction(data.GetFriction()); SetScatter(MathF.DegToRad(data.GetScatter())); } SetEnabled(data.GetIsCollidable()); }
public GET_getZone(ref IPhysicalData physicalData) : base(ref physicalData) { }
public GET_bass(ref IPhysicalData physicalData) : base(ref physicalData) { }
public Device(IPhysicalData physicalData, XDocument xDoc) { PhysicalData = physicalData; XDocument = xDoc; }
public GET_bassCapabilities(ref IPhysicalData physicalData) : base(ref physicalData) { }
public GET_presets(ref IPhysicalData physicalData) : base(ref physicalData) { }
public GET_info(ref IPhysicalData physicalData) : base(ref physicalData) { }
public GET(ref IPhysicalData physicalData) { m_physicalData = physicalData; }
public GET_sources(ref IPhysicalData physicalData) : base(ref physicalData) { }
public GET_volume(ref IPhysicalData physicalData) : base(ref physicalData) { }
public POST(IPhysicalData physicalData) { m_ipAddress = physicalData.Address; }
public GET_group(ref IPhysicalData physicalData) : base(ref physicalData) { }
public POST_volume(IPhysicalData physicalData) : base(physicalData) { }