Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            currentCard = null;

            richTextBox1.ContextMenu = contextMenu1;
        }
Exemplo n.º 2
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem != null)
            {
                splitContainer2.Visible = true;
                if (currentCard != null)
                {
                    currentCard.rtfData = richTextBox1.Rtf;
                }

                richTextBox1.Rtf = ((DexCard)listBox1.SelectedItem).rtfData;
                currentCard      = (DexCard)listBox1.SelectedItem;
            }
            else
            {
                splitContainer2.Visible = false;
            }
        }
Exemplo n.º 3
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //listBox1.SelectedIndex = 0;

            if (listBox1.SelectedItem != null)
            {
                splitContainer2.Visible = true;
                if (currentCard != null)
                {
                    currentCard.rtfData = richTextBox1.Rtf;
                }
            }

            DialogResult dr = saveFileDialog1.ShowDialog();

            String path = "default.dex";

            try
            {
                if (saveFileDialog1.FileName != null && dr == DialogResult.OK)
                {
                    path = saveFileDialog1.FileName;
                }

                CardHive hive = new CardHive();

                foreach (Object o in listBox1.Items)
                {
                    DexCard card = (DexCard)o;
                    hive.Add(card);
                }

                hive.SerializeToXML(path);
            }
            catch (Exception de)
            {
            }
        }
Exemplo n.º 4
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem != null)
            {
                DexCard rename = ((DexCard)listBox1.SelectedItem);

                Add_Card newName = new Add_Card("Rename Card");
                newName.ShowDialog();

                if (newName.newCardName != null)
                {
                    rename.name = newName.newCardName;
                }
                else
                {
                    return;
                }

                int oldIndex = listBox1.SelectedIndex;

                listBox1.Items.Remove(rename);
                listBox1.Items.Insert(oldIndex, rename);
            }
        }
Exemplo n.º 5
0
        private DexCard readIndex()
        {
            int offset = br.ReadInt32();
            // MessageBox.Show("Going to offset " + offset);

            Int64 warpZone = br.BaseStream.Position;

            br.BaseStream.Seek(offset, SeekOrigin.Begin);

            String data;

            br.ReadBytes(2);

            int dl = br.ReadInt16();

            //MessageBox.Show("Length " + dl);
            data = new String(br.ReadChars(dl));
            // MessageBox.Show("Data " + data.Trim());
            br.BaseStream.Seek(warpZone, SeekOrigin.Begin);

            char cr = br.ReadChar();
            // MessageBox.Show(cr+"");

            String title = new String(br.ReadChars(47));
            // MessageBox.Show("Length " + title);


            DexCard dc = new DexCard(title.Trim(new char[] { '\0', '\r', '\n', ' ' }));

            dc.StoreRTF(data);

            dc.sanitize();


            return(dc);
        }