├── Config ├── BuffConfig.txt └── StartConfig │ ├── 127.0.0.1.txt │ ├── 192.168.12.112.txt │ ├── 192.168.9.182.txt │ ├── Benchmark.txt │ ├── Benchmark127.0.0.1.txt │ ├── Benchmark2.txt │ ├── BenchmarkClient.txt │ ├── ClientConfig.txt │ └── LocalAllServer.txt ├── README.md └── Server ├── App ├── App.config ├── NLog.config ├── NLog.xsd ├── Program.cs ├── Properties │ └── launchSettings.json └── Server.App.csproj ├── Hotfix ├── Handler │ ├── Actor_TestHandler.cs │ ├── Actor_TestRequestHandler.cs │ ├── Actor_TransferHandler.cs │ ├── C2M_ReloadHandler.cs │ ├── C2R_PingHandler.cs │ ├── G2G_LockReleaseRequestHandler.cs │ ├── G2G_LockRequestHandler.cs │ ├── M2A_ReloadHandler.cs │ └── M2M_TrasferUnitRequest.cs ├── Helper │ ├── HotfixHelper.cs │ └── MessageHelper.cs ├── Module │ ├── Actor │ │ ├── ActorComponentSystem.cs │ │ ├── ActorMessageDispatherComponentSystem.cs │ │ ├── CommonActorTypeHandler.cs │ │ └── GateSessionActorTypeHandler.cs │ ├── DB │ │ ├── DBQueryBatchRequestHandler.cs │ │ ├── DBQueryJsonRequestHandler.cs │ │ ├── DBQueryRequestHandler.cs │ │ ├── DBSaveBatchRequestHandler.cs │ │ └── DBSaveRequestHandler.cs │ ├── FrameSync │ │ ├── C2G_EnterMapHandler.cs │ │ ├── C2G_LoginGateHandler.cs │ │ ├── C2M_TestActorRequestHandler.cs │ │ ├── C2R_LoginHandler.cs │ │ ├── G2M_CreateUnitHandler.cs │ │ ├── OneFrameMessageHandler.cs │ │ ├── R2G_GetLoginKeyHandler.cs │ │ ├── RealmGateAddressComponentSystem.cs │ │ └── ServerFrameComponentSystem.cs │ ├── Http │ │ └── HttpTest.cs │ ├── Location │ │ ├── ObjectAddRequestHandler.cs │ │ ├── ObjectGetRequestHandler.cs │ │ ├── ObjectLockRequestHandler.cs │ │ ├── ObjectRemoveRequestHandler.cs │ │ └── ObjectUnLockRequestHandler.cs │ └── Message │ │ ├── InnerMessageDispatcher.cs │ │ ├── MessageDispatherComponentSystem.cs │ │ ├── NetInnerComponentSystem.cs │ │ ├── NetOuterComponentSystem.cs │ │ └── OuterMessageDispatcher.cs └── Server.Hotfix.csproj ├── Model ├── Base │ ├── DoubleMap.cs │ ├── Event │ │ ├── Env.cs │ │ ├── EnvKey.cs │ │ ├── EventAttribute.cs │ │ ├── EventIdType.cs │ │ └── IEvent.cs │ ├── Helper │ │ ├── ByteHelper.cs │ │ ├── DllHelper.cs │ │ ├── EnumHelper.cs │ │ ├── FileHelper.cs │ │ ├── IdGenerater.cs │ │ ├── JsonHelper.cs │ │ ├── MD5Helper.cs │ │ ├── MethodInfoHelper.cs │ │ ├── MongoHelper.cs │ │ ├── NetHelper.cs │ │ ├── ObjectHelper.cs │ │ ├── ProtobufHelper.cs │ │ ├── RandomHelper.cs │ │ ├── StringHelper.cs │ │ ├── TimeHelper.cs │ │ └── ZipHelper.cs │ ├── Log.cs │ ├── LogType.cs │ ├── Logger │ │ ├── ALogDecorater.cs │ │ ├── ILog.cs │ │ ├── NLogAdapter.cs │ │ └── StackInfoDecorater.cs │ ├── MultiMap.cs │ ├── Object │ │ ├── Component.cs │ │ ├── ComponentFactory.cs │ │ ├── ComponentWithId.cs │ │ ├── Entity.cs │ │ ├── EntityType.cs │ │ ├── EventSystem.cs │ │ ├── IAwakeSystem.cs │ │ ├── IChangeSystem.cs │ │ ├── IDestroySystem.cs │ │ ├── ILateUpdateSystem.cs │ │ ├── ILoadSystem.cs │ │ ├── ISerializeToEntity.cs │ │ ├── IStartSystem.cs │ │ ├── IUpdateSystem.cs │ │ ├── Object.cs │ │ ├── ObjectPool.cs │ │ └── ObjectSystemAttribute.cs │ ├── OneThreadSynchronizationContext.cs │ ├── QueueDictionary.cs │ ├── TryLocker.cs │ └── UnOrderMultiMap.cs ├── Component │ ├── AppManagerComponent.cs │ ├── BenchmarkComponent.cs │ ├── Config │ │ ├── ClientConfig.cs │ │ ├── DBConfig.cs │ │ ├── HttpConfig.cs │ │ ├── InnerConfig.cs │ │ └── OuterConfig.cs │ ├── KVComponent.cs │ ├── OptionComponent.cs │ ├── RobotComponent.cs │ ├── StartConfigComponent.cs │ ├── TimerComponent.cs │ └── Unit │ │ ├── LockComponent.cs │ │ └── MasterComponent.cs ├── Entity │ ├── Config │ │ └── StartConfig.cs │ ├── Game.cs │ ├── Http.cs │ ├── Scene.cs │ └── Unit.cs ├── Module │ ├── Actor │ │ ├── AMActorHandler.cs │ │ ├── ActorComponent.cs │ │ ├── ActorManagerComponent.cs │ │ ├── ActorMessageAttribute.cs │ │ ├── ActorMessageDispatherComponent.cs │ │ ├── ActorMessageHandlerAttribute.cs │ │ ├── ActorProxy.cs │ │ ├── ActorProxyComponent.cs │ │ ├── ActorResponse.cs │ │ ├── ActorTask.cs │ │ ├── ActorType.cs │ │ ├── ActorTypeHandlerAttribute.cs │ │ ├── IActorTypeHandler.cs │ │ └── IMActorHandler.cs │ ├── Config │ │ ├── ACategory.cs │ │ ├── AConfigComponent.cs │ │ ├── ConfigAttribute.cs │ │ ├── ConfigComponent.cs │ │ ├── ConfigHelper.cs │ │ └── IConfig.cs │ ├── DB │ │ ├── DBCacheComponent.cs │ │ ├── DBComponent.cs │ │ ├── DBProxyComponent.cs │ │ ├── DBQueryBatchTask.cs │ │ ├── DBQueryJsonTask.cs │ │ ├── DBQueryTask.cs │ │ ├── DBSaveBatchTask.cs │ │ ├── DBSaveTask.cs │ │ ├── DBTask.cs │ │ └── DBTaskQueue.cs │ ├── FrameSync │ │ ├── GateSessionKeyComponent.cs │ │ ├── Player.cs │ │ ├── PlayerComponent.cs │ │ ├── RealmGateAddressComponent.cs │ │ ├── ServerFrameComponent.cs │ │ ├── SessionInfoComponent.cs │ │ ├── SessionPlayerComponent.cs │ │ ├── UnitComponent.cs │ │ └── UnitGateComponent.cs │ ├── Http │ │ ├── HttpComponent.cs │ │ ├── HttpHandlerAttribute.cs │ │ └── IHttpHandler.cs │ ├── Location │ │ ├── Location.cs │ │ ├── LocationComponent.cs │ │ └── LocationProxyComponent.cs │ ├── Message │ │ ├── AMHandler.cs │ │ ├── AMRpcHandler.cs │ │ ├── ErrorCode.cs │ │ ├── HotfixMessage.cs │ │ ├── HotfixOpcode.cs │ │ ├── IActorMessage.cs │ │ ├── IMHandler.cs │ │ ├── IMessage.cs │ │ ├── IMessageDispatcher.cs │ │ ├── IMessagePacker.cs │ │ ├── InnerMessage.cs │ │ ├── InnerOpcode.cs │ │ ├── MessageAttribute.cs │ │ ├── MessageDispatherComponent.cs │ │ ├── MessageHandlerAttribute.cs │ │ ├── MessageInfo.cs │ │ ├── MongoPacker.cs │ │ ├── NetInnerComponent.cs │ │ ├── NetOuterComponent.cs │ │ ├── Network │ │ │ ├── AChannel.cs │ │ │ ├── AService.cs │ │ │ ├── Circularbuffer.cs │ │ │ ├── KCP │ │ │ │ ├── KChannel.cs │ │ │ │ ├── KService.cs │ │ │ │ └── Kcp.cs │ │ │ ├── NetworkHelper.cs │ │ │ └── TCP │ │ │ │ ├── PacketParser.cs │ │ │ │ ├── TChannel.cs │ │ │ │ └── TService.cs │ │ ├── NetworkComponent.cs │ │ ├── Opcode.cs │ │ ├── OpcodeHelper.cs │ │ ├── OpcodeTypeComponent.cs │ │ ├── OuterMessage.cs │ │ ├── OuterOpcode.cs │ │ ├── ProtobufPacker.cs │ │ ├── RpcException.cs │ │ └── Session.cs │ └── Numeric │ │ ├── INumericWatcher.cs │ │ ├── NumericChangeEvent_NotifyWatcher.cs │ │ ├── NumericComponent.cs │ │ ├── NumericType.cs │ │ ├── NumericWatcherAttribute.cs │ │ └── NumericWatcherComponent.cs ├── Other │ ├── AppType.cs │ └── Options.cs ├── Server.Model.csproj └── Server.Model.csproj.user ├── Server.sln └── ThirdParty └── MongodbDriver ├── DotNetCoreDriver ├── DotNetCoreDriver.sln ├── MongoDB.Bson │ └── MongoDB.Bson.csproj ├── MongoDB.Driver.Core │ └── MongoDB.Driver.Core.csproj └── MongoDB.Driver │ └── MongoDB.Driver.csproj ├── MongoDB.Bson ├── BsonConstants.cs ├── BsonDefaults.cs ├── BsonExtensionMethods.cs ├── BsonUtils.cs ├── Exceptions │ ├── BsonException.cs │ ├── BsonInternalException.cs │ ├── BsonSerializationException.cs │ ├── DuplicateBsonMemberMapAttributeException.cs │ └── TruncationException.cs ├── IO │ ├── ArrayElementNameAccelerator.cs │ ├── BsonBinaryReader.cs │ ├── BsonBinaryReaderBookmark.cs │ ├── BsonBinaryReaderContext.cs │ ├── BsonBinaryReaderSettings.cs │ ├── BsonBinaryWriter.cs │ ├── BsonBinaryWriterContext.cs │ ├── BsonBinaryWriterSettings.cs │ ├── BsonChunkPool.cs │ ├── BsonDocumentReader.cs │ ├── BsonDocumentReaderBookmark.cs │ ├── BsonDocumentReaderContext.cs │ ├── BsonDocumentReaderSettings.cs │ ├── BsonDocumentWriter.cs │ ├── BsonDocumentWriterContext.cs │ ├── BsonDocumentWriterSettings.cs │ ├── BsonReader.cs │ ├── BsonReaderBookmark.cs │ ├── BsonReaderSettings.cs │ ├── BsonReaderState.cs │ ├── BsonStream.cs │ ├── BsonStreamAdapter.cs │ ├── BsonStreamExtensions.cs │ ├── BsonTrie.cs │ ├── BsonWriter.cs │ ├── BsonWriterSettings.cs │ ├── BsonWriterState.cs │ ├── ByteArrayBuffer.cs │ ├── ByteArrayChunk.cs │ ├── ByteBufferFactory.cs │ ├── ByteBufferSlice.cs │ ├── ByteBufferStream.cs │ ├── CStringUtf8Encoding.cs │ ├── ContextType.cs │ ├── IBsonChunk.cs │ ├── IBsonChunkSource.cs │ ├── IBsonReader.cs │ ├── IBsonReaderExtensions.cs │ ├── IBsonWriter.cs │ ├── IBsonWriterExtensions.cs │ ├── IByteBuffer.cs │ ├── IElementNameValidator.cs │ ├── INameDecoder.cs │ ├── InputBufferChunkSource.cs │ ├── JsonBuffer.cs │ ├── JsonConvert.cs │ ├── JsonOutputMode.cs │ ├── JsonReader.cs │ ├── JsonReaderBookmark.cs │ ├── JsonReaderContext.cs │ ├── JsonReaderSettings.cs │ ├── JsonScanner.cs │ ├── JsonToken.cs │ ├── JsonWriter.cs │ ├── JsonWriterContext.cs │ ├── JsonWriterSettings.cs │ ├── MultiChunkBuffer.cs │ ├── NoOpElementNameValidator.cs │ ├── OutputBufferChunkSource.cs │ ├── SingleChunkBuffer.cs │ ├── TrieNameDecoder.cs │ ├── Utf8Encodings.cs │ ├── Utf8Helper.cs │ └── Utf8NameDecoder.cs ├── MongoDB.Bson.csproj ├── ObjectModel │ ├── BsonArray.cs │ ├── BsonBinaryData.cs │ ├── BsonBinarySubType.cs │ ├── BsonBoolean.cs │ ├── BsonDateTime.cs │ ├── BsonDecimal128.cs │ ├── BsonDocument.cs │ ├── BsonDocumentWrapper.cs │ ├── BsonDouble.cs │ ├── BsonElement.cs │ ├── BsonInt32.cs │ ├── BsonInt64.cs │ ├── BsonJavaScript.cs │ ├── BsonJavaScriptWithScope.cs │ ├── BsonMaxKey.cs │ ├── BsonMinKey.cs │ ├── BsonNull.cs │ ├── BsonObjectId.cs │ ├── BsonRegularExpression.cs │ ├── BsonString.cs │ ├── BsonSymbol.cs │ ├── BsonSymbolTable.cs │ ├── BsonTimestamp.cs │ ├── BsonType.cs │ ├── BsonTypeMapper.cs │ ├── BsonTypeMapperOptions.cs │ ├── BsonUndefined.cs │ ├── BsonValue.cs │ ├── Decimal128.cs │ ├── GuidConverter.cs │ ├── GuidRepresentation.cs │ ├── IConvertibleToBsonDocument.cs │ ├── ICustomBsonTypeMapper.cs │ ├── LazyBsonArray.cs │ ├── LazyBsonDocument.cs │ ├── MaterializedOnDemandBsonArray.cs │ ├── MaterializedOnDemandBsonDocument.cs │ ├── ObjectId.cs │ ├── RawBsonArray.cs │ ├── RawBsonDocument.cs │ └── UInt128.cs ├── PowerOf2.cs ├── Properties │ └── AssemblyInfo.cs ├── Serialization │ ├── AttributedSerializationProvider.cs │ ├── Attributes │ │ ├── BsonConstructorAttribute.cs │ │ ├── BsonDateTimeOptionsAttribute.cs │ │ ├── BsonDefaultValueAttribute.cs │ │ ├── BsonDictionaryOptionsAttribute.cs │ │ ├── BsonDiscriminatorAttribute.cs │ │ ├── BsonElementAttribute.cs │ │ ├── BsonExtraElementsAttribute.cs │ │ ├── BsonFactoryMethodAttribute.cs │ │ ├── BsonIdAttribute.cs │ │ ├── BsonIgnoreAttribute.cs │ │ ├── BsonIgnoreExtraElementsAttribute.cs │ │ ├── BsonIgnoreIfDefaultAttribute.cs │ │ ├── BsonIgnoreIfNullAttribute.cs │ │ ├── BsonKnownTypesAttribute.cs │ │ ├── BsonMemberMapAttributeUsageAttribute.cs │ │ ├── BsonNoIdAttribute.cs │ │ ├── BsonRepresentationAttribute.cs │ │ ├── BsonRequiredAttribute.cs │ │ ├── BsonSerializationOptionsAttribute.cs │ │ ├── BsonSerializerAttribute.cs │ │ ├── BsonTimeSpanOptionsAttribute.cs │ │ ├── IBsonClassMapAttribute.cs │ │ ├── IBsonCreatorMapAttribute.cs │ │ ├── IBsonMemberMapAttribute.cs │ │ └── IBsonPostProcessingAttribute.cs │ ├── BsonClassMap.cs │ ├── BsonClassMapSerializationProvider.cs │ ├── BsonCreatorMap.cs │ ├── BsonDeserializationArgs.cs │ ├── BsonDeserializationContext.cs │ ├── BsonDocumentBackedClass.cs │ ├── BsonMemberMap.cs │ ├── BsonObjectModelSerializationProvider.cs │ ├── BsonSerializationArgs.cs │ ├── BsonSerializationContext.cs │ ├── BsonSerializationInfo.cs │ ├── BsonSerializationProviderBase.cs │ ├── BsonSerializer.cs │ ├── BsonSerializerRegistry.cs │ ├── CollectionsSerializationProvider.cs │ ├── Conventions │ │ ├── AttributeConventionPack.cs │ │ ├── CamelCaseElementNameConvention.cs │ │ ├── ConventionBase.cs │ │ ├── ConventionPack.cs │ │ ├── ConventionRegistry.cs │ │ ├── ConventionRunner.cs │ │ ├── DefaultConventionPack.cs │ │ ├── DelegateClassMapConvention.cs │ │ ├── DelegateMemberMapConvention.cs │ │ ├── DelegatePostProcessingConvention.cs │ │ ├── EnumRepresentationConvention.cs │ │ ├── HierarchicalDiscriminatorConvention.cs │ │ ├── IClassMapConvention.cs │ │ ├── IConvention.cs │ │ ├── IConventionPack.cs │ │ ├── ICreatorMapConvention.cs │ │ ├── IDiscriminatorConvention.cs │ │ ├── IMemberMapConvention.cs │ │ ├── IPostProcessingConvention.cs │ │ ├── IgnoreExtraElementsConvention.cs │ │ ├── IgnoreIfDefaultConvention.cs │ │ ├── IgnoreIfNullConvention.cs │ │ ├── ImmutableTypeClassMapConvention.cs │ │ ├── LookupIdGeneratorConvention.cs │ │ ├── MemberDefaultValueConvention.cs │ │ ├── MemberNameElementNameConvention.cs │ │ ├── NamedExtraElementsMemberConvention.cs │ │ ├── NamedIdMemberConvention.cs │ │ ├── NamedParameterCreatorMapConvention.cs │ │ ├── NoIdMemberConvention.cs │ │ ├── ObjectDiscriminatorConvention.cs │ │ ├── ReadWriteMemberFinderConvention.cs │ │ ├── ResetClassMapConvention.cs │ │ ├── ResetMemberMapsConvention.cs │ │ ├── ScalarDiscriminatorConvention.cs │ │ ├── StandardDiscriminatorConvention.cs │ │ └── StringObjectIdIdGeneratorConvention.cs │ ├── CreatorMapDelegateCompiler.cs │ ├── DiscriminatedInterfaceSerializationProvider.cs │ ├── ExpressionVisitor.cs │ ├── IBsonArraySerializer.cs │ ├── IBsonDictionarySerializer.cs │ ├── IBsonDocumentSerializer.cs │ ├── IBsonIdProvider.cs │ ├── IBsonPolymorphicSerializer.cs │ ├── IBsonSerializationProvider.cs │ ├── IBsonSerializer.cs │ ├── IBsonSerializerExtensions.cs │ ├── IBsonSerializerRegistry.cs │ ├── IChildSerializerConfigurable.cs │ ├── ICreatorSelector.cs │ ├── IDictionaryRepresentationConfigurable.cs │ ├── IIdGenerator.cs │ ├── IRepresentationConfigurable.cs │ ├── IRepresentationConverterConfigurable.cs │ ├── IdGenerators │ │ ├── AscendingGuidGenerator.cs │ │ ├── BsonBinaryDataGuidGenerator.cs │ │ ├── BsonObjectIdGenerator.cs │ │ ├── CombGuidGenerator.cs │ │ ├── GuidGenerator.cs │ │ ├── NullIdChecker.cs │ │ ├── ObjectIdGenerator.cs │ │ ├── StringObjectIdGenerator.cs │ │ └── ZeroIdChecker.cs │ ├── MostArgumentsCreatorSelector.cs │ ├── Options │ │ ├── DictionaryRepresentation.cs │ │ ├── RepresentationConverter.cs │ │ └── TimeSpanUnits.cs │ ├── PrimitiveSerializationProvider.cs │ ├── Serializers │ │ ├── AbstractClassSerializer.cs │ │ ├── ArraySerializer.cs │ │ ├── BitArraySerializer.cs │ │ ├── BooleanSerializer.cs │ │ ├── BsonArraySerializer.cs │ │ ├── BsonBinaryDataSerializer.cs │ │ ├── BsonBooleanSerializer.cs │ │ ├── BsonClassMapSerializer.cs │ │ ├── BsonDateTimeSerializer.cs │ │ ├── BsonDecimal128Serializer.cs │ │ ├── BsonDocumentBackedClassSerializer.cs │ │ ├── BsonDocumentSerializer.cs │ │ ├── BsonDocumentWrapperSerializer.cs │ │ ├── BsonDoubleSerializer.cs │ │ ├── BsonInt32Serializer.cs │ │ ├── BsonInt64Serializer.cs │ │ ├── BsonJavaScriptSerializer.cs │ │ ├── BsonJavaScriptWithScopeSerializer.cs │ │ ├── BsonMaxKeySerializer.cs │ │ ├── BsonMinKeySerializer.cs │ │ ├── BsonNullSerializer.cs │ │ ├── BsonObjectIdSerializer.cs │ │ ├── BsonRegularExpressionSerializer.cs │ │ ├── BsonStringSerializer.cs │ │ ├── BsonSymbolSerializer.cs │ │ ├── BsonTimestampSerializer.cs │ │ ├── BsonUndefinedSerializer.cs │ │ ├── BsonValueCSharpNullSerializer.cs │ │ ├── BsonValueSerializer.cs │ │ ├── BsonValueSerializerBase.cs │ │ ├── ByteArraySerializer.cs │ │ ├── ByteSerializer.cs │ │ ├── CharSerializer.cs │ │ ├── ClassSerializerBase.cs │ │ ├── CultureInfoSerializer.cs │ │ ├── DateTimeOffsetSerializer.cs │ │ ├── DateTimeSerializer.cs │ │ ├── Decimal128Serializer.cs │ │ ├── DecimalSerializer.cs │ │ ├── DictionaryInterfaceImplementerSerializer.cs │ │ ├── DictionarySerializerBase.cs │ │ ├── DiscriminatedInterfaceSerializer.cs │ │ ├── DiscriminatedWrapperSerializer.cs │ │ ├── DoubleSerializer.cs │ │ ├── DynamicDocumentBaseSerializer.cs │ │ ├── EnumSerializer.cs │ │ ├── EnumerableInterfaceImplementerSerializer.cs │ │ ├── EnumerableInterfaceImplementerSerializerBase.cs │ │ ├── EnumerableSerializerBase.cs │ │ ├── ExpandoObjectSerializer.cs │ │ ├── GuidSerializer.cs │ │ ├── IPAddressSerializer.cs │ │ ├── IPEndPointSerializer.cs │ │ ├── ImpliedImplementationInterfaceSerializer.cs │ │ ├── Int16Serializer.cs │ │ ├── Int32Serializer.cs │ │ ├── Int64Serializer.cs │ │ ├── KeyValuePairSerializer.cs │ │ ├── LazyBsonArraySerializer.cs │ │ ├── LazyBsonDocumentSerializer.cs │ │ ├── NullableGenericSerializer.cs │ │ ├── ObjectIdSerializer.cs │ │ ├── ObjectSerializer.cs │ │ ├── PartiallyRawBsonDocumentSerializer.cs │ │ ├── ProjectingDeserializer.cs │ │ ├── QueueSerializer.cs │ │ ├── RawBsonArraySerializer.cs │ │ ├── RawBsonDocumentSerializer.cs │ │ ├── ReadOnlyCollectionSerializer.cs │ │ ├── ReadOnlyCollectionSubclassSerializer.cs │ │ ├── SByteSerializer.cs │ │ ├── SealedClassSerializerBase.cs │ │ ├── SerializeAsNominalTypeSerializer.cs │ │ ├── SerializerBase.cs │ │ ├── SerializerHelper.cs │ │ ├── SingleSerializer.cs │ │ ├── StackSerializer.cs │ │ ├── StringSerializer.cs │ │ ├── StructSerializerBase.cs │ │ ├── ThreeDimensionalArraySerializer.cs │ │ ├── TimeSpanSerializer.cs │ │ ├── TupleSerializers.cs │ │ ├── TwoDimensionalArraySerializer.cs │ │ ├── UInt16Serializer.cs │ │ ├── UInt32Serializer.cs │ │ ├── UInt64Serializer.cs │ │ ├── UndiscriminatedActualTypeSerializer.cs │ │ ├── UriSerializer.cs │ │ └── VersionSerializer.cs │ ├── TypeMappingSerializationProvider.cs │ └── TypeNameDiscriminator.cs └── packages.config ├── MongoDB.Driver.Core ├── BatchTransformingAsyncCursor.cs ├── Collation.cs ├── CollectionNamespace.cs ├── Core │ ├── Async │ │ └── AsyncQueue.cs │ ├── Authentication │ │ ├── AuthenticationHelper.cs │ │ ├── DefaultAuthenticator.cs │ │ ├── GssapiAuthenticator.cs │ │ ├── IAuthenticator.cs │ │ ├── MongoDBCRAuthenticator.cs │ │ ├── MongoDBX509Authenticator.cs │ │ ├── PlainAuthenticator.cs │ │ ├── SaslAuthenticator.cs │ │ ├── ScramSha1Authenticator.cs │ │ ├── Sspi │ │ │ ├── AuthIdentity.cs │ │ │ ├── AuthIdentityFlag.cs │ │ │ ├── DataRepresentation.cs │ │ │ ├── EncryptQualityOfProtection.cs │ │ │ ├── NativeMethods.cs │ │ │ ├── QueryContextAttribute.cs │ │ │ ├── SecurityBuffer.cs │ │ │ ├── SecurityBufferDescriptor.cs │ │ │ ├── SecurityBufferType.cs │ │ │ ├── SecurityContext.cs │ │ │ ├── SecurityCredential.cs │ │ │ ├── SecurityCredentialUse.cs │ │ │ ├── SecurityPackageContextSizes.cs │ │ │ ├── SecurityPackageInfo.cs │ │ │ ├── SspiContextFlags.cs │ │ │ ├── SspiHandle.cs │ │ │ ├── SspiPackage.cs │ │ │ └── Win32Exception.cs │ │ └── UsernamePasswordCredential.cs │ ├── Bindings │ │ ├── ChannelChannelSource.cs │ │ ├── ChannelReadBinding.cs │ │ ├── ChannelReadWriteBinding.cs │ │ ├── ChannelSourceHandle.cs │ │ ├── ChannelSourceReadWriteBinding.cs │ │ ├── IBinding.cs │ │ ├── IChannel.cs │ │ ├── IChannelSource.cs │ │ ├── ReadBindingHandle.cs │ │ ├── ReadPreferenceBinding.cs │ │ ├── ReadWriteBindingHandle.cs │ │ ├── ServerChannelSource.cs │ │ ├── SingleServerReadBinding.cs │ │ ├── SingleServerReadWriteBinding.cs │ │ ├── SplitReadWriteBinding.cs │ │ └── WritableServerBinding.cs │ ├── Clusters │ │ ├── Cluster.cs │ │ ├── ClusterConnectionMode.cs │ │ ├── ClusterDescription.cs │ │ ├── ClusterDescriptionChangedEventArgs.cs │ │ ├── ClusterFactory.cs │ │ ├── ClusterId.cs │ │ ├── ClusterState.cs │ │ ├── ClusterType.cs │ │ ├── ElectionId.cs │ │ ├── ICluster.cs │ │ ├── IClusterFactory.cs │ │ ├── MultiServerCluster.cs │ │ ├── ReplicaSetConfig.cs │ │ ├── ServerSelectors │ │ │ ├── CompositeServerSelector.cs │ │ │ ├── DelegateServerSelector.cs │ │ │ ├── EndPointServerSelector.cs │ │ │ ├── IServerSelector.cs │ │ │ ├── LatencyLimitingServerSelector.cs │ │ │ ├── RandomServerSelector.cs │ │ │ ├── ReadPreferenceServerSelector.cs │ │ │ └── WritableServerSelector.cs │ │ └── SingleServerCluster.cs │ ├── Configuration │ │ ├── ClusterBuilder.cs │ │ ├── ClusterBuilderExtensions.cs │ │ ├── ClusterSettings.cs │ │ ├── ConnectionPoolSettings.cs │ │ ├── ConnectionSettings.cs │ │ ├── ConnectionString.cs │ │ ├── ServerSettings.cs │ │ ├── SslStreamSettings.cs │ │ └── TcpStreamSettings.cs │ ├── ConnectionPools │ │ ├── ExclusiveConnectionPool.cs │ │ ├── ExclusiveConnectionPoolFactory.cs │ │ ├── IConnectionPool.cs │ │ └── IConnectionPoolFactory.cs │ ├── Connections │ │ ├── BinaryConnection.cs │ │ ├── BinaryConnectionFactory.cs │ │ ├── BuildInfoResult.cs │ │ ├── ClientDocumentHelper.cs │ │ ├── CommandEventHelper.cs │ │ ├── ConnectionDescription.cs │ │ ├── ConnectionExtensions.cs │ │ ├── ConnectionId.cs │ │ ├── ConnectionInitializer.cs │ │ ├── IConnection.cs │ │ ├── IConnectionFactory.cs │ │ ├── IConnectionInitializer.cs │ │ ├── IStreamFactory.cs │ │ ├── IsMasterResult.cs │ │ ├── SslStreamFactory.cs │ │ └── TcpStreamFactory.cs │ ├── Events │ │ ├── ClusterAddedServerEvent.cs │ │ ├── ClusterAddingServerEvent.cs │ │ ├── ClusterClosedEvent.cs │ │ ├── ClusterClosingEvent.cs │ │ ├── ClusterDescriptionChangedEvent.cs │ │ ├── ClusterOpenedEvent.cs │ │ ├── ClusterOpeningEvent.cs │ │ ├── ClusterRemovedServerEvent.cs │ │ ├── ClusterRemovingServerEvent.cs │ │ ├── ClusterSelectedServerEvent.cs │ │ ├── ClusterSelectingServerEvent.cs │ │ ├── ClusterSelectingServerFailedEvent.cs │ │ ├── CommandFailedEvent.cs │ │ ├── CommandStartedEvent.cs │ │ ├── CommandSucceededEvent.cs │ │ ├── ConnectionClosedEvent.cs │ │ ├── ConnectionClosingEvent.cs │ │ ├── ConnectionFailedEvent.cs │ │ ├── ConnectionOpenedEvent.cs │ │ ├── ConnectionOpeningEvent.cs │ │ ├── ConnectionOpeningFailedEvent.cs │ │ ├── ConnectionPoolAddedConnectionEvent.cs │ │ ├── ConnectionPoolAddingConnectionEvent.cs │ │ ├── ConnectionPoolCheckedInConnectionEvent.cs │ │ ├── ConnectionPoolCheckedOutConnectionEvent.cs │ │ ├── ConnectionPoolCheckingInConnectionEvent.cs │ │ ├── ConnectionPoolCheckingOutConnectionEvent.cs │ │ ├── ConnectionPoolCheckingOutConnectionFailedEvent.cs │ │ ├── ConnectionPoolClosedEvent.cs │ │ ├── ConnectionPoolClosingEvent.cs │ │ ├── ConnectionPoolOpenedEvent.cs │ │ ├── ConnectionPoolOpeningEvent.cs │ │ ├── ConnectionPoolRemovedConnectionEvent.cs │ │ ├── ConnectionPoolRemovingConnectionEvent.cs │ │ ├── ConnectionReceivedMessageEvent.cs │ │ ├── ConnectionReceivingMessageEvent.cs │ │ ├── ConnectionReceivingMessageFailedEvent.cs │ │ ├── ConnectionSendingMessagesEvent.cs │ │ ├── ConnectionSendingMessagesFailedEvent.cs │ │ ├── ConnectionSentMessagesEvent.cs │ │ ├── Diagnostics │ │ │ ├── PerformanceCounterEventSubscriber.cs │ │ │ ├── PerformanceCounters │ │ │ │ ├── ConnectionPerformanceRecorder.cs │ │ │ │ ├── ConnectionPoolPerformanceRecorder.cs │ │ │ │ ├── PerformanceCounterAttribute.cs │ │ │ │ └── PerformanceCounterPackage.cs │ │ │ ├── TraceSourceCommandEventSubscriber.cs │ │ │ ├── TraceSourceEventHelper.cs │ │ │ └── TraceSourceEventSubscriber.cs │ │ ├── EventAggregator.cs │ │ ├── EventContext.cs │ │ ├── IEventSubscriber.cs │ │ ├── ReflectionEventSubscriber.cs │ │ ├── ServerClosedEvent.cs │ │ ├── ServerClosingEvent.cs │ │ ├── ServerDescriptionChangedEvent.cs │ │ ├── ServerHeartbeatFailedEvent.cs │ │ ├── ServerHeartbeatStartedEvent.cs │ │ ├── ServerHeartbeatSucceededEvent.cs │ │ ├── ServerOpenedEvent.cs │ │ ├── ServerOpeningEvent.cs │ │ └── SingleEventSubscriber.cs │ ├── Misc │ │ ├── ArrayFiltersFeature.cs │ │ ├── BatchableSource.cs │ │ ├── CachedEnumerable.cs │ │ ├── CollationFeature.cs │ │ ├── CommandsThatWriteAcceptWriteConcernFeature.cs │ │ ├── DefaultRandomStringGenerator.cs │ │ ├── EndPointHelper.cs │ │ ├── Ensure.cs │ │ ├── ExceptionMapper.cs │ │ ├── ExponentiallyWeightedMovingAverage.cs │ │ ├── Feature.cs │ │ ├── IClock.cs │ │ ├── IRandomStringGenerator.cs │ │ ├── IdGenerator.cs │ │ ├── IndexMap.cs │ │ ├── InterlockedInt32.cs │ │ ├── Metronome.cs │ │ ├── Range.cs │ │ ├── ReadAheadEnumerable.cs │ │ ├── ReadConcernFeature.cs │ │ ├── ReferenceCounted.cs │ │ ├── SemanticVersion.cs │ │ ├── SemaphoreSlimRequest.cs │ │ ├── StreamExtensionMethods.cs │ │ ├── StringBuilderExtensionMethods.cs │ │ ├── SystemClock.cs │ │ ├── TaskExtensions.cs │ │ ├── ThreadStaticRandom.cs │ │ ├── TimeSpanParser.cs │ │ └── ToStringComparer.cs │ ├── Operations │ │ ├── AggregateExplainOperation.cs │ │ ├── AggregateOperation.cs │ │ ├── AggregateToCollectionOperation.cs │ │ ├── AsyncCursor.cs │ │ ├── AsyncCursorEnumerableOneTimeAdapter.cs │ │ ├── AsyncCursorEnumerator.cs │ │ ├── AsyncCursorSourceEnumerableAdapter.cs │ │ ├── BulkDeleteOperation.cs │ │ ├── BulkDeleteOperationEmulator.cs │ │ ├── BulkInsertOperation.cs │ │ ├── BulkInsertOperationEmulator.cs │ │ ├── BulkMixedWriteOperation.cs │ │ ├── BulkUnmixedWriteOperationBase.cs │ │ ├── BulkUnmixedWriteOperationEmulatorBase.cs │ │ ├── BulkUpdateOperation.cs │ │ ├── BulkUpdateOperationEmulator.cs │ │ ├── BulkWriteBatchResult.cs │ │ ├── BulkWriteBatchResultCombiner.cs │ │ ├── BulkWriteConcernError.cs │ │ ├── BulkWriteOperationError.cs │ │ ├── BulkWriteOperationResult.cs │ │ ├── BulkWriteOperationResultConverter.cs │ │ ├── BulkWriteOperationUpsert.cs │ │ ├── CommandOperationBase.cs │ │ ├── CountOperation.cs │ │ ├── CreateCollectionOperation.cs │ │ ├── CreateIndexRequest.cs │ │ ├── CreateIndexesOperation.cs │ │ ├── CreateIndexesUsingCommandOperation.cs │ │ ├── CreateIndexesUsingInsertOperation.cs │ │ ├── CreateViewOperation.cs │ │ ├── CursorBatchDeserializationHelper.cs │ │ ├── CursorType.cs │ │ ├── DatabaseExistsOperation.cs │ │ ├── DeleteOpcodeOperation.cs │ │ ├── DeleteOpcodeOperationEmulator.cs │ │ ├── DeleteRequest.cs │ │ ├── DistinctOperation.cs │ │ ├── DropCollectionOperation.cs │ │ ├── DropDatabaseOperation.cs │ │ ├── DropIndexOperation.cs │ │ ├── ElementDeserializer.cs │ │ ├── ElementNameValidators │ │ │ ├── CollectionElementNameValidator.cs │ │ │ ├── ElementNameValidatorFactory.cs │ │ │ ├── UpdateElementNameValidator.cs │ │ │ └── UpdateOrReplacementElementNameValidator.cs │ │ ├── EvalOperation.cs │ │ ├── ExplainOperation.cs │ │ ├── ExplainVerbosity.cs │ │ ├── FindAndModifyOperationBase.cs │ │ ├── FindAndModifyValueDeserializer.cs │ │ ├── FindCommandOperation.cs │ │ ├── FindOneAndDeleteOperation.cs │ │ ├── FindOneAndReplaceOperation.cs │ │ ├── FindOneAndUpdateOperation.cs │ │ ├── FindOpcodeOperation.cs │ │ ├── FindOperation.cs │ │ ├── GeoNearOperation.cs │ │ ├── GeoSearchOperation.cs │ │ ├── GroupOperation.cs │ │ ├── IOperation.cs │ │ ├── IndexNameHelper.cs │ │ ├── InsertOpcodeOperation.cs │ │ ├── InsertOpcodeOperationEmulator.cs │ │ ├── InsertRequest.cs │ │ ├── ListCollectionsOperation.cs │ │ ├── ListCollectionsUsingCommandOperation.cs │ │ ├── ListCollectionsUsingQueryOperation.cs │ │ ├── ListDatabasesOperation.cs │ │ ├── ListIndexesOperation.cs │ │ ├── ListIndexesUsingCommandOperation.cs │ │ ├── ListIndexesUsingQueryOperation.cs │ │ ├── MapReduceLegacyOperation.cs │ │ ├── MapReduceOperation.cs │ │ ├── MapReduceOperationBase.cs │ │ ├── MapReduceOutputMode.cs │ │ ├── MapReduceOutputToCollectionOperation.cs │ │ ├── MongoBulkWriteOperationException.cs │ │ ├── OperationExtensionMethods.cs │ │ ├── ParallelScanOperation.cs │ │ ├── PingOperation.cs │ │ ├── QueryHelper.cs │ │ ├── ReIndexOperation.cs │ │ ├── ReadCommandOperation.cs │ │ ├── RenameCollectionOperation.cs │ │ ├── ReturnDocument.cs │ │ ├── UpdateOpcodeOperation.cs │ │ ├── UpdateOpcodeOperationEmulator.cs │ │ ├── UpdateRequest.cs │ │ ├── UpdateType.cs │ │ ├── WriteCommandOperation.cs │ │ ├── WriteConcernErrorHelper.cs │ │ ├── WriteRequest.cs │ │ └── WriteRequestType.cs │ ├── Servers │ │ ├── HeartbeatDelay.cs │ │ ├── IClusterableServerFactory.cs │ │ ├── IServer.cs │ │ ├── IServerMonitor.cs │ │ ├── IServerMonitorFactory.cs │ │ ├── Server.cs │ │ ├── ServerDescription.cs │ │ ├── ServerDescriptionChangedEventArgs.cs │ │ ├── ServerFactory.cs │ │ ├── ServerId.cs │ │ ├── ServerMonitor.cs │ │ ├── ServerMonitorFactory.cs │ │ ├── ServerState.cs │ │ └── ServerType.cs │ └── WireProtocol │ │ ├── CommandResponseHandling.cs │ │ ├── CommandWireProtocol.cs │ │ ├── CursorBatch.cs │ │ ├── DeleteWireProtocol.cs │ │ ├── GetMoreWireProtocol.cs │ │ ├── IWireProtocol.cs │ │ ├── InsertWireProtocol.cs │ │ ├── KillCursorsWireProtocol.cs │ │ ├── Messages │ │ ├── DeleteMessage.cs │ │ ├── Encoders │ │ │ ├── BinaryEncoders │ │ │ │ ├── BinaryMessageEncoderFactory.cs │ │ │ │ ├── DeleteMessageBinaryEncoder.cs │ │ │ │ ├── GetMoreMessageBinaryEncoder.cs │ │ │ │ ├── InsertMessageBinaryEncoder.cs │ │ │ │ ├── KillCursorsMessageBinaryEncoder.cs │ │ │ │ ├── MessageBinaryEncoderBase.cs │ │ │ │ ├── Opcode.cs │ │ │ │ ├── QueryMessageBinaryEncoder.cs │ │ │ │ ├── ReplyMessageBinaryEncoder.cs │ │ │ │ └── UpdateMessageBinaryEncoder.cs │ │ │ ├── IEncodableMessage.cs │ │ │ ├── IMessageEncoder.cs │ │ │ ├── IMessageEncoderFactory.cs │ │ │ ├── IMessageEncoderSelector.cs │ │ │ ├── JsonEncoders │ │ │ │ ├── DeleteMessageJsonEncoder.cs │ │ │ │ ├── GetMoreMessageJsonEncoder.cs │ │ │ │ ├── InsertMessageJsonEncoder.cs │ │ │ │ ├── JsonMessageEncoderFactory.cs │ │ │ │ ├── KillCursorsMessageJsonEncoder.cs │ │ │ │ ├── MessageJsonEncoderBase.cs │ │ │ │ ├── QueryMessageJsonEncoder.cs │ │ │ │ ├── ReplyMessageJsonEncoder.cs │ │ │ │ └── UpdateMessageJsonEncoder.cs │ │ │ ├── MessageEncoderSettings.cs │ │ │ └── ReplyMessageEncoderSelector.cs │ │ ├── GetMoreMessage.cs │ │ ├── InsertMessage.cs │ │ ├── KillCursorsMessage.cs │ │ ├── MongoDBMessage.cs │ │ ├── MongoDBMessageType.cs │ │ ├── QueryMessage.cs │ │ ├── ReplyMessage.cs │ │ ├── RequestMessage.cs │ │ ├── ResponseMessage.cs │ │ └── UpdateMessage.cs │ │ ├── QueryWireProtocol.cs │ │ ├── UpdateWireProtocol.cs │ │ └── WriteWireProtocolBase.cs ├── DatabaseNamespace.cs ├── DeferredAsyncCursor.cs ├── DocumentValidationAction.cs ├── DocumentValidationLevel.cs ├── IAsyncCursor.cs ├── IAsyncCursorSource.cs ├── MongoAuthenticationException.cs ├── MongoClientException.cs ├── MongoCommandException.cs ├── MongoConfigurationException.cs ├── MongoConnectionClosedException.cs ├── MongoConnectionException.cs ├── MongoCursorNotFoundException.cs ├── MongoDB.Driver.Core.csproj ├── MongoDuplicateKeyException.cs ├── MongoException.cs ├── MongoExecutionTimeoutException.cs ├── MongoIncompatibleDriverException.cs ├── MongoInternalException.cs ├── MongoNodeIsRecoveringException.cs ├── MongoNotPrimaryException.cs ├── MongoQueryException.cs ├── MongoServerException.cs ├── MongoWaitQueueFullException.cs ├── MongoWriteConcernException.cs ├── Optional.cs ├── Properties │ └── AssemblyInfo.cs ├── ReadConcern.cs ├── ReadConcernLevel.cs ├── ReadPreference.cs ├── ReadPreferenceMode.cs ├── ServerErrorCategory.cs ├── SingleBatchAsyncCursor.cs ├── Tag.cs ├── TagSet.cs ├── WriteConcern.cs ├── WriteConcernResult.cs └── packages.config ├── MongoDB.Driver ├── AggregateBucketAutoGranularity.cs ├── AggregateBucketAutoOptions.cs ├── AggregateBucketAutoResult.cs ├── AggregateBucketAutoResultId.cs ├── AggregateBucketOptions.cs ├── AggregateBucketResult.cs ├── AggregateCountResult.cs ├── AggregateExpressionDefinition.cs ├── AggregateFacet.cs ├── AggregateFacetOptions.cs ├── AggregateFacetResult.cs ├── AggregateFacetResults.cs ├── AggregateFluent.cs ├── AggregateFluentBase.cs ├── AggregateGraphLookupOptions.cs ├── AggregateLookupOptions.cs ├── AggregateOptions.cs ├── AggregateSortByCountResult.cs ├── AggregateStringTranslationMode.cs ├── AggregateUnwindOptions.cs ├── ArrayFilterDefinition.cs ├── AsyncCursorHelper.cs ├── Builders.cs ├── BulkWriteError.cs ├── BulkWriteOptions.cs ├── BulkWriteResult.cs ├── BulkWriteUpsert.cs ├── ClusterKey.cs ├── ClusterRegistry.cs ├── Command.cs ├── ConnectionMode.cs ├── CountOptions.cs ├── CreateCollectionOptions.cs ├── CreateIndexModel.cs ├── CreateIndexOptions.cs ├── CreateViewOptions.cs ├── CursorType.cs ├── DeleteManyModel.cs ├── DeleteOneModel.cs ├── DeleteOptions.cs ├── DeleteResult.cs ├── DistinctOptions.cs ├── ExpressionTranslationOptions.cs ├── ExternalEvidence.cs ├── FieldDefinition.cs ├── FieldValueSerializerHelper.cs ├── FilterDefinition.cs ├── FilterDefinitionBuilder.cs ├── FilteredMongoCollectionBase.cs ├── FindFluent.cs ├── FindFluentBase.cs ├── FindOneAndDeleteOptions.cs ├── FindOneAndReplaceOptions.cs ├── FindOneAndUpdateOptions.cs ├── FindOptions.cs ├── GeoJsonObjectModel │ ├── GeoJson.cs │ ├── GeoJson2DCoordinates.cs │ ├── GeoJson2DGeographicCoordinates.cs │ ├── GeoJson2DProjectedCoordinates.cs │ ├── GeoJson3DCoordinates.cs │ ├── GeoJson3DGeographicCoordinates.cs │ ├── GeoJson3DProjectedCoordinates.cs │ ├── GeoJsonBoundingBox.cs │ ├── GeoJsonCoordinateReferenceSystem.cs │ ├── GeoJsonCoordinates.cs │ ├── GeoJsonFeature.cs │ ├── GeoJsonFeatureArgs.cs │ ├── GeoJsonFeatureCollection.cs │ ├── GeoJsonGeometry.cs │ ├── GeoJsonGeometryCollection.cs │ ├── GeoJsonLineString.cs │ ├── GeoJsonLineStringCoordinates.cs │ ├── GeoJsonLinearRingCoordinates.cs │ ├── GeoJsonLinkedCoordinateReferenceSystem.cs │ ├── GeoJsonMultiLineString.cs │ ├── GeoJsonMultiLineStringCoordinates.cs │ ├── GeoJsonMultiPoint.cs │ ├── GeoJsonMultiPointCoordinates.cs │ ├── GeoJsonMultiPolygon.cs │ ├── GeoJsonMultiPolygonCoordinates.cs │ ├── GeoJsonNamedCoordinateReferenceSystem.cs │ ├── GeoJsonObject.cs │ ├── GeoJsonObjectArgs.cs │ ├── GeoJsonObjectType.cs │ ├── GeoJsonPoint.cs │ ├── GeoJsonPolygon.cs │ ├── GeoJsonPolygonCoordinates.cs │ └── Serializers │ │ ├── GeoJson2DCoordinatesSerializer.cs │ │ ├── GeoJson2DGeographicCoordinatesSerializer.cs │ │ ├── GeoJson2DProjectedCoordinatesSerializer.cs │ │ ├── GeoJson3DCoordinatesSerializer.cs │ │ ├── GeoJson3DGeographicCoordinatesSerializer.cs │ │ ├── GeoJson3DProjectedCoordinatesSerializer.cs │ │ ├── GeoJsonBoundingBoxSerializer.cs │ │ ├── GeoJsonCoordinateReferenceSystemSerializer.cs │ │ ├── GeoJsonCoordinatesSerializer.cs │ │ ├── GeoJsonFeatureCollectionSerializer.cs │ │ ├── GeoJsonFeatureSerializer.cs │ │ ├── GeoJsonGeometryCollectionSerializer.cs │ │ ├── GeoJsonGeometrySerializer.cs │ │ ├── GeoJsonLineStringCoordinatesSerializer.cs │ │ ├── GeoJsonLineStringSerializer.cs │ │ ├── GeoJsonLinearRingCoordinatesSerializer.cs │ │ ├── GeoJsonLinkedCoordinateReferenceSystemSerializer.cs │ │ ├── GeoJsonMultiLineStringCoordinatesSerializer.cs │ │ ├── GeoJsonMultiLineStringSerializer.cs │ │ ├── GeoJsonMultiPointCoordinatesSerializer.cs │ │ ├── GeoJsonMultiPointSerializer.cs │ │ ├── GeoJsonMultiPolygonCoordinatesSerializer.cs │ │ ├── GeoJsonMultiPolygonSerializer.cs │ │ ├── GeoJsonNamedCoordinateReferenceSystemSerializer.cs │ │ ├── GeoJsonObjectSerializer.cs │ │ ├── GeoJsonObjectSerializerHelper.cs │ │ ├── GeoJsonPointSerializer.cs │ │ ├── GeoJsonPolygonCoordinatesSerializer.cs │ │ └── GeoJsonPolygonSerializer.cs ├── IAggregateFluent.cs ├── IAggregateFluentExtensions.cs ├── IFilteredMongoCollection.cs ├── IFindFluent.cs ├── IFindFluentExtensions.cs ├── IInheritableMongoClientSettings.cs ├── IMongoClient.cs ├── IMongoCollection.cs ├── IMongoCollectionExtensions.cs ├── IMongoDatabase.cs ├── IMongoIndexManager.cs ├── IOperationExecutor.cs ├── IndexKeysDefinition.cs ├── IndexKeysDefinitionBuilder.cs ├── IndexOptionDefaults.cs ├── InsertManyOptions.cs ├── InsertOneModel.cs ├── InsertOneOptions.cs ├── Linq │ ├── AggregateQueryableExecutionModel.cs │ ├── ExecutionPlanBuilder.cs │ ├── ExpressionHelper.cs │ ├── Expressions │ │ ├── AccumulatorExpression.cs │ │ ├── AccumulatorType.cs │ │ ├── AggregateExpressionExpression.cs │ │ ├── ArrayIndexExpression.cs │ │ ├── CollectionExpression.cs │ │ ├── ConcatExpression.cs │ │ ├── CorrelatedExpression.cs │ │ ├── DefaultIfEmptyExpression.cs │ │ ├── DistinctExpression.cs │ │ ├── DocumentExpression.cs │ │ ├── ExceptExpression.cs │ │ ├── ExpressionComparer.cs │ │ ├── ExpressionReplacer.cs │ │ ├── ExtensionExpression.cs │ │ ├── ExtensionExpressionType.cs │ │ ├── ExtensionExpressionVisitor.cs │ │ ├── FieldAsDocumentExpression.cs │ │ ├── FieldExpression.cs │ │ ├── GroupByExpression.cs │ │ ├── GroupByWithResultSelectorExpression.cs │ │ ├── GroupJoinExpression.cs │ │ ├── GroupingKeyExpression.cs │ │ ├── IFieldExpression.cs │ │ ├── ISerializationExpression.cs │ │ ├── ISourcedExpression.cs │ │ ├── InjectedFilterExpression.cs │ │ ├── IntersectExpression.cs │ │ ├── JoinExpression.cs │ │ ├── OrderByClause.cs │ │ ├── OrderByExpression.cs │ │ ├── PipelineExpression.cs │ │ ├── ResultOperator.cs │ │ ├── ResultOperators │ │ │ ├── AggregateResultOperator.cs │ │ │ ├── AllResultOperator.cs │ │ │ ├── AnyResultOperator.cs │ │ │ ├── ArrayResultOperator.cs │ │ │ ├── AverageResultOperator.cs │ │ │ ├── ContainsResultOperator.cs │ │ │ ├── CountResultOperator.cs │ │ │ ├── FirstResultOperator.cs │ │ │ ├── HashSetResultOperator.cs │ │ │ ├── LastResultOperator.cs │ │ │ ├── ListResultOperator.cs │ │ │ ├── MaxResultOperator.cs │ │ │ ├── MinResultOperator.cs │ │ │ ├── ResultTransformerHelper.cs │ │ │ ├── SingleResultOperator.cs │ │ │ ├── StandardDeviationResultOperator.cs │ │ │ └── SumResultOperator.cs │ │ ├── ReverseExpression.cs │ │ ├── SampleExpression.cs │ │ ├── SelectExpression.cs │ │ ├── SelectManyExpression.cs │ │ ├── SerializationExpression.cs │ │ ├── SerializedValueExpression.cs │ │ ├── SkipExpression.cs │ │ ├── TakeExpression.cs │ │ ├── UnionExpression.cs │ │ ├── WhereExpression.cs │ │ └── ZipExpression.cs │ ├── FieldExpressionFlattener.cs │ ├── IMongoQueryProvider.cs │ ├── IMongoQueryable.cs │ ├── IResultTransformer.cs │ ├── LinqExtensions.cs │ ├── MethodHelper.cs │ ├── MongoEnumerable.cs │ ├── MongoQueryProviderImpl.cs │ ├── MongoQueryable.cs │ ├── MongoQueryableImpl.cs │ ├── Processors │ │ ├── AccumulatorBinder.cs │ │ ├── BinderHelper.cs │ │ ├── CompositeMethodCallBinder.cs │ │ ├── CorrelatedAccumulatorRemover.cs │ │ ├── CorrelatedGroupRewriter.cs │ │ ├── EmbeddedPipeline │ │ │ ├── EmbeddedPipelineBinder.cs │ │ │ ├── EmbeddedPipelineBindingContext.cs │ │ │ └── MethodCallBinders │ │ │ │ ├── AggregateBinder.cs │ │ │ │ ├── AllBinder.cs │ │ │ │ ├── AnyBinder.cs │ │ │ │ ├── AsQueryableBinder.cs │ │ │ │ ├── AverageBinder.cs │ │ │ │ ├── ConcatBinder.cs │ │ │ │ ├── ContainsBinder.cs │ │ │ │ ├── CountBinder.cs │ │ │ │ ├── DefaultIfEmptyBinder.cs │ │ │ │ ├── DistinctBinder.cs │ │ │ │ ├── ExceptBinder.cs │ │ │ │ ├── FirstBinder.cs │ │ │ │ ├── IntersectBinder.cs │ │ │ │ ├── LastBinder.cs │ │ │ │ ├── MaxBinder.cs │ │ │ │ ├── MinBinder.cs │ │ │ │ ├── OfTypeBinder.cs │ │ │ │ ├── ReverseBinder.cs │ │ │ │ ├── SelectBinder.cs │ │ │ │ ├── SkipBinder.cs │ │ │ │ ├── StandardDeviationBinder.cs │ │ │ │ ├── SumBinder.cs │ │ │ │ ├── TakeBinder.cs │ │ │ │ ├── ToArrayBinder.cs │ │ │ │ ├── ToHashSetBinder.cs │ │ │ │ ├── ToListBinder.cs │ │ │ │ ├── UnionBinder.cs │ │ │ │ ├── WhereBinder.cs │ │ │ │ └── ZipBinder.cs │ │ ├── IBindingContext.cs │ │ ├── IMethodCallBinder.cs │ │ ├── MethodInfoMethodCallBinder.cs │ │ ├── MultipleWhereMerger.cs │ │ ├── NameBasedMethodCallBinder.cs │ │ ├── PartialEvaluator.cs │ │ ├── Pipeline │ │ │ ├── MethodCallBinders │ │ │ │ ├── AnyBinder.cs │ │ │ │ ├── AverageBinder.cs │ │ │ │ ├── CountBinder.cs │ │ │ │ ├── DistinctBinder.cs │ │ │ │ ├── FirstBinder.cs │ │ │ │ ├── GroupByBinder.cs │ │ │ │ ├── GroupByWithResultSelectorBinder.cs │ │ │ │ ├── JoinBinder.cs │ │ │ │ ├── JoinSerializer.cs │ │ │ │ ├── MaxBinder.cs │ │ │ │ ├── MinBinder.cs │ │ │ │ ├── OfTypeBinder.cs │ │ │ │ ├── OrderByBinder.cs │ │ │ │ ├── SampleBinder.cs │ │ │ │ ├── SelectBinder.cs │ │ │ │ ├── SelectManyBinder.cs │ │ │ │ ├── SelectingResultOperatorBinderBase.cs │ │ │ │ ├── SingleBinder.cs │ │ │ │ ├── SkipBinder.cs │ │ │ │ ├── StandardDeviationPopulationBinder.cs │ │ │ │ ├── StandardDeviationSampleBinder.cs │ │ │ │ ├── SumBinder.cs │ │ │ │ ├── TakeBinder.cs │ │ │ │ ├── ThenByBinder.cs │ │ │ │ └── WhereBinder.cs │ │ │ ├── PipelineBinder.cs │ │ │ └── PipelineBindingContext.cs │ │ ├── PipelineBinderBase.cs │ │ ├── PreviouslyUsedSerializerFinder.cs │ │ ├── ProjectionMapper.cs │ │ ├── SerializationBinder.cs │ │ ├── SerializerBuilder.cs │ │ ├── Transformer.cs │ │ └── Transformers │ │ │ ├── CollectionConstructorTransformer.cs │ │ │ ├── ConstantOnRightTransformer.cs │ │ │ ├── EqualsAnyBooleanTransformer.cs │ │ │ ├── ExpressionTransformerRegistry.cs │ │ │ ├── FirstLastNormalizingTransformer.cs │ │ │ ├── IExpressionTransformer.cs │ │ │ ├── NullableTransformer.cs │ │ │ ├── SelectSelectCombiningTransformer.cs │ │ │ ├── VBCoalesceTransformer.cs │ │ │ ├── VBCompareStringTransformer.cs │ │ │ ├── VBInformationIsNothingTransformer.cs │ │ │ ├── VBNothingConversionRemovalTransformer.cs │ │ │ └── VBStringIndexComparisonTransformer.cs │ ├── QueryableExecutionModel.cs │ ├── QueryableTranslation.cs │ ├── SerializerHelper.cs │ └── Translators │ │ ├── AggregateExpressionTranslator.cs │ │ ├── AggregateGroupTranslator.cs │ │ ├── AggregateLanguageTranslator.cs │ │ ├── AggregateProjectTranslator.cs │ │ ├── FieldNamePrefixer.cs │ │ ├── FindProjectionTranslator.cs │ │ ├── PredicateTranslator.cs │ │ ├── ProjectedObject.cs │ │ ├── ProjectedObjectDeserializer.cs │ │ └── QueryableTranslator.cs ├── ListCollectionsOptions.cs ├── MapReduceOptions.cs ├── MongoBulkWriteException.cs ├── MongoClient.cs ├── MongoClientBase.cs ├── MongoClientSettings.cs ├── MongoCollectionBase.cs ├── MongoCollectionImpl.cs ├── MongoCollectionSettings.cs ├── MongoCredential.cs ├── MongoCredentialStore.cs ├── MongoDB.Driver.csproj ├── MongoDBRef.cs ├── MongoDatabaseBase.cs ├── MongoDatabaseImpl.cs ├── MongoDatabaseSettings.cs ├── MongoDefaults.cs ├── MongoExternalIdentity.cs ├── MongoIdentity.cs ├── MongoIdentityEvidence.cs ├── MongoIndexManagerBase.cs ├── MongoInternalIdentity.cs ├── MongoServerAddress.cs ├── MongoUrl.cs ├── MongoUrlBuilder.cs ├── MongoUtils.cs ├── MongoWriteException.cs ├── MongoX509Identity.cs ├── OfTypeMongoCollection.cs ├── OfTypeSerializer.cs ├── OperationExecutor.cs ├── PasswordEvidence.cs ├── PipelineDefinition.cs ├── PipelineDefinitionBuilder.cs ├── PipelineStageDefinition.cs ├── PipelineStageDefinitionBuilder.cs ├── ProjectionDefinition.cs ├── ProjectionDefinitionBuilder.cs ├── Properties │ └── AssemblyInfo.cs ├── RenameCollectionOptions.cs ├── ReplaceOneModel.cs ├── ReplaceOneResult.cs ├── ReturnDocument.cs ├── Setting.cs ├── SortDefinition.cs ├── SortDefinitionBuilder.cs ├── SslSettings.cs ├── Support │ ├── IndexMap.cs │ └── ReflectionExtensions.cs ├── TextSearchOptions.cs ├── UpdateDefinition.cs ├── UpdateDefinitionBuilder.cs ├── UpdateManyModel.cs ├── UpdateOneModel.cs ├── UpdateOptions.cs ├── UpdateResult.cs ├── WriteConcernError.cs ├── WriteError.cs ├── WriteModel.cs ├── WriteModelType.cs └── packages.config └── MongoDB.Shared ├── ApplicationNameHelper.cs ├── CanonicalDisposableClass.cs ├── CanonicalDisposableDerivedClass.cs ├── CanonicalDisposableStruct.cs ├── CanonicalEquatableClass.cs ├── CanonicalEquatableDerivedClass.cs ├── CanonicalEquatableStruct.cs ├── GlobalAssemblyInfo.cs ├── Hasher.cs └── IncrementalMD5.cs /Config/BuffConfig.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roubincode/ETServer/a7f3fabff110077d999b035a02f524f1f3d1e097/Config/BuffConfig.txt -------------------------------------------------------------------------------- /Config/StartConfig/Benchmark.txt: -------------------------------------------------------------------------------- 1 | { "_t" : "StartConfig", "_id" : NumberLong("98808811814943"), "components" : [{ "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10000, "Host2" : null }, { "_t" : "InnerConfig", "Host" : "127.0.0.1", "Port" : 20000 }], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" } 2 | { "_t" : "StartConfig", "_id" : NumberLong("98808818892845"), "components" : [{ "_t" : "ClientConfig", "Host" : "127.0.0.1", "Port" : 10000 }], "AppId" : 2, "AppType" : "Benchmark", "ServerIP" : "*" } 3 | -------------------------------------------------------------------------------- /Config/StartConfig/Benchmark2.txt: -------------------------------------------------------------------------------- 1 | { "_t" : "StartConfig", "_id" : NumberLong("98547768819754"), "components" : [{ "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10002, "Host2" : null }, { "_t" : "InnerConfig", "Host" : "127.0.0.1", "Port" : 20000 }, { "_t" : "HttpConfig", "Url" : "", "AppId" : 0, "AppKey" : "", "ManagerSystemUrl" : "" }, { "_t" : "DBConfig", "ConnectionString" : null, "DBName" : null }], "AppId" : 1, "AppType" : "AllServer", "ServerIP" : "*" } 2 | { "_t" : "StartConfig", "_id" : NumberLong("98892711264291"), "components" : [{ "_t" : "ClientConfig", "Host" : "127.0.0.1", "Port" : 10002 }], "AppId" : 2, "AppType" : "Benchmark", "ServerIP" : "*" } 3 | -------------------------------------------------------------------------------- /Config/StartConfig/BenchmarkClient.txt: -------------------------------------------------------------------------------- 1 | { "_t" : "StartConfig", "_id" : NumberLong("98813417750535"), "components" : [{ "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10000, "Host2" : null }, { "_t" : "InnerConfig", "Host" : "127.0.0.1", "Port" : 20003 }], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" } 2 | { "_t" : "StartConfig", "_id" : NumberLong("98813420503048"), "components" : [{ "_t" : "ClientConfig", "Host" : "127.0.0.1", "Port" : 10002 }], "AppId" : 2, "AppType" : "Benchmark", "ServerIP" : "*" } 3 | -------------------------------------------------------------------------------- /Config/StartConfig/ClientConfig.txt: -------------------------------------------------------------------------------- 1 | { "_t" : "StartConfig", "_id" : NumberLong("96935508377601"), "components" : [{ "_t" : "ClientConfig", "_id" : NumberLong("96935508377602"), "Host" : "127.0.0.1", "Port" : 10000 }], "AppId" : 0, "AppType" : "Client", "ServerIP" : "*" } 2 | -------------------------------------------------------------------------------- /Config/StartConfig/LocalAllServer.txt: -------------------------------------------------------------------------------- 1 | { "_t" : "StartConfig", "_id" : NumberLong("98547768819754"), "components" : [{ "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10002, "Host2" : "127.0.0.1" }, { "_t" : "InnerConfig", "Host" : "127.0.0.1", "Port" : 20000 }, { "_t" : "HttpConfig", "Url" : "http://*:8080/", "AppId" : 0, "AppKey" : "", "ManagerSystemUrl" : "" }, { "_t" : "DBConfig", "ConnectionString" : null, "DBName" : null }], "AppId" : 1, "AppType" : "AllServer", "ServerIP" : "*" } 2 | -------------------------------------------------------------------------------- /Server/App/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Server/App/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Server.App": { 4 | "commandName": "Project", 5 | "commandLineArgs": "--appId=1 --appType=AllServer --config=../Config/StartConfig/LocalAllServer.txt", 6 | "workingDirectory": "../../Bin" 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /Server/App/Server.App.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.0 6 | App 7 | App 8 | 9 | 10 | 11 | false 12 | 13 | 14 | 15 | TRACE;DEBUG;NETCOREAPP2_0;SERVER 16 | ..\..\Bin\ 17 | 18 | 19 | 20 | TRACE;RELEASE;NETCOREAPP2_0;SERVER 21 | ..\..\Bin\ 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | Always 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Server/Hotfix/Handler/Actor_TestHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [ActorMessageHandler(AppType.Map)] 7 | public class Actor_TestHandler : AMActorHandler 8 | { 9 | protected override async Task Run(Unit unit, Actor_Test message) 10 | { 11 | Log.Debug(message.Info); 12 | await Task.CompletedTask; 13 | unit.GetComponent().GetActorProxy().Send(message); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Server/Hotfix/Handler/Actor_TestRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using ETModel; 4 | 5 | namespace ETHotfix 6 | { 7 | [ActorMessageHandler(AppType.Map)] 8 | public class Actor_TestRequestHandler : AMActorRpcHandler 9 | { 10 | protected override async Task Run(Unit unit, Actor_TestRequest message, Action reply) 11 | { 12 | await Task.CompletedTask; 13 | reply(new Actor_TestResponse() {response = "response actor rpc"}); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Server/Hotfix/Handler/C2M_ReloadHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Manager)] 7 | public class C2M_ReloadHandler: AMRpcHandler 8 | { 9 | protected override async void Run(Session session, C2M_Reload message, Action reply) 10 | { 11 | M2C_Reload response = new M2C_Reload(); 12 | try 13 | { 14 | StartConfigComponent startConfigComponent = Game.Scene.GetComponent(); 15 | NetInnerComponent netInnerComponent = Game.Scene.GetComponent(); 16 | foreach (StartConfig startConfig in startConfigComponent.GetAll()) 17 | { 18 | if (!message.AppType.Is(startConfig.AppType)) 19 | { 20 | continue; 21 | } 22 | InnerConfig innerConfig = startConfig.GetComponent(); 23 | Session serverSession = netInnerComponent.Get(innerConfig.IPEndPoint); 24 | await serverSession.Call(new M2A_Reload()); 25 | } 26 | reply(response); 27 | } 28 | catch (Exception e) 29 | { 30 | ReplyError(response, e, reply); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Server/Hotfix/Handler/C2R_PingHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Realm)] 7 | public class C2R_PingHandler : AMRpcHandler 8 | { 9 | protected override void Run(Session session, C2R_Ping message, Action reply) 10 | { 11 | R2C_Ping r2CPing = new R2C_Ping(); 12 | reply(r2CPing); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Server/Hotfix/Handler/G2G_LockReleaseRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Gate)] 7 | public class G2G_LockReleaseRequestHandler : AMRpcHandler 8 | { 9 | protected override void Run(Session session, G2G_LockReleaseRequest message, Action reply) 10 | { 11 | G2G_LockReleaseResponse g2GLockReleaseResponse = new G2G_LockReleaseResponse(); 12 | 13 | try 14 | { 15 | Unit unit = Game.Scene.GetComponent().Get(message.Id); 16 | if (unit == null) 17 | { 18 | g2GLockReleaseResponse.Error = ErrorCode.ERR_NotFoundUnit; 19 | reply(g2GLockReleaseResponse); 20 | return; 21 | } 22 | 23 | unit.GetComponent().Release(NetworkHelper.ToIPEndPoint(message.Address)); 24 | reply(g2GLockReleaseResponse); 25 | } 26 | catch (Exception e) 27 | { 28 | ReplyError(g2GLockReleaseResponse, e, reply); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Server/Hotfix/Handler/G2G_LockRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Gate)] 7 | public class G2G_LockRequestHandler : AMRpcHandler 8 | { 9 | protected override async void Run(Session session, G2G_LockRequest message, Action reply) 10 | { 11 | G2G_LockResponse response = new G2G_LockResponse(); 12 | try 13 | { 14 | Unit unit = Game.Scene.GetComponent().Get(message.Id); 15 | if (unit == null) 16 | { 17 | response.Error = ErrorCode.ERR_NotFoundUnit; 18 | reply(response); 19 | return; 20 | } 21 | 22 | await unit.GetComponent().Lock(NetworkHelper.ToIPEndPoint(message.Address)); 23 | 24 | reply(response); 25 | } 26 | catch (Exception e) 27 | { 28 | ReplyError(response, e, reply); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Server/Hotfix/Handler/M2A_ReloadHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.AllServer)] 7 | public class M2A_ReloadHandler : AMRpcHandler 8 | { 9 | protected override void Run(Session session, M2A_Reload message, Action reply) 10 | { 11 | A2M_Reload response = new A2M_Reload(); 12 | try 13 | { 14 | Game.EventSystem.Add(DLLType.Hotfix, DllHelper.GetHotfixAssembly()); 15 | reply(response); 16 | } 17 | catch (Exception e) 18 | { 19 | response.Error = ErrorCode.ERR_ReloadFail; 20 | StartConfig myStartConfig = Game.Scene.GetComponent().StartConfig; 21 | InnerConfig innerConfig = myStartConfig.GetComponent(); 22 | response.Message = $"{innerConfig.IPEndPoint} reload fail, {e}"; 23 | reply(response); 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Server/Hotfix/Handler/M2M_TrasferUnitRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Map)] 7 | public class M2M_TrasferUnitRequestHandler : AMRpcHandler 8 | { 9 | protected override void Run(Session session, M2M_TrasferUnitRequest message, Action reply) 10 | { 11 | M2M_TrasferUnitResponse response = new M2M_TrasferUnitResponse(); 12 | try 13 | { 14 | Unit unit = message.Unit; 15 | Log.Debug(MongoHelper.ToJson(message.Unit)); 16 | // 这里不需要注册location,因为unlock会更新位置 17 | unit.AddComponent(); 18 | Game.Scene.GetComponent().Add(unit); 19 | reply(response); 20 | } 21 | catch (Exception e) 22 | { 23 | ReplyError(response, e, reply); 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Server/Hotfix/Helper/HotfixHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace ETHotfix 5 | { 6 | public static class HotfixHelper 7 | { 8 | public static object Create(object old) 9 | { 10 | Assembly assembly = typeof(HotfixHelper).Assembly; 11 | string objectName = old.GetType().FullName; 12 | return Activator.CreateInstance(assembly.GetType(objectName)); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Server/Hotfix/Helper/MessageHelper.cs: -------------------------------------------------------------------------------- 1 | using ETModel; 2 | 3 | namespace ETHotfix 4 | { 5 | public static class MessageHelper 6 | { 7 | public static void Broadcast(IActorMessage message) 8 | { 9 | Unit[] units = Game.Scene.GetComponent().GetAll(); 10 | ActorProxyComponent actorProxyComponent = Game.Scene.GetComponent(); 11 | foreach (Unit unit in units) 12 | { 13 | long gateSessionId = unit.GetComponent().GateSessionId; 14 | actorProxyComponent.Get(gateSessionId).Send(message); 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Server/Hotfix/Module/Actor/CommonActorTypeHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [ActorTypeHandler(AppType.AllServer, ActorType.Common)] 7 | public class CommonActorTypeHandler : IActorTypeHandler 8 | { 9 | public async Task Handle(Session session, Entity entity, IActorMessage actorMessage) 10 | { 11 | await Game.Scene.GetComponent().Handle(session, entity, actorMessage); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Server/Hotfix/Module/Actor/GateSessionActorTypeHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using ETModel; 4 | 5 | namespace ETHotfix 6 | { 7 | /// 8 | /// gate session收到的actor消息直接转发给客户端 9 | /// 10 | [ActorTypeHandler(AppType.Gate, ActorType.GateSession)] 11 | public class GateSessionActorTypeHandler : IActorTypeHandler 12 | { 13 | public async Task Handle(Session session, Entity entity, IActorMessage actorMessage) 14 | { 15 | ActorResponse actorResponse = new ActorResponse 16 | { 17 | RpcId = actorMessage.RpcId 18 | }; 19 | try 20 | { 21 | // 发送给客户端 22 | Session clientSession = entity as Session; 23 | actorMessage.ActorId = 0; 24 | clientSession.Send(actorMessage); 25 | 26 | session.Reply(actorResponse); 27 | await Task.CompletedTask; 28 | } 29 | catch (Exception e) 30 | { 31 | actorResponse.Error = ErrorCode.ERR_SessionActorError; 32 | actorResponse.Message = $"session actor error {e}"; 33 | session.Reply(actorResponse); 34 | throw; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Server/Hotfix/Module/DB/DBQueryBatchRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ETModel; 4 | 5 | namespace ETHotfix 6 | { 7 | [MessageHandler(AppType.DB)] 8 | public class DBQueryBatchRequestHandler : AMRpcHandler 9 | { 10 | protected override async void Run(Session session, DBQueryBatchRequest message, Action reply) 11 | { 12 | DBQueryBatchResponse response = new DBQueryBatchResponse(); 13 | try 14 | { 15 | DBCacheComponent dbCacheComponent = Game.Scene.GetComponent(); 16 | List components = await dbCacheComponent.GetBatch(message.CollectionName, message.IdList); 17 | 18 | response.Components = components; 19 | 20 | if (message.NeedCache) 21 | { 22 | foreach (ComponentWithId component in components) 23 | { 24 | dbCacheComponent.AddToCache(component, message.CollectionName); 25 | } 26 | } 27 | 28 | reply(response); 29 | } 30 | catch (Exception e) 31 | { 32 | ReplyError(response, e, reply); 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/DB/DBQueryJsonRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ETModel; 4 | 5 | namespace ETHotfix 6 | { 7 | [MessageHandler(AppType.DB)] 8 | public class DBQueryJsonRequestHandler : AMRpcHandler 9 | { 10 | protected override async void Run(Session session, DBQueryJsonRequest message, Action reply) 11 | { 12 | DBQueryJsonResponse response = new DBQueryJsonResponse(); 13 | try 14 | { 15 | DBCacheComponent dbCacheComponent = Game.Scene.GetComponent(); 16 | List components = await dbCacheComponent.GetJson(message.CollectionName, message.Json); 17 | response.Components = components; 18 | 19 | reply(response); 20 | } 21 | catch (Exception e) 22 | { 23 | ReplyError(response, e, reply); 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/DB/DBQueryRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.DB)] 7 | public class DBQueryRequestHandler : AMRpcHandler 8 | { 9 | protected override async void Run(Session session, DBQueryRequest message, Action reply) 10 | { 11 | DBQueryResponse response = new DBQueryResponse(); 12 | try 13 | { 14 | DBCacheComponent dbCacheComponent = Game.Scene.GetComponent(); 15 | ComponentWithId component = await dbCacheComponent.Get(message.CollectionName, message.Id); 16 | 17 | response.Component = component; 18 | 19 | if (message.NeedCache && component != null) 20 | { 21 | dbCacheComponent.AddToCache(component, message.CollectionName); 22 | } 23 | 24 | reply(response); 25 | } 26 | catch (Exception e) 27 | { 28 | ReplyError(response, e, reply); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/DB/DBSaveBatchRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.DB)] 7 | public class DBSaveBatchRequestHandler : AMRpcHandler 8 | { 9 | protected override async void Run(Session session, DBSaveBatchRequest message, Action reply) 10 | { 11 | DBSaveBatchResponse response = new DBSaveBatchResponse(); 12 | try 13 | { 14 | DBCacheComponent dbCacheComponent = Game.Scene.GetComponent(); 15 | 16 | if (string.IsNullOrEmpty(message.CollectionName)) 17 | { 18 | message.CollectionName = message.Components[0].GetType().Name; 19 | } 20 | 21 | if (message.NeedCache) 22 | { 23 | foreach (ComponentWithId component in message.Components) 24 | { 25 | dbCacheComponent.AddToCache(component, message.CollectionName); 26 | } 27 | } 28 | 29 | await dbCacheComponent.AddBatch(message.Components, message.CollectionName); 30 | 31 | reply(response); 32 | } 33 | catch (Exception e) 34 | { 35 | ReplyError(response, e, reply); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Server/Hotfix/Module/DB/DBSaveRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.DB)] 7 | public class DBSaveRequestHandler : AMRpcHandler 8 | { 9 | protected override async void Run(Session session, DBSaveRequest message, Action reply) 10 | { 11 | DBSaveResponse response = new DBSaveResponse(); 12 | try 13 | { 14 | DBCacheComponent dbCacheComponent = Game.Scene.GetComponent(); 15 | if (string.IsNullOrEmpty(message.CollectionName)) 16 | { 17 | message.CollectionName = message.Component.GetType().Name; 18 | } 19 | 20 | if (message.NeedCache) 21 | { 22 | dbCacheComponent.AddToCache(message.Component, message.CollectionName); 23 | } 24 | await dbCacheComponent.Add(message.Component, message.CollectionName); 25 | reply(response); 26 | } 27 | catch (Exception e) 28 | { 29 | ReplyError(response, e, reply); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/FrameSync/C2G_EnterMapHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using ETModel; 4 | 5 | namespace ETHotfix 6 | { 7 | [MessageHandler(AppType.Gate)] 8 | public class C2G_EnterMapHandler : AMRpcHandler 9 | { 10 | protected override async void Run(Session session, C2G_EnterMap message, Action reply) 11 | { 12 | G2C_EnterMap response = new G2C_EnterMap(); 13 | try 14 | { 15 | Player player = session.GetComponent().Player; 16 | // 在map服务器上创建战斗Unit 17 | IPEndPoint mapAddress = Game.Scene.GetComponent().MapConfigs[0].GetComponent().IPEndPoint; 18 | Session mapSession = Game.Scene.GetComponent().Get(mapAddress); 19 | M2G_CreateUnit createUnit = (M2G_CreateUnit)await mapSession.Call(new G2M_CreateUnit() { PlayerId = player.Id, GateSessionId = session.Id }); 20 | player.UnitId = createUnit.UnitId; 21 | response.UnitId = createUnit.UnitId; 22 | response.Count = createUnit.Count; 23 | reply(response); 24 | } 25 | catch (Exception e) 26 | { 27 | ReplyError(response, e, reply); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/FrameSync/C2G_LoginGateHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Gate)] 7 | public class C2G_LoginGateHandler : AMRpcHandler 8 | { 9 | protected override async void Run(Session session, C2G_LoginGate message, Action reply) 10 | { 11 | G2C_LoginGate response = new G2C_LoginGate(); 12 | try 13 | { 14 | string account = Game.Scene.GetComponent().Get(message.Key); 15 | if (account == null) 16 | { 17 | response.Error = ErrorCode.ERR_ConnectGateKeyError; 18 | response.Message = "Gate key验证失败!"; 19 | reply(response); 20 | return; 21 | } 22 | Player player = ComponentFactory.Create(account); 23 | Game.Scene.GetComponent().Add(player); 24 | session.AddComponent().Player = player; 25 | await session.AddComponent(ActorType.GateSession).AddLocation(); 26 | 27 | response.PlayerId = player.Id; 28 | reply(response); 29 | 30 | session.Send(new G2C_TestHotfixMessage() { Info = "recv hotfix message success" }); 31 | } 32 | catch (Exception e) 33 | { 34 | ReplyError(response, e, reply); 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/FrameSync/C2M_TestActorRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using ETModel; 4 | 5 | namespace ETHotfix 6 | { 7 | [ActorMessageHandler(AppType.Map)] 8 | public class C2M_TestActorRequestHandler : AMActorRpcHandler 9 | { 10 | protected override async Task Run(Unit unit, C2M_TestActorRequest message, Action reply) 11 | { 12 | reply(new M2C_TestActorResponse(){Info = "actor rpc response"}); 13 | await Task.CompletedTask; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/FrameSync/G2M_CreateUnitHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Map)] 7 | public class G2M_CreateUnitHandler : AMRpcHandler 8 | { 9 | protected override async void Run(Session session, G2M_CreateUnit message, Action reply) 10 | { 11 | M2G_CreateUnit response = new M2G_CreateUnit(); 12 | try 13 | { 14 | Unit unit = ComponentFactory.Create(); 15 | 16 | await unit.AddComponent().AddLocation(); 17 | unit.AddComponent(message.GateSessionId); 18 | Game.Scene.GetComponent().Add(unit); 19 | response.UnitId = unit.Id; 20 | 21 | response.Count = Game.Scene.GetComponent().Count; 22 | reply(response); 23 | 24 | if (response.Count == 2) 25 | { 26 | Actor_CreateUnits actorCreateUnits = new Actor_CreateUnits(); 27 | Unit[] units = Game.Scene.GetComponent().GetAll(); 28 | foreach (Unit u in units) 29 | { 30 | actorCreateUnits.Units.Add(new UnitInfo() {UnitId = u.Id, X = (int)(u.Position.X * 1000), Z = (int)(u.Position.Z * 1000) }); 31 | } 32 | MessageHelper.Broadcast(actorCreateUnits); 33 | } 34 | } 35 | catch (Exception e) 36 | { 37 | ReplyError(response, e, reply); 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/FrameSync/OneFrameMessageHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [ActorMessageHandler(AppType.Map)] 7 | public class OneFrameMessageHandler: AMActorHandler 8 | { 9 | protected override async Task Run(Unit entity, OneFrameMessage message) 10 | { 11 | Game.Scene.GetComponent().Add(message); 12 | await Task.CompletedTask; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Server/Hotfix/Module/FrameSync/R2G_GetLoginKeyHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Gate)] 7 | public class R2G_GetLoginKeyHandler : AMRpcHandler 8 | { 9 | protected override void Run(Session session, R2G_GetLoginKey message, Action reply) 10 | { 11 | G2R_GetLoginKey response = new G2R_GetLoginKey(); 12 | try 13 | { 14 | long key = RandomHelper.RandInt64(); 15 | Game.Scene.GetComponent().Add(key, message.Account); 16 | response.Key = key; 17 | reply(response); 18 | } 19 | catch (Exception e) 20 | { 21 | ReplyError(response, e, reply); 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/FrameSync/RealmGateAddressComponentSystem.cs: -------------------------------------------------------------------------------- 1 | using ETModel; 2 | 3 | namespace ETHotfix 4 | { 5 | [ObjectSystem] 6 | public class RealmGateAddressComponentSystem : StartSystem 7 | { 8 | public override void Start(RealmGateAddressComponent self) 9 | { 10 | self.Start(); 11 | } 12 | } 13 | 14 | public static class RealmGateAddressComponentEx 15 | { 16 | public static void Start(this RealmGateAddressComponent component) 17 | { 18 | StartConfig[] startConfigs = component.Entity.GetComponent().GetAll(); 19 | foreach (StartConfig config in startConfigs) 20 | { 21 | if (!config.AppType.Is(AppType.Gate)) 22 | { 23 | continue; 24 | } 25 | 26 | component.GateAddress.Add(config); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Server/Hotfix/Module/Http/HttpTest.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using ETModel; 3 | using System.Threading.Tasks; 4 | 5 | namespace ETHotfix 6 | { 7 | [HttpHandler(AppType.Gate, "/")] 8 | public class HttpTest : AHttpHandler 9 | { 10 | [Get] // url-> /Login?name=11&age=1111 11 | public string Login(string name, int age, HttpListenerRequest req, HttpListenerResponse resp) 12 | { 13 | Log.Info(name); 14 | Log.Info($"{age}"); 15 | return "ok"; 16 | } 17 | 18 | [Get("t")] // url-> /t 19 | public int Test() 20 | { 21 | System.Console.WriteLine(""); 22 | return 1; 23 | } 24 | 25 | [Post] // url-> /Test1 26 | public int Test1(HttpListenerRequest req) 27 | { 28 | return 1; 29 | } 30 | 31 | [Get] // url-> /Test2 32 | public int Test2(HttpListenerResponse resp) 33 | { 34 | return 1; 35 | } 36 | 37 | [Get] // url-> /GetRechargeRecord 38 | public async Task GetRechargeRecord(long id) 39 | { 40 | // var db = Game.Scene.GetComponent(); 41 | 42 | // var info = await db.Query(id); 43 | 44 | await Task.Delay(1000); // 用于测试 45 | 46 | object info = null; 47 | if (info != null) 48 | { 49 | return Ok(data: info); 50 | } 51 | else 52 | { 53 | return Error("ID不存在!"); 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/Location/ObjectAddRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Location)] 7 | public class ObjectAddRequestHandler : AMRpcHandler 8 | { 9 | protected override void Run(Session session, ObjectAddRequest message, Action reply) 10 | { 11 | ObjectAddResponse response = new ObjectAddResponse(); 12 | try 13 | { 14 | Game.Scene.GetComponent().Add(message.Key, message.AppId); 15 | reply(response); 16 | } 17 | catch (Exception e) 18 | { 19 | ReplyError(response, e, reply); 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/Location/ObjectGetRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Location)] 7 | public class ObjectGetRequestHandler : AMRpcHandler 8 | { 9 | protected override async void Run(Session session, ObjectGetRequest message, Action reply) 10 | { 11 | ObjectGetResponse response = new ObjectGetResponse(); 12 | try 13 | { 14 | int appId = await Game.Scene.GetComponent().GetAsync(message.Key); 15 | if (appId == 0) 16 | { 17 | response.Error = ErrorCode.ERR_ActorLocationNotFound; 18 | } 19 | response.AppId = appId; 20 | reply(response); 21 | } 22 | catch (Exception e) 23 | { 24 | ReplyError(response, e, reply); 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/Location/ObjectLockRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Location)] 7 | public class ObjectLockRequestHandler : AMRpcHandler 8 | { 9 | protected override void Run(Session session, ObjectLockRequest message, Action reply) 10 | { 11 | ObjectLockResponse response = new ObjectLockResponse(); 12 | try 13 | { 14 | Game.Scene.GetComponent().LockAsync(message.Key, message.LockAppId, message.Time); 15 | reply(response); 16 | } 17 | catch (Exception e) 18 | { 19 | ReplyError(response, e, reply); 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/Location/ObjectRemoveRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Location)] 7 | public class ObjectRemoveRequestHandler : AMRpcHandler 8 | { 9 | protected override void Run(Session session, ObjectRemoveRequest message, Action reply) 10 | { 11 | ObjectRemoveResponse response = new ObjectRemoveResponse(); 12 | try 13 | { 14 | Game.Scene.GetComponent().Remove(message.Key); 15 | reply(response); 16 | } 17 | catch (Exception e) 18 | { 19 | ReplyError(response, e, reply); 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/Location/ObjectUnLockRequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | [MessageHandler(AppType.Location)] 7 | public class ObjectUnLockRequestHandler : AMRpcHandler 8 | { 9 | protected override void Run(Session session, ObjectUnLockRequest message, Action reply) 10 | { 11 | ObjectUnLockResponse response = new ObjectUnLockResponse(); 12 | try 13 | { 14 | Game.Scene.GetComponent().UpdateAndUnLock(message.Key, message.UnLockAppId, message.AppId); 15 | reply(response); 16 | } 17 | catch (Exception e) 18 | { 19 | ReplyError(response, e, reply); 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Server/Hotfix/Module/Message/InnerMessageDispatcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ETModel; 3 | 4 | namespace ETHotfix 5 | { 6 | public class InnerMessageDispatcher: IMessageDispatcher 7 | { 8 | public void Dispatch(Session session, Packet packet) 9 | { 10 | ushort opcode = packet.Opcode(); 11 | Type messageType = Game.Scene.GetComponent().GetType(opcode); 12 | IMessage message = (IMessage)session.Network.MessagePacker.DeserializeFrom(messageType, packet.Bytes, Packet.Index, packet.Length - Packet.Index); 13 | 14 | // 收到actor消息,放入actor队列 15 | if (message is IActorMessage iActorMessage) 16 | { 17 | Entity entity = Game.Scene.GetComponent().Get(iActorMessage.ActorId); 18 | if (entity == null) 19 | { 20 | Log.Warning($"not found actor: {iActorMessage.ActorId}"); 21 | ActorResponse response = new ActorResponse 22 | { 23 | Error = ErrorCode.ERR_NotFoundActor, 24 | RpcId = iActorMessage.RpcId 25 | }; 26 | session.Reply(response); 27 | return; 28 | } 29 | 30 | entity.GetComponent().Add(new ActorMessageInfo() { Session = session, Message = iActorMessage }); 31 | return; 32 | } 33 | 34 | Game.Scene.GetComponent().Handle(session, new MessageInfo(opcode, message)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Server/Hotfix/Server.Hotfix.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | Hotfix 6 | ETHotfix 7 | 8 | 9 | 10 | false 11 | 12 | 13 | 14 | TRACE;DEBUG;NETCOREAPP2_0;SERVER 15 | ..\..\Bin\ 16 | 17 | 18 | 19 | TRACE;RELEASE;NETCOREAPP2_0;SERVER 20 | ..\..\Bin\ 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Server/Model/Base/Event/EnvKey.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | /// 4 | /// 一般使用事件名+变量名 5 | /// 6 | public enum EnvKey 7 | { 8 | ChannelError 9 | } 10 | } -------------------------------------------------------------------------------- /Server/Model/Base/Event/EventAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 6 | public class EventAttribute: Attribute 7 | { 8 | public string Type { get; private set; } 9 | 10 | public EventAttribute(string type) 11 | { 12 | this.Type = type; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Server/Model/Base/Event/EventIdType.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public static class EventIdType 4 | { 5 | public const string NumbericChange = "NumbericChange"; 6 | } 7 | } -------------------------------------------------------------------------------- /Server/Model/Base/Helper/DllHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Reflection; 5 | 6 | namespace ETModel 7 | { 8 | public static class DllHelper 9 | { 10 | public static Assembly GetHotfixAssembly() 11 | { 12 | byte[] dllBytes = File.ReadAllBytes("./Hotfix.dll"); 13 | #if __MonoCS__ 14 | byte[] pdbBytes = File.ReadAllBytes("./Hotfix.dll.mdb"); 15 | #else 16 | byte[] pdbBytes = File.ReadAllBytes("./Hotfix.pdb"); 17 | #endif 18 | Assembly assembly = Assembly.Load(dllBytes, pdbBytes); 19 | return assembly; 20 | } 21 | 22 | public static Type[] GetMonoTypes() 23 | { 24 | List types = new List(); 25 | foreach (Assembly assembly in Game.EventSystem.GetAll()) 26 | { 27 | types.AddRange(assembly.GetTypes()); 28 | } 29 | return types.ToArray(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Server/Model/Base/Helper/EnumHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public static class EnumHelper 6 | { 7 | public static int EnumIndex(int value) 8 | { 9 | int i = 0; 10 | foreach (object v in Enum.GetValues(typeof (T))) 11 | { 12 | if ((int) v == value) 13 | { 14 | return i; 15 | } 16 | ++i; 17 | } 18 | return -1; 19 | } 20 | 21 | public static T FromString(string str) 22 | { 23 | if (!Enum.IsDefined(typeof(T), str)) 24 | { 25 | return default(T); 26 | } 27 | return (T)Enum.Parse(typeof(T), str); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Server/Model/Base/Helper/IdGenerater.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public static class IdGenerater 4 | { 5 | public static long AppId { private get; set; } 6 | 7 | private static ushort value; 8 | 9 | public static long GenerateId() 10 | { 11 | long time = TimeHelper.ClientNowSeconds(); 12 | 13 | return (AppId << 48) + (time << 16) + ++value; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Server/Model/Base/Helper/JsonHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public static class JsonHelper 6 | { 7 | public static string ToJson(object obj) 8 | { 9 | return MongoHelper.ToJson(obj); 10 | } 11 | 12 | public static T FromJson(string str) 13 | { 14 | return MongoHelper.FromJson(str); 15 | } 16 | 17 | public static object FromJson(Type type, string str) 18 | { 19 | return MongoHelper.FromJson(type, str); 20 | } 21 | 22 | public static T Clone(T t) 23 | { 24 | return FromJson(ToJson(t)); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Server/Model/Base/Helper/MD5Helper.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Security.Cryptography; 3 | 4 | namespace ETModel 5 | { 6 | public static class MD5Helper 7 | { 8 | public static string FileMD5(string filePath) 9 | { 10 | byte[] retVal; 11 | using (FileStream file = new FileStream(filePath, FileMode.Open)) 12 | { 13 | MD5 md5 = new MD5CryptoServiceProvider(); 14 | retVal = md5.ComputeHash(file); 15 | } 16 | return retVal.ToHex("x2"); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Server/Model/Base/Helper/MethodInfoHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace ETModel 4 | { 5 | public static class MethodInfoHelper 6 | { 7 | public static void Run(this MethodInfo methodInfo, object obj, params object[] param) 8 | { 9 | 10 | if (methodInfo.IsStatic) 11 | { 12 | object[] p = new object[param.Length + 1]; 13 | p[0] = obj; 14 | for (int i = 0; i < param.Length; ++i) 15 | { 16 | p[i + 1] = param[i]; 17 | } 18 | methodInfo.Invoke(null, p); 19 | } 20 | else 21 | { 22 | methodInfo.Invoke(obj, param); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Server/Model/Base/Helper/NetHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Net; 3 | 4 | namespace ETModel 5 | { 6 | public static class NetHelper 7 | { 8 | public static string[] GetAddressIPs() 9 | { 10 | //获取本地的IP地址 11 | List addressIPs = new List(); 12 | foreach (IPAddress address in Dns.GetHostEntry(Dns.GetHostName()).AddressList) 13 | { 14 | if (address.AddressFamily.ToString() == "InterNetwork") 15 | { 16 | addressIPs.Add(address.ToString()); 17 | } 18 | } 19 | return addressIPs.ToArray(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Server/Model/Base/Helper/ObjectHelper.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public static class ObjectHelper 4 | { 5 | public static void Swap(ref T t1, ref T t2) 6 | { 7 | T t3 = t1; 8 | t1 = t2; 9 | t2 = t3; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Server/Model/Base/Helper/RandomHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public static class RandomHelper 6 | { 7 | private static readonly Random random = new Random(); 8 | 9 | public static UInt64 RandUInt64() 10 | { 11 | var bytes = new byte[8]; 12 | random.NextBytes(bytes); 13 | return BitConverter.ToUInt64(bytes, 0); 14 | } 15 | 16 | public static Int64 RandInt64() 17 | { 18 | var bytes = new byte[8]; 19 | random.NextBytes(bytes); 20 | return BitConverter.ToInt64(bytes, 0); 21 | } 22 | 23 | /// 24 | /// 获取lower与Upper之间的随机数 25 | /// 26 | /// 27 | /// 28 | /// 29 | public static int RandomNumber(int lower, int upper) 30 | { 31 | int value = random.Next(lower, upper); 32 | return value; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Server/Model/Base/Helper/TimeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public static class TimeHelper 6 | { 7 | private static readonly long epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks; 8 | /// 9 | /// 客户端时间 10 | /// 11 | /// 12 | public static long ClientNow() 13 | { 14 | return (DateTime.UtcNow.Ticks - epoch) / 10000; 15 | } 16 | 17 | public static long ClientNowSeconds() 18 | { 19 | return (DateTime.UtcNow.Ticks - epoch) / 10000000; 20 | } 21 | 22 | /// 23 | /// 登陆前是客户端时间,登陆后是同步过的服务器时间 24 | /// 25 | /// 26 | public static long Now() 27 | { 28 | return ClientNow(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Server/Model/Base/Log.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public static class Log 6 | { 7 | private static readonly ILog globalLog = new NLogAdapter(); 8 | 9 | public static void Trace(string message) 10 | { 11 | globalLog.Trace(message); 12 | } 13 | 14 | public static void Warning(string message) 15 | { 16 | globalLog.Warning(message); 17 | } 18 | 19 | public static void Info(string message) 20 | { 21 | globalLog.Info(message); 22 | } 23 | 24 | public static void Debug(string message) 25 | { 26 | globalLog.Debug(message); 27 | } 28 | 29 | public static void Error(Exception e) 30 | { 31 | globalLog.Error(e.ToString()); 32 | } 33 | 34 | public static void Error(string message) 35 | { 36 | globalLog.Error(message); 37 | } 38 | 39 | public static void Fatal(Exception e) 40 | { 41 | globalLog.Fatal(e.ToString()); 42 | } 43 | 44 | public static void Fatal(string message) 45 | { 46 | globalLog.Fatal(message); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Server/Model/Base/LogType.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public enum LogType 4 | { 5 | Warning, 6 | Info, 7 | Debug, 8 | Error, 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Server/Model/Base/Logger/ALogDecorater.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public abstract class ALogDecorater 4 | { 5 | protected const string SEP = " "; 6 | private int level; 7 | protected readonly ALogDecorater decorater; 8 | 9 | protected ALogDecorater(ALogDecorater decorater = null) 10 | { 11 | this.decorater = decorater; 12 | this.Level = 0; 13 | } 14 | 15 | protected int Level 16 | { 17 | get 18 | { 19 | return this.level; 20 | } 21 | set 22 | { 23 | this.level = value; 24 | if (this.decorater != null) 25 | { 26 | this.decorater.Level = value + 1; 27 | } 28 | } 29 | } 30 | 31 | public virtual string Decorate(string message) 32 | { 33 | if (this.decorater == null) 34 | { 35 | return message; 36 | } 37 | return this.decorater.Decorate(message); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Server/Model/Base/Logger/ILog.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public interface ILog 4 | { 5 | void Trace(string message); 6 | void Warning(string message); 7 | void Info(string message); 8 | void Debug(string message); 9 | void Error(string message); 10 | void Fatal(string message); 11 | } 12 | } -------------------------------------------------------------------------------- /Server/Model/Base/Logger/NLogAdapter.cs: -------------------------------------------------------------------------------- 1 | using NLog; 2 | 3 | namespace ETModel 4 | { 5 | public class NLogAdapter: ALogDecorater, ILog 6 | { 7 | private readonly Logger logger = LogManager.GetLogger("Logger"); 8 | 9 | public NLogAdapter(ALogDecorater decorater = null): base(decorater) 10 | { 11 | } 12 | 13 | public void Trace(string message) 14 | { 15 | this.logger.Trace(this.Decorate(message)); 16 | } 17 | 18 | public void Warning(string message) 19 | { 20 | this.logger.Warn(this.Decorate(message)); 21 | } 22 | 23 | public void Info(string message) 24 | { 25 | this.logger.Info(this.Decorate(message)); 26 | } 27 | 28 | public void Debug(string message) 29 | { 30 | this.logger.Debug(this.Decorate(message)); 31 | } 32 | 33 | public void Error(string message) 34 | { 35 | this.logger.Error(this.Decorate(message)); 36 | } 37 | 38 | public void Fatal(string message) 39 | { 40 | this.logger.Fatal(this.Decorate(message)); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Server/Model/Base/Logger/StackInfoDecorater.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.IO; 3 | 4 | namespace ETModel 5 | { 6 | internal class StackInfoDecorater: ALogDecorater 7 | { 8 | public StackInfoDecorater(ALogDecorater decorater = null): base(decorater) 9 | { 10 | this.FileName = true; 11 | this.FileLineNumber = true; 12 | } 13 | 14 | public bool FileName { get; set; } 15 | 16 | public bool FileLineNumber { get; set; } 17 | 18 | public override string Decorate(string message) 19 | { 20 | if (this.decorater != null) 21 | { 22 | message = this.decorater.Decorate(message); 23 | } 24 | 25 | if (!this.FileLineNumber && !this.FileName) 26 | { 27 | return message; 28 | } 29 | 30 | string extraInfo = ""; 31 | StackTrace stackTrace = new StackTrace(true); 32 | StackFrame frame = stackTrace.GetFrame(this.Level + 3); 33 | 34 | if (this.FileName) 35 | { 36 | string fileName = Path.GetFileName(frame.GetFileName()); 37 | extraInfo += fileName + " "; 38 | } 39 | if (this.FileLineNumber) 40 | { 41 | int fileLineNumber = frame.GetFileLineNumber(); 42 | extraInfo += fileLineNumber + " "; 43 | } 44 | return extraInfo + message; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Server/Model/Base/Object/ComponentWithId.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using MongoDB.Bson.Serialization.Attributes; 3 | 4 | namespace ETModel 5 | { 6 | [BsonIgnoreExtraElements] 7 | public abstract partial class ComponentWithId : Component 8 | { 9 | [BsonIgnoreIfDefault] 10 | [BsonDefaultValue(0L)] 11 | [BsonElement] 12 | [BsonId] 13 | public long Id { get; set; } 14 | 15 | protected ComponentWithId() 16 | { 17 | this.Id = this.InstanceId; 18 | } 19 | 20 | protected ComponentWithId(long id) 21 | { 22 | this.Id = id; 23 | } 24 | 25 | public override void Dispose() 26 | { 27 | if (this.IsDisposed) 28 | { 29 | return; 30 | } 31 | 32 | base.Dispose(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Server/Model/Base/Object/EntityType.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public enum EntityType 4 | { 5 | None, 6 | Scene, 7 | Session, 8 | UI, 9 | Config, 10 | Unit 11 | } 12 | } -------------------------------------------------------------------------------- /Server/Model/Base/Object/IChangeSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public interface IChangeSystem 6 | { 7 | Type Type(); 8 | void Run(object o); 9 | } 10 | 11 | public abstract class ChangeSystem : IChangeSystem 12 | { 13 | public void Run(object o) 14 | { 15 | this.Change((T)o); 16 | } 17 | 18 | public Type Type() 19 | { 20 | return typeof(T); 21 | } 22 | 23 | public abstract void Change(T self); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Server/Model/Base/Object/IDestroySystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public interface IDestroySystem 6 | { 7 | Type Type(); 8 | void Run(object o); 9 | } 10 | 11 | public abstract class DestroySystem : IDestroySystem 12 | { 13 | public void Run(object o) 14 | { 15 | this.Destroy((T)o); 16 | } 17 | 18 | public Type Type() 19 | { 20 | return typeof(T); 21 | } 22 | 23 | public abstract void Destroy(T self); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Server/Model/Base/Object/ILateUpdateSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public interface ILateUpdateSystem 6 | { 7 | Type Type(); 8 | void Run(object o); 9 | } 10 | 11 | public abstract class LateUpdateSystem : ILateUpdateSystem 12 | { 13 | public void Run(object o) 14 | { 15 | this.LateUpdate((T)o); 16 | } 17 | 18 | public Type Type() 19 | { 20 | return typeof(T); 21 | } 22 | 23 | public abstract void LateUpdate(T self); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Server/Model/Base/Object/ILoadSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public interface ILoadSystem 6 | { 7 | Type Type(); 8 | void Run(object o); 9 | } 10 | 11 | public abstract class LoadSystem : ILoadSystem 12 | { 13 | public void Run(object o) 14 | { 15 | this.Load((T)o); 16 | } 17 | 18 | public Type Type() 19 | { 20 | return typeof(T); 21 | } 22 | 23 | public abstract void Load(T self); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Server/Model/Base/Object/ISerializeToEntity.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public interface ISerializeToEntity 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /Server/Model/Base/Object/IStartSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public interface IStartSystem 6 | { 7 | Type Type(); 8 | void Run(object o); 9 | } 10 | 11 | public abstract class StartSystem : IStartSystem 12 | { 13 | public void Run(object o) 14 | { 15 | this.Start((T)o); 16 | } 17 | 18 | public Type Type() 19 | { 20 | return typeof(T); 21 | } 22 | 23 | public abstract void Start(T self); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Server/Model/Base/Object/IUpdateSystem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public interface IUpdateSystem 6 | { 7 | Type Type(); 8 | void Run(object o); 9 | } 10 | 11 | public abstract class UpdateSystem : IUpdateSystem 12 | { 13 | public void Run(object o) 14 | { 15 | this.Update((T)o); 16 | } 17 | 18 | public Type Type() 19 | { 20 | return typeof(T); 21 | } 22 | 23 | public abstract void Update(T self); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Server/Model/Base/Object/Object.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace ETModel 4 | { 5 | public abstract class Object: ISupportInitialize 6 | { 7 | public virtual void BeginInit() 8 | { 9 | } 10 | 11 | public virtual void EndInit() 12 | { 13 | } 14 | 15 | public override string ToString() 16 | { 17 | return JsonHelper.ToJson(this); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Server/Model/Base/Object/ObjectPool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ETModel 5 | { 6 | public class ObjectPool 7 | { 8 | private readonly Dictionary> dictionary = new Dictionary>(); 9 | 10 | public Component Fetch(Type type) 11 | { 12 | Queue queue; 13 | if (!this.dictionary.TryGetValue(type, out queue)) 14 | { 15 | queue = new Queue(); 16 | this.dictionary.Add(type, queue); 17 | } 18 | Component obj; 19 | if (queue.Count > 0) 20 | { 21 | obj = queue.Dequeue(); 22 | obj.IsFromPool = true; 23 | return obj; 24 | } 25 | obj = (Component)Activator.CreateInstance(type); 26 | return obj; 27 | } 28 | 29 | public T Fetch() where T: Component 30 | { 31 | T t = (T) this.Fetch(typeof(T)); 32 | t.IsFromPool = true; 33 | return t; 34 | } 35 | 36 | public void Recycle(Component obj) 37 | { 38 | Type type = obj.GetType(); 39 | Queue queue; 40 | if (!this.dictionary.TryGetValue(type, out queue)) 41 | { 42 | queue = new Queue(); 43 | this.dictionary.Add(type, queue); 44 | } 45 | queue.Enqueue(obj); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Server/Model/Base/Object/ObjectSystemAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 6 | public class ObjectSystemAttribute: Attribute 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /Server/Model/Base/OneThreadSynchronizationContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Threading; 4 | 5 | namespace ETModel 6 | { 7 | public class OneThreadSynchronizationContext : SynchronizationContext 8 | { 9 | // 线程同步队列,发送接收socket回调都放到该队列,由poll线程统一执行 10 | private readonly ConcurrentQueue queue = new ConcurrentQueue(); 11 | 12 | private void Add(Action action) 13 | { 14 | this.queue.Enqueue(action); 15 | } 16 | 17 | public void Update() 18 | { 19 | while (true) 20 | { 21 | Action a; 22 | if (!this.queue.TryDequeue(out a)) 23 | { 24 | return; 25 | } 26 | a(); 27 | } 28 | } 29 | 30 | public override void Post(SendOrPostCallback callback, object state) 31 | { 32 | this.Add(() => { callback(state); }); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Server/Model/Base/QueueDictionary.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ETModel 4 | { 5 | public class QueueDictionary 6 | { 7 | private readonly List list = new List(); 8 | private readonly Dictionary dictionary = new Dictionary(); 9 | 10 | public void Enqueue(T t, K k) 11 | { 12 | this.list.Add(t); 13 | this.dictionary.Add(t, k); 14 | } 15 | 16 | public void Dequeue() 17 | { 18 | if (this.list.Count == 0) 19 | { 20 | return; 21 | } 22 | T t = this.list[0]; 23 | this.list.RemoveAt(0); 24 | this.dictionary.Remove(t); 25 | } 26 | 27 | public void Remove(T t) 28 | { 29 | this.list.Remove(t); 30 | this.dictionary.Remove(t); 31 | } 32 | 33 | public bool ContainsKey(T t) 34 | { 35 | return this.dictionary.ContainsKey(t); 36 | } 37 | 38 | public int Count 39 | { 40 | get 41 | { 42 | return this.list.Count; 43 | } 44 | } 45 | 46 | public T FirstKey 47 | { 48 | get 49 | { 50 | return this.list[0]; 51 | } 52 | } 53 | 54 | public K FirstValue 55 | { 56 | get 57 | { 58 | T t = this.list[0]; 59 | return this[t]; 60 | } 61 | } 62 | 63 | public K this[T t] 64 | { 65 | get 66 | { 67 | return this.dictionary[t]; 68 | } 69 | } 70 | 71 | public void Clear() 72 | { 73 | this.list.Clear(); 74 | this.dictionary.Clear(); 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /Server/Model/Base/TryLocker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace ETModel 5 | { 6 | public class TryLock : IDisposable 7 | { 8 | private object locked; 9 | 10 | public bool HasLock { get; private set; } 11 | 12 | public TryLock(object obj) 13 | { 14 | if (!Monitor.TryEnter(obj)) 15 | { 16 | return; 17 | } 18 | 19 | this.HasLock = true; 20 | this.locked = obj; 21 | } 22 | 23 | public void Dispose() 24 | { 25 | if (!this.HasLock) 26 | { 27 | return; 28 | } 29 | 30 | Monitor.Exit(this.locked); 31 | this.locked = null; 32 | this.HasLock = false; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Server/Model/Component/Config/ClientConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using MongoDB.Bson.Serialization.Attributes; 3 | 4 | namespace ETModel 5 | { 6 | public class ClientConfig: AConfigComponent 7 | { 8 | public string Host = ""; 9 | public int Port; 10 | 11 | [BsonIgnore] 12 | private IPEndPoint ipEndPoint; 13 | 14 | public override void EndInit() 15 | { 16 | base.EndInit(); 17 | 18 | this.ipEndPoint = NetworkHelper.ToIPEndPoint(this.Host, this.Port); 19 | } 20 | 21 | [BsonIgnore] 22 | public IPEndPoint IPEndPoint 23 | { 24 | get 25 | { 26 | return this.ipEndPoint; 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Server/Model/Component/Config/DBConfig.cs: -------------------------------------------------------------------------------- 1 | using MongoDB.Bson.Serialization.Attributes; 2 | 3 | namespace ETModel 4 | { 5 | [BsonIgnoreExtraElements] 6 | public class DBConfig : AConfigComponent 7 | { 8 | public string ConnectionString { get; set; } 9 | public string DBName { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /Server/Model/Component/Config/HttpConfig.cs: -------------------------------------------------------------------------------- 1 | using MongoDB.Bson.Serialization.Attributes; 2 | 3 | namespace ETModel 4 | { 5 | [BsonIgnoreExtraElements] 6 | public class HttpConfig: AConfigComponent 7 | { 8 | public string Url { get; set; } = ""; 9 | public int AppId { get; set; } 10 | public string AppKey { get; set; } = ""; 11 | public string ManagerSystemUrl { get; set; } = ""; 12 | } 13 | } -------------------------------------------------------------------------------- /Server/Model/Component/Config/InnerConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using MongoDB.Bson.Serialization.Attributes; 3 | 4 | namespace ETModel 5 | { 6 | [BsonIgnoreExtraElements] 7 | public class InnerConfig: AConfigComponent 8 | { 9 | public string Host { get; set; } 10 | public int Port { get; set; } 11 | 12 | [BsonIgnore] 13 | private IPEndPoint ipEndPoint; 14 | 15 | public override void EndInit() 16 | { 17 | base.EndInit(); 18 | 19 | this.ipEndPoint = NetworkHelper.ToIPEndPoint(this.Host, this.Port); 20 | } 21 | 22 | [BsonIgnore] 23 | public IPEndPoint IPEndPoint 24 | { 25 | get 26 | { 27 | return this.ipEndPoint; 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Server/Model/Component/Config/OuterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using MongoDB.Bson.Serialization.Attributes; 3 | 4 | namespace ETModel 5 | { 6 | [BsonIgnoreExtraElements] 7 | public class OuterConfig: AConfigComponent 8 | { 9 | public string Host { get; set; } 10 | public int Port { get; set; } 11 | 12 | public string Host2 { get; set; } 13 | 14 | [BsonIgnore] 15 | private IPEndPoint ipEndPoint; 16 | 17 | [BsonIgnore] 18 | private IPEndPoint ipEndPoint2; 19 | 20 | public override void EndInit() 21 | { 22 | base.EndInit(); 23 | 24 | if (this.Host2 == null) 25 | { 26 | this.Host2 = this.Host; 27 | } 28 | 29 | this.ipEndPoint = NetworkHelper.ToIPEndPoint(this.Host, this.Port); 30 | this.ipEndPoint2 = NetworkHelper.ToIPEndPoint(this.Host2, this.Port); 31 | } 32 | 33 | [BsonIgnore] 34 | public IPEndPoint IPEndPoint 35 | { 36 | get 37 | { 38 | return this.ipEndPoint; 39 | } 40 | } 41 | 42 | [BsonIgnore] 43 | public IPEndPoint IPEndPoint2 44 | { 45 | get 46 | { 47 | return this.ipEndPoint2; 48 | } 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Server/Model/Component/KVComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using MongoDB.Bson.Serialization.Attributes; 3 | 4 | namespace ETModel 5 | { 6 | /// 7 | /// Key Value组件用于保存一些数据 8 | /// 9 | public class KVComponent: Component 10 | { 11 | [BsonElement] 12 | private readonly Dictionary kv = new Dictionary(); 13 | 14 | public void Add(string key, object value) 15 | { 16 | this.kv.Add(key, value); 17 | } 18 | 19 | public void Remove(string key) 20 | { 21 | this.kv.Remove(key); 22 | } 23 | 24 | public T Get(string key) 25 | { 26 | if (!this.kv.TryGetValue(key, out object k)) 27 | { 28 | return default(T); 29 | } 30 | return (T) k; 31 | } 32 | 33 | public override void Dispose() 34 | { 35 | if (this.IsDisposed) 36 | { 37 | return; 38 | } 39 | 40 | base.Dispose(); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Server/Model/Component/OptionComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using CommandLine; 3 | 4 | namespace ETModel 5 | { 6 | [ObjectSystem] 7 | public class OptionComponentSystem : AwakeSystem 8 | { 9 | public override void Awake(OptionComponent self, string[] a) 10 | { 11 | self.Awake(a); 12 | } 13 | } 14 | 15 | public class OptionComponent : Component 16 | { 17 | public Options Options { get; set; } 18 | 19 | public void Awake(string[] args) 20 | { 21 | Parser.Default.ParseArguments(args) 22 | .WithNotParsed(error => throw new Exception($"命令行格式错误!")) 23 | .WithParsed(options => { Options = options; }); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Server/Model/Component/RobotComponent.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public class RobotComponent: Component 4 | { 5 | public override void Dispose() 6 | { 7 | if (this.IsDisposed) 8 | { 9 | return; 10 | } 11 | 12 | base.Dispose(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Server/Model/Entity/Config/StartConfig.cs: -------------------------------------------------------------------------------- 1 | using MongoDB.Bson; 2 | using MongoDB.Bson.Serialization.Attributes; 3 | 4 | namespace ETModel 5 | { 6 | public class StartConfig: Entity 7 | { 8 | public int AppId { get; set; } 9 | 10 | [BsonRepresentation(BsonType.String)] 11 | public AppType AppType { get; set; } 12 | 13 | public string ServerIP { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Server/Model/Entity/Game.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public static class Game 4 | { 5 | private static Scene scene; 6 | 7 | public static Scene Scene 8 | { 9 | get 10 | { 11 | if (scene != null) 12 | { 13 | return scene; 14 | } 15 | scene = new Scene(); 16 | scene.AddComponent(); 17 | return scene; 18 | } 19 | } 20 | 21 | private static EventSystem eventSystem; 22 | 23 | public static EventSystem EventSystem 24 | { 25 | get 26 | { 27 | return eventSystem ?? (eventSystem = new EventSystem()); 28 | } 29 | } 30 | 31 | private static ObjectPool objectPool; 32 | 33 | public static ObjectPool ObjectPool 34 | { 35 | get 36 | { 37 | return objectPool ?? (objectPool = new ObjectPool()); 38 | } 39 | } 40 | 41 | public static void Close() 42 | { 43 | scene.Dispose(); 44 | scene = null; 45 | eventSystem = null; 46 | objectPool = null; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Server/Model/Entity/Http.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | // 充值流水 4 | public sealed class RechargeRecord : Entity 5 | { 6 | // 充值玩家 7 | public int PlayerNO { get; set; } 8 | 9 | // 充值数量 10 | public int CardNumber { get; set; } 11 | 12 | // 充值时间 13 | public long Time { get; set; } 14 | 15 | public RechargeRecord() : base() 16 | { 17 | } 18 | 19 | public RechargeRecord(long id) : base(id) 20 | { 21 | } 22 | } 23 | 24 | // 保存玩家充值记录, 每个玩家只有一条 25 | public sealed class Recharge : Entity 26 | { 27 | public int CardNumber { get; set; } 28 | 29 | public long UpdateTime { get; set; } 30 | 31 | public Recharge() : base() 32 | { 33 | } 34 | 35 | public Recharge(long id) : base(id) 36 | { 37 | } 38 | } 39 | 40 | public class HttpResult 41 | { 42 | public int code; 43 | public bool status; 44 | public string msg = ""; 45 | [MongoDB.Bson.Serialization.Attributes.BsonIgnoreIfNull] 46 | public object data; 47 | } 48 | 49 | public static class HttpErrorCode 50 | { 51 | public const int Exception = 999; 52 | public const int Success = 1000; 53 | public const int RpcFail = 1002; 54 | } 55 | } -------------------------------------------------------------------------------- /Server/Model/Entity/Scene.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public enum SceneType 4 | { 5 | Share, 6 | Game, 7 | Login, 8 | Lobby, 9 | Map, 10 | Launcher, 11 | Robot, 12 | BehaviorTreeScene, 13 | RobotClient, 14 | 15 | Realm 16 | } 17 | 18 | public sealed class Scene: Entity 19 | { 20 | public string Name { get; set; } 21 | 22 | public SceneType SceneType { get; private set; } 23 | 24 | public Scene() 25 | { 26 | } 27 | 28 | public Scene(long id): base(id) 29 | { 30 | } 31 | 32 | public override void Dispose() 33 | { 34 | if (this.IsDisposed) 35 | { 36 | return; 37 | } 38 | 39 | base.Dispose(); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Server/Model/Entity/Unit.cs: -------------------------------------------------------------------------------- 1 | using System.Numerics; 2 | using MongoDB.Bson.Serialization.Attributes; 3 | 4 | namespace ETModel 5 | { 6 | public enum UnitType 7 | { 8 | Hero, 9 | Npc 10 | } 11 | 12 | [ObjectSystem] 13 | public class UnitSystem : AwakeSystem 14 | { 15 | public override void Awake(Unit self, UnitType a) 16 | { 17 | self.Awake(a); 18 | } 19 | } 20 | 21 | public sealed class Unit: Entity 22 | { 23 | public UnitType UnitType { get; private set; } 24 | 25 | [BsonIgnore] 26 | public Vector3 Position { get; set; } 27 | 28 | public void Awake(UnitType unitType) 29 | { 30 | this.UnitType = unitType; 31 | } 32 | 33 | public override void Dispose() 34 | { 35 | if (this.IsDisposed) 36 | { 37 | return; 38 | } 39 | 40 | base.Dispose(); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Server/Model/Module/Actor/ActorComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | 4 | namespace ETModel 5 | { 6 | public struct ActorMessageInfo 7 | { 8 | public Session Session; 9 | public IActorMessage Message; 10 | } 11 | 12 | /// 13 | /// 挂上这个组件表示该Entity是一个Actor, 它会将Entity位置注册到Location Server, 接收的消息将会队列处理 14 | /// 15 | public class ActorComponent: Component 16 | { 17 | public string ActorType; 18 | 19 | // 队列处理消息 20 | public Queue Queue = new Queue(); 21 | 22 | public TaskCompletionSource Tcs; 23 | 24 | public override void Dispose() 25 | { 26 | if (this.IsDisposed) 27 | { 28 | return; 29 | } 30 | 31 | base.Dispose(); 32 | 33 | var t = this.Tcs; 34 | this.Tcs = null; 35 | t?.SetResult(new ActorMessageInfo()); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Server/Model/Module/Actor/ActorManagerComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ETModel 4 | { 5 | /// 6 | /// 用来管理该服务器上所有的Actor对象 7 | /// 8 | public class ActorManagerComponent : Component 9 | { 10 | private readonly Dictionary dictionary = new Dictionary(); 11 | 12 | public void Add(Entity entity) 13 | { 14 | Log.Info($"add actor: {entity.Id} {entity.GetType().Name}"); 15 | dictionary[entity.Id] = entity; 16 | } 17 | 18 | public void Remove(long id) 19 | { 20 | Entity entity; 21 | if (!this.dictionary.TryGetValue(id, out entity)) 22 | { 23 | return; 24 | } 25 | Log.Info($"remove actor: {entity.Id} {entity.GetType().Name}"); 26 | this.dictionary.Remove(id); 27 | } 28 | 29 | public Entity Get(long id) 30 | { 31 | Entity entity = null; 32 | this.dictionary.TryGetValue(id, out entity); 33 | return entity; 34 | } 35 | 36 | public override void Dispose() 37 | { 38 | if (this.IsDisposed) 39 | { 40 | return; 41 | } 42 | 43 | base.Dispose(); 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /Server/Model/Module/Actor/ActorMessageAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public class ActorMessageAttribute : Attribute 6 | { 7 | public ushort Opcode { get; private set; } 8 | 9 | public ActorMessageAttribute(ushort opcode) 10 | { 11 | this.Opcode = opcode; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Server/Model/Module/Actor/ActorMessageDispatherComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ETModel 5 | { 6 | /// 7 | /// Actor消息分发组件 8 | /// 9 | public class ActorMessageDispatherComponent : Component 10 | { 11 | public readonly Dictionary ActorTypeHandlers = new Dictionary(); 12 | 13 | public readonly Dictionary ActorMessageHandlers = new Dictionary(); 14 | 15 | public override void Dispose() 16 | { 17 | if (this.IsDisposed) 18 | { 19 | return; 20 | } 21 | base.Dispose(); 22 | 23 | this.ActorMessageHandlers.Clear(); 24 | this.ActorTypeHandlers.Clear(); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Server/Model/Module/Actor/ActorMessageHandlerAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public class ActorMessageHandlerAttribute : Attribute 6 | { 7 | public AppType Type { get; } 8 | 9 | public ActorMessageHandlerAttribute(AppType appType) 10 | { 11 | this.Type = appType; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Server/Model/Module/Actor/ActorResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ProtoBuf; 4 | 5 | namespace ETModel 6 | { 7 | /// 8 | /// actor RPC消息响应 9 | /// 10 | [Message(Opcode.ActorResponse)] 11 | [ProtoContract] 12 | public class ActorResponse : IActorResponse 13 | { 14 | [ProtoMember(90, IsRequired = true)] 15 | public int RpcId { get; set; } 16 | 17 | [ProtoMember(91, IsRequired = true)] 18 | public int Error { get; set; } 19 | 20 | [ProtoMember(92, IsRequired = true)] 21 | public string Message { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Server/Model/Module/Actor/ActorTask.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace ETModel 4 | { 5 | public struct ActorTask 6 | { 7 | public ActorProxy proxy; 8 | 9 | public IActorMessage message; 10 | 11 | public TaskCompletionSource Tcs; 12 | 13 | public async Task Run() 14 | { 15 | Session session = Game.Scene.GetComponent().Get(this.proxy.Address); 16 | 17 | this.message.ActorId = this.proxy.Id; 18 | IResponse response = await session.Call(message, this.proxy.CancellationTokenSource.Token); 19 | 20 | if (response.Error != ErrorCode.ERR_NotFoundActor) 21 | { 22 | if (this.Tcs != null) 23 | { 24 | this.Tcs?.SetResult(response); 25 | } 26 | } 27 | return response; 28 | } 29 | 30 | public void RunFail(int error) 31 | { 32 | this.Tcs?.SetException(new RpcException(error, "")); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Server/Model/Module/Actor/ActorType.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public static partial class ActorType 4 | { 5 | public const string Common = "Common"; 6 | public const string GateSession = "GateSession"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Server/Model/Module/Actor/ActorTypeHandlerAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public class ActorTypeHandlerAttribute : Attribute 6 | { 7 | public AppType Type { get; } 8 | 9 | public string ActorType { get; } 10 | 11 | public ActorTypeHandlerAttribute(AppType appType, string actorType) 12 | { 13 | this.Type = appType; 14 | this.ActorType = actorType; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Server/Model/Module/Actor/IActorTypeHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace ETModel 4 | { 5 | public interface IActorTypeHandler 6 | { 7 | Task Handle(Session session, Entity entity, IActorMessage actorMessage); 8 | } 9 | } -------------------------------------------------------------------------------- /Server/Model/Module/Actor/IMActorHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace ETModel 5 | { 6 | public interface IMActorHandler 7 | { 8 | Task Handle(Session session, Entity entity, IActorMessage actorRequest); 9 | Type GetMessageType(); 10 | } 11 | } -------------------------------------------------------------------------------- /Server/Model/Module/Config/AConfigComponent.cs: -------------------------------------------------------------------------------- 1 | using MongoDB.Bson.Serialization.Attributes; 2 | 3 | namespace ETModel 4 | { 5 | /// 6 | /// 每个Config的基类 7 | /// 8 | [BsonKnownTypes(typeof (ClientConfig))] 9 | [BsonKnownTypes(typeof (InnerConfig))] 10 | [BsonKnownTypes(typeof (OuterConfig))] 11 | [BsonKnownTypes(typeof (HttpConfig))] 12 | [BsonKnownTypes(typeof (DBConfig))] 13 | public abstract class AConfigComponent: Component, ISerializeToEntity 14 | { 15 | } 16 | } -------------------------------------------------------------------------------- /Server/Model/Module/Config/ConfigAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | [AttributeUsage(AttributeTargets.Class)] 6 | public class ConfigAttribute: Attribute 7 | { 8 | public AppType Type { get; } 9 | 10 | public ConfigAttribute(AppType type) 11 | { 12 | this.Type = type; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Server/Model/Module/Config/ConfigHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace ETModel 5 | { 6 | public static class ConfigHelper 7 | { 8 | public static string GetText(string key) 9 | { 10 | string path = $"../Config/{key}.txt"; 11 | try 12 | { 13 | string configStr = File.ReadAllText(path); 14 | return configStr; 15 | } 16 | catch (Exception e) 17 | { 18 | throw new Exception($"load config file fail, path: {path} {e}"); 19 | } 20 | } 21 | 22 | public static T ToObject(string str) 23 | { 24 | return MongoHelper.FromJson(str); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Server/Model/Module/Config/IConfig.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | /// 4 | /// 每个Config的基类 5 | /// 6 | public interface IConfig 7 | { 8 | long Id { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /Server/Model/Module/DB/DBComponent.cs: -------------------------------------------------------------------------------- 1 | using MongoDB.Driver; 2 | 3 | namespace ETModel 4 | { 5 | [ObjectSystem] 6 | public class DbComponentSystem : AwakeSystem 7 | { 8 | public override void Awake(DBComponent self) 9 | { 10 | self.Awake(); 11 | } 12 | } 13 | 14 | /// 15 | /// 连接mongodb 16 | /// 17 | public class DBComponent : Component 18 | { 19 | public MongoClient mongoClient; 20 | public IMongoDatabase database; 21 | 22 | public void Awake() 23 | { 24 | //DBConfig config = Game.Scene.GetComponent().StartConfig.GetComponent(); 25 | //string connectionString = config.ConnectionString; 26 | //mongoClient = new MongoClient(connectionString); 27 | //this.database = this.mongoClient.GetDatabase(config.DBName); 28 | } 29 | 30 | public IMongoCollection GetCollection(string name) 31 | { 32 | return this.database.GetCollection(name); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Server/Model/Module/DB/DBSaveTask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using MongoDB.Driver; 4 | 5 | namespace ETModel 6 | { 7 | 8 | [ObjectSystem] 9 | public class DbSaveTaskAwakeSystem : AwakeSystem> 10 | { 11 | public override void Awake(DBSaveTask self, ComponentWithId component, string collectionName, TaskCompletionSource tcs) 12 | { 13 | self.Component = component; 14 | self.CollectionName = collectionName; 15 | self.Tcs = tcs; 16 | } 17 | } 18 | 19 | public sealed class DBSaveTask : DBTask 20 | { 21 | public ComponentWithId Component; 22 | 23 | public string CollectionName { get; set; } 24 | 25 | public TaskCompletionSource Tcs; 26 | 27 | public override async Task Run() 28 | { 29 | DBComponent dbComponent = Game.Scene.GetComponent(); 30 | 31 | try 32 | { 33 | // 执行保存数据库任务 34 | await dbComponent.GetCollection(this.CollectionName).ReplaceOneAsync(s => s.Id == this.Component.Id, this.Component, new UpdateOptions {IsUpsert = true}); 35 | this.Tcs.SetResult(true); 36 | } 37 | catch (Exception e) 38 | { 39 | this.Tcs.SetException(new Exception($"保存数据失败! {CollectionName} {Id}", e)); 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Server/Model/Module/DB/DBTask.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace ETModel 4 | { 5 | public abstract class DBTask : ComponentWithId 6 | { 7 | public abstract Task Run(); 8 | } 9 | } -------------------------------------------------------------------------------- /Server/Model/Module/FrameSync/GateSessionKeyComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ETModel 4 | { 5 | public class GateSessionKeyComponent : Component 6 | { 7 | private readonly Dictionary sessionKey = new Dictionary(); 8 | 9 | public void Add(long key, string account) 10 | { 11 | this.sessionKey.Add(key, account); 12 | this.TimeoutRemoveKey(key); 13 | } 14 | 15 | public string Get(long key) 16 | { 17 | string account = null; 18 | this.sessionKey.TryGetValue(key, out account); 19 | return account; 20 | } 21 | 22 | public void Remove(long key) 23 | { 24 | this.sessionKey.Remove(key); 25 | } 26 | 27 | private async void TimeoutRemoveKey(long key) 28 | { 29 | await Game.Scene.GetComponent().WaitAsync(20000); 30 | this.sessionKey.Remove(key); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Server/Model/Module/FrameSync/Player.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | [ObjectSystem] 4 | public class PlayerSystem : AwakeSystem 5 | { 6 | public override void Awake(Player self, string a) 7 | { 8 | self.Awake(a); 9 | } 10 | } 11 | 12 | public sealed class Player : Entity 13 | { 14 | public string Account { get; private set; } 15 | 16 | public long UnitId { get; set; } 17 | 18 | public void Awake(string account) 19 | { 20 | this.Account = account; 21 | } 22 | 23 | public override void Dispose() 24 | { 25 | if (this.IsDisposed) 26 | { 27 | return; 28 | } 29 | 30 | base.Dispose(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Server/Model/Module/FrameSync/RealmGateAddressComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ETModel 4 | { 5 | public class RealmGateAddressComponent : Component 6 | { 7 | public readonly List GateAddress = new List(); 8 | 9 | public StartConfig GetAddress() 10 | { 11 | int n = RandomHelper.RandomNumber(0, this.GateAddress.Count); 12 | return this.GateAddress[n]; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Server/Model/Module/FrameSync/ServerFrameComponent.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public class ServerFrameComponent: Component 4 | { 5 | public int Frame; 6 | 7 | public FrameMessage FrameMessage; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Server/Model/Module/FrameSync/SessionInfoComponent.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public class SessionInfoComponent : Component 4 | { 5 | public Session Session; 6 | } 7 | } -------------------------------------------------------------------------------- /Server/Model/Module/FrameSync/SessionPlayerComponent.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public class SessionPlayerComponent : Component 4 | { 5 | public Player Player; 6 | 7 | public override void Dispose() 8 | { 9 | if (this.IsDisposed) 10 | { 11 | return; 12 | } 13 | 14 | base.Dispose(); 15 | 16 | Game.Scene.GetComponent()?.Remove(this.Player.Id); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Server/Model/Module/FrameSync/UnitComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace ETModel 5 | { 6 | public class UnitComponent: Component 7 | { 8 | private readonly Dictionary idUnits = new Dictionary(); 9 | 10 | public override void Dispose() 11 | { 12 | if (this.IsDisposed) 13 | { 14 | return; 15 | } 16 | base.Dispose(); 17 | 18 | foreach (Unit unit in this.idUnits.Values) 19 | { 20 | unit.Dispose(); 21 | } 22 | this.idUnits.Clear(); 23 | } 24 | 25 | public void Add(Unit unit) 26 | { 27 | this.idUnits.Add(unit.Id, unit); 28 | } 29 | 30 | public Unit Get(long id) 31 | { 32 | this.idUnits.TryGetValue(id, out Unit unit); 33 | return unit; 34 | } 35 | 36 | public void Remove(long id) 37 | { 38 | Unit unit; 39 | this.idUnits.TryGetValue(id, out unit); 40 | this.idUnits.Remove(id); 41 | unit?.Dispose(); 42 | } 43 | 44 | public void RemoveNoDispose(long id) 45 | { 46 | this.idUnits.Remove(id); 47 | } 48 | 49 | public int Count 50 | { 51 | get 52 | { 53 | return this.idUnits.Count; 54 | } 55 | } 56 | 57 | public Unit[] GetAll() 58 | { 59 | return this.idUnits.Values.ToArray(); 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Server/Model/Module/FrameSync/UnitGateComponent.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | [ObjectSystem] 4 | public class UnitGateComponentAwakeSystem : AwakeSystem 5 | { 6 | public override void Awake(UnitGateComponent self, long a) 7 | { 8 | self.Awake(a); 9 | } 10 | } 11 | 12 | public class UnitGateComponent : Component, ISerializeToEntity 13 | { 14 | public long GateSessionId; 15 | 16 | public void Awake(long gateSessionId) 17 | { 18 | this.GateSessionId = gateSessionId; 19 | } 20 | 21 | public ActorProxy GetActorProxy() 22 | { 23 | return Game.Scene.GetComponent().Get(this.GateSessionId); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Server/Model/Module/Http/HttpHandlerAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public class HttpHandlerAttribute : Attribute 6 | { 7 | public AppType AppType { get; } 8 | 9 | public string Path { get; } 10 | 11 | public HttpHandlerAttribute(AppType appType, string path) 12 | { 13 | this.AppType = appType; 14 | this.Path = path; 15 | } 16 | } 17 | 18 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)] 19 | public class GetAttribute : Attribute 20 | { 21 | public string Path { get; } 22 | 23 | public GetAttribute() 24 | { 25 | } 26 | 27 | public GetAttribute(string path) 28 | { 29 | this.Path = path; 30 | } 31 | } 32 | 33 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)] 34 | public class PostAttribute : Attribute 35 | { 36 | public string Path { get; } 37 | 38 | public PostAttribute() 39 | { 40 | } 41 | 42 | public PostAttribute(string path) 43 | { 44 | this.Path = path; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /Server/Model/Module/Http/IHttpHandler.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace ETModel 4 | { 5 | public interface IHttpHandler 6 | { 7 | void Handle(HttpListenerContext context); 8 | } 9 | 10 | public abstract class AHttpHandler : IHttpHandler 11 | { 12 | public virtual void Handle(HttpListenerContext context) 13 | { 14 | } 15 | public virtual HttpResult Ok(string msg = "", object data = null) 16 | { 17 | return new HttpResult 18 | { 19 | code = HttpErrorCode.Success, 20 | msg = msg, 21 | status = true, 22 | data = data 23 | }; 24 | } 25 | 26 | public virtual HttpResult Error(string msg = "") 27 | { 28 | return new HttpResult 29 | { 30 | code = HttpErrorCode.Exception, 31 | msg = msg, 32 | status = false 33 | }; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Server/Model/Module/Location/Location.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public class Location: Entity 4 | { 5 | public string Address; 6 | 7 | public Location(long id, string address): base(id) 8 | { 9 | this.Address = address; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/AMHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public abstract class AMHandler : IMHandler where Message: class 6 | { 7 | protected abstract void Run(Session session, Message message); 8 | 9 | public void Handle(Session session, object msg) 10 | { 11 | Message message = msg as Message; 12 | if (message == null) 13 | { 14 | Log.Error($"消息类型转换错误: {msg.GetType().Name} to {typeof(Message).Name}"); 15 | return; 16 | } 17 | if (session.IsDisposed) 18 | { 19 | Log.Error($"session disconnect {msg}"); 20 | return; 21 | } 22 | this.Run(session, message); 23 | } 24 | 25 | public Type GetMessageType() 26 | { 27 | return typeof(Message); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/AMRpcHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public abstract class AMRpcHandler: IMHandler where Request : class, IRequest where Response : class, IResponse 6 | { 7 | protected static void ReplyError(Response response, Exception e, Action reply) 8 | { 9 | Log.Error(e); 10 | response.Error = ErrorCode.ERR_RpcFail; 11 | response.Message = e.ToString(); 12 | reply(response); 13 | } 14 | 15 | protected abstract void Run(Session session, Request message, Action reply); 16 | 17 | public void Handle(Session session, object message) 18 | { 19 | try 20 | { 21 | Request request = message as Request; 22 | if (request == null) 23 | { 24 | Log.Error($"消息类型转换错误: {message.GetType().Name} to {typeof (Request).Name}"); 25 | } 26 | 27 | int rpcId = request.RpcId; 28 | this.Run(session, request, response => 29 | { 30 | // 等回调回来,session可以已经断开了,所以需要判断session id是否为0 31 | if (session.IsDisposed) 32 | { 33 | return; 34 | } 35 | 36 | response.RpcId = rpcId; 37 | session.Reply(response); 38 | }); 39 | } 40 | catch (Exception e) 41 | { 42 | throw new Exception($"解释消息失败: {message.GetType().FullName}", e); 43 | } 44 | } 45 | 46 | public Type GetMessageType() 47 | { 48 | return typeof (Request); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/ErrorCode.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/roubincode/ETServer/a7f3fabff110077d999b035a02f524f1f3d1e097/Server/Model/Module/Message/ErrorCode.cs -------------------------------------------------------------------------------- /Server/Model/Module/Message/HotfixOpcode.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public static partial class HotfixOpcode 4 | { 5 | public const ushort C2R_Login = 10001; 6 | public const ushort R2C_Login = 10002; 7 | public const ushort C2G_LoginGate = 10003; 8 | public const ushort G2C_LoginGate = 10004; 9 | public const ushort G2C_TestHotfixMessage = 10005; 10 | public const ushort C2M_TestActorRequest = 10006; 11 | public const ushort M2C_TestActorResponse = 10007; 12 | public const ushort PlayerInfo = 10008; 13 | public const ushort C2G_PlayerInfo = 10009; 14 | public const ushort G2C_PlayerInfo = 10010; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/IActorMessage.cs: -------------------------------------------------------------------------------- 1 | using ProtoBuf; 2 | 3 | // 不要在这个文件加[ProtoInclude]跟[BsonKnowType]标签,加到InnerMessage.cs或者OuterMessage.cs里面去 4 | namespace ETModel 5 | { 6 | public interface IActorMessage: IRequest 7 | { 8 | long ActorId { get; set; } 9 | } 10 | 11 | [ProtoContract] 12 | public interface IActorRequest : IActorMessage 13 | { 14 | } 15 | 16 | [ProtoContract] 17 | public interface IActorResponse : IResponse 18 | { 19 | } 20 | 21 | [ProtoContract] 22 | public interface IFrameMessage : IMessage 23 | { 24 | long Id { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/IMHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public interface IMHandler 6 | { 7 | void Handle(Session session, object message); 8 | Type GetMessageType(); 9 | } 10 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/IMessage.cs: -------------------------------------------------------------------------------- 1 | using ProtoBuf; 2 | 3 | // 不要在这个文件加[ProtoInclude]跟[BsonKnowType]标签,加到InnerMessage.cs或者OuterMessage.cs里面去 4 | namespace ETModel 5 | { 6 | public interface IMessage 7 | { 8 | } 9 | 10 | public interface IRequest: IMessage 11 | { 12 | int RpcId { get; set; } 13 | } 14 | 15 | public interface IResponse: IMessage 16 | { 17 | int Error { get; set; } 18 | string Message { get; set; } 19 | int RpcId { get; set; } 20 | } 21 | 22 | public class ResponseMessage: IResponse 23 | { 24 | public int Error { get; set; } 25 | public string Message { get; set; } 26 | public int RpcId { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/IMessageDispatcher.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public interface IMessageDispatcher 4 | { 5 | void Dispatch(Session session, Packet packet); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/IMessagePacker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public interface IMessagePacker 6 | { 7 | byte[] SerializeToByteArray(object obj); 8 | string SerializeToText(object obj); 9 | 10 | object DeserializeFrom(Type type, byte[] bytes); 11 | object DeserializeFrom(Type type, byte[] bytes, int index, int count); 12 | T DeserializeFrom(byte[] bytes); 13 | T DeserializeFrom(byte[] bytes, int index, int count); 14 | 15 | T DeserializeFrom(string str); 16 | object DeserializeFrom(Type type, string str); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/MessageAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public class MessageAttribute: Attribute 6 | { 7 | public ushort Opcode { get; } 8 | 9 | public MessageAttribute(ushort opcode) 10 | { 11 | this.Opcode = opcode; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/MessageDispatherComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ETModel 4 | { 5 | /// 6 | /// 消息分发组件 7 | /// 8 | public class MessageDispatherComponent : Component 9 | { 10 | public readonly Dictionary> Handlers = new Dictionary>(); 11 | } 12 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/MessageHandlerAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public class MessageHandlerAttribute : Attribute 6 | { 7 | public AppType Type { get; } 8 | 9 | public MessageHandlerAttribute() 10 | { 11 | } 12 | 13 | public MessageHandlerAttribute(AppType appType) 14 | { 15 | this.Type = appType; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/MessageInfo.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public struct MessageInfo 4 | { 5 | public ushort Opcode { get; } 6 | public object Message { get; } 7 | 8 | public MessageInfo(ushort opcode, object message) 9 | { 10 | this.Opcode = opcode; 11 | this.Message = message; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/MongoPacker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public class MongoPacker: IMessagePacker 6 | { 7 | public byte[] SerializeToByteArray(object obj) 8 | { 9 | return MongoHelper.ToBson(obj); 10 | } 11 | 12 | public string SerializeToText(object obj) 13 | { 14 | return MongoHelper.ToJson(obj); 15 | } 16 | 17 | public object DeserializeFrom(Type type, byte[] bytes) 18 | { 19 | return MongoHelper.FromBson(type, bytes); 20 | } 21 | 22 | public object DeserializeFrom(Type type, byte[] bytes, int index, int count) 23 | { 24 | return MongoHelper.FromBson(type, bytes, index, count); 25 | } 26 | 27 | public T DeserializeFrom(byte[] bytes) 28 | { 29 | return MongoHelper.FromBson(bytes); 30 | } 31 | 32 | public T DeserializeFrom(byte[] bytes, int index, int count) 33 | { 34 | return MongoHelper.FromBson(bytes, index, count); 35 | } 36 | 37 | public T DeserializeFrom(string str) 38 | { 39 | return MongoHelper.FromJson(str); 40 | } 41 | 42 | public object DeserializeFrom(Type type, string str) 43 | { 44 | return MongoHelper.FromJson(type, str); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/NetInnerComponent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Net; 3 | 4 | namespace ETModel 5 | { 6 | public class NetInnerComponent: NetworkComponent 7 | { 8 | public readonly Dictionary adressSessions = new Dictionary(); 9 | 10 | public override void Remove(long id) 11 | { 12 | Session session = this.Get(id); 13 | if (session == null) 14 | { 15 | return; 16 | } 17 | this.adressSessions.Remove(session.RemoteAddress); 18 | 19 | base.Remove(id); 20 | } 21 | 22 | /// 23 | /// 从地址缓存中取Session,如果没有则创建一个新的Session,并且保存到地址缓存中 24 | /// 25 | public Session Get(IPEndPoint ipEndPoint) 26 | { 27 | if (this.adressSessions.TryGetValue(ipEndPoint, out Session session)) 28 | { 29 | return session; 30 | } 31 | 32 | session = this.Create(ipEndPoint); 33 | 34 | this.adressSessions.Add(ipEndPoint, session); 35 | return session; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/NetOuterComponent.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public class NetOuterComponent: NetworkComponent 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/Network/AService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Threading.Tasks; 4 | 5 | namespace ETModel 6 | { 7 | public enum NetworkProtocol 8 | { 9 | TCP, 10 | KCP, 11 | } 12 | 13 | public abstract class AService: Component 14 | { 15 | public abstract AChannel GetChannel(long id); 16 | 17 | public abstract Task AcceptChannel(); 18 | 19 | public abstract AChannel ConnectChannel(IPEndPoint ipEndPoint); 20 | 21 | public abstract void Remove(long channelId); 22 | 23 | public abstract void Update(); 24 | } 25 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/Network/NetworkHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | 3 | namespace ETModel 4 | { 5 | public static class NetworkHelper 6 | { 7 | public static IPEndPoint ToIPEndPoint(string host, int port) 8 | { 9 | return new IPEndPoint(IPAddress.Parse(host), port); 10 | } 11 | 12 | public static IPEndPoint ToIPEndPoint(string address) 13 | { 14 | int index = address.LastIndexOf(':'); 15 | string host = address.Substring(0, index); 16 | string p = address.Substring(index + 1); 17 | int port = int.Parse(p); 18 | return ToIPEndPoint(host, port); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/Opcode.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public static partial class Opcode 4 | { 5 | public const ushort ActorResponse = 1; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/OpcodeHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace ETModel 4 | { 5 | public static class OpcodeHelper 6 | { 7 | private static readonly HashSet needDebugLogMessageSet = new HashSet { 1 }; 8 | 9 | public static bool IsNeedDebugLogMessage(ushort opcode) 10 | { 11 | //return true; 12 | if (opcode > 1000) 13 | { 14 | return true; 15 | } 16 | 17 | if (needDebugLogMessageSet.Contains(opcode)) 18 | { 19 | return true; 20 | } 21 | 22 | return false; 23 | } 24 | 25 | public static bool IsClientHotfixMessage(ushort opcode) 26 | { 27 | return opcode > 10000; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/OpcodeTypeComponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | [ObjectSystem] 6 | public class OpcodeTypeComponentSystem : AwakeSystem 7 | { 8 | public override void Awake(OpcodeTypeComponent self) 9 | { 10 | self.Awake(); 11 | } 12 | } 13 | 14 | public class OpcodeTypeComponent : Component 15 | { 16 | private readonly DoubleMap opcodeTypes = new DoubleMap(); 17 | 18 | public void Awake() 19 | { 20 | Type[] types = DllHelper.GetMonoTypes(); 21 | foreach (Type type in types) 22 | { 23 | object[] attrs = type.GetCustomAttributes(typeof(MessageAttribute), false); 24 | if (attrs.Length == 0) 25 | { 26 | continue; 27 | } 28 | 29 | MessageAttribute messageAttribute = attrs[0] as MessageAttribute; 30 | if (messageAttribute == null) 31 | { 32 | continue; 33 | } 34 | 35 | this.opcodeTypes.Add(messageAttribute.Opcode, type); 36 | } 37 | } 38 | 39 | public ushort GetOpcode(Type type) 40 | { 41 | return this.opcodeTypes.GetKeyByValue(type); 42 | } 43 | 44 | public Type GetType(ushort opcode) 45 | { 46 | return this.opcodeTypes.GetValueByKey(opcode); 47 | } 48 | 49 | public override void Dispose() 50 | { 51 | if (this.IsDisposed) 52 | { 53 | return; 54 | } 55 | 56 | base.Dispose(); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Server/Model/Module/Message/OuterOpcode.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public static partial class OuterOpcode 4 | { 5 | public const ushort Actor_Test = 101; 6 | public const ushort Actor_TestRequest = 102; 7 | public const ushort Actor_TestResponse = 103; 8 | public const ushort Actor_TransferRequest = 104; 9 | public const ushort Actor_TransferResponse = 105; 10 | public const ushort C2G_EnterMap = 106; 11 | public const ushort G2C_EnterMap = 107; 12 | public const ushort UnitInfo = 108; 13 | public const ushort Actor_CreateUnits = 109; 14 | public const ushort OneFrameMessage = 110; 15 | public const ushort FrameMessage = 111; 16 | public const ushort Frame_ClickMap = 112; 17 | public const ushort C2M_Reload = 113; 18 | public const ushort M2C_Reload = 114; 19 | public const ushort C2R_Ping = 115; 20 | public const ushort R2C_Ping = 116; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/ProtobufPacker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public class ProtobufPacker : IMessagePacker 6 | { 7 | public byte[] SerializeToByteArray(object obj) 8 | { 9 | return ProtobufHelper.ToBytes(obj); 10 | } 11 | 12 | public string SerializeToText(object obj) 13 | { 14 | return JsonHelper.ToJson(obj); 15 | } 16 | 17 | public object DeserializeFrom(Type type, byte[] bytes) 18 | { 19 | return ProtobufHelper.FromBytes(type, bytes); 20 | } 21 | 22 | public object DeserializeFrom(Type type, byte[] bytes, int index, int count) 23 | { 24 | return ProtobufHelper.FromBytes(type, bytes, index, count); 25 | } 26 | 27 | public T DeserializeFrom(byte[] bytes) 28 | { 29 | return ProtobufHelper.FromBytes(bytes); 30 | } 31 | 32 | public T DeserializeFrom(byte[] bytes, int index, int count) 33 | { 34 | return ProtobufHelper.FromBytes(bytes, index, count); 35 | } 36 | 37 | public T DeserializeFrom(string str) 38 | { 39 | return JsonHelper.FromJson(str); 40 | } 41 | 42 | public object DeserializeFrom(Type type, string str) 43 | { 44 | return JsonHelper.FromJson(type, str); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Server/Model/Module/Message/RpcException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | /// 6 | /// RPC异常,带ErrorCode 7 | /// 8 | [Serializable] 9 | public class RpcException: Exception 10 | { 11 | public int Error { get; private set; } 12 | 13 | public RpcException(int error, string message): base($"Error: {error} Message: {message}") 14 | { 15 | this.Error = error; 16 | } 17 | 18 | public RpcException(int error, string message, Exception e): base($"Error: {error} Message: {message}", e) 19 | { 20 | this.Error = error; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Server/Model/Module/Numeric/INumericWatcher.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public interface INumericWatcher 4 | { 5 | void Run(long id, int value); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Server/Model/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | // 分发数值监听 4 | [Event(EventIdType.NumbericChange)] 5 | public class NumericChangeEvent_NotifyWatcher: AEvent 6 | { 7 | public override void Run(NumericType numericType, long id, int value) 8 | { 9 | Game.Scene.GetComponent().Run(numericType, id, value); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Server/Model/Module/Numeric/NumericType.cs: -------------------------------------------------------------------------------- 1 | namespace ETModel 2 | { 3 | public enum NumericType 4 | { 5 | Max = 10000, 6 | 7 | Speed = 1000, 8 | SpeedBase = Speed * 10 + 1, 9 | SpeedAdd = Speed * 10 + 2, 10 | SpeedPct = Speed * 10 + 3, 11 | SpeedFinalAdd = Speed * 10 + 4, 12 | SpeedFinalPct = Speed * 10 + 5, 13 | 14 | Hp = 1001, 15 | HpBase = Hp * 10 + 1, 16 | 17 | MaxHp = 1002, 18 | MaxHpBase = MaxHp * 10 + 1, 19 | MaxHpAdd = MaxHp * 10 + 2, 20 | MaxHpPct = MaxHp * 10 + 3, 21 | MaxHpFinalAdd = MaxHp * 10 + 4, 22 | MaxHpFinalPct = MaxHp * 10 + 5, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Server/Model/Module/Numeric/NumericWatcherAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ETModel 4 | { 5 | public class NumericWatcherAttribute : Attribute 6 | { 7 | public NumericType NumericType { get; } 8 | 9 | public NumericWatcherAttribute(NumericType type) 10 | { 11 | this.NumericType = type; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Server/Model/Other/AppType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace ETModel 5 | { 6 | [Flags] 7 | public enum AppType 8 | { 9 | None = 0, 10 | Manager = 1, 11 | Realm = 1 << 1, 12 | Gate = 1 << 2, 13 | Http = 1 << 3, 14 | DB = 1 << 4, 15 | Location = 1 << 5, 16 | Map = 1 << 6, 17 | 18 | Robot = 1 << 29, 19 | Benchmark = 1 << 30, 20 | Client = 1 << 31, 21 | 22 | // 7 23 | AllServer = Manager | Realm | Gate | Http | DB | Location | Map 24 | } 25 | 26 | public static class AppTypeHelper 27 | { 28 | public static List GetServerTypes() 29 | { 30 | List appTypes = new List { AppType.Manager, AppType.Realm, AppType.Gate }; 31 | return appTypes; 32 | } 33 | 34 | public static bool Is(this AppType a, AppType b) 35 | { 36 | if ((a & b) != 0) 37 | { 38 | return true; 39 | } 40 | return false; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Server/Model/Other/Options.cs: -------------------------------------------------------------------------------- 1 | #if SERVER 2 | using CommandLine; 3 | #endif 4 | 5 | namespace ETModel 6 | { 7 | public class Options 8 | { 9 | [Option("appId", Required = false, Default = 1)] 10 | public int AppId { get; set; } 11 | 12 | // 没啥用,主要是在查看进程信息能区分每个app.exe的类型 13 | [Option("appType", Required = false, Default = AppType.Manager)] 14 | public AppType AppType { get; set; } 15 | 16 | [Option("config", Required = false, Default = "../Config/StartConfig/LocalAllServer.txt")] 17 | public string Config { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Server/Model/Server.Model.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | false 5 | 6 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/DotNetCoreDriver/MongoDB.Bson/MongoDB.Bson.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | false 9 | 10 | 11 | 12 | ..\..\..\..\..\Bin\ 13 | 14 | 15 | 16 | ..\..\..\..\..\Bin\ 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/DotNetCoreDriver/MongoDB.Driver.Core/MongoDB.Driver.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | false 9 | 10 | 11 | 12 | ..\..\..\..\..\Bin\ 13 | 14 | 15 | 16 | ..\..\..\..\..\Bin\ 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/DotNetCoreDriver/MongoDB.Driver/MongoDB.Driver.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | false 9 | 10 | 11 | 12 | ..\..\..\..\..\Bin\ 13 | 14 | 15 | 16 | ..\..\..\..\..\Bin\ 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/IO/IBsonChunk.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | 18 | namespace MongoDB.Bson.IO 19 | { 20 | /// 21 | /// Represents a chunk of bytes. 22 | /// 23 | public interface IBsonChunk : IDisposable 24 | { 25 | /// 26 | /// Gets the bytes. 27 | /// 28 | /// 29 | /// The bytes. 30 | /// 31 | ArraySegment Bytes { get; } 32 | 33 | /// 34 | /// Returns a new reference to the same chunk that can be independently disposed. 35 | /// 36 | /// A new reference to the same chunk. 37 | IBsonChunk Fork(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/IO/IBsonChunkSource.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | 18 | namespace MongoDB.Bson.IO 19 | { 20 | /// 21 | /// Represents a source of chunks. 22 | /// 23 | public interface IBsonChunkSource : IDisposable 24 | { 25 | /// 26 | /// Gets the chunk. 27 | /// 28 | /// The chunk source is free to return a larger or smaller chunk than requested. 29 | /// Size of the requested. 30 | /// A chunk. 31 | IBsonChunk GetChunk(int requestedSize); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/ObjectModel/IConvertibleToBsonDocument.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson 17 | { 18 | /// 19 | /// An interface implemented by objects that convert themselves to a BsonDocument. 20 | /// 21 | public interface IConvertibleToBsonDocument 22 | { 23 | /// 24 | /// Converts this object to a BsonDocument. 25 | /// 26 | /// A BsonDocument. 27 | BsonDocument ToBsonDocument(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/ObjectModel/ICustomBsonTypeMapper.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson 17 | { 18 | /// 19 | /// An interface for custom mappers that map an object to a BsonValue. 20 | /// 21 | public interface ICustomBsonTypeMapper 22 | { 23 | /// 24 | /// Tries to map an object to a BsonValue. 25 | /// 26 | /// An object. 27 | /// The BsonValue. 28 | /// True if the mapping was successfull. 29 | bool TryMapToBsonValue(object value, out BsonValue bsonValue); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Attributes/BsonIgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | 18 | namespace MongoDB.Bson.Serialization.Attributes 19 | { 20 | /// 21 | /// Indicates that this field or property should be ignored when this class is serialized. 22 | /// 23 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] 24 | public class BsonIgnoreAttribute : Attribute 25 | { 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Attributes/BsonNoIdAttribute.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | 18 | namespace MongoDB.Bson.Serialization.Attributes 19 | { 20 | /// 21 | /// Specifies that the class's IdMember should be null. 22 | /// 23 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] 24 | public class BsonNoIdAttribute : Attribute, IBsonPostProcessingAttribute 25 | { 26 | // public methods 27 | /// 28 | /// Applies the post processing attribute to the class map. 29 | /// 30 | /// The class map. 31 | public void PostProcess(BsonClassMap classMap) 32 | { 33 | classMap.SetIdMember(null); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Attributes/BsonRequiredAttribute.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | 18 | namespace MongoDB.Bson.Serialization.Attributes 19 | { 20 | /// 21 | /// Indicates that a field or property is required. 22 | /// 23 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] 24 | public class BsonRequiredAttribute : Attribute, IBsonMemberMapAttribute 25 | { 26 | // public methods 27 | /// 28 | /// Applies a modification to the member map. 29 | /// 30 | /// The member map. 31 | public void Apply(BsonMemberMap memberMap) 32 | { 33 | memberMap.SetIsRequired(true); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Attributes/IBsonClassMapAttribute.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization 17 | { 18 | /// 19 | /// Represents an attribute used to modify a class map. 20 | /// 21 | public interface IBsonClassMapAttribute 22 | { 23 | /// 24 | /// Applies the attribute to the class map. 25 | /// 26 | /// The class map. 27 | void Apply(BsonClassMap classMap); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Attributes/IBsonCreatorMapAttribute.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization 17 | { 18 | /// 19 | /// Represents an attribute used to modify a creator map. 20 | /// 21 | public interface IBsonCreatorMapAttribute 22 | { 23 | /// 24 | /// Applies the attribute to the creator map. 25 | /// 26 | /// The creator map. 27 | void Apply(BsonCreatorMap creatorMap); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Attributes/IBsonMemberMapAttribute.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization 17 | { 18 | /// 19 | /// Represents an attribute used to modify a member map. 20 | /// 21 | public interface IBsonMemberMapAttribute 22 | { 23 | /// 24 | /// Applies the attribute to the member map. 25 | /// 26 | /// The member map. 27 | void Apply(BsonMemberMap memberMap); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Attributes/IBsonPostProcessingAttribute.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization 17 | { 18 | /// 19 | /// Represents an attribute used to post process a class map. 20 | /// 21 | public interface IBsonPostProcessingAttribute 22 | { 23 | /// 24 | /// Applies the post processing attribute to the class map. 25 | /// 26 | /// The class map. 27 | void PostProcess(BsonClassMap classMap); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Conventions/IClassMapConvention.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization.Conventions 17 | { 18 | /// 19 | /// Represents a convention that applies to a BsonClassMap. 20 | /// 21 | public interface IClassMapConvention : IConvention 22 | { 23 | /// 24 | /// Applies a modification to the class map. 25 | /// 26 | /// The class map. 27 | void Apply(BsonClassMap classMap); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Conventions/IConvention.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization.Conventions 17 | { 18 | /// 19 | /// Represents a convention. 20 | /// 21 | public interface IConvention 22 | { 23 | /// 24 | /// Gets the name of the convention. 25 | /// 26 | string Name { get; } 27 | } 28 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Conventions/IConventionPack.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Collections.Generic; 17 | 18 | namespace MongoDB.Bson.Serialization.Conventions 19 | { 20 | /// 21 | /// Represents a grouping of conventions. 22 | /// 23 | public interface IConventionPack 24 | { 25 | /// 26 | /// Gets the conventions. 27 | /// 28 | IEnumerable Conventions { get; } 29 | } 30 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Conventions/ICreatorMapConvention.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization.Conventions 17 | { 18 | /// 19 | /// Represents a convention that applies to a BsonCreatorMap. 20 | /// 21 | public interface ICreatorMapConvention : IConvention 22 | { 23 | /// 24 | /// Applies a modification to the creator map. 25 | /// 26 | /// The creator map. 27 | void Apply(BsonCreatorMap creatorMap); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Conventions/IMemberMapConvention.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization.Conventions 17 | { 18 | /// 19 | /// Represents a convention that applies to a BsonMemberMap. 20 | /// 21 | public interface IMemberMapConvention : IConvention 22 | { 23 | /// 24 | /// Applies a modification to the member map. 25 | /// 26 | /// The member map. 27 | void Apply(BsonMemberMap memberMap); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Conventions/IPostProcessingConvention.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization.Conventions 17 | { 18 | /// 19 | /// Represents a post processing convention that applies to a BsonClassMap. 20 | /// 21 | public interface IPostProcessingConvention : IConvention 22 | { 23 | /// 24 | /// Applies a post processing modification to the class map. 25 | /// 26 | /// The class map. 27 | void PostProcess(BsonClassMap classMap); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Conventions/MemberNameElementNameConvention.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Reflection; 18 | 19 | namespace MongoDB.Bson.Serialization.Conventions 20 | { 21 | /// 22 | /// A convention that sets the element name the same as the member name. 23 | /// 24 | public class MemberNameElementNameConvention : ConventionBase, IMemberMapConvention 25 | { 26 | // public methods 27 | /// 28 | /// Applies a modification to the member map. 29 | /// 30 | /// The member map. 31 | public void Apply(BsonMemberMap memberMap) 32 | { 33 | memberMap.SetElementName(memberMap.MemberName); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Conventions/ResetClassMapConvention.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization.Conventions 17 | { 18 | /// 19 | /// A convention that resets a class map (resetting any changes that earlier conventions may have applied). 20 | /// 21 | public class ResetClassMapConvention : ConventionBase, IClassMapConvention 22 | { 23 | // public methods 24 | /// 25 | /// Applies a modification to the class map. 26 | /// 27 | /// The class map. 28 | public void Apply(BsonClassMap classMap) 29 | { 30 | classMap.Reset(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Conventions/ResetMemberMapsConvention.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization.Conventions 17 | { 18 | /// 19 | /// A convention that resets class members (resetting any changes that earlier conventions may have applied). 20 | /// 21 | public class ResetMemberMapsConvention : ConventionBase, IMemberMapConvention 22 | { 23 | // public methods 24 | /// 25 | /// Applies a modification to the member map. 26 | /// 27 | /// The member map. 28 | public void Apply(BsonMemberMap memberMap) 29 | { 30 | memberMap.Reset(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/IBsonArraySerializer.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Bson.Serialization 17 | { 18 | /// 19 | /// Contract for serializers to implement if they serialize an array of items. 20 | /// 21 | public interface IBsonArraySerializer : IBsonSerializer 22 | { 23 | /// 24 | /// Tries to get the serialization info for the individual items of the array. 25 | /// 26 | /// The serialization information. 27 | /// 28 | /// true if the serialization info exists; otherwise false. 29 | /// 30 | bool TryGetItemSerializationInfo(out BsonSerializationInfo serializationInfo); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/IBsonPolymorphicSerializer.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using MongoDB.Bson.IO; 18 | 19 | namespace MongoDB.Bson.Serialization 20 | { 21 | /// 22 | /// An interface implemented by a polymorphic serializer. 23 | /// 24 | public interface IBsonPolymorphicSerializer 25 | { 26 | /// 27 | /// Gets a value indicating whether this serializer's discriminator is compatible with the object serializer. 28 | /// 29 | /// 30 | /// true if this serializer's discriminator is compatible with the object serializer; otherwise, false. 31 | /// 32 | bool IsDiscriminatorCompatibleWithObjectSerializer { get; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/ICreatorSelector.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Collections.Generic; 17 | 18 | namespace MongoDB.Bson.Serialization 19 | { 20 | internal interface ICreatorSelector 21 | { 22 | BsonCreatorMap SelectCreator(BsonClassMap classMap, Dictionary values); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Serializers/AbstractClassSerializer.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace MongoDB.Bson.Serialization.Serializers 23 | { 24 | /// 25 | /// Represents a serializer for an abstract class. 26 | /// 27 | /// The type of the class. 28 | public class AbstractClassSerializer : ClassSerializerBase where TClass : class 29 | { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/Serialization/Serializers/StructSerializerBase.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using MongoDB.Bson.IO; 18 | using MongoDB.Bson.Serialization.Conventions; 19 | 20 | namespace MongoDB.Bson.Serialization.Serializers 21 | { 22 | /// 23 | /// Represents an abstract base class for struct serializers. 24 | /// 25 | /// The type of the value. 26 | public abstract class StructSerializerBase : SerializerBase where TValue : struct 27 | { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Bson/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Authentication/Sspi/AuthIdentityFlag.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Core.Authentication.Sspi 17 | { 18 | /// 19 | /// Flag for the AuthIdentity structure. 20 | /// 21 | internal enum AuthIdentityFlag 22 | { 23 | /// 24 | /// SEC_WINNT_AUTH_IDENTITY_ANSI 25 | /// 26 | Ansi = 0x1, 27 | /// 28 | /// SEC_WINNT_AUTH_IDENTITY_UNICODE 29 | /// 30 | Unicode = 0x2 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Authentication/Sspi/DataRepresentation.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Core.Authentication.Sspi 17 | { 18 | /// 19 | /// Flags for InitiateSecurityContext. 20 | /// 21 | /// 22 | /// See the TargetDataRep parameter at 23 | /// http://msdn.microsoft.com/en-us/library/windows/desktop/aa375507(v=vs.85).aspx 24 | /// 25 | internal enum DataRepresentation 26 | { 27 | /// 28 | /// SECURITY_NETWORK_DREP 29 | /// 30 | Network = 0, 31 | /// 32 | /// SECURITY_NATIVE_DREP 33 | /// 34 | Native = 16 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Authentication/Sspi/EncryptQualityOfProtection.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Core.Authentication.Sspi 17 | { 18 | /// 19 | /// Flags for EncryptMessage. 20 | /// 21 | /// 22 | /// See the fQOP parameter at 23 | /// http://msdn.microsoft.com/en-us/library/windows/desktop/aa375378(v=vs.85).aspx. 24 | /// 25 | internal enum EncryptQualityOfProtection : uint 26 | { 27 | /// 28 | /// SECQOP_WRAP_NO_ENCRYPT 29 | /// 30 | WrapNoEncrypt = 0x80000001 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Authentication/Sspi/QueryContextAttribute.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Core.Authentication.Sspi 17 | { 18 | /// 19 | /// Flags for QueryContextAttributes. 20 | /// 21 | /// 22 | /// See the ulAttribute parameter at 23 | /// http://msdn.microsoft.com/en-us/library/windows/desktop/aa379326(v=vs.85).aspx. 24 | /// 25 | internal enum QueryContextAttributes 26 | { 27 | /// 28 | /// SECPKG_ATTR_SIZES 29 | /// 30 | Sizes = 0x0 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Authentication/Sspi/SecurityCredentialUse.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Core.Authentication.Sspi 17 | { 18 | /// 19 | /// Flags for AcquireCredentialsHandle. 20 | /// 21 | /// 22 | /// See the fCredentialUse at http://msdn.microsoft.com/en-us/library/windows/desktop/aa374712(v=vs.85).aspx. 23 | /// 24 | internal enum SecurityCredentialUse 25 | { 26 | /// 27 | /// SECPKG_CRED_OUTBOUND 28 | /// 29 | Outbound = 0x2 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Authentication/Sspi/SecurityPackageContextSizes.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Runtime.InteropServices; 17 | 18 | namespace MongoDB.Driver.Core.Authentication.Sspi 19 | { 20 | /// 21 | /// A SecPkgContext_Sizes structure. 22 | /// 23 | /// 24 | /// http://msdn.microsoft.com/en-us/library/windows/desktop/aa380097(v=vs.85).aspx 25 | /// 26 | [StructLayout(LayoutKind.Sequential)] 27 | internal struct SecurityPackageContextSizes 28 | { 29 | public uint MaxToken; 30 | public uint MaxSignature; 31 | public uint BlockSize; 32 | public uint SecurityTrailer; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Authentication/Sspi/SspiPackage.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Core.Authentication.Sspi 17 | { 18 | /// 19 | /// This is represented as a string in AcquireCredentialsHandle. This value will have .ToString() called on it. 20 | /// 21 | internal enum SspiPackage 22 | { 23 | /// 24 | /// Kerberos 25 | /// 26 | Kerberos 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Clusters/ClusterState.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace MongoDB.Driver.Core.Clusters 23 | { 24 | /// 25 | /// Represents the state of a cluster. 26 | /// 27 | public enum ClusterState 28 | { 29 | /// 30 | /// The cluster is disconnected. 31 | /// 32 | Disconnected, 33 | 34 | /// 35 | /// The cluster is connected. 36 | /// 37 | Connected 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Clusters/IClusterFactory.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | 17 | namespace MongoDB.Driver.Core.Clusters 18 | { 19 | /// 20 | /// Represents a cluster factory. 21 | /// 22 | public interface IClusterFactory 23 | { 24 | // methods 25 | /// 26 | /// Creates a cluster. 27 | /// 28 | /// A cluster. 29 | ICluster CreateCluster(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Clusters/ServerSelectors/IServerSelector.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Collections.Generic; 17 | using MongoDB.Driver.Core.Servers; 18 | 19 | namespace MongoDB.Driver.Core.Clusters.ServerSelectors 20 | { 21 | /// 22 | /// Represents a selector that selects servers. 23 | /// 24 | public interface IServerSelector 25 | { 26 | /// 27 | /// Selects the servers. 28 | /// 29 | /// The cluster. 30 | /// The servers. 31 | /// The selected servers. 32 | IEnumerable SelectServers(ClusterDescription cluster, IEnumerable servers); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Connections/IConnectionInitializer.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Threading; 18 | using System.Threading.Tasks; 19 | using MongoDB.Driver.Core.Servers; 20 | 21 | namespace MongoDB.Driver.Core.Connections 22 | { 23 | internal interface IConnectionInitializer 24 | { 25 | ConnectionDescription InitializeConnection(IConnection connection, CancellationToken cancellationToken); 26 | Task InitializeConnectionAsync(IConnection connection, CancellationToken cancellationToken); 27 | } 28 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Events/IEventSubscriber.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | 18 | namespace MongoDB.Driver.Core.Events 19 | { 20 | /// 21 | /// A subscriber to events. 22 | /// 23 | public interface IEventSubscriber 24 | { 25 | /// 26 | /// Tries to get an event handler for an event of type . 27 | /// 28 | /// The type of the event. 29 | /// The handler. 30 | /// true if this subscriber has provided an event handler; otherwise false. 31 | bool TryGetEventHandler(out Action handler); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Misc/IClock.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | 18 | namespace MongoDB.Driver.Core.Misc 19 | { 20 | internal interface IClock 21 | { 22 | DateTime UtcNow { get; } 23 | } 24 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Misc/IRandomStringGenerator.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Core.Misc 17 | { 18 | internal interface IRandomStringGenerator 19 | { 20 | string Generate(int length, string legalCharacters); 21 | } 22 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Misc/IdGenerator.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Threading; 17 | 18 | namespace MongoDB.Driver.Core.Misc 19 | { 20 | internal static class IdGenerator 21 | { 22 | // static fields 23 | private static int __lastId; 24 | 25 | // static methods 26 | public static int GetNextId() 27 | { 28 | return Interlocked.Increment(ref __lastId); 29 | } 30 | } 31 | 32 | internal static class LongIdGenerator 33 | { 34 | // static fields 35 | private static long __lastId; 36 | 37 | // static methods 38 | public static long GetNextId() 39 | { 40 | return Interlocked.Increment(ref __lastId); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Misc/SystemClock.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | 18 | namespace MongoDB.Driver.Core.Misc 19 | { 20 | internal class SystemClock : IClock 21 | { 22 | // public static fields 23 | public static readonly SystemClock Instance = new SystemClock(); 24 | 25 | // constructors 26 | private SystemClock() 27 | { 28 | } 29 | 30 | // public properties 31 | public DateTime UtcNow 32 | { 33 | get { return DateTime.UtcNow; } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Misc/TaskExtensions.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Threading.Tasks; 17 | 18 | namespace MongoDB.Driver.Core.Misc 19 | { 20 | internal static class TaskExtensions 21 | { 22 | public static void IgnoreExceptions(this Task task) 23 | { 24 | task.ContinueWith(t => { var ignored = t.Exception; }, 25 | TaskContinuationOptions.OnlyOnFaulted | 26 | TaskContinuationOptions.ExecuteSynchronously); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Misc/ThreadStaticRandom.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | 18 | namespace MongoDB.Driver.Core.Misc 19 | { 20 | internal static class ThreadStaticRandom 21 | { 22 | // static fields 23 | [ThreadStatic] 24 | private static Random __threadStaticRandom; 25 | 26 | // static methods 27 | public static int Next(int maxValue) 28 | { 29 | var random = __threadStaticRandom; 30 | if (random == null) 31 | { 32 | random = __threadStaticRandom = new Random(); 33 | } 34 | 35 | return random.Next(maxValue); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Misc/ToStringComparer.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Collections.Generic; 17 | 18 | namespace MongoDB.Driver.Core.Misc 19 | { 20 | internal class ToStringComparer : IComparer 21 | { 22 | public int Compare(T x, T y) 23 | { 24 | if (object.ReferenceEquals(x, null) && object.ReferenceEquals(y, null)) 25 | { 26 | return 0; 27 | } 28 | if (object.ReferenceEquals(x, null)) 29 | { 30 | return -1; 31 | } 32 | if (object.ReferenceEquals(y, null)) 33 | { 34 | return 1; 35 | } 36 | return x.ToString().CompareTo(y.ToString()); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Operations/CursorType.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace MongoDB.Driver.Core.Operations 23 | { 24 | /// 25 | /// The cursor type. 26 | /// 27 | public enum CursorType 28 | { 29 | /// 30 | /// A non-tailable cursor. This is sufficient for most uses. 31 | /// 32 | NonTailable = 0, 33 | /// 34 | /// A tailable cursor. 35 | /// 36 | Tailable, 37 | /// 38 | /// A tailable cursor with a built-in server sleep. 39 | /// 40 | TailableAwait 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Operations/ReturnDocument.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace MongoDB.Driver.Core.Operations 23 | { 24 | /// 25 | /// The document to return when executing a FindAndModify command. 26 | /// 27 | public enum ReturnDocument 28 | { 29 | /// 30 | /// Returns the document before the modification. 31 | /// 32 | Before = 0, 33 | 34 | /// 35 | /// Returns the document after the modification. 36 | /// 37 | After 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Operations/UpdateType.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using MongoDB.Bson.IO; 17 | using MongoDB.Driver.Core.Operations.ElementNameValidators; 18 | namespace MongoDB.Driver.Core.Operations 19 | { 20 | /// 21 | /// Represents the update type. 22 | /// 23 | public enum UpdateType 24 | { 25 | /// 26 | /// The update type is unknown. 27 | /// 28 | Unknown, 29 | 30 | /// 31 | /// This update uses an update specification to update an existing document. 32 | /// 33 | Update, 34 | 35 | /// 36 | /// This update completely replaces an existing document with a new one. 37 | /// 38 | Replacement 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Operations/WriteRequestType.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Core.Operations 17 | { 18 | /// 19 | /// Represents the type of a write request. 20 | /// 21 | public enum WriteRequestType 22 | { 23 | /// 24 | /// A delete request. 25 | /// 26 | Delete, 27 | 28 | /// 29 | /// An insert request. 30 | /// 31 | Insert, 32 | 33 | /// 34 | /// An udpate request. 35 | /// 36 | Update 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Servers/IServerMonitorFactory.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Net; 17 | 18 | namespace MongoDB.Driver.Core.Servers 19 | { 20 | /// 21 | /// Represents a server monitor factory. 22 | /// 23 | internal interface IServerMonitorFactory 24 | { 25 | /// 26 | /// Creates a server monitor. 27 | /// 28 | /// The server identifier. 29 | /// The end point. 30 | /// A server monitor. 31 | IServerMonitor Create(ServerId serverId, EndPoint endPoint); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/Servers/ServerState.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace MongoDB.Driver.Core.Servers 23 | { 24 | /// 25 | /// Represents the server state. 26 | /// 27 | public enum ServerState 28 | { 29 | /// 30 | /// The server is disconnected. 31 | /// 32 | Disconnected, 33 | 34 | /// 35 | /// The server is connected. 36 | /// 37 | Connected 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/WireProtocol/CommandResponseHandling.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | using MongoDB.Driver.Core.Misc; 22 | 23 | namespace MongoDB.Driver.Core.WireProtocol 24 | { 25 | /// 26 | /// Instructions for handling the response from a command. 27 | /// 28 | public enum CommandResponseHandling 29 | { 30 | /// 31 | /// Return the response from the server. 32 | /// 33 | Return, 34 | /// 35 | /// Ignore the response from the server. 36 | /// 37 | Ignore 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/WireProtocol/Messages/Encoders/BinaryEncoders/Opcode.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace MongoDB.Driver.Core.WireProtocol.Messages.Encoders.BinaryEncoders 23 | { 24 | internal enum Opcode 25 | { 26 | Reply = 1, 27 | Message = 1000, 28 | Update = 2001, 29 | Insert = 2002, 30 | Query = 2004, 31 | GetMore = 2005, 32 | Delete = 2006, 33 | KillCursors = 2007 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/Core/WireProtocol/Messages/Encoders/IMessageEncoderSelector.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2013-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Core.WireProtocol.Messages.Encoders 17 | { 18 | /// 19 | /// Represents a message encoder selector that gets the appropriate encoder from an encoder factory. 20 | /// 21 | public interface IMessageEncoderSelector 22 | { 23 | // methods 24 | /// 25 | /// Get the appropriate encoder from an encoder factory. 26 | /// 27 | /// The encoder factory. 28 | /// A message encoder. 29 | IMessageEncoder GetEncoder(IMessageEncoderFactory encoderFactory); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/DocumentValidationAction.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver 17 | { 18 | /// 19 | /// Represents the document validation action. 20 | /// 21 | public enum DocumentValidationAction 22 | { 23 | /// 24 | /// Validation failures result in an error. 25 | /// 26 | Error = 0, // the default 27 | /// 28 | /// Validation failures result in a warning. 29 | /// 30 | Warn 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/DocumentValidationLevel.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver 17 | { 18 | /// 19 | /// Represents the document validation level. 20 | /// 21 | public enum DocumentValidationLevel 22 | { 23 | /// 24 | /// Strict document validation. 25 | /// 26 | Strict = 0, // the default 27 | /// 28 | /// Moderate document validation. 29 | /// 30 | Moderate, 31 | /// 32 | /// No document validation. 33 | /// 34 | Off 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/ServerErrorCategory.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace MongoDB.Driver 23 | { 24 | /// 25 | /// Represents the category for an error from the server. 26 | /// 27 | public enum ServerErrorCategory 28 | { 29 | /// 30 | /// An error without a category. 31 | /// 32 | Uncategorized, 33 | 34 | /// 35 | /// A duplicate key error. 36 | /// 37 | DuplicateKey, 38 | 39 | /// 40 | /// An execution timeout error. 41 | /// 42 | ExecutionTimeout 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver.Core/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/AggregateBucketAutoOptions.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver 17 | { 18 | /// 19 | /// Represents options for the BucketAuto method. 20 | /// 21 | public class AggregateBucketAutoOptions 22 | { 23 | /// 24 | /// Gets or sets the granularity. 25 | /// 26 | public Optional Granularity { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/AggregateBucketOptions.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver 17 | { 18 | /// 19 | /// Represents options for the Bucket method. 20 | /// 21 | /// The type of the value. 22 | public class AggregateBucketOptions 23 | { 24 | /// 25 | /// Gets or sets the default bucket. 26 | /// 27 | public Optional DefaultBucket { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/AggregateFacetOptions.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using MongoDB.Bson.Serialization; 17 | 18 | namespace MongoDB.Driver 19 | { 20 | /// 21 | /// Options for the aggregate $facet stage. 22 | /// 23 | /// The type of the output documents. 24 | public sealed class AggregateFacetOptions 25 | { 26 | private IBsonSerializer _outputSerializer; 27 | 28 | /// 29 | /// Gets or sets the output serializer. 30 | /// 31 | public IBsonSerializer OutputSerializer 32 | { 33 | get { return _outputSerializer; } 34 | set { _outputSerializer = value; } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/AggregateStringTranslationMode.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | namespace MongoDB.Driver 18 | { 19 | /// 20 | /// Option for which expression to generate for certain string operations. 21 | /// 22 | public enum AggregateStringTranslationMode 23 | { 24 | /// 25 | /// Translate to the byte variation. 26 | /// 27 | Bytes, 28 | /// 29 | /// Translate to the code points variation. This is only supported in >= MongoDB 3.4. 30 | /// 31 | CodePoints 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/DeleteOptions.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver 17 | { 18 | /// 19 | /// Options for the Delete methods. 20 | /// 21 | public sealed class DeleteOptions 22 | { 23 | // fields 24 | private Collation _collation; 25 | 26 | // properties 27 | /// 28 | /// Gets or sets the collation. 29 | /// 30 | public Collation Collation 31 | { 32 | get { return _collation; } 33 | set { _collation = value; } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/ExpressionTranslationOptions.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | * 15 | */ 16 | 17 | namespace MongoDB.Driver 18 | { 19 | /// 20 | /// Options for controlling translation from .NET expression trees into MongoDB expressions. 21 | /// 22 | public class ExpressionTranslationOptions 23 | { 24 | internal static ExpressionTranslationOptions Default = new ExpressionTranslationOptions(); 25 | 26 | /// 27 | /// Gets or sets the string translation mode. 28 | /// 29 | public AggregateStringTranslationMode? StringTranslationMode { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/GeoJsonObjectModel/GeoJsonCoordinateReferenceSystem.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using MongoDB.Bson.Serialization.Attributes; 17 | using MongoDB.Driver.GeoJsonObjectModel.Serializers; 18 | 19 | namespace MongoDB.Driver.GeoJsonObjectModel 20 | { 21 | /// 22 | /// Represents a GeoJson coordinate reference system (see subclasses). 23 | /// 24 | [BsonSerializer(typeof(GeoJsonCoordinateReferenceSystemSerializer))] 25 | public abstract class GeoJsonCoordinateReferenceSystem 26 | { 27 | // public properties 28 | /// 29 | /// Gets the type of the GeoJson coordinate reference system. 30 | /// 31 | public abstract string Type { get; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/GeoJsonObjectModel/GeoJsonFeatureArgs.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using MongoDB.Bson; 17 | 18 | namespace MongoDB.Driver.GeoJsonObjectModel 19 | { 20 | /// 21 | /// Represents additional arguments for a GeoJson Feature object. 22 | /// 23 | /// The type of the coordinates. 24 | public class GeoJsonFeatureArgs : GeoJsonObjectArgs where TCoordinates : GeoJsonCoordinates 25 | { 26 | /// 27 | /// Gets or sets the id. 28 | /// 29 | public BsonValue Id { get; set; } 30 | 31 | /// 32 | /// Gets or sets the properties. 33 | /// 34 | public BsonDocument Properties { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/IFilteredMongoCollection.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver 17 | { 18 | /// 19 | /// A filtered mongo collection. The filter will be and'ed with all filters. 20 | /// 21 | /// The type of the document. 22 | public interface IFilteredMongoCollection : IMongoCollection 23 | { 24 | /// 25 | /// Gets the filter. 26 | /// 27 | FilterDefinition Filter { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/IInheritableMongoClientSettings.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Text; 18 | using MongoDB.Bson; 19 | 20 | namespace MongoDB.Driver 21 | { 22 | internal interface IInheritableMongoClientSettings 23 | { 24 | GuidRepresentation GuidRepresentation { get; } 25 | ReadConcern ReadConcern { get; } 26 | UTF8Encoding ReadEncoding { get; } 27 | ReadPreference ReadPreference { get; } 28 | WriteConcern WriteConcern { get; } 29 | UTF8Encoding WriteEncoding { get; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/Linq/Expressions/AccumulatorType.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver.Linq.Expressions 17 | { 18 | internal enum AccumulatorType 19 | { 20 | AddToSet = 1, 21 | Average, 22 | First, 23 | Last, 24 | Min, 25 | Max, 26 | Push, 27 | StandardDeviationPopulation, 28 | StandardDeviationSample, 29 | Sum, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/Linq/Expressions/IFieldExpression.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Linq.Expressions; 17 | 18 | namespace MongoDB.Driver.Linq.Expressions 19 | { 20 | internal interface IFieldExpression : ISerializationExpression 21 | { 22 | Expression Document { get; } 23 | 24 | string FieldName { get; } 25 | } 26 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/Linq/Expressions/ISourcedExpression.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Linq.Expressions; 17 | 18 | namespace MongoDB.Driver.Linq.Expressions 19 | { 20 | internal interface ISourcedExpression 21 | { 22 | Expression Source { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/Linq/Expressions/ResultOperator.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using MongoDB.Bson.Serialization; 18 | 19 | namespace MongoDB.Driver.Linq.Expressions 20 | { 21 | internal abstract class ResultOperator 22 | { 23 | public abstract string Name { get; } 24 | 25 | public abstract IBsonSerializer Serializer { get; } 26 | 27 | public abstract Type Type { get; } 28 | 29 | protected internal virtual ResultOperator Update(ExtensionExpressionVisitor visitor) 30 | { 31 | return this; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/Linq/Expressions/ResultOperators/AllResultOperator.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using MongoDB.Bson.Serialization; 18 | using MongoDB.Bson.Serialization.Serializers; 19 | 20 | namespace MongoDB.Driver.Linq.Expressions.ResultOperators 21 | { 22 | internal sealed class AllResultOperator : ResultOperator 23 | { 24 | private static readonly BooleanSerializer __serializer = new BooleanSerializer(); 25 | 26 | public override string Name 27 | { 28 | get { return "All"; } 29 | } 30 | 31 | public override IBsonSerializer Serializer 32 | { 33 | get { return __serializer; } 34 | } 35 | 36 | public override Type Type 37 | { 38 | get { return typeof(bool); } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/Linq/Expressions/SerializationExpression.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using MongoDB.Bson.Serialization; 17 | 18 | namespace MongoDB.Driver.Linq.Expressions 19 | { 20 | internal abstract class SerializationExpression : ExtensionExpression, ISerializationExpression 21 | { 22 | public abstract IBsonSerializer Serializer { get; } 23 | } 24 | } -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/Linq/IResultTransformer.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Linq.Expressions; 18 | 19 | namespace MongoDB.Driver.Linq 20 | { 21 | internal interface IResultTransformer 22 | { 23 | LambdaExpression CreateAggregator(Type sourceType); 24 | 25 | LambdaExpression CreateAsyncAggregator(Type sourceType); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/Linq/Processors/IMethodCallBinder.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Collections.Generic; 17 | using System.Linq.Expressions; 18 | using MongoDB.Driver.Linq.Expressions; 19 | 20 | namespace MongoDB.Driver.Linq.Processors 21 | { 22 | internal interface IMethodCallBinder where TBindingContext : IBindingContext 23 | { 24 | Expression Bind(PipelineExpression pipeline, TBindingContext bindingContext, MethodCallExpression node, IEnumerable arguments); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/Linq/Processors/Transformers/IExpressionTransformer.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Linq.Expressions; 17 | 18 | namespace MongoDB.Driver.Linq.Processors.Transformers 19 | { 20 | internal interface IExpressionTransformer where TExpression : Expression 21 | { 22 | ExpressionType[] SupportedNodeTypes { get; } 23 | 24 | Expression Transform(TExpression node); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/ListCollectionsOptions.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using MongoDB.Bson; 17 | namespace MongoDB.Driver 18 | { 19 | /// 20 | /// Options for a list collections operation. 21 | /// 22 | public sealed class ListCollectionsOptions 23 | { 24 | // fields 25 | private FilterDefinition _filter; 26 | 27 | // properties 28 | /// 29 | /// Gets or sets the filter. 30 | /// 31 | public FilterDefinition Filter 32 | { 33 | get { return _filter; } 34 | set { _filter = value; } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/MongoInternalIdentity.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | 21 | namespace MongoDB.Driver 22 | { 23 | /// 24 | /// Represents an identity defined inside mongodb. 25 | /// 26 | public class MongoInternalIdentity : MongoIdentity 27 | { 28 | /// 29 | /// Initializes a new instance of the class. 30 | /// 31 | /// Name of the database. 32 | /// The username. 33 | public MongoInternalIdentity(string databaseName, string username) 34 | : base(databaseName, username) 35 | { } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/MongoX509Identity.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2014 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver 17 | { 18 | /// 19 | /// Represents an identity defined by an X509 certificate. 20 | /// 21 | public class MongoX509Identity : MongoIdentity 22 | { 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The username. 27 | public MongoX509Identity(string username) 28 | : base("$external", username, allowNullUsername: true) 29 | { } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/RenameCollectionOptions.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2010-2015 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | namespace MongoDB.Driver 17 | { 18 | /// 19 | /// Options for renaming a collection. 20 | /// 21 | public class RenameCollectionOptions 22 | { 23 | // fields 24 | private bool? _dropTarget; 25 | 26 | // properties 27 | /// 28 | /// Gets or sets a value indicating whether to drop the target collection first if it already exists. 29 | /// 30 | public bool? DropTarget 31 | { 32 | get { return _dropTarget; } 33 | set { _dropTarget = value; } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Driver/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Server/ThirdParty/MongodbDriver/MongoDB.Shared/GlobalAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* Copyright 2015-2017 MongoDB Inc. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | using System.Reflection; 17 | 18 | [assembly: AssemblyCompany("MongoDB Inc.")] 19 | [assembly: AssemblyVersion("0.0.0.*")] 20 | [assembly: AssemblyFileVersion("0.0.0.0")] 21 | [assembly: AssemblyInformationalVersion("0.0.0-unofficial")] 22 | [assembly: AssemblyCopyright("Copyright © 2010-2017 MongoDB Inc.")] 23 | [assembly: AssemblyConfiguration("Debug")] 24 | --------------------------------------------------------------------------------