public BridgeController(IOptions <WebBridgeOptions> options, IStreamBridge streamBridge, UrlEncoder urlEncoder, ISign sign, IRequestBridgeNotifier requestBridgeNotifier, ILogger <BridgeController> logger)
 {
     _options               = options?.Value ?? throw new ArgumentNullException(nameof(options));
     _streamBridge          = streamBridge ?? throw new ArgumentNullException(nameof(streamBridge));
     _sign                  = sign ?? throw new ArgumentNullException(nameof(sign));
     _urlEncoder            = urlEncoder ?? throw new ArgumentNullException(nameof(urlEncoder));
     _requestBridgeNotifier = requestBridgeNotifier ?? throw new ArgumentNullException(nameof(requestBridgeNotifier));
     _logger                = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public PasswordProjectStor(ISerializationHelper <PaswordProjectDataStor> serializationHelper
                            , ICryptor cryptor
                            , ISign sign
                            , IFileReadWriteHelper fileReadWrite)
 {
     SerializationHelper = serializationHelper;
     Cryptor             = cryptor;
     Sign          = sign;
     FileReadWrite = fileReadWrite;
 }
示例#3
0
        public MainWindow()
        {
            InitializeComponent();

            TextPosition.ItemsSource = Enums.GetValues <Position>().Select(p => new Item <Position>(p.AsString(EnumFormat.Description), p)).ToList();
            //TextPosition.DisplayMemberPath = "Name";

            TextMode.ItemsSource = Enums.GetValues <Mode>().Select(p => new Item <Mode>(p.AsString(EnumFormat.Description), p)).ToList();

            _sign = new Sign();            // FakeSign();
        }
示例#4
0
        public DiscreteCentralMoment(int i, int j, ISign <Point> centerOfMass)
        {
            if (centerOfMass == null)
            {
                throw new ArgumentNullException("centerOfMass");
            }

            this.i            = i;
            this.j            = j;
            this.centerOfMass = centerOfMass;
        }
示例#5
0
文件: Density.cs 项目: spzSource/IMGP
        public Density(ISign <double> squareSign, ISign <double> perimeterSign)
        {
            if (squareSign == null)
            {
                throw new ArgumentNullException("squareSign");
            }
            if (perimeterSign == null)
            {
                throw new ArgumentNullException("perimeterSign");
            }

            this.squareSign    = squareSign;
            this.perimeterSign = perimeterSign;
        }
示例#6
0
        //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;
        }
示例#7
0
        //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;
        }
示例#8
0
 public UsersAuth(bookingContext context, IProfile _profile, ISign sign)
 {
     _bookingContext = context;
     profile         = _profile;
     _sign           = sign;
 }
示例#9
0
        public int InsertNewSign(string[] parameters)
        {
            ISign sign = DALFactory.CreateSign();

            return(sign.Insert((object[])parameters));
        }
示例#10
0
 public void AddSign(ISign <Object> sign)
 {
     this._content.Add(sign);
 }
示例#11
0
 public void AddSign(ISign <object> sign)
 {
     madeFromSheet.AddSign(sign);
 }
示例#12
0
        /// <exception cref="ArgumentNullException">factory == null. -or- signImpl == null. -or-
        /// publicKeyForm == null.</exception>
        /// <exception cref="InvalidOperationException">Login == null.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Source: <see cref="CryptoFactoryBase.CreateHashAlgorithm(string, string)"/></exception>
        public byte[] CreateSign(CryptoFactoryBase factory, PublicKeyForm publicKeyForm, ISign signImpl,
                                 out byte[] hash)
        {
            if (publicKeyForm == null)
            {
                throw new ArgumentNullException(nameof(publicKeyForm))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;

            return(CreateSign(factory, publicKeyForm.HashAlg, publicKeyForm.CryptoProvider, signImpl, out hash));
        }
示例#13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SignEvent"/> class with the specified <paramref name="sign"/>.
 /// </summary>
 /// <param name="sign">The sign involved in the event.</param>
 /// <exception cref="ArgumentNullException"><paramref name="sign"/> is <see langword="null"/>.</exception>
 protected SignEvent(ISign sign)
 {
     Sign = sign ?? throw new ArgumentNullException(nameof(sign));
 }
示例#14
0
 public LogInCommand(ISign curVM)
 {
     CurVM = curVM;
 }
示例#15
0
 /// <exception cref="Exception">All exceptions from Source: <see cref="CreateSign(CryptoFactoryBase, PublicKeyForm, ISign, out byte[])"/>.</exception>
 public void CreateSign(CryptoFactoryBase factory, PublicKeyForm publicKeyForm, ISign signImpl)
 {
     byte[] hash;
     Sign = CreateSign(factory, publicKeyForm, signImpl, out hash);
     Hash = hash;
 }
示例#16
0
 /// <exception cref="Exception">All exceptions from Source: <see cref="CreateSign(CryptoFactoryBase, string, string, ISign,out byte[])"/>.</exception>
 public void CreateSign(CryptoFactoryBase factory, string hashAlgName, string providerName, ISign signImpl)
 {
     byte[] hash;
     Sign = CreateSign(factory, hashAlgName, providerName, signImpl, out hash);
     Hash = hash;
 }
示例#17
0
        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();
        }
示例#18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SignReadEvent"/> class with the specified
 /// <paramref name="sign"/> and <paramref name="player"/>.
 /// </summary>
 /// <param name="sign">The sign being read.</param>
 /// <param name="player">The player reading the sign.</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="sign"/> or <paramref name="player"/> are <see langword="null"/>.
 /// </exception>
 public SignReadEvent(ISign sign, IPlayer player) : base(sign)
 {
     Player = player ?? throw new ArgumentNullException(nameof(player));
 }
示例#19
0
        /// <exception cref="ArgumentNullException">factory == null. -or- signImpl == null.</exception>
        /// <exception cref="InvalidOperationException">Login == null.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Source: <see cref="CryptoFactoryBase.CreateHashAlgorithm(string, string)"/></exception>
        public byte[] CreateSign(CryptoFactoryBase factory, string hashAlgName, string providerName, ISign signImpl,
                                 out byte[] hash)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;
            if (signImpl == null)
            {
                throw new ArgumentNullException(nameof(signImpl))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;
            if (Login == null)
            {
                throw new InvalidOperationException("Login == null.")
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;

            try
            {
                var hashAlg      = factory.CreateHashAlgorithm(providerName, hashAlgName);
                var loginAsBytes = Encoding.UTF8.GetBytes(Login);
                hash = hashAlg.ComputeHash(loginAsBytes);
                var sign = signImpl.SignData(hash);
                return(sign);
            }
            catch (ArgumentOutOfRangeException ex)
            {
                //factory.CreateHashAlgorithm(providerName, hashAlgName);
                throw;
            }
        }