예제 #1
0
        private void Button12_Click(object sender, EventArgs e)
        {
            try
            {
                string HashRegistro = Biblioteca.MD5String(
                    Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].a) +
                    Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].b) +
                    Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].c) +
                    Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].d) +
                    Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].e)
                    );

                Memo2.AppendText("\r===================================");
                Memo2.AppendText("\rId = " + ListaPagamento[Grid2.CurrentRow.Index].Id);

                if (HashRegistro == ListaPagamento[Grid2.CurrentRow.Index].f)
                {
                    Memo2.AppendText("\rHash OK - Registro não violado.");
                }
                else
                {
                    Memo2.AppendText("\rHash Diferente - Registro violado.");
                }
                Memo2.AppendText("\r===================================");
            }
            catch (Exception eError)
            {
                MessageBox.Show(eError.Message);
            }
        }
예제 #2
0
 protected void newPXPMemo(UInt32 uLength)
 {
     if (PXPMemo is null)
     {
         PXPMemo = new Memo2 <PawnPosition>("PXP", uLength);
     }
 }
예제 #3
0
 private void Button14_Click(object sender, EventArgs e)
 {
     Button11.PerformClick();
     //
     Memo2.AppendText("\r=====================================================");
     Memo2.AppendText("\rHash Registro Bloqueado  = " + ListaPagamento[Grid2.CurrentRow.Index].f);
     Memo2.AppendText("\rChave Desbloqueio = " + Biblioteca.MD5String(ListaPagamento[Grid2.CurrentRow.Index].f + "uma_chave"));
     Memo2.AppendText("\r=====================================================");
 }
예제 #4
0
        protected void newCXPMemo(UInt32 uLength)
        {
            if (CXPMemo is null)
#if MaterialBalance
            { CXPMemo = new Memo2 <Composition2>("CX2", uLength); }
#else
            { CXPMemo = new Memo <Composition>("CXP", uLength); }
#endif
        }
예제 #5
0
 private void Button11_Click(object sender, EventArgs e)
 {
     try
     {
         Memo2.Clear();
         Memo2.AppendText("Mês = " + Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].a));
         Memo2.AppendText("\rAno = " + Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].b));
         Memo2.AppendText("\rVencimento = " + Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].c));
         Memo2.AppendText("\rBloqueio = " + Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].d));
         Memo2.AppendText("\rLiberado = " + Biblioteca.Desencripta(ListaPagamento[Grid2.CurrentRow.Index].e));
     }
     catch (Exception eError)
     {
         MessageBox.Show(eError.Message);
     }
 }
예제 #6
0
        private CompositionAlternatives2 RecursiveShrinking(
            string anagramCharPool,
            IList <Blob> dictionary,
            Memo2 memo,
            int level,
            int maxLevel)
        {
            if (memo.Has(anagramCharPool))
            {
                return(memo.Get(anagramCharPool));
            }

            if (level > maxLevel)
            {
                return(CompositionAlternatives2.DeadEnd);
            }

            var localBlackList = new List <Blob>();

            foreach (var wordEquivalencyClass in dictionary)
            {
                if (localBlackList.Contains(wordEquivalencyClass))
                {
                    //this is a "big bother of an instant looser so it is a bigger looser"
                    continue;
                }

                var difference = anagramCharPool.SubtractChars(wordEquivalencyClass.CharPool);


                switch (difference)
                {
                case null:     //negative
                    // this is an instant looser
                    localBlackList.AddRange(wordEquivalencyClass.BigBrothers);
                    continue;

                case "":     // solution
                    var solution = new BlobComposition(new List <Blob> {
                        wordEquivalencyClass
                    });
                    memo.Add(anagramCharPool, solution);
                    break;

                default:     //inconclusive
                    var sols = CompositionAlternatives2.GetCombined(RecursiveShrinking(difference, dictionary, memo, level++), wordEquivalencyClass);
                    if (!sols.IsDeadend)
                    {
                        memo.AddMultiple(anagramCharPool, sols);
                    }
                    break;
                }
            }

            if (!memo.Has(anagramCharPool))
            {
                memo.AddDeadEnd(anagramCharPool);
            }

            return(memo.Get(anagramCharPool));
        }
예제 #7
0
 public MemoTests()
 {
     _sut = new Memo2();
 }