Beispiel #1
0
 /// <summary>
 /// Generates the Shared Key for this pair (My Secret Key - Your Public Key)
 /// </summary>
 /// <param name="secretKey"></param>
 /// <param name="peerPublicKey"></param>
 internal SharedSecretKey(SecretKey secretKey, PublicKey peerPublicKey)
 {
     KeyValue = AlgorithmService.GetSharedSecretKey(
         privateKey: secretKey.KeyValue,
         peerPublicKey: peerPublicKey.KeyValue);
     Uid = Guid.NewGuid();
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BacktestDaemonState"/> class.
 /// </summary>
 /// <param name="algoService">The algorithm service.</param>
 /// <param name="allocationManager">The allocation manager.</param>
 /// <param name="exchangeFactory">The exchange factory service.</param>
 public BacktestDaemonState(AlgorithmService algoService, IAllocationManager allocationManager, ExchangeFactoryService exchangeFactory)
 {
     Guard.Argument(algoService).NotNull();
     AlgorithmService  = algoService;
     AllocationManager = allocationManager;
     ExchangeFactory   = exchangeFactory;
 }
Beispiel #3
0
        protected override async Task OnParametersSetAsync()
        {
            if (SaveAs == SaveAs.Full || SaveAs == SaveAs.Page)
            {
                await SaveAsSVG();
            }
            if (GraphMode == GraphMode.Default)
            {
                SvgClass = "grab";
            }
            else if (GraphMode == GraphMode.InsertNode)
            {
                SvgClass = "insert";
            }
            else if (GraphMode == GraphMode.Algorithm)
            {
                if (StartAlgorithm.Ready)
                {
                    if (!StartAlgorithm.Done)
                    {
                        AlgorithmService.RunAlgorithm(Options, StartAlgorithm, Graph, AlgoExplain, ref PlayAlgorithm);
                        await AlgoExplainChanged.InvokeAsync(AlgoExplain);

                        await StartAlgorithmChanged.InvokeAsync(StartAlgorithm);
                    }
                    else
                    {
                        UpdateAlgoGraph();
                    }
                }
            }
        }
Beispiel #4
0
        //Helper Method
        private AlgorithmService CreateAlgorithmService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new AlgorithmService(userId);

            return(service);
        }
 public ManualRecogTriggerService(AlgorithmService algService, AlghorithmFaceRecognition faceRecognition, IHcFaceDetection faceDetection, IAuthenticationService authenticationService, ICaptureService captureService)
 {
     _algService            = algService;
     _faceRecognition       = faceRecognition;
     _faceDetection         = faceDetection;
     _authenticationService = authenticationService;
     _captureService        = captureService;
 }
 public MainViewController(ITestImageRepository testImageRepository, IRegionManager regionManager, IAuthenticationService authenticationService, AlgorithmService algorithmService, IEventAggregator ea)
 {
     _regionManager         = regionManager;
     _authenticationService = authenticationService;
     _algorithmService      = algorithmService;
     _ea = ea;
     _testImageRepository = testImageRepository;
 }
 public StartWorkViewController(AlgorithmService algorithmService, IEventAggregator ea)
 {
     _algorithmService = algorithmService;
     _ea       = ea;
     StartWork = new DelegateCommand(OnStartWorkExecute);
     StopWork  = new DelegateCommand(OnStopWorkExecute,
                                     () => !_pauseRequested && !_stopRequested && (!_vm?.IsPaused ?? true));
     TogglePauseWork = new DelegateCommand(TogglePauseExecute, () => !_pauseRequested && !_stopRequested);
 }
Beispiel #8
0
 private async void LoadAlgorithms()
 {
     try {
         AlgorithmService service = new AlgorithmService();
         AlgorithmsList = await service.GetAlgorithmsAsync();
     }catch (NoNetworkException e)
     {
         ShowToast(e.ToString());
     }
 }
Beispiel #9
0
        static void Main(string[] args)
        {
            try
            {
                var fileService = new FileService();
                var inputFiles  = fileService.GetInputFiles();

                foreach (var inputFile in inputFiles)
                {
                    var fileContents = fileService.ReadFile(inputFile);

                    Console.WriteLine($"File {inputFile} has been read out.");

                    Console.WriteLine($"Amount of rows: {fileContents.Rows}");
                    Console.WriteLine($"Amount of columns: {fileContents.Columns}");
                    Console.WriteLine($"Number of vehicles in fleet: {fileContents.NumberOfVehicles}");
                    Console.WriteLine($"Number of rides: {fileContents.NumberOfRides}");
                    Console.WriteLine($"Bonus for starting on time: {fileContents.PerRideBonusForStartingOnTime}");
                    Console.WriteLine($"Number of steps in simulation: {fileContents.NumberOfStepsInSimulation}");
                    Console.WriteLine();

                    //TODO Execute algorithm
                    var algorithmService = new AlgorithmService();

                    var result = algorithmService.AssignRides(fileContents);

                    //TODO Write correct solution to file
                    fileService.WriteFile(inputFile, result);
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
            }
            finally
            {
                Console.ReadLine();
            }
        }
        public ProfileViewController(ITestImageRepository testImageRepository, IAuthenticationService authenticationService, IRegionManager rm, AlgorithmService moduleService)
        {
            _testImageRepository   = testImageRepository;
            _authenticationService = authenticationService;
            _rm            = rm;
            _moduleService = moduleService;
            RestartInit    = new DelegateCommand(() =>
            {
                _rm.Regions[ShellRegions.MainRegion].RequestNavigate(nameof(ProfileInitView));
            }, () => !_moduleService.Alghorithm.Started);


            _moduleService.Alghorithm.AlgorithmStopped += () =>
            {
                _vm.AlgorithmStarted = false;
                RestartInit.RaiseCanExecuteChanged();
            };
            _moduleService.Alghorithm.AlgorithmStarted += () =>
            {
                _vm.AlgorithmStarted = true;
                RestartInit.RaiseCanExecuteChanged();
            };
        }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BacktestDaemonService"/> class.
 /// </summary>
 /// <param name="algoService">The algorithm service.</param>
 /// <param name="allocationManager">The allocation manager.</param>
 /// <param name="exchangeFactoryService">The exchange factory service.</param>
 public BacktestDaemonService(AlgorithmService algoService, IAllocationManager allocationManager, ExchangeFactoryService exchangeFactoryService)
 {
     State = new BacktestDaemonState(algoService, allocationManager, exchangeFactoryService);
 }
 public void GetSharedKeyBobAlice2() => Assert.IsTrue(NaCL_Curve25519TestVectors.AliceBobSharedKey
                                                      .SequenceEqual(AlgorithmService.GetSharedSecretKey(NaCL_Curve25519TestVectors.AlicePublicKey2, NaCL_Curve25519TestVectors.BobPrivateKey)));
 public TriggerRecognitionNavigation(IRegionManager rm, AlgorithmService moduleService, IEventAggregator ea)
 {
     _rm            = rm;
     _moduleService = moduleService;
     _ea            = ea;
 }
Beispiel #14
0
 public WorkTimeEsRepositorDecorator(IWorkTimeEsRepository repository, AlgorithmService moduleService)
 {
     _repository    = repository;
     _moduleService = moduleService;
 }
 public ClockworkEngine()
 {
     iOService        = new InputOutputService();
     algorithmService = new AlgorithmService();
     fieldState       = new PolygonState();
 }
 public void GetPublicKeySegments() => Assert.IsTrue(NaCL_Curve25519TestVectors.BobPublicKey
                                                     .SequenceEqual(AlgorithmService.GetPublicKey(NaCL_Curve25519TestVectors.BobPrivateKey)));
Beispiel #17
0
 public BasicAlgorithmServiceTests()
 {
     _algorithmService = new AlgorithmService();
 }
 public void GetSharedKeyAliceFrank() => Assert.IsTrue(NaCL_Curve25519TestVectors.AliceFrankSharedKey
                                                       .SequenceEqual(AlgorithmService.GetSharedSecretKey(NaCL_Curve25519TestVectors.FrankPublicKey, NaCL_Curve25519TestVectors.AlicePrivateKey)));
Beispiel #19
0
 /// <summary>
 /// Generates the Public Key for this Private Key
 /// </summary>
 /// <param name="secretKey">My Private Key</param>
 internal PublicKey(SecretKey secretKey)
 {
     KeyValue = AlgorithmService.GetPublicKey(secretKey: secretKey.KeyValue);
     Uid      = Guid.NewGuid();
 }
 public SecretKey()
 {
     _secretKeyValue = AlgorithmService.GetRandomPrivateKey();
 }