Esempio n. 1
0
        public async Task <IActionResult> PutAcc([FromRoute] int id, [FromBody] Acc acc)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != acc.AccId)
            {
                return(BadRequest());
            }

            _context.Entry(acc).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AccExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
            public FireParticle()
            {
                Color(0xEE7722);
                Lifespan = 1f;

                Acc.Set(0, +80);
            }
Esempio n. 3
0
        protected override void BeforeRun()
        {
            Encoding.RegisterProvider(CosmosEncodingProvider.Instance);
            Console.InputEncoding  = Encoding.GetEncoding(437);
            Console.OutputEncoding = Encoding.GetEncoding(437);

            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Loading virtual FS...");
            VFSManager.RegisterVFS(Reference.FAT);

            if (Reference.FAT.GetVolumes().Count != 0)
            {
                ColorConsole.WriteLine(ConsoleColor.Green, "Sucessfully loaded the virtual FS!");
            }
            else
            {
                ColorConsole.WriteLine(ConsoleColor.Red, "Uh-oh, couldn't load the virtual FS...");
            }

            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Initializing SSE...");
            Global.CPU.InitSSE();
            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Initializing Float...");
            Global.CPU.InitFloat();

            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Initializing settings...");
            if (!File.Exists(Reference.Settings))
            {
                File.Create(Reference.Settings);
            }
            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Loading settings...");

            string layout = SettingsMan.Get("keyboard_layout");

            if (layout == "fr")
            {
                Sys.KeyboardManager.SetKeyLayout(new Sys.ScanMaps.FR_Standard());
            }
            else if (layout == "en")
            {
                Sys.KeyboardManager.SetKeyLayout(new Sys.ScanMaps.US_Standard());
            }
            else if (layout == "de")
            {
                Sys.KeyboardManager.SetKeyLayout(new Sys.ScanMaps.DE_Standard());
            }

            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Creating live account...");
            Acc acc = new Acc("Sartox", "123");

            acc.Create();

            Reference.Installed = File.Exists(Reference.RootPath + "Installed.txt");
            if (!Reference.Installed)
            {
                ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Loading setup...");
                Setup.Init();
            }

            Console.Clear();
            ColorConsole.WriteLine(ConsoleColor.Green, $"Welcome to Sartox OS v{Reference.Version}!");
        }
Esempio n. 4
0
        public override void Attack(int cell)
        {
            base.Attack(cell);

            Speed.Set(0, -FallSpeed);
            Acc.Set(0, FallSpeed * 4);
        }
Esempio n. 5
0
            public static Instruction CreateInstance(string instruction)
            {
                Instruction instance;

                var parts = instruction.Split(' ');
                var op    = parts[0];
                var val   = int.Parse(parts[1]);

                switch (op)
                {
                case "nop":
                    instance = new Nop();
                    break;

                case "acc":
                    instance = new Acc(val);
                    break;

                case "jmp":
                    instance = new Jmp(val);
                    break;

                default:
                    throw new ArgumentException($"Unknown operation {op}");
                }

                return(instance);
            }
Esempio n. 6
0
        public async Task <ActionResult <Acc> > PostAcc(Acc acc)
        {
            _context.Acc.Add(acc);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAcc", new { id = acc.id_acc }, acc));
        }
Esempio n. 7
0
        public override void Update()
        {
            base.Update();

            Am = Left / Lifespan;
            Acc.Set((_emitter.x - X) * 10, (_emitter.y - Y) * 10);
        }
Esempio n. 8
0
 public void SendMessage(String callee, String message)
 {
     ZDK_NET.Message msg = Acc.CreateMessage(MessageType.Simple);
     msg.Peer    = callee;
     msg.Content = message;
     msg.SendMessage();
 }
Esempio n. 9
0
        public override void Update()
        {
            base.Update();

            Am = (Left / Lifespan) / 2;
            Acc.Set(-Speed.X * 10, -Speed.Y * 10);
        }
Esempio n. 10
0
 public Flame()
     : base(Assets.FIREBALL)
 {
     Frame(pdsharp.utils.Random.Int(2) == 0 ? Flame1 : Flame2);
     Origin.Set(Width / 2, Height / 2);
     Acc.Set(0, ACC);
 }
Esempio n. 11
0
        public Owner()
        {
            //Перебераем все записи в таблице Acc, если нет ниодной записи с полными правами, то создаем ее
            //С указанными выше логином и паролем
            using (LenternContext db = new LenternContext())
            {
                var selectOwner = from acc in db.Accs
                                  where acc.Owner == true
                                  select acc;

                int i = 0;
                foreach (Acc a in selectOwner)
                {
                    if (a.Owner == true)
                    {
                        i++;
                    }
                }

                if (i == 0)
                {
                    Acc own = new Acc {
                        Login = OwnerLogin, Password = OwnerPassword, Admin = true, Owner = true
                    };
                    db.Accs.Add(own);
                    db.SaveChanges();
                }
            }
        }
Esempio n. 12
0
        public async Task <IActionResult> PutAcc(int id, Acc acc)
        {
            if (id != acc.id_acc)
            {
                return(BadRequest());
            }

            _context.Entry(acc).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AccExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 13
0
        public ElmoParticle()
        {
            Color(0x22EE66);
            Lifespan = 0.6f;

            Acc.Set(0, -80);
        }
Esempio n. 14
0
        public BloodParticle()
        {
            Color(0xCC0000);
            Lifespan = 0.8f;

            Acc.Set(0, +40);
        }
Esempio n. 15
0
    public void Solve()
    {
        int H = 2 * K;
        int W = 2 * K;

        int[][][] M = new int[2][][];
        for (int i = 0; i < 2; i++)
        {
            M[i] = new int[H][];
            for (int j = 0; j < H; j++)
            {
                M[i][j] = new int[W];
            }
        }

        for (int i = 0; i < N; i++)
        {
            M[C[i]][Y[i] % H][X[i] % W]++;
        }

        var asum = new Acc[2];

        for (int i = 0; i < 2; i++)
        {
            asum[i] = new Acc(H, W);
            asum[i].Init(M[i]);
        }

        int max = 0;

        for (int t = 0; t < 2; t++)
        {
            for (int i = 0; i < K; i++)
            {
                for (int j = 0; j < K; j++)
                {
                    int cnt0 = 0;
                    cnt0 += asum[t].cal(j, i, j + K, i + K);
                    cnt0 += asum[t].cal(j + K, i + K, W, H);
                    cnt0 += asum[t].cal(0, 0, j, i);
                    cnt0 += asum[t].cal(j + K, 0, W, i);
                    cnt0 += asum[t].cal(0, i + K, j, H);

                    int cnt1 = 0;
                    cnt1 += asum[t ^ 1].cal(j, i, j + K, i + K);
                    cnt1 += asum[t ^ 1].cal(j + K, i + K, W, H);
                    cnt1 += asum[t ^ 1].cal(0, 0, j, i);
                    cnt1 += asum[t ^ 1].cal(j + K, 0, W, i);
                    cnt1 += asum[t ^ 1].cal(0, i + K, j, H);

                    int tt = asum[t ^ 1].cal(0, 0, W, H);
                    cnt1 = tt - cnt1;

                    max = Math.Max(max, cnt1 + cnt0);
                }
            }
        }

        Console.WriteLine(max);
    }
Esempio n. 16
0
        static void Main()
        {
            IAccount vGoldAccount  = new GoldAccount();
            IAccount vSaverAccount = new SaverAccount();

            ITransferAccount vCurAccount = new CurrentAccount();

            vGoldAccount.Credit(10000);
            vSaverAccount.Credit(100);

            Console.WriteLine($"Gold Account Balance {vGoldAccount.Balance,6:C}");
            Console.WriteLine(vSaverAccount.ToString());

            vSaverAccount.Debit(1000);


            IAccount[] allAccounts = new IAccount[2];
            allAccounts[0] = vGoldAccount;
            allAccounts[1] = vSaverAccount;

            //Dividend...
            foreach (IAccount Acc in allAccounts)
            {
                Acc.Credit(10);
            }


            vCurAccount.Transfer(vSaverAccount, vCurAccount);
        }
Esempio n. 17
0
        public FlameParticle()
        {
            Color(0xEE7722);
            Lifespan = 0.6f;

            Acc.Set(0, -80);
        }
Esempio n. 18
0
 private static void UpdateAll(IEnumerable <Node> entities, long cnt)
 {
     Acc.Update(cnt);
     foreach (Node entity in entities)
     {
         entity.Frequency = cnt;
     }
 }
Esempio n. 19
0
        public EarthParticle()
        {
            Lifespan = 0.5f;

            Color(ColorMath.Random(0x555555, 0x777766));

            Acc.Set(0, +40);
        }
Esempio n. 20
0
        public void SetAccounts(params string[] Acc)
        {
            List <string> result = Acc.Concat(Accounts).ToList();

            result.Remove("");
            result = result.Distinct().ToList();
            SetOneValue(C.Objecte.Account1C, result.Aggregate((a, b) => $"{a},{b}"));
        }
 public void Step()
 {
     run(idx, buffer1, buffer2);
     Acc.Synchronize();
     if (CopyBack)
     {
         var r = buffer1.GetAsArray();
     }
 }
Esempio n. 22
0
        public frmMain(Acc acc)
        {
            InitializeComponent();
            this.LoginAccount = acc;
            panel1.Controls.Clear();
            ucMain UCSV = new ucMain();

            panel1.Controls.Add(UCSV);
            UCSV.Dock = DockStyle.Fill;
        }
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (SourceItem != null ? SourceItem.GetHashCode() : 0);
         result = (result * 397) ^ (Ascc != null ? Ascc.GetHashCode() : 0);
         result = (result * 397) ^ (Acc != null ? Acc.GetHashCode() : 0);
         return(result);
     }
 }
Esempio n. 24
0
        public override void Revive()
        {
            base.Revive();

            Speed.Set(0);
            Acc.Set(0);
            dropInterval = 0;

            heap = null;
        }
Esempio n. 25
0
 //状态转换
 public override void StateCheck()
 {
     if (Acc.Balance > 0)
     {
         Acc.SetState(new NormalState(this));
     }
     else if (Acc.Balance > -2000)
     {
         Acc.SetState(new OverdraftState(this));
     }
 }
Esempio n. 26
0
        public async Task <IActionResult> PostAcc([FromBody] Acc acc)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Acc.Add(acc);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAcc", new { id = acc.AccId }, acc));
        }
Esempio n. 27
0
 public int GetHashCode(Acc obj)
 {
     if (obj == null)
     {
         return(0);
     }
     if (obj == "")
     {
         return(0);
     }
     return(obj.result.GetHashCode());
 }
Esempio n. 28
0
        public virtual void Reset(float x, float y)
        {
            Revive();

            X = x;
            Y = y;

            Left = Lifespan;

            Acc.Set(0);
            Speed.Set(Random.Float(-40, +40), Random.Float(-40, +40));
        }
Esempio n. 29
0
        public async Task <ActionResult <request> > PostrequestApproval([FromBody] RequestApproval ra, [FromHeader] string api_token)
        {
            AuthController newAuth      = new AuthController(_context);
            var            ActionResult = await newAuth.getId(api_token);

            var OkObjectResult = ActionResult as OkObjectResult;

            int userId = (int)OkObjectResult.Value;

            int?credit_rate = null;

            if (_context.request.Any(x => x.id_request == ra.id))
            {
                var app_request = _context.request.Where(x => x.id_request == ra.id).ToList();
                if (app_request[0].status_request_id == 1)
                {
                    return(Ok());
                }
                else
                {
                    app_request[0].status_request_id = ra.s_r_id;
                    await _context.SaveChangesAsync();

                    var UpdatedApp = await _context.request.FindAsync(ra.id);                           //1-accepted 2-rejected 3-approval

                    if (ra.s_r_id == 1)
                    {
                        AccsController Acc = new AccsController(_context);
                        if (app_request[0].type_acc_id == 3)
                        {
                            credit_rate = 2;
                        }
                        Acc new_acc = new Acc
                        {
                            balance_acc    = credit_rate == 2 ? _context.credit_rate.Where(x => x.id_credit_rate == 2).ToList()[0].credit_limit:0,
                            credit_rate_id = credit_rate,
                            client_id      = app_request[0].client_id,
                            date_open_acc  = DateTime.Now,
                            date_close_acc = DateTime.Now.AddYears(4),
                            status_acc_id  = 1,                                                           //1-open 2-frozen 3-closed
                            type_acc_id    = app_request[0].type_acc_id
                        };
                        await Acc.PostAcc(new_acc);
                    }
                    return(UpdatedApp);
                }
            }
            else
            {
                return(NotFound());
            }
        }
Esempio n. 30
0
        public virtual void Reset(float x, float y, Emitter emitter)
        {
            Revive();

            X        = x;
            Y        = y;
            _emitter = emitter;

            Left = Lifespan;

            Acc.Set(0);
            Speed.Set(Random.Float(-20, +20), Random.Float(-20, +20));
        }