/// <exception cref="ArgumentNullException">websocketContext == null. -или- closeFunc == null. -или- recieveFunc == null. /// -или- sendFunc == null. -или- core == null. -or- ipOfClient == null.</exception> public MolePushServerReciever(TcpClient clientF, MolePushServerCoreBase core, CustomBinarySerializerBase serializer) { if (clientF == null) { throw new ArgumentNullException(nameof(clientF)) { Source = GetType().AssemblyQualifiedName } } ; if (core == null) { throw new ArgumentNullException(nameof(core)) { Source = GetType().AssemblyQualifiedName } } ; if (serializer == null) { throw new ArgumentNullException(nameof(serializer)) { Source = GetType().AssemblyQualifiedName } } ; Core = core; ClientF = clientF; NetStreamF = ClientF.GetStream(); SerializerF = serializer; }
//protected ConcurrentDictionary<string, StreamForTempSaving> FilesSending; public MoleClientCore(CustomBinarySerializerBase serializer, string dirForFileSaving, ICollection <CryptoFactoryBase> factoriesBase, UserForm myUserForm, ISign signAlgImpl) : base(serializer, factoriesBase, myUserForm, signAlgImpl) { if (dirForFileSaving == null) { throw new ArgumentNullException(nameof(dirForFileSaving)) { Source = GetType().AssemblyQualifiedName } } ; if (string.IsNullOrEmpty(dirForFileSaving)) { throw new ArgumentException("Value cannot be null or empty.", nameof(dirForFileSaving)) { Source = GetType().AssemblyQualifiedName } } ; if (string.IsNullOrWhiteSpace(dirForFileSaving)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(dirForFileSaving)) { Source = GetType().AssemblyQualifiedName } } ; if (!Directory.Exists(dirForFileSaving)) { throw new ArgumentOutOfRangeException(nameof(dirForFileSaving), "Указанной директории не существует.") { Source = GetType().AssemblyQualifiedName } } ; ContactsF = new List <ContactForm>(); //var options = new Options() //{ // RewriteFileIfExist = true, // FullFilePath = dirForFileSaving + @"\contactsDb.mole", // PathToTableFile = dirForFileSaving + @"\contactsDbTable.mole", // SaveRAM = true, // Serializer = new ProtoBufSerializer() //}; //var factory = new Factory<ContactForm>(options); //ContactsF = new CollectionInFile<ContactForm>(factory); DirForFileSaving = dirForFileSaving; }
//protected Dictionary<string, CryptoProviderTupl> CryptoProviders; /// <exception cref="ArgumentNullException">nameOfCryptoProvider == null. -or- signAlg == null. /// -or- asEnc == null. -or- serializer == null. -or- nameOfCryptoProvider == null.</exception> protected MoleClientCoreBase(CustomBinarySerializerBase serializer, ICollection <CryptoFactoryBase> factoriesBase, UserForm myUserForm, ISign signAlgImpl) { if (serializer == null) { throw new ArgumentNullException(nameof(serializer)) { Source = GetType().AssemblyQualifiedName } } ; if (factoriesBase == null) { throw new ArgumentNullException(nameof(factoriesBase)) { Source = GetType().AssemblyQualifiedName } } ; if (!factoriesBase.Any()) { throw new ArgumentException("Value cannot be an empty collection.", nameof(factoriesBase)) { Source = GetType().AssemblyQualifiedName } } ; if (myUserForm == null) { throw new ArgumentNullException(nameof(myUserForm)) { Source = GetType().AssemblyQualifiedName } } ; if (signAlgImpl == null) { throw new ArgumentNullException(nameof(signAlgImpl)) { Source = GetType().AssemblyQualifiedName } } ; Ser = serializer; Factories = new ReadOnlyCollection <CryptoFactoryBase>(factoriesBase.ToArray()); MyUserForm = myUserForm; SignAlgImpl = signAlgImpl; }
public MoleClientCore(CustomBinarySerializerBase serializer, ICollection <CryptoFactoryBase> factoriesBase, UserForm myUserForm, IEnumerable <ContactForm> contactsF, ISign signAlgImpl) : base(serializer, factoriesBase, myUserForm, signAlgImpl) { if (contactsF == null) { throw new ArgumentNullException(nameof(contactsF)) { Source = GetType().AssemblyQualifiedName } } ; ContactsF = contactsF.ToList(); }