Ejemplo n.º 1
0
        public void GetIntで無効なkeyを指定すると例外が発生する()
        {
            //setUp
            var sut = new Reg(TestUtil.GetTmpPath(TmpDir));

            //exercise
            sut.GetInt("key1");
        }
Ejemplo n.º 2
0
        public void GetIntでKeyにnullを指定すると例外が発生する()
        {
            //setUp
            var sut = new Reg(TestUtil.GetTmpPath(TmpDir));

            //exercise
            sut.GetInt(null);
        }
Ejemplo n.º 3
0
        void mul(string[] ops)
        {
            Reg dst  = DstOp(ops[0]),
                src0 = SrcOp(ops[1]),
                src1 = SrcOp(ops[2]);


            for (int i = 0; i < dst.Length; i++)
            {
                Next = Assign(dst[i], dst.IsBoolean, new CodeBinaryOperatorExpression(src0[i], CodeBinaryOperatorType.Multiply, src1[i]));
            }
        }
Ejemplo n.º 4
0
        public MatchCollection Matchs(Regex regex, string input)
        {
            var r = new Reg(regex, input);

            r.OnMatchComplete += MatchCompleteHandler;

            var t = new Thread(r.Matchs);

            t.Start();
            Sleep(t);
            return(_mc);
        }
Ejemplo n.º 5
0
        void acos(string[] ops)
        {
            Reg dst  = DstOp(ops[0]),
                src0 = SrcOp(ops[1]);

            for (int i = 0; i < dst.Length; i++)
            {
                Next = Assign(dst[i], dst.IsBoolean, new CodeCastExpression(typeof(float),
                                                                            new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(
                                                                                                               new CodeTypeReferenceExpression(typeof(System.Math)), "Acos"), src0[i])));
            }
        }
Ejemplo n.º 6
0
        void SaveColumnSetting()
        {
            string v = Reg.TranslateString(ListColSize);

            Debug.Print("Saving Col Sizes");
            Debug.Print(v);
            if (!string.IsNullOrEmpty(v))
            {
                ListColumns = v;
            }
            ListFontSize = lve.Font.SizeInPoints.ToString();
        }
 public override bool RefreshLayout()
 {
     brushPause    = new SolidBrush(Color.FromArgb(255, 255, 255, 0));
     TomatoSetting = Program.AppSetting.In("Setting").In("Tomato");
     restTime      = Convert.ToInt32(TomatoSetting.GetInfo("restTime", "300"));
     workTime      = Convert.ToInt32(TomatoSetting.GetInfo("workTime", "1500"));
     nowTime       = nowTime * 0.95f + targetNowTime * 0.05f;
     if (Math.Abs(nowTime - targetNowTime) > 0.1)
     {
         this.Invalidate();
     }
     return(base.RefreshLayout());
 }
Ejemplo n.º 8
0
        private static void handle_const(Reg to_reg, long v, List <MCInst> r, CilNode.IRNode n, Code c)
        {
            if (to_reg.type != rt_gpr)
            {
                throw new NotImplementedException();
            }

            r.Add(inst(n, arm_mov_imm, Rd: to_reg, imm: (int)(v & 0xffff)));
            if (v < 0 || v > UInt16.MaxValue)
            {
                r.Add(inst(n, arm_movt_imm, Rd: to_reg, imm: (int)((v >> 16) & 0xffff)));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Read from a CC2420 register.  The first byte written is the register
        /// address, with the RAM/~REG bit (bit 7) set to 0 and the R/~W bit (bit 6)
        /// set to 1; two don't-care bytes follow.  The first byte read is the status
        /// byte (discarded since readOffset = 1), the next two bytes are the 16-bit
        /// register, read MSB first.
        ///
        /// The SPI transaction looks like (X = Don't care values):
        ///        SI:  0  1 A5 A4 A3 A2 A1 A0   X   X   X   X   X ...  X  X
        ///        SO: S7 S6 S5 S4 S3 S2 S1 S0 D15 D14 D13 D12 D11 ... D1 D0
        ///
        /// </summary>
        /// <param name="reg">The address of the register to read</param>
        /// <returns>         The value read from the register   </returns>
        public ushort ReadReg(Reg reg)
        {
            byte[] read       = new byte[2];
            byte[] write      = new byte[] { (byte)((int)reg | 0x40), 0, 0 };
            int    readOffset = 1;

            lock (_spi)
            {
                _spi.WriteRead(write, read, readOffset);
            }

            return((ushort)((read[0] << 8) + read[1]));
        }
Ejemplo n.º 10
0
        public IActionResult EditPic(int UserId, Reg editUser)
        {
            ViewBag.Id = HttpContext.Session.GetInt32("UId");
            Reg user = dbContext.Users
                       .FirstOrDefault(p => p.UserId == HttpContext.Session.GetInt32("UId"));

            user.FirstName  = editUser.FirstName;
            user.LastName   = editUser.LastName;
            user.Username   = editUser.Username;
            user.ProfilePic = editUser.ProfilePic;
            dbContext.SaveChanges();
            return(RedirectToAction("Account"));
        }
Ejemplo n.º 11
0
        private void button11_Click(object sender, EventArgs e)
        {
            string s = textBox1.Text;

            Reg.Stud(s, out MatchCollection mtch);
            if (mtch.Count > 0)
            {
                foreach (Match n in mtch)
                {
                    label21.Text = $"Найдено номеров студенческих билетов: {n.Value}";
                }
            }
        }
Ejemplo n.º 12
0
            public static void SetFormPos(System.Windows.Forms.Form frm)
            {
                if (frm.WindowState != System.Windows.Forms.FormWindowState.Normal)
                {
                    return;
                }
                Reg fn = GetFrmLocationReg(frm);

                fn.SetInfo("x", frm.Left > 0?frm.Left:0);
                fn.SetInfo("y", frm.Top > 0 ? frm.Top : 0);
                fn.SetInfo("w", frm.Width > 0 ? frm.Width : 0);
                fn.SetInfo("h", frm.Height > 0 ? frm.Height : 0);
            }
Ejemplo n.º 13
0
        private void button10_Click(object sender, EventArgs e)
        {
            string s = textBox1.Text;

            Reg.Data(s, out MatchCollection mat);
            if (mat.Count > 0)
            {
                foreach (Match n in mat)
                {
                    label22.Text = $"Найдено: {n.Value}";
                }
            }
        }
Ejemplo n.º 14
0
        bool mov_r3264_creg(List <OutputBlock> ret, AsmParser.ParseOutput op, List <AsmParser.ParseOutput> prefixes,
                            List <AsmParser.ParseOutput> parameters, AssemblerState state)
        {
            Reg r  = regs[parameters[1].Name];
            Reg rm = regs[parameters[0].Name];

            AppendRex(ret, GenerateRex(false, r, rm));
            ret.Add(new CodeBlock {
                Code = new byte[] { 0x0f, 0x20 }
            });
            AppendModRM(ret, r, rm, state);
            return(true);
        }
Ejemplo n.º 15
0
        public static void RegForwarding(Options option, params string[] keys)
        {
            if (keys == null || keys.Length == 0)
            {
                return;
            }
            var backup = PathEx.Combine($"%TEMP%\\backup-{{{Math.Abs(PathEx.LocalPath.GetHashCode())}}}.reg");
            var file   = PathEx.Combine(PathEx.LocalDir, "Data\\settings.reg");

            switch (option)
            {
            case Options.Exit:
                if (keys.Length > 0)
                {
                    Reg.ExportKeys(file, keys);
                    foreach (var key in keys)
                    {
                        Reg.RemoveSubKey(key);
                    }
                }
                if (!File.Exists(backup))
                {
                    return;
                }
                Reg.ImportFile(backup);
                File.Delete(backup);
                break;

            default:
                if (!keys.Any(x => Reg.EntryExists(x, "Portable App")))
                {
                    if (!File.Exists(backup))
                    {
                        Reg.ExportKeys(backup, keys);
                    }
                    foreach (var key in keys)
                    {
                        Reg.RemoveSubKey(key);
                    }
                }
                foreach (var key in keys)
                {
                    Reg.Write(key, "Portable App", "True");
                }
                if (File.Exists(file))
                {
                    Reg.ImportFile(file);
                }
                break;
            }
        }
Ejemplo n.º 16
0
            public Entry(string line)
            {
                if (!Reg.IsMatch(line))
                {
                    throw new Exception("Commandline client bad output");
                }

                Match match = Reg.Match(line);

                this.createdRevision = int.Parse(match.Groups[1].ToString());
                this.author          = match.Groups[2].ToString();

                if (match.Groups[3].Success)
                {
                    this.size = long.Parse(match.Groups[3].ToString());
                }
                else
                {
                    this.size = 0;
                }

                System.IFormatProvider format =
                    System.Globalization.CultureInfo.CurrentCulture;

                // get the month and day
                string date = match.Groups[4].ToString();

                this.time = DateTime.ParseExact(date, "MMM' 'dd",
                                                format);

                // the year
                if (match.Groups[5].Success)
                {
                    this.time = this.time.AddYears(-this.time.Year +
                                                   int.Parse(match.Groups[5].ToString()));
                }

                // or the time of day?
                DateTime timeOfDay = DateTime.Today;

                if (match.Groups[6].Success)
                {
                    timeOfDay = DateTime.ParseExact(match.Groups[6].ToString(),
                                                    "HH':'mm", format);
                }
                this.time = this.time.AddHours(timeOfDay.Hour);
                this.time = this.time.AddMinutes(timeOfDay.Minute);

                this.path = match.Groups[7].ToString();
            }
Ejemplo n.º 17
0
        private void button14_Click(object sender, EventArgs e)
        {
            string s = textBox1.Text;

            Reg.FindEmail(s, out Match m);
            while (m.Success)
            {
                if (m.Success)
                {
                    label30.Text = $"Найдено: {m.Value}";
                }
                m = m.NextMatch();
            }
        }
Ejemplo n.º 18
0
        private void button12_Click(object sender, EventArgs e)
        {
            string s = textBox1.Text;

            Reg.CorrectTime(s, out Match m);
            while (m.Success)
            {
                if (m.Success)
                {
                    label26.Text = $"Найдено: {m.Value}";
                }
                m = m.NextMatch();
            }
        }
        public ActionResult Login(Reg r)
        {
            var l = db.Regs.Where(a => a.username.Equals(r.username) && a.password.Equals(r.password)).FirstOrDefault();

            if (l != null)
            {
                return(RedirectToAction("Index", "User"));
            }
            else
            {
                return(RedirectToAction("Login", "User"));
            }
            return(View());
        }
Ejemplo n.º 20
0
        public static void callMillicodeSupport2(int procIndex, SObject a,
                                                 SObject b)
        {
#if HAS_PERFORMANCE_COUNTERS
            if (millicodeSupportCallCounter != null)
            {
                millicodeSupportCallCounter.Increment();
            }
#endif
            saveContext(false);
            Reg.setRegister(1, a);
            Reg.setRegister(2, b);
            call1(getSupportProcedure(procIndex), 2);
        }
Ejemplo n.º 21
0
        public void Setstringで保存した値をgetstringで読み出す()
        {
            //setUp
            var sut = new Reg(TestUtil.GetTmpPath(TmpDir));

            sut.SetString("key2", "2");
            var expected = "2";

            //exercise
            var actual = sut.GetString("key2");

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Ejemplo n.º 22
0
        // GET: Regs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Reg reg = db.Regs.Find(id);

            if (reg == null)
            {
                return(HttpNotFound());
            }
            return(View(reg));
        }
Ejemplo n.º 23
0
        public void Setstringでvalにnullを指定すると空白が保存される()
        {
            //setUp
            var sut = new Reg(TestUtil.GetTmpPath(TmpDir));

            sut.SetString("key1", null);
            var expected = "";

            //exercise
            var actual = sut.GetString("key1");

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Ejemplo n.º 24
0
            internal static ErrorState Get(string registryKey, out string cdKey)
            {
                cdKey = null;
                ErrorState errorState = Reg.IsValidAsErrorState(registryKey);

                if (errorState != ErrorState.None)
                {
                    return(errorState);
                }

                cdKey = Registry.GetValue(registryKey, "codkey", string.Empty).ToString();

                return(ErrorState.None);
            }
Ejemplo n.º 25
0
Archivo: Scop.cs Proyecto: QsCompany/Qs
        public void UnLock(Reg reg)
        {
            if (ModeReg == ModeReg.Auto)
            {
                throw new Exception();
            }
            var stat = GetStat(reg);

            if (stat == null)
            {
                return;
            }
            stat.locked = false;
        }
Ejemplo n.º 26
0
        public void SetIntで保存した値をgetIntで読み出す()
        {
            //setUp
            var sut = new Reg(TestUtil.GetTmpPath(TmpDir));

            sut.SetInt("key1", 1);
            var expected = 1;

            //exercise
            var actual = sut.GetInt("key1");

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Ejemplo n.º 27
0
        //greater than or equal
        void ge(string[] ops)
        {
            Reg dst  = DstOp(ops[0]),
                src0 = SrcOp(ops[1]),
                src1 = SrcOp(ops[2]);

            for (int i = 0; i < dst.Length; i++)
            {
                Next = new CodeConditionStatement(
                    new CodeBinaryOperatorExpression(src0[i], CodeBinaryOperatorType.GreaterThanOrEqual, src1[i]),
                    new CodeStatement[] { Assign(dst[i], dst.IsBoolean, Zero) },
                    new CodeStatement[] { Assign(dst[i], dst.IsBoolean, One) });
            }
        }
        public void ReplaceDateTest()
        {
            string inputString = "Все даты в тексте записаны в западноевропейском формате: 2012.11.21 " +
                                 "Привести их к принятому формату у нас: 21.11.2012 " +
                                 "1999.12.31; 2012.02.29-date" +
                                 "192.168.1.1; 2222.2.22; 2000.00.01";
            string actualString = "Все даты в тексте записаны в западноевропейском формате: 21.11.2012 " +
                                  "Привести их к принятому формату у нас: 21.11.2012 " +
                                  "31.12.1999; 29.02.2012-date" +
                                  "192.168.1.1; 2222.2.22; 2000.00.01";
            string outputString = Reg.ReplaceDate(inputString);

            Assert.AreEqual(actualString, outputString);
        }
Ejemplo n.º 29
0
        private static void handle_push(Reg reg, ref int push_length, List <MCInst> r, CilNode.IRNode n, Code c)
        {
            switch (reg.type)
            {
            case rt_gpr:
                r.Add(inst(n, arm_push, register_list: new Param[] { reg }));
                push_length += c.t.psize;

                break;

            default:
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 30
0
        public override void CGenStmt(Env env, CGenState state)
        {
            Reg ret = CGenExprStmt(env, this.Cond, state);

            Int32 finish_label = state.RequestLabel();

            CGenTest(ret, state);

            state.JZ(finish_label);

            this.Stmt.CGenStmt(env, state);

            state.CGenLabel(finish_label);
        }
        public void ReplaceEmailTest()
        {
            string inputString = "8. Заменить в тексте адреса электронной почты [email protected] на [email protected]" +
                                 "[email protected] " +
                                 "@tut.by " +
                                 "user@@tut.by ";
            string actualString = "8. Заменить в тексте адреса электронной почты [email protected] на [email protected]" +
                                  "[email protected] " +
                                  "@tut.by " +
                                  "user@@tut.by ";
            string outputString = Reg.ReplaceEmail(inputString);

            Assert.AreEqual(actualString, outputString);
        }
Ejemplo n.º 32
0
 internal Reg(Reg <T> orig)
 {
     tp           = orig.tp;
     DateFormat6  = orig.DateFormat6;
     DateFormat8  = orig.DateFormat8;
     DateFormat10 = orig.DateFormat10;
     DateFormat12 = orig.DateFormat12;
     DateFormat14 = orig.DateFormat14;
     Acentos      = orig.Acentos;
     Upper        = orig.Upper;
     fields       = orig.fields;
     valuesRF     = orig.valuesRF;
     valuesItem   = new SortedList <string, object>();
 }
    protected void btn_Click(object sender, EventArgs e)
    {
        // Assim juntando os 3 conceitos: Reflection, Attributs, e Generics a classe Reg<T> é criada
        // Veja aqui alguns breves exemplos de tradução de valores com a Reg<T>
        IReg ir=null;
        try
        {
            switch (rblTipo.SelectedValue)
            {
                case "0":   // Traduz linhas de Header CNAB400
                    Reg<CNAB400Header1Bradesco> r0 = new Reg<CNAB400Header1Bradesco>();
                    ir = r0;
                    r0.Line = txt.Text;
                    break;

                case "1":   // Traduz linhas de registro Bradesco
                    Reg<CNAB400Remessa1Bradesco> r1 = new Reg<CNAB400Remessa1Bradesco>();
                    ir = r1;
                    r1.Line = txt.Text;
                    break;

                case "2":   // Traduz linhas de registro Bradesco (tipo 2 apenas como sendo expemplo para simplificar)
                    Reg<CNAB400Retorno1Bradesco> r2 = new Reg<CNAB400Retorno1Bradesco>();
                    ir = r2;
                    r2.Line = txt.Text;
                    break;

                case "9":   // Traduz linhas de rodape CNAB400
                    Reg<CNAB400ArquivoTrailer> r9 = new Reg<CNAB400ArquivoTrailer>();
                    ir = r9;
                    r9.Line = txt.Text;
                    break;
            }
            lbl.Text = "OK";
        }
        catch (Exception ex)
        {
            // Se o layout não estiver de acordo com o tipo de dado esperado pode haver erros de conversão.
            // Imagine por exemplo a conversão de textos em campo numericos de data ou valor
            lbl.Text = ex.Message;
        }
        lbl.Text += "<pre>" + ir.Dump + "</pre>";
    }
Ejemplo n.º 34
0
 public Int32 CGenPushLong(Reg src) {
     PUSHL(src);
     stack_size += 4;
     return stack_size;
 }
Ejemplo n.º 35
0
 public void CGenPopLong(Int32 saved_size, Reg dst) {
     if (stack_size == saved_size) {
         POPL(dst);
         stack_size -= 4;
     } else {
         MOVL(-saved_size, Reg.EBP, dst);
     }
 }
Ejemplo n.º 36
0
 public void SUBL(Reg er, Reg ee, String comment = "") => SUBL(RegToString(er), RegToString(ee), comment);
Ejemplo n.º 37
0
 public void SETNA(Reg dst) => SETNA(RegToString(dst));
Ejemplo n.º 38
0
 public void SHRL(Reg er, Reg ee) => SHRL(RegToString(er), RegToString(ee));
Ejemplo n.º 39
0
 public void ADDL(Reg er, Reg ee, String comment = "") => ADDL(RegToString(er), RegToString(ee), comment);
Ejemplo n.º 40
0
 public void ORL(Reg er, Reg ee, String comment = "") {
     ORL(RegToString(er), RegToString(ee), comment);
 }
Ejemplo n.º 41
0
 private void InitializeContiguousSpace(int startAt, int count)
 {
     slots = new Reg[count];
     for (int i = 0; i < count; i++)
         slots[i] = new Reg() { regNo = startAt + i, beg = startAt, size = count };
 }
Ejemplo n.º 42
0
 public void MUL(Reg er) {
     MUL(RegToString(er));
 }
Ejemplo n.º 43
0
 public static String RegToString(Reg reg) => reg_strs[reg];
Ejemplo n.º 44
0
 public void IMUL(Reg er) {
     IMUL(RegToString(er));
 }
Ejemplo n.º 45
0
 public void XORL(Reg er, Reg ee) {
     XORL(RegToString(er), RegToString(ee));
 }
Ejemplo n.º 46
0
 public void SHRL(Int32 er, Reg ee) => SHRL($"${er}", RegToString(ee));
Ejemplo n.º 47
0
 private void FILDL(Int32 offset, Reg dst) => FILDL($"{offset}({RegToString(dst)})");
Ejemplo n.º 48
0
 public void ANDB(Int32 er, Reg ee) => ANDB($"${er}", RegToString(ee));
Ejemplo n.º 49
0
 private void btn_Registration_Click(object sender, RoutedEventArgs e)
 {
     Reg w = new Reg();
     w.ShowDialog();
 }
Ejemplo n.º 50
0
 public RPSLote()
 {
     _Cabecalho = new Reg<RPS1Cabecalho>();
     _Itens = new RPSLoteItens();
     _rodape = new Reg<RPS9Rodape>();
 }
Ejemplo n.º 51
0
 public void IDIVL(Reg er) => IDIVL(RegToString(er));
Ejemplo n.º 52
0
 public void SALL(Reg er, Reg ee) {
     SALL(RegToString(er), RegToString(ee));
 }
Ejemplo n.º 53
0
 public void DIVL(Reg er) => DIVL(RegToString(er));
Ejemplo n.º 54
0
 public void CMPL(Reg er, Reg ee) => CMPL(RegToString(er), RegToString(ee));
Ejemplo n.º 55
0
 /// <summary>
 /// Adiciona um item completo já predefinido
 /// </summary>
 /// <param name="rItem"></param>
 public void Add(Reg<RPS2Detalhe> rItem)
 {
     if (_itens.ContainsKey((int)rItem[RPS2Detalhe.Numero]))
         throw new Exception("Já existe uma RPS com esse numero");
     else
         _itens.Add((int)rItem[RPS2Detalhe.Numero], rItem);
 }
Ejemplo n.º 56
0
 public void CMPL(Int32 imm, Reg ee) => CMPL($"${imm}", RegToString(ee));
Ejemplo n.º 57
0
 /// <summary>
 /// Adiciona as informações basicas da notafiscal, apos esta etapa é necessário definir o endereço
 /// </summary>
 /// <param name="nNumero">Número da RPS</param>
 /// <param name="cCPFCNPJ">CPF ou CNPJ do tomador do serviço</param>
 /// <param name="cNomeRazao">Nome ou Razão Social</param>
 /// <param name="nCodigo">Código do Serviço</param>
 /// <param name="nAliquota">Aliquota</param>
 /// <param name="cDiscriminacao">Disciminação dos serviços (as quebras de linha serão convertidas no formato exigido pela RPS/NF-e)</param>
 /// <param name="nValor">Valor</param>
 /// <param name="nDeducoes">Deduções</param>
 /// <param name="ISSretido">Reter ISS</param>
 /// <param name="dData">Data de emissão</param>
 public Reg<RPS2Detalhe> Add(int nNumero, string cCPFCNPJ, string cNomeRazao, int nCodigo, double nAliquota, string cDiscriminacao, double nValor, double nDeducoes, bool ISSretido, DateTime dData)
 {
     Reg<RPS2Detalhe> item = new Reg<RPS2Detalhe>();
     cCPFCNPJ = cCPFCNPJ.Replace(".", "").Replace("-", "").Replace("/", "").Replace(" ", "");
     item[RPS2Detalhe.Numero] = nNumero;
     item[RPS2Detalhe.Data] = dData;
     item[RPS2Detalhe.Indicador] = (cCPFCNPJ.Length == 11) ? 1 : 2;
     item[RPS2Detalhe.Tomador] = cCPFCNPJ;
     item[RPS2Detalhe.RazaoSocial] = cNomeRazao;
     item[RPS2Detalhe.Aliquota] = nAliquota;
     item[RPS2Detalhe.Codigo] = nCodigo;
     item[RPS2Detalhe.Discriminacao] = cDiscriminacao.Replace("\n", "").Replace("\r", "|");
     item[RPS2Detalhe.Valor] = nValor;
     item[RPS2Detalhe.Deducoes] = nDeducoes;
     item[RPS2Detalhe.ISS] = (ISSretido) ? 1 : 2;
     Add(item);
     return item;
 }
Ejemplo n.º 58
0
 public void TESTL(Reg er, Reg ee) => TESTL(RegToString(er), RegToString(ee));
Ejemplo n.º 59
0
 public void ANDL(Reg er, Reg ee) => ANDL(RegToString(er), RegToString(ee));
Ejemplo n.º 60
0
 public void SUBL(Int32 er, Reg ee, String comment = "") => SUBL($"${er}", RegToString(ee), comment);