Exemplo n.º 1
0
        public WindowsPhoneIO()
        {
            MethodList = new List<MethodInvoker>(WindowsPhoneUtils.GetMethodInvokersList(this));
            IOUserAgent = "Unity 1.0";
            var pendingTask = Task.Run(async () =>
            {
                _servicesConfigObject = await GetServicesConfig();
            });

            pendingTask.Wait();
        }
Exemplo n.º 2
0
 /// <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);
     }
 }
Exemplo n.º 3
0
 /// <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
     }
 }
Exemplo n.º 4
0
 /// <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);
     }
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 /// <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);
     }
 }