示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            // Json formatında container nesnesi serialize edilir.
            string json = JsonConvert.SerializeObject(container);

            // şifreleme yapılır.
            json = new Sifreleyici().Sifrele(json, this.Anahtar);

            //txtOzet.Text = json;

            File.WriteAllText(path, json);
        }
示例#2
0
        private void openToolStripButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter           = "Minemosyne Files(*.acma)|*.acma";
            ofd.FilterIndex      = 1;
            ofd.RestoreDirectory = true;
            ofd.InitialDirectory = Application.StartupPath;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                path = ofd.FileName;

                lblDosyaAdi.Text       = ofd.SafeFileName.Replace(".acma", "");
                lblDosyaAdiStatus.Text = ofd.SafeFileName.Replace(".acma", "");

                if (File.Exists(path) == false)
                {
                    return;
                }

                try
                {
                    string json = File.ReadAllText(path);
                    json = new Sifreleyici().SifreCoz(json, this.Anahtar);

                    container = JsonConvert.DeserializeObject <KategoriContainer>(json);

                    LoadKategorilerSifreler(container);
                }
                catch (Exception)
                {
                    MessageBox.Show("Anahtar değer hatası", "Hatalı Anahtar", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);

                    AnahtarFormu.Show();
                    this.Close();
                }
            }
        }