Пример #1
0
        public bool CanCreateSigner(string signatureName)
        {
            var signatureNameLower = signatureName.ToLower();

            return(signatureNameLower == AlgorithmName.ToLower() ||
                   signatureNameLower == "Gost34311withGost34310x2004".ToLower());
        }
        public async Task <IHttpActionResult> CreateModels(AlgorithmName algorithmName)
        {
            var minMaxValues = _analysisManager.ReadMinMaxValues();

            try
            {
                using (var client = new WebClient())
                {
                    foreach (var csvLocation in _csvLocations)
                    {
                        var response = client.UploadFile(new Uri("http://localhost:8080/SussolWebservice/api/model/" + algorithmName.ToString().ToLower()),
                                                         csvLocation);
                        //creatie van model binnen algoritme
                        var jsonResponse = Encoding.Default.GetString(response);
                        var algorithm    = JsonHelper.ParseJson(jsonResponse, minMaxValues.ToList());
                        _analysisManager.CreateAlgorithm(algorithm);
                    }
                    client.Dispose();
                    return(Ok());
                }
            }
            catch (Exception e)
            {
                return(BadRequest("An error occurred while generating the model."));
            }
        }
 public Model ReadModel(string dataSet, AlgorithmName algorithmName)
 {
     return(_context.Models
            .Include(p => p.Clusters)
            .Include(p => p.Clusters.Select(pt => pt.DistanceToClusters))
            .Include(p => p.Clusters.Select(pt => pt.Solvents))
            .Include(p => p.Clusters.Select(pt => pt.Solvents.Select(v => v.Features)))
            .Where(t => t.DataSet.Equals(dataSet))
            .FirstOrDefault(a => a.AlgorithmName == algorithmName));
 }
Пример #4
0
        /// <summary>
        /// This method is auto-generated using Visual Studio.
        /// </summary>
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = 696079939;
                hashCode = hashCode * -1521134295 + AlgorithmName.GetHashCode();
                hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(HexDigest);

                return(hashCode);
            }
        }
        public void Select_ValidArrayLenthOne_SequenceScript()
        {
            uint minLenth = 1;
            uint maxLenth = 2;
            uint num      = 1;

            string[]      array    = { "3" };
            AlgorithmName expected = AlgorithmName.Sequence;
            Mock <IInnerDataValidator> validator = new Mock <IInnerDataValidator>();

            validator.Setup(x => x.ValidateInputArray(It.IsAny <string[]>())).Returns(true);
            validator.Setup(x => x.ConvertArrayToParams(It.IsAny <string[]>(), out num)).Returns(true);
            AlgoritmSelector algoritmSelector = new AlgoritmSelector(validator.Object, minLenth, maxLenth);

            IAlgorithm result = algoritmSelector.Select(array);

            Assert.AreEqual(result.Name, expected);
        }
Пример #6
0
        public SymmetricKeyProvider(AlgorithmName name = AlgorithmName.Aes, AlgorithmMode mode = AlgorithmMode.Cbc, AlgorithmPadding padding = AlgorithmPadding.Pkcs7, byte[] salt = null)
        {
            Name    = name;
            Mode    = mode;
            Padding = padding;
            Salt    = salt ?? DefaultSalt;
            switch (Name)
            {
            case AlgorithmName.Aes:
                _alg = Aes.Create();
                break;

            case AlgorithmName.TripleDes:
                _alg = TripleDES.Create();
                break;
            }
            switch (Mode)
            {
            case AlgorithmMode.Cbc:
                _alg.Mode = CipherMode.CBC;
                break;

            case AlgorithmMode.Ecb:
                _alg.Mode = CipherMode.ECB;
                break;
            }
            switch (Padding)
            {
            case AlgorithmPadding.None:
                _alg.Padding = PaddingMode.None;
                break;

            case AlgorithmPadding.Pkcs7:
                _alg.Padding = PaddingMode.PKCS7;
                break;

            case AlgorithmPadding.Zeros:
                _alg.Padding = PaddingMode.Zeros;
                break;
            }
        }
Пример #7
0
        public SettingsWindow()
        {
            DataContext = Settings.Instance;
            InitializeComponent();

            foreach (var DragEffectName in Enum.GetNames(typeof(DragEffect)))
            {
                DragEffectComboBox.Items.Add(new ComboBoxItem()
                {
                    Content = DragEffectName.Replace('_', ' ')
                });
            }

            foreach (var AlgorithmName in Enum.GetNames(typeof(Algorithm)))
            {
                AlgorithmComboBox.Items.Add(new ComboBoxItem()
                {
                    Content = AlgorithmName.Replace('_', ' ')
                });
            }
        }
Пример #8
0
        public static Result Sort(AlgorithmName algorithm, int[] input)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            int[] resultValues = null;

            if (algorithm == AlgorithmName.InsertionSort)
            {
                resultValues = RunInsertionSort(input);
            }
            else
            if (algorithm == AlgorithmName.SelectionSort)
            {
                resultValues = RunSelectionSort(input);
            }
            else
            if (algorithm == AlgorithmName.HeapSort)
            {
                resultValues = RunHeapSort(input);
            }
            else
            if (algorithm == AlgorithmName.CocktailSort)
            {
                resultValues = RunCocktailSort(input);
            }
            else
            if (algorithm == AlgorithmName.QuickSort)
            {
                resultValues = RunQuickSort(input);
            }

            sw.Stop();

            Result result = new Result(resultValues, sw.Elapsed);

            return(result);
        }
 public Model ReadModel(string dataSet, AlgorithmName algorithmName)
 {
     return(repo.ReadModel(dataSet, algorithmName));
 }
Пример #10
0
 public List <Model> ReadModelsForAlgorithm(AlgorithmName algorithmName)
 {
     return(repo.ReadModelsForAlgorithm(algorithmName));
 }
 public List <Model> ReadModelsForAlgorithm(AlgorithmName algorithmName)
 {
     return(_context.Models.Where(m => m.AlgorithmName == algorithmName).ToList());
 }
Пример #12
0
 public override int GetHashCode()
 {
     return(AlgorithmName.GetHashCode() + this.ExecutionID.GetHashCode());
 }