Пример #1
0
        public FileMgrProxy(string serviceUrl = null)
            : base(FileMgrListener.CreateServiceEndpoint(serviceUrl))
        {
            if (serviceUrl == null)
            {
                serviceUrl = FileMgrListener.GetDefaultListenUri();
            }

            this.serviceUrl = serviceUrl;
        }
Пример #2
0
        public static ServiceEndpoint CreateServiceEndpoint(string listenUri)
        {
            if (listenUri == null)
            {
                listenUri = FileMgrListener.GetDefaultListenUri();
            }

            var endpoint = new ServiceEndpoint(ContractDescription.GetContract(typeof(FileMgrInterface)));

            endpoint.Address = new EndpointAddress(listenUri);
            endpoint.Binding = new WebHttpBinding();
            endpoint.EndpointBehaviors.Add(new WebHttpBehavior {
                HelpEnabled = true
            });

            return(endpoint);
        }
Пример #3
0
        public void Sync(string serviceUrl, string name, string targetDir)
        {
            try
            {
                if (serviceUrl == null)
                {
                    serviceUrl = FileMgrListener.GetDefaultListenUri();
                }
                if (name == null)
                {
                    name = "latest";
                }
                if (targetDir == null)
                {
                    targetDir = AppDomain.CurrentDomain.BaseDirectory;
                }

                SyncFiles(serviceUrl, name, targetDir);
            }
            catch (Exception ex)
            {
                Logger.Instance.Write(LogLevel.Warn, ex.Message);
            }
        }