Exemplo n.º 1
0
        /// <summary>
        /// dll loader
        /// </summary>
        /// <param name="serviceEntryContainer"></param>
        /// <param name="logger"></param>
        /// <param name="path">where are the dll directory</param>
        /// <param name="watchingFilePattern">what type of file will be watch when enableWatchChanged is true</param>
        /// <param name="enableWatchChanged">whether enable watch file changed</param>
        public ServicesLoader(IServiceEntryContainer serviceEntryContainer, ILogger logger, ServiceOptions options)
        {
            _logger = logger;
            _serviceEntryContainer = serviceEntryContainer;
            _options = options;

            //if (string.IsNullOrEmpty(_options.Path))
            //{
            //    _options.Path = "./";
            //}
        }
        public override IDictionary <PaymentType, string> GetPaymentTypeMappings()
        {
            var paymentTypeMappings = new Dictionary <PaymentType, string> {
                { PaymentType.Cash, "0" },
                { PaymentType.Card, "1" },
                { PaymentType.Check, "2" }
            };

            ServiceOptions.RemapPaymentTypes(Info.SerialNumber, paymentTypeMappings);
            return(paymentTypeMappings);
        }
Exemplo n.º 3
0
 protected BgFiscalPrinter(
     IChannel channel,
     ServiceOptions serviceOptions,
     IDictionary <string, string>?options = null)
 {
     ServiceOptions = serviceOptions;
     Options        = new Dictionary <string, string>()
                      .MergeWith(GetDefaultOptions())
                      .MergeWith(options);
     Channel = channel;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Creates new instance of the <see cref="ESRI.ArcLogistics.Routing.IVrpRequestAnalyzer"/>
        /// object corresponding to the specified service options.
        /// </summary>
        /// <param name="options">The options specifying the analyzer to be used.</param>
        /// <param name="solverConfig">Solver config, containing info about max orders and routes
        /// count for synq request.</param>
        /// <returns>The reference to the new instance of the VRP requests analyzer.</returns>
        private static IVrpRequestAnalyzer _CreateRequestAnalyzer(ServiceOptions options,
                                                                  SolveInfoWrap solverConfig)
        {
            // Check that sync vrp is allowed.
            if ((options & ServiceOptions.UseSyncVrp) != 0)
            {
                return(new SimpleVrpRequestAnalyzer(solverConfig.MaxSyncVrpRequestRoutesCount,
                                                    solverConfig.MaxSyncVrpRequestOrdersCount));
            }

            return(new ConstantVrpRequestAnalyzer(false));
        }
Exemplo n.º 5
0
 public CommodityLoader(ILogger <CommodityLoader> logger, EntityParser entityParser,
                        IJsonFileReaderWriter jsonFileReaderWriter,
                        LoaderService <CommodityTypeAndSubType> commodityTypeService,
                        IOptions <ServiceOptions> options, LocalisationService localisationService)
 {
     _logger               = logger;
     _entityParser         = entityParser;
     _jsonFileReaderWriter = jsonFileReaderWriter;
     _localisationService  = localisationService;
     CommodityTypes        = commodityTypeService.Items;
     _options              = options.Value;
 }
Exemplo n.º 6
0
        public void ShouldSerializeAndDeserialize()
        {
            var options = new ServiceOptions
            {
                StorageConnectionString = "Filename=storage.litedb;InitialSize=123"
            };
            var s            = JsonConvert.SerializeObject(options);
            var deserialized = JsonConvert.DeserializeObject <ServiceOptions>(s);

            deserialized.Should().NotBeSameAs(options);
            deserialized.StorageConnectionString.Should().Be("Filename=storage.litedb;InitialSize=123");
        }
Exemplo n.º 7
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     //services.AddScoped<IHostedService, MqttClient>();
     //services.AddHostedService<MqttClient>();
     services.AddSingleton(Log.Logger);
     services.AddHostedService <ClientConnectorHostedService>();
     services.AddSingleton <MqttClientFactory>();
     services.AddControllers();
     services.AddHealthChecks()
     .AddCheck <ClientHealthCheck>("mqtt_connection_health_check");
     ServiceOptions.Setup(Configuration);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Gets options for the AMI service.
        /// </summary>
        /// <returns>Returns options for the AMI service.</returns>
        public override ServiceOptions Options()
        {
            this.ThrowIfNotReady();
            RestOperationContext.Current.OutgoingResponse.StatusCode = (int)HttpStatusCode.OK;
            RestOperationContext.Current.OutgoingResponse.Headers.Add("Allow", $"GET, PUT, POST, OPTIONS, HEAD, DELETE{(ApplicationServiceContext.Current.GetService<IPatchService>() != null ? ", PATCH" : null)}");

            if (ApplicationServiceContext.Current.GetService <IPatchService>() != null)
            {
                RestOperationContext.Current.OutgoingResponse.Headers.Add("Accept-Patch", "application/xml+sdb-patch");
            }

            // mex configuration
            var    mexConfig     = ApplicationServiceContext.Current.GetService <IConfigurationManager>().GetSection <SanteDB.Rest.Common.Configuration.RestConfigurationSection>();
            String boundHostPort = $"{RestOperationContext.Current.IncomingRequest.Url.Scheme}://{RestOperationContext.Current.IncomingRequest.Url.Host}:{RestOperationContext.Current.IncomingRequest.Url.Port}";

            if (!String.IsNullOrEmpty(mexConfig.ExternalHostPort))
            {
                var tUrl = new Uri(mexConfig.ExternalHostPort);
                boundHostPort = $"{tUrl.Scheme}://{tUrl.Host}:{tUrl.Port}";
            }

            var serviceOptions = new ServiceOptions
            {
                InterfaceVersion = "1.0.0.0",
                Endpoints        = ApplicationServiceContext.Current.GetService <IServiceManager>().GetServices().OfType <IApiEndpointProvider>().Select(o =>
                                                                                                                                                         new ServiceEndpointOptions(o)
                {
                    BaseUrl = o.Url.Select(url =>
                    {
                        var turi = new Uri(url);
                        return($"{boundHostPort}{turi.AbsolutePath}");
                    }).ToArray()
                }
                                                                                                                                                         ).ToList()
            };

            // Get endpoints
            var config = ApplicationServiceContext.Current.GetService <IConfigurationManager>().GetSection <AmiConfigurationSection>();

            if (config?.Endpoints != null)
            {
                serviceOptions.Endpoints.AddRange(config.Endpoints);
            }

            // Get the resources which are supported
            foreach (var itm in this.GetResourceHandler().Handlers)
            {
                var svc = this.ResourceOptions(itm.ResourceName);
                serviceOptions.Resources.Add(svc);
            }

            return(serviceOptions);
        }
Exemplo n.º 9
0
 public ShipLoader(ILogger <ShipLoader> logger, EntityParser entityParser, IOptions <ServiceOptions> options,
                   IJsonFileReaderWriter jsonFileReaderWriter, VehicleParser vehicleParser,
                   LocalisationService localisationService, LoaderService <Manufacturer> manufacturersService)
 {
     _logger               = logger;
     _entityParser         = entityParser;
     _jsonFileReaderWriter = jsonFileReaderWriter;
     _vehicleParser        = vehicleParser;
     _localisationService  = localisationService;
     Manufacturers         = manufacturersService.Items;
     _options              = options.Value;
 }
Exemplo n.º 10
0
        public TwitterApi(SecretsStoreManager secretsStoreManager, string id, object ServiceOptions) : base(secretsStoreManager, id)
        {
            Options = (ServiceOptions)ServiceOptions;

            client.Authenticator = OAuth1Authenticator.ForProtectedResource(
                secretsStoreManager.TryGetSecret(Options.ConsumerKey),
                secretsStoreManager.TryGetSecret(Options.ConsumerSecret),
                secretsStoreManager.TryGetSecret(Options.Token),
                secretsStoreManager.TryGetSecret(Options.TokenSecret)
                );
            client.AddHandler("application/json", new DynamicJsonDeserializer());
        }
Exemplo n.º 11
0
        /// <summary>
        /// Creates new instance of the REST context provider for the synchronous
        /// VRP service.
        /// </summary>
        /// <param name="options">Options for VRP service to create context for.</param>
        /// <returns></returns>
        private IRestServiceContextProvider _CreateSyncContextProvider(ServiceOptions options)
        {
            if ((options & ServiceOptions.UseSyncVrp) == 0)
            {
                return(new NullRestServiceContextProvider());
            }

            return(new RestServiceContextProvider(
                       _syncVrpServiceConfig.RestUrl,
                       _syncVrpServiceConfig.ToolName,
                       _syncVrpServer));
        }
Exemplo n.º 12
0
        public JsonFileReaderWriter(ILogger <JsonFileReaderWriter> logger, IOptions <ServiceOptions> options)
        {
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                Formatting            = Formatting.Indented,
                NullValueHandling     = NullValueHandling.Ignore,
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            };


            _logger  = logger;
            _options = options.Value;
        }
Exemplo n.º 13
0
    public virtual void AttachOptions(ServiceOptions serviceOptions)
    {
        if (EditorUtility.DisplayDialog
            (
                serviceOptions.ServiceType.ToString().Replace("_", " "),
                "Provider: " + serviceOptions.ServiceName + "\n\nDo you want to attach " + serviceOptions.ServiceType.ToString().Replace("_", " ") + " to:\n" + Selection.activeTransform.gameObject.name,
                "Attach",
                "Cancel"
            ))
        {
            string typeAbbrev = string.Empty;

            switch (serviceOptions.ServiceType)
            {
            case ServiceType.Cognigy_AI:
                typeAbbrev = "AI";
                break;

            case ServiceType.Speech_To_Text:
                typeAbbrev = "STT";
                break;

            case ServiceType.Text_To_Speech:
                typeAbbrev = "TTS";
                break;
            }

            string path = "Assets";

            string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/" + typeAbbrev + "_" + serviceOptions.ServiceName + ".asset");

            AssetDatabase.CreateAsset(serviceOptions, assetPathAndName);

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            TServiceComponent serviceComponent;


            if ((serviceComponent = (TServiceComponent)Selection.activeTransform.gameObject.GetComponent(typeof(TServiceComponent))) == null)
            {
                serviceComponent = (TServiceComponent)Selection.activeTransform.gameObject.AddComponent(typeof(TServiceComponent));
            }

            serviceComponent.serviceOptions = serviceOptions;

            SetFocus(serviceComponent);

            this.Close();
        }
    }
Exemplo n.º 14
0
 public MapBoxConversionService(ILogger <MapBoxConversionService> logger,
                                IOptions <ServiceOptions> serviceOptions,
                                IMbConversionQueue mbConversionQueue,
                                IStatusTable statusTable,
                                ITileStorage tileStorage,
                                IMapLayerUpdateTopicClient topicClient)
 {
     _logger            = logger;
     _serviceOptions    = serviceOptions.Value;
     _mbConversionQueue = mbConversionQueue;
     _statusTable       = statusTable;
     _tileStorage       = tileStorage;
     _topicClient       = topicClient;
 }
Exemplo n.º 15
0
 public ItemLoader(ILogger <ItemLoader> logger, EntityParser entityParser,
                   IJsonFileReaderWriter jsonFileReaderWriter, LoaderService <Manufacturer> manufacturersService,
                   IOptions <ServiceOptions> options, LocalisationService localisationService,
                   LoaderService <Ship> shipService, LoaderService <Commodity> commodtiyService)
 {
     _logger               = logger;
     _entityParser         = entityParser;
     _jsonFileReaderWriter = jsonFileReaderWriter;
     _localisationService  = localisationService;
     Manufacturers         = manufacturersService.Items;
     Ships       = shipService.Items;
     Commodities = commodtiyService.Items;
     _options    = options.Value;
 }
Exemplo n.º 16
0
        public void SentinelConnectTest()
        {
            var options = ServiceOptions.Clone();

            options.EndPoints.Add(TestConfig.Current.SentinelServer, TestConfig.Current.SentinelPortA);

            var conn = ConnectionMultiplexer.SentinelConnect(options);
            var db   = conn.GetDatabase();

            var test = db.Ping();

            Log("ping to sentinel {0}:{1} took {2} ms", TestConfig.Current.SentinelServer,
                TestConfig.Current.SentinelPortA, test.TotalMilliseconds);
        }
Exemplo n.º 17
0
        public TwitterWeb(SecretsStoreManager secretsStoreManager, string id, object ServiceOptions) : base(secretsStoreManager, id)
        {
            Options = (ServiceOptions)ServiceOptions;

            var driverOptions = new ChromeOptions();

#if !DEBUG
            driverOptions.AddArgument("headless");
#endif
            driverOptions.AddArgument("disable-gpu");

            driver = new ChromeDriver(Directory.GetCurrentDirectory(), driverOptions);
            driver.Manage().Timeouts().ImplicitWait = new TimeSpan(0, 0, 30);
        }
Exemplo n.º 18
0
        public static SSSBService Create(IServiceProvider serviceProvider, Action <ServiceOptions> configure)
        {
            ServiceOptions serviceOptions = new ServiceOptions()
            {
                IsQueueActivationEnabled = false, MaxReadersCount = 1, Name = null
            };

            configure?.Invoke(serviceOptions);
            if (string.IsNullOrEmpty(serviceOptions.Name))
            {
                throw new ArgumentException($"SSSBService must have a Name");
            }
            return(ActivatorUtilities.CreateInstance <SSSBService>(serviceProvider, new object[] { serviceOptions }));
        }
Exemplo n.º 19
0
        /// <summary>
        /// Setup Dependency constructor Injections for interfaces
        /// </summary>
        /// <param name="service"></param>
        /// <param name="configuration"></param>
        public static void Config(IServiceCollection service, IConfiguration configuration)
        {
            var config = new ServiceOptions();

            configuration.GetSection("Services").Bind(config);
            service.AddDbContext <CustomerDbContext>(option => option.UseSqlServer(config.DefaultConnection));
            service.AddTransient <ICustomerRuleManager, CustomerRuleManager>();
            service.AddTransient <IAddressRuleProcessor, AddressRuleProcessor>();
            service.AddTransient <IContactsRuleProcessor, ContactsRuleProcessor>();
            service.AddTransient <ICustomerRulesProcessor, CustomerRulesProcessor>();
            service.AddTransient <IContactRuleManager, ContactRuleManager>();
            service.AddTransient <IAddressRuleManager, AddressRuleManager>();
            service.AddSingleton <IUnitOfWork, UnitOfWork>();
            service.AddSingleton <IRepositoryFactory, RepositoryFactory>();
        }
Exemplo n.º 20
0
        public GdalConversionService(ILogger <GdalConversionService> logger,
                                     IOptions <ServiceOptions> serviceOptions,
                                     IGdConversionQueue gdConversionQueue,
                                     IMbConversionQueue mbConversionQueue,
                                     IStatusTable statusTable,
                                     IGeoJsonStorage geoJsonStorage)
        {
            _logger         = logger;
            _serviceOptions = serviceOptions.Value;

            _gdConversionQueue = gdConversionQueue;
            _mbConversionQueue = mbConversionQueue;
            _statusTable       = statusTable;
            _geoJsonStorage    = geoJsonStorage;
        }
        public static IHostBuilder CreateHostBuilder(string[] args, IConfiguration configuration)
        {
            var serviceOptions = new ServiceOptions();

            var serviceOptionsSection = configuration.GetSection("Services");

            serviceOptionsSection.Bind(serviceOptions);

            return(Host
                   .CreateDefaultBuilder(args)
                   .ConfigureServices((context, services) =>
            {
                services.AddOptions <ServiceOptions>().Bind(serviceOptionsSection);
            })
                   .CustomConfigWebHostFor(serviceOptions.GraphQLApi, typeof(Startup), configuration, serviceOptions));
        }
Exemplo n.º 22
0
        public BloombergPricingAPIService()
        {
            // Generate unique resource indentifiers.
            var resourceIdPostfix = DateTime.UtcNow.ToString("yyyyMMddhhmmss");
            var sfx = Options.CustomerName.Substring(0, 3).ToUpper();

            UniverseId      = $"{sfx}Universe{resourceIdPostfix}";
            FieldListId     = $"{sfx}FieldList{resourceIdPostfix}";
            TriggerId       = $"{sfx}Trigger{resourceIdPostfix}";
            RequestId       = $"{sfx}Req{resourceIdPostfix}";
            Options         = new ServiceOptions();
            ServiceResponse = new ServiceResponse()
            {
                RequestId       = resourceIdPostfix,
                RequestDateTime = DateTime.Now
            };
        }
        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            var configuration  = ConfigurationExtensions.BuildConfiguration(Directory.GetCurrentDirectory());
            var serviceOptions = new ServiceOptions();

            var serviceOptionsSection = configuration.GetSection("Services");

            serviceOptionsSection.Bind(serviceOptions);

            return(Host
                   .CreateDefaultBuilder(args)
                   .ConfigureServices((context, services) =>
            {
                services.AddOptions <ServiceOptions>().Bind(serviceOptionsSection);
            })
                   .CustomConfigWebHostFor(serviceOptions.InventoriesApi, typeof(Startup), configuration, serviceOptions));
        }
Exemplo n.º 24
0
        private void _InitSettings(
            SolveInfoWrap settings,
            ICollection <AgsServer> servers,
            ServiceOptions options)
        {
            Debug.Assert(settings != null);
            Debug.Assert(servers != null);

            // VRP data
            _InitVrpSettings(settings, servers, options);

            // route data
            _InitRouteSettings(settings, servers);

            // solver settings
            _solverConfig = settings;
        }
Exemplo n.º 25
0
        Dictionary <string, string> DumpOptions(FileDescriptorProto source, ServiceOptions options)
        {
            var optionsKv = new Dictionary <string, string>();

            if (options == null)
            {
                return(optionsKv);
            }

            if (options.deprecatedSpecified)
            {
                optionsKv.Add("deprecated", options.deprecated ? "true" : "false");
            }

            DumpOptionsMatching(source, ".google.protobuf.ServiceOptions", options, optionsKv);

            return(optionsKv);
        }
        private TransportService CreateService()
        {
            var options = new ServiceOptions
            {
                ServiceIntervalMs = 100000,
                Transports        = new List <TransportOptions>
                {
                    new TransportOptions
                    {
                        IsEnabled       = true,
                        SendErrorReport = false,
                        SystemName      = TelegramSystemName
                    }
                }
            };

            return(new TransportService(_loggerFactory.CreateLogger <TransportService>(), _serviceProviderMock.Object, Options.Create(options)));
        }
Exemplo n.º 27
0
 public PollingService(IOptions <ServiceOptions> option, ILoggerFactory loggerFactory) : base(loggerFactory)
 {
     try
     {
         this.options = option.Value;
         var serviceSchedule = this.options.ServiceSchedules?.FirstOrDefault(sc => string.Compare(sc.Name, this.GetType().Name) == 0);
         schedule       = serviceSchedule.Schedule;
         pollingControl = new Dictionary <string, pollWrapper>();
         //BeforeTaskStartsAsync = async (m) => { await BeforeStart(m); };
         //AfterTaskCompletesAsync = async (m) => { await AfterFinish(m); };
         CreatePipeline(this);
     }
     catch (Exception)
     {
         Debugger.Break();
         throw;
     }
 }
Exemplo n.º 28
0
        private void ConfigureRabbitMq(IBusRegistrationContext context, IRabbitMqBusFactoryConfigurator rabbitMqCfg)
        {
            _rabbitMqOptions = Configuration.GetSection(ServiceDependenciesOptions.SERVICE_DEPENDENCIES)
                               .Get <ServiceOptions[]>()
                               .First(svc => svc.Name.Equals("RabbitMQ"));

            X509Certificate2 x509Certificate2 = null;

            var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);

            store.Open(OpenFlags.ReadOnly);

            try
            {
                var certificatesInStore = store.Certificates;

                x509Certificate2 = certificatesInStore.OfType <X509Certificate2>()
                                   .FirstOrDefault(cert => cert.Thumbprint?.ToLower() == _rabbitMqOptions.SslThumbprint?.ToLower());
            }
            finally
            {
                store.Close();
            }

            rabbitMqCfg.Host(_rabbitMqOptions.Host, _rabbitMqOptions.VirtualHost, h =>
            {
                h.Username(_rabbitMqOptions.Username);
                h.Password(_rabbitMqOptions.Password);

                if (_rabbitMqOptions.UseSsl)
                {
                    h.UseSsl(ssl =>
                    {
                        ssl.ServerName = Dns.GetHostName();
                        ssl.AllowPolicyErrors(SslPolicyErrors.RemoteCertificateNameMismatch);
                        ssl.Certificate = x509Certificate2;
                        ssl.Protocol    = SslProtocols.Tls12;
                        ssl.CertificateSelectionCallback = CertificateSelectionCallback;
                    });
                }
            });

            rabbitMqCfg.ConfigureEndpoints(context);
        }
        public override IDictionary <PaymentType, string> GetPaymentTypeMappings()
        {
            var paymentTypeMappings = new Dictionary <PaymentType, string> {
                { PaymentType.Cash, "P" },
                { PaymentType.Check, "N" },
                { PaymentType.Coupons, "C" },
                { PaymentType.ExtCoupons, "D" },
                { PaymentType.Packaging, "I" },
                { PaymentType.InternalUsage, "J" },
                { PaymentType.Damage, "K" },
                { PaymentType.Card, "L" },
                { PaymentType.Bank, "M" },
                { PaymentType.Reserved1, "Q" },
                { PaymentType.Reserved2, "R" }
            };

            ServiceOptions.RemapPaymentTypes(Info.SerialNumber, paymentTypeMappings);
            return(paymentTypeMappings);
        }
Exemplo n.º 30
0
        public override IDictionary <PaymentType, string> GetPaymentTypeMappings()
        {
            var paymentTypeMappings = new Dictionary <PaymentType, string> {
                { PaymentType.Cash, "0" },
                { PaymentType.Check, "1" },
                { PaymentType.Coupons, "2" },
                { PaymentType.ExtCoupons, "3" },
                { PaymentType.Packaging, "4" },
                { PaymentType.InternalUsage, "5" },
                { PaymentType.Damage, "6" },
                { PaymentType.Card, "7" },
                { PaymentType.Bank, "8" },
                { PaymentType.Reserved1, "9" },
                { PaymentType.Reserved2, "A" }
            };

            ServiceOptions.RemapPaymentTypes(Info.SerialNumber, paymentTypeMappings);
            return(paymentTypeMappings);
        }
Exemplo n.º 31
0
 /// <summary>Helper: Serialize into a MemoryStream and return its byte array</summary>
 public static byte[] SerializeToBytes(ServiceOptions instance)
 {
     using (var ms = new MemoryStream())
     {
         Serialize(ms, instance);
         return ms.ToArray();
     }
 }
Exemplo n.º 32
0
 /// <summary>Helper: Serialize with a varint length prefix</summary>
 public static void SerializeLengthDelimited(Stream stream, ServiceOptions instance)
 {
     var data = SerializeToBytes(instance);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, (uint)data.Length);
     stream.Write(data, 0, data.Length);
 }
Exemplo n.º 33
0
        /// <summary>Serialize the instance into the stream</summary>
        public static void Serialize(Stream stream, ServiceOptions instance)
        {
            if (instance.UninterpretedOption != null)
            {
                foreach (var i999 in instance.UninterpretedOption)
                {
                    // Key for field: 999, LengthDelimited
                    stream.Write(new byte[]{186, 62}, 0, 2);
                    using (var ms999 = new MemoryStream())
                    {
                        Google.protobuf.UninterpretedOption.Serialize(ms999, i999);
                        // Length delimited byte array
                        uint ms999Length = (uint)ms999.Length;
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, ms999Length);
                        stream.Write(ms999.GetBuffer(), 0, (int)ms999Length);
                    }

                }
            }
        }
Exemplo n.º 34
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static ServiceOptions DeserializeLengthDelimited(Stream stream)
 {
     ServiceOptions instance = new ServiceOptions();
     DeserializeLengthDelimited(stream, instance);
     return instance;
 }
Exemplo n.º 35
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static ServiceOptions DeserializeLength(Stream stream, int length)
 {
     ServiceOptions instance = new ServiceOptions();
     DeserializeLength(stream, length, instance);
     return instance;
 }
Exemplo n.º 36
0
 /// <summary>Helper: put the buffer into a MemoryStream and create a new instance to deserializing into</summary>
 public static ServiceOptions Deserialize(byte[] buffer)
 {
     ServiceOptions instance = new ServiceOptions();
     using (var ms = new MemoryStream(buffer))
         Deserialize(ms, instance);
     return instance;
 }
Exemplo n.º 37
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static ServiceOptions Deserialize(Stream stream)
 {
     ServiceOptions instance = new ServiceOptions();
     Deserialize(stream, instance);
     return instance;
 }
Exemplo n.º 38
0
 public ServiceThreadMethod(ServiceControl ss, string serviceName, ServiceOptions so)
 {
     _ss = ss;
     _serviceName = serviceName;
     _so = so;
 }
Exemplo n.º 39
0
 /// <summary>
 /// �첽���Ʒ���
 /// </summary>
 /// <param name="serviceName">������</param>
 /// <param name="so">����ѡ��</param>
 public void AsyncService(string serviceName, ServiceOptions so)
 {
     ServiceThreadMethod stm = new ServiceThreadMethod(this, serviceName, so);
     Thread _th = new Thread(new ThreadStart(stm.RunThread));
     _th.Start();
 }
Exemplo n.º 40
0
 public ProductService(HttpContextBase http, ServiceOptions options)
 {
     Http = http;
 }
        /// <summary>Serialize the instance into the stream</summary>
        public static void Serialize(Stream stream, ServiceOptions instance)
        {
            var msField = global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Pop();
            if (instance.UninterpretedOption != null)
            {
                foreach (var i999 in instance.UninterpretedOption)
                {
                    // Key for field: 999, LengthDelimited
                    stream.WriteByte(186);
                    stream.WriteByte(62);
                    msField.SetLength(0);
                    Google.Protobuf.UninterpretedOption.Serialize(msField, i999);
                    // Length delimited byte array
                    uint length999 = (uint)msField.Length;
                    global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, length999);
                    msField.WriteTo(stream);

                }
            }
            global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Push(msField);
        }