Esempio n. 1
0
        public object Retrieve(string serviceName, XmlRpcStruct args)
        {
            Console.WriteLine("Service \"{0}\"", serviceName);
            ProvidersManager providers = new ProvidersManager();
            Extractable service = null;
            try {
                service = providers.FindService(serviceName);
            }
            catch (InvalidNameException) {
                string msg = "The name of the service should be in the format NameSpace.ServiceName";
                throw new XmlRpcFaultException(32602, msg);
            }
            catch (ServiceNotFoundException) {
                string msg = String.Format("The service \"{0}\" does not exist on this server.", serviceName);
                throw new XmlRpcFaultException(32602, msg);
            }

            Console.WriteLine("Arguments (as strings):");
            StringDict arguments = new StringDict();
            foreach (DictionaryEntry keyval in args) {
                arguments.Add((string)keyval.Key, keyval.Value.ToString());
                Console.WriteLine("{0}=>{1}", keyval.Key, keyval.Value);
            }

            service.Extract(arguments);

            Console.WriteLine("Result: {0}", service.ToString());
            return service;
        }
Esempio n. 2
0
 public FinanceHelper(IDataStorage storage, ILogger logger, ProvidersManager providers, ConvertHelper convertor)
 {
     _storage   = storage;
     _logger    = logger;
     _providers = providers;
     _convertor = convertor;
 }
Esempio n. 3
0
 public void Start()
 {
     _container = ContainerManager.GetContainer();
     _storage   = _container.Resolve <IDataStorage>();
     _providers = _container.Resolve <ProvidersManager>();
     _settings  = _container.Resolve <ISettingsStorage>();
     userId     = Guid.Parse("bd0b506b-1bf4-449b-975c-15964d1dca6e");
 }
Esempio n. 4
0
        public MainPageViewModel(DownloadsManager down, ProvidersManager p)
        {
            downloadManager = down;
            downloadManager.ListDownloads.CollectionChanged += ListDownloads_CollectionChanged;
            providers = p;

            //MyTraceListener myTrace = new MyTraceListener();
            //myTrace.TextChanged += MyTrace_TextChanged;
            //Trace.Listeners.Add(myTrace);
        }
Esempio n. 5
0
    static void Main(string[] args)
    {
        if (args.Length == 0) {
            Console.WriteLine("Either pass --server to run as XML-RPC server mode, or pass " +
                              "\"ServiceName [arg, arg...]\" to run directly.");
            return;
        }

        if (args.Length > 0 && args[0] == "--server") {
            int port = 9996;
            BlockingXmlRpcServer server = new BlockingXmlRpcServer(port);
            server.Start();
        } else {
            ProvidersManager providers = new ProvidersManager();
            Extractable service = null;
            try {
                service = providers.FindService(args[0]);
            }
            catch (InvalidNameException) {
                Console.WriteLine("The name of the service should be in the format NameSpace.ServiceName");
                return;
            }
            catch (ServiceNotFoundException) {
                Console.WriteLine("The service {0} is not currently supported.", args[0]);
                return;
            }

            StringDict arguments = new StringDict();
            if (args.Length > 1)
                for (int i = 1; i < args.Length; i++) {
                    string[] name_val = args[i].Split("=".ToCharArray(), 2);
                    if (name_val.Length > 1)
                        arguments.Add(name_val[0], name_val[1]);
                    else
                        Console.WriteLine("Wrong argument format, ignored: {0}", args[i]);
                }

            service.Extract(arguments);
            Console.WriteLine (service.ToString());
        }
    }
 public ProvidersController(UserManager <User> userManager, ProvidersManager providersManager) : base(userManager)
 {
     _providersManager = providersManager;
 }