示例#1
0
 public Reporter(string serviceName, StoragesInfo storagesInfo, EMailSender sender, TimeSpan time)
 {
     this.serviceName = serviceName;
     this.storagesInfo = storagesInfo;
     this.sender = sender;
     this.time = time;
 }
        /// <summary>
        /// Creates and initializes a console server.
        /// </summary>
        /// <param name="serviceName"></param>
        /// <param name="args"></param>
        /// <param name="watcher"></param>
        /// <param name="storagesInfo"></param>
        /// <returns></returns>
        private static ConsoleServer CreateConsoleServer(
            string serviceName,
            OnStartServiceArgs args,
            Watcher watcher,
            StoragesInfo storagesInfo)
        {
            if (args.Settings["console"] == null)
            {
                throw new ArgumentNullException("console");
            }

            // Web service URI (required)
            string uri = args.Settings["console"].Parameters["uri"].Trim();
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            // Metadata web service URI (required)
            string metadataUri = args.Settings["console"].Parameters["metadataUri"].Trim();
            if (uri == null)
            {
                throw new ArgumentNullException("metadataUri");
            }

            return new ConsoleServer(serviceName, args.IsDebugMode, uri, metadataUri, storagesInfo, watcher);
        }
        /// <summary>
        /// Creates and initializes a reporter.
        /// </summary>
        /// <param name="serviceName"></param>
        /// <param name="args"></param>
        /// <param name="storagesInfo"></param>
        /// <param name="sender"></param>
        /// <returns></returns>
        private static Reporter CreateReporter(
            string serviceName,
            OnStartServiceArgs args,
            StoragesInfo storagesInfo,
            EMailSender sender)
        {
            if (args.Settings["reporter"] == null)
            {
                throw new ArgumentNullException("reporter");
            }

            // Time (required)
            string time = args.Settings["reporter"].Parameters["time"].Trim();
            if (time == null)
            {
                throw new ArgumentNullException("time");
            }
            TimeSpan timeSpan = TimeSpan.Parse(time);

            return new Reporter(serviceName, storagesInfo, sender, timeSpan);
        }
示例#4
0
 public ConsoleServer(
     string serviceName,
     bool isDebugMode,
     string uri,
     string metadataUri,
     StoragesInfo storagesInfo,
     Watcher watcher)
 {
     this.serviceName = serviceName;
     this.IsDebugMode = isDebugMode;
     this.uri = uri;
     this.metadataUri = metadataUri;
     this.storagesInfo = storagesInfo;
     this.serviceWatcher = watcher;
 }