Example #1
0
        public void ProcessRequests_SendStreetBasedServiceType_StoreStreetBasedAddressResults()
        {
            if (Directory.GetFiles(this._downloads).Any())
            {
                foreach (var file in Directory.GetFiles(this._downloads))
                {
                    File.Delete(file);
                }
            }

            if (Directory.GetFiles(this._extracts).Any())
            {
                foreach (var file in Directory.GetFiles(this._extracts))
                {
                    File.Delete(file);
                }
            }

            foreach (var filepath in Directory.GetFiles(this._source)
                     .Where(p => p.EndsWith(".zip") && !p.StartsWith("korea")))
            {
                var filename = ConversionHelper.GetFilenameFromFilepath(filepath, this._settings);
                File.Copy(filepath, String.Format("{0}\\{1}", this._downloads, filename));
            }

            var factory = new UpdaterServiceFactory(this._settings);

            factory.ProcessRequests(ConverterServiceType.Street);
        }
        /// <summary>
        /// Processes the requests based on the argument provided.
        /// </summary>
        /// <param name="args">List of arguments.</param>
        private static void ProcessRequests(IList <string> args)
        {
            if (args == null || !args.Any())
            {
                throw new ArgumentException("No argument found");
            }

            var serviceType = GetServiceType(args);

            if (serviceType == ConverterServiceType.Undefined)
            {
                throw new ArgumentException("Invalid arguments");
            }

            var settings = Settings.Instance;

            if (_log.IsInfoEnabled)
            {
                _log.Info(String.Format("Starting - {0}", Convert.ToString(serviceType)));
            }

            var factory = new UpdaterServiceFactory(settings);

            factory.StatusChanged   += Factory_StatusChanged;
            factory.ExceptionThrown += Factory_ExceptionThrown;
            factory.ProcessRequests(serviceType);

            if (_log.IsInfoEnabled)
            {
                _log.Info(String.Format("Stopped - {0}", Convert.ToString(serviceType)));
            }
        }
Example #3
0
        public void ProcessRequests_SendLotBasedServiceType_StoreLotBasedAddressResults()
        {
            if (Directory.GetFiles(this._downloads).Any())
            {
                foreach (var file in Directory.GetFiles(this._downloads))
                {
                    File.Delete(file);
                }
            }

            if (Directory.GetFiles(this._extracts).Any())
            {
                foreach (var file in Directory.GetFiles(this._extracts))
                {
                    File.Delete(file);
                }
            }

            File.Copy(String.Format("{0}\\koreapost_zipcode_DB.zip", this._source),
                      String.Format("{0}\\koreapost_zipcode_DB.zip", this._downloads));

            var factory = new UpdaterServiceFactory(this._settings);

            factory.ProcessRequests(ConverterServiceType.Lot);
        }