public WindowsPhoneIO() { MethodList = new List<MethodInvoker>(WindowsPhoneUtils.GetMethodInvokersList(this)); IOUserAgent = "Unity 1.0"; var pendingTask = Task.Run(async () => { _servicesConfigObject = await GetServicesConfig(); }); pendingTask.Wait(); }
/// <summary> /// /// </summary> protected void LoadServicesConfig() { try { // FileStream to read the XML document. Stream fs = GetConfigFileStream(); if (fs != null) { XmlSerializer serializer = new XmlSerializer(typeof(IOServicesConfig)); servicesConfig = (IOServicesConfig)serializer.Deserialize(new MemoryStream(((MemoryStream)fs).GetBuffer())); } } catch (Exception e) { SystemLogger.Log(SystemLogger.Module.CORE, "Error when loading services configuration", e); } }
/// <summary> /// /// </summary> protected void LoadServicesConfig() { try { // FileStream to read the XML document. byte[] configFileRawData = GetConfigFileBinaryData(); if (configFileRawData != null) { XmlSerializer serializer = new XmlSerializer(typeof(IOServicesConfig)); servicesConfig = (IOServicesConfig)serializer.Deserialize(new MemoryStream(configFileRawData)); } } catch (Exception e) { SystemLogger.Log(SystemLogger.Module.CORE, "Error when loading services configuration", e); servicesConfig = new IOServicesConfig(); // reset services config mapping when the services could not be loaded for any reason } }
/// <summary> /// /// </summary> protected void LoadServicesConfig() { servicesConfig = new IOServicesConfig(); // reset services config mapping when the services could not be loaded for any reason try { // FileStream to read the XML document. byte[] configFileRawData = GetConfigFileBinaryData(); if (configFileRawData != null) { XmlSerializer serializer = new XmlSerializer(typeof(IOServicesConfig)); servicesConfig = (IOServicesConfig)serializer.Deserialize(new MemoryStream(configFileRawData)); } } catch (Exception e) { SystemLogger.Log(SystemLogger.Module.CORE, "Error when loading services configuration", e); } }
public override async Task<IOService> GetService(string name) { if (_servicesConfigObject == null) _servicesConfigObject = await GetServicesConfig(); return _servicesConfigObject != null ? _servicesConfigObject.Services.First(serv => serv.Name.Equals(name)) : null; }
private async Task<IOServicesConfig> GetServicesConfig() { if (_servicesConfigObject != null) return _servicesConfigObject; var IOConfigStorageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(SERVICES_CONFIG_FILE)); var serializer = new XmlSerializer(typeof(IOServicesConfig)); var reader = XmlReader.Create(await IOConfigStorageFile.OpenStreamForReadAsync()); _servicesConfigObject = (IOServicesConfig)serializer.Deserialize(reader); return _servicesConfigObject; }
/// <summary> /// /// </summary> protected void LoadServicesConfig() { try { // FileStream to read the XML document. Stream fs = GetConfigFileStream (); if (fs != null) { XmlSerializer serializer = new XmlSerializer (typeof(IOServicesConfig)); servicesConfig = (IOServicesConfig)serializer.Deserialize (new MemoryStream (((MemoryStream)fs).GetBuffer ())); } } catch (Exception e) { SystemLogger.Log (SystemLogger.Module .CORE, "Error when loading services configuration", e); } }