Пример #1
0
 internal GenericSpecification(
     ISearchableRepository <T> repository,
     ProtobufSerialization protobuf)
 {
     this.Repository = repository;
     this.Protobuf   = protobuf;
 }
Пример #2
0
        public HttpClient(
            IServiceProvider locator,
            ProtobufSerialization protobuf,
            Configuration settings)
        {
            var remoteUrl = settings["RemoteUrl"];

            if (string.IsNullOrEmpty(remoteUrl))
            {
                throw new ArgumentException("RemoteUrl not provided");
            }
            this.Server = remoteUrl;
            var basicAuth = settings["BasicAuth"];
            var auth      = settings["Auth"];

            if (!string.IsNullOrEmpty(basicAuth))
            {
                this.Auhtorization = "Basic " + basicAuth;
            }
            else if (!string.IsNullOrEmpty(auth))
            {
                this.Auhtorization = auth;
            }

            this.Protobuf = protobuf;
            Context       = new ProtoBuf.SerializationContext {
                Context = locator
            };
        }
Пример #3
0
 public static IServiceProvider Start(IDictionary<string, string> settings)
 {
     var configuration = new Configuration(new Dictionary<string, string>(settings));
     var locator = new DictionaryServiceLocator();
     var protobuf = new ProtobufSerialization();
     var restHttp = new HttpClient(locator, protobuf, configuration);
     var app = new ApplicationProxy(restHttp);
     var domain = new DomainProxy(restHttp, app);
     var report = new ReportingProxy(restHttp, app);
     locator.Register(typeof(Configuration), configuration);
     locator.Register(typeof(ProtobufSerialization), protobuf);
     locator.Register(typeof(HttpClient), restHttp);
     locator.Register(typeof(IServiceProvider), locator);
     locator.Register(typeof(IApplicationProxy), app);
     locator.Register(typeof(ICrudProxy), new CrudProxy(restHttp));
     locator.Register(typeof(IS3Repository), new LitS3Repository(configuration));
     locator.Register(typeof(IDomainProxy), domain);
     locator.Register(typeof(IStandardProxy), new StandardProxy(restHttp, protobuf, app));
     locator.Register(typeof(IReportingProxy), report);
     locator.Register(typeof(ITemplaterService), new ClientTemplaterService(report));
     locator.Register(typeof(ISearchableRepository<>), typeof(ClientSearchableRepository<>));
     locator.Register(typeof(IRepository<>), typeof(ClientRepository<>));
     locator.Register(typeof(IPersistableRepository<>), typeof(ClientPersistableRepository<>));
     locator.Register(typeof(IDomainEventStore), new ClientDomainStore(domain));
     Static.Locator = locator;
     return locator;
 }
Пример #4
0
        public static IServiceProvider Start(IDictionary <string, string> settings)
        {
            var configuration = new Configuration(new Dictionary <string, string>(settings));
            var locator       = new DictionaryServiceLocator();
            var protobuf      = new ProtobufSerialization();
            var restHttp      = new HttpClient(locator, protobuf, configuration);
            var app           = new ApplicationProxy(restHttp);
            var domain        = new DomainProxy(restHttp, app);
            var report        = new ReportingProxy(restHttp, app);

            locator.Register(typeof(Configuration), configuration);
            locator.Register(typeof(ProtobufSerialization), protobuf);
            locator.Register(typeof(HttpClient), restHttp);
            locator.Register(typeof(IServiceProvider), locator);
            locator.Register(typeof(IApplicationProxy), app);
            locator.Register(typeof(ICrudProxy), new CrudProxy(restHttp));
            locator.Register(typeof(IS3Repository), new LitS3Repository(configuration));
            locator.Register(typeof(IDomainProxy), domain);
            locator.Register(typeof(IStandardProxy), new StandardProxy(restHttp, protobuf, app));
            locator.Register(typeof(IReportingProxy), report);
            locator.Register(typeof(ITemplaterService), new ClientTemplaterService(report));
            locator.Register(typeof(ISearchableRepository <>), typeof(ClientSearchableRepository <>));
            locator.Register(typeof(IRepository <>), typeof(ClientRepository <>));
            locator.Register(typeof(IPersistableRepository <>), typeof(ClientPersistableRepository <>));
            locator.Register(typeof(IDomainEventStore), new ClientDomainStore(domain));
            Static.Locator = locator;
            return(locator);
        }
Пример #5
0
 public StandardProxy(
     HttpClient http,
     ProtobufSerialization protobuf,
     IApplicationProxy application)
 {
     this.Http        = http;
     this.Protobuf    = protobuf;
     this.Application = application;
 }
Пример #6
0
        public static void Main(string[] args)
        {
            var host = CreateWebHostBuilder(args).Build();

            ProtobufSerialization.Warm();

            LocalSystem
            .Bootstrap()
            .Build();

            host.Run();

            Console.CancelKeyPress += (sender, eventArgs) => LocalSystem.Instance.Shutdown();
            AssemblyLoadContext.Default.Unloading += _ => LocalSystem.Instance.Shutdown();

            LocalSystem.Instance
            .KeepAlive()
            .Wait();
        }
        public static void Postfix(EnumSerializationHandler __instance,
                                   ProtobufSerialization serializer, DataContractFieldPair contractField,
                                   object instance, object fieldValue, Dictionary <uint, object> deserializedReferences,
                                   ClassTypeResolver ___classResolver)
        {
            if (((EnumMember)fieldValue).EnumValue == "SIM_GAME_EVENT_RESOLVED" &&
                contractField.MemberName == "saveReason")
            {
                Logger.LogLine("here goes nothing ...");
                EnumMember newFieldValue = new EnumMember();
                newFieldValue.EnumType  = ((EnumMember)fieldValue).EnumType;
                newFieldValue.EnumValue = "IRON_MECH_MOD";

                /*
                 * __instance.Serialize(serializer, contractField, instance,
                 *  newFieldValue, contractField.);
                 *
                 * __instance.Deserialize(serializer, contractField, instance,
                 *  newFieldValue, deserializedReferences);
                 * Logger.LogLine("All done");
                 */
            }
        }