Example #1
0
        private void LinkItem_Click(object sender, EventArgs e)
        {
            LinkToolStripMenuItem linkStrip = sender as LinkToolStripMenuItem;
            ILink link = linkStrip.AssociatedLink;

            if (link == null)
            {
                return;
            }

            ListViewItem i = new LinkListViewItem(link);

            lvChain.Items.Add(i);
        }
Example #2
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            if (lvChain.Items.Count < 1)
            {
                MessageBox.Show("Chain is empty, please add a link");
                return;
            }
            string        currentString = rtbInput.Text;
            Stopwatch     sw            = new Stopwatch();
            bool          success       = true;
            StringBuilder sb            = new StringBuilder();

            foreach (ListViewItem i in lvChain.Items)
            {
                if (success == false)
                {
                    i.SubItems[1].Text = "";
                    i.SubItems[2].Text = "";
                    i.SubItems[3].Text = "";
                    continue;
                }
                sw.Start();
                LinkListViewItem llItem = i as LinkListViewItem;
                try
                {
                    if (llItem == null)
                    {
                        throw new Exception("Invalid Link");
                    }
                    ILink link = ((LinkListViewItem)i).AssociatedLink;
                    currentString = cbDecode.Checked ? link.Decode(currentString) : link.Encode(currentString);
                    if (sb.Length != 0)
                    {
                        sb.Append(" > ");
                    }
                    sb.Append(link.Name);
                }
                catch (Exception ex)
                {
                    success       = false;
                    currentString = ex.Message;
                }
                sw.Stop();
                if (llItem != null)
                {
                    i.SubItems[1].Text = sw.ElapsedMilliseconds.ToString() + "ms";
                    i.SubItems[2].Text = success.ToString();
                    i.SubItems[3].Text = currentString;
                }
                sw.Reset();

                if (cbDecode.Checked)
                {
                    tbDecryptChain.Text = "[D] " + sb.ToString();
                }
                else
                {
                    tbDecryptChain.Text = sb.ToString();
                }
            }

            rtbOutput.Text = success ? currentString : string.Empty;
        }