public void Process() 
        {
		
		    ApplicationDescriptor applicationDescriptor = connectResourceManager.GetApplicationDescriptor();
		    IEnumerator<String> serviceDescriptorPaths = applicationDescriptor.GetServiceDescriptorPaths();
		
		    while(serviceDescriptorPaths.MoveNext()) 
            {
			    String serviceDescriptorPath = serviceDescriptorPaths.Current;

                String serviceDescriptorFileName = null;
                String serviceDescriptorFilePath = null;

                serviceDescriptorFilePath = serviceDescriptorPath.Substring(0, serviceDescriptorPath.LastIndexOf("/"));
                serviceDescriptorFileName = serviceDescriptorPath.Substring(serviceDescriptorPath.LastIndexOf("/") + 1, (serviceDescriptorPath.Length - serviceDescriptorPath.LastIndexOf("/")) - 1);

                Stream serviceDescriptorStream = null;

                try 
                {
                    
                    #if XAMARIN
                        serviceDescriptorStream = FileUtils.ReadFileFromEmbeddedResources("Assets." + serviceDescriptorFilePath + "." + serviceDescriptorFileName);
				        if(serviceDescriptorStream == null) 
				        {
					        serviceDescriptorStream = FileUtils.ReadFileFromEmbeddedResources(serviceDescriptorFilePath + "." + serviceDescriptorFileName);					
				        }
                    #elif WINDOWS
                        serviceDescriptorStream = FileUtils.SearchFile(serviceDescriptorFilePath, serviceDescriptorFileName, FileUtils.INSTALLED_FOLDER);
                    #endif

                } 
                catch(System.Exception ioException) 
                {
                    Log.Error(this.GetType().Name, "Process", "IOException caught while getting input stream of Service Descriptor: " + serviceDescriptorPath + ", " + ioException.Message);
                    throw new SiminovException(this.GetType().Name, "process", "IOException caught while getting input stream of Service Descriptor: " + serviceDescriptorPath + ", " + ioException.Message);
                }
			
			    try 
                {
                    ParseMessage(serviceDescriptorStream);
			    }
                catch (PrematureEndOfParseException exception) 
                {
                    Log.Error(this.GetType().Name, "Process", "PrematureEndOfParseException caught while parsing Service Descriptor: " + serviceDescriptorPath + ", " + exception.Message);
			    }
			
			    if(doesMatch) 
                {

				    ServiceDescriptorReader serviceDescriptor = new ServiceDescriptorReader(serviceDescriptorPath);
				    this.serviceDescriptor = serviceDescriptor.GetServiceDescriptor();
				
				    return;
			    }
		    }
	    }
Example #2
0
	    public void SetServiceDescriptor(ServiceDescriptor serviceDescriptor) 
        {
		    this.serviceDescriptor = serviceDescriptor;
	    }