예제 #1
0
        void CreateVol()
        {
            FCXMono.Debug("Initiating create volume...");
            FireCryptVolume FinalVolume;
            bool            ValidVolume;
            string          VolumeFileLocation = VolumePath;
            string          fnwoext            = Path.GetFileNameWithoutExtension(VolumeFileLocation); //filenamewithout extension
            string          volN = Path.GetDirectoryName(VolumeFileLocation) + Path.DirectorySeparatorChar + fnwoext + ".vault" + Path.DirectorySeparatorChar + fnwoext + ".FireCrypt";

            FireCryptVolume.CreateNewVolume(VolumeFileLocation, VolumeLabel, Password, "1.0");
            //dont change it before createvolume because it uses the older standard.
            VolumeFileLocation = volN;             //point it to the actual .FireCrypt file.
            try
            {
                FireCryptVolume fcv = new FireCryptVolume(VolumeFileLocation);
                ValidVolume = true;
                FinalVolume = fcv;
                FCXMono.Debug("Volume created successfully.");
            }
            catch (Exception e)
            {
                ValidVolume = false;
                Console.WriteLine("Volume creation was unsuccessful: {0}", e);
            }
        }
예제 #2
0
        void Button2Click(object sender, EventArgs e)
        {
            //create new
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter = "FireCrypt Volumes (*.FireCrypt)|*.FireCrypt|All files (*.*)|*.*";
            DialogResult dr = sfd.ShowDialog();

            if (dr == DialogResult.OK)
            {
                VolumeFileLocation = sfd.FileName;
                label4.Text        = VolumeFileLocation;
                string fnwoext = Path.GetFileNameWithoutExtension(VolumeFileLocation);                 //filenamewithout extension
                string volN    = Path.GetDirectoryName(VolumeFileLocation) + "\\" + fnwoext + ".vault\\" + fnwoext + ".FireCrypt";
                FireCryptVolume.CreateNewVolume(VolumeFileLocation, VolumeName, Password, VolumeVersion);
                //dont change it before createvolume because it uses the older standard.
                VolumeFileLocation = volN;                 //point it to the actual .FireCrypt file.
                try
                {
                    FireCryptVolume fcv = new FireCryptVolume(VolumeFileLocation);
                    ValidVolume       = true;
                    finishBtn.Enabled = ValidVolume;
                    FinalVolume       = fcv;
                }
                catch
                {
                    ValidVolume       = false;
                    finishBtn.Enabled = ValidVolume;
                    MessageBox.Show("Volume creation error.");
                }
            }
        }