Exemple #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);
            }
        }
        void OnNextPage2Click(object sender, EventArgs e1, VolumeLocation vlp)
        {
            FireCryptVolume fcv = vlp.FinalVolume;

            this.FinalVolume = fcv;
            this.Close();
        }
Exemple #3
0
        void UnlockVol()
        {
            FCXMono.Debug("Initiating open 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";

            //dont change it before createvolume because it uses the older standard.
            VolumeFileLocation = volN; //point it to the actual .FireCrypt file.
            FireCryptVolume fcv = new FireCryptVolume(VolumeFileLocation);

            try
            {
                ValidVolume = true;
                FinalVolume = fcv;
                FCXMono.Debug("Volume opened successfully.");
            }
            catch (Exception e)
            {
                ValidVolume = false;
                Console.WriteLine("Volume opening was unsuccessful: {0}", e);
            }
            fcv.UnlockVolume(Password);
            Console.WriteLine("Vault unlocked to {0}", fcv.UnlockPath);
        }
        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.");
                }
            }
        }
        void Button1Click(object sender, EventArgs e)
        {
            //Choose existing
            OpenFileDialog sfd = new OpenFileDialog();

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

            if (dr == DialogResult.OK)
            {
                string tvfl = sfd.FileName;                 //test volume file location
                VolumeFileLocation = tvfl;
                if (tvfl.EndsWith(".FireCrypt"))
                {
                    tvfl = Path.GetDirectoryName(tvfl);
                }
                string vaultLoc = tvfl;
                label4.Text = VolumeFileLocation;
                try
                {
                    FireCryptVolume fcv = new FireCryptVolume(VolumeFileLocation);
                    ValidVolume       = true;
                    finishBtn.Enabled = ValidVolume;
                    FinalVolume       = fcv;
                }
                catch
                {
                    ValidVolume       = false;
                    finishBtn.Enabled = ValidVolume;
                    MessageBox.Show("Invalid Volume selected.");
                }
            }
        }
 void OnNextPage2Click(object sender, EventArgs e1, VolumeLocation vlp)
 {
     FireCryptVolume fcv = vlp.FinalVolume;
     this.FinalVolume = fcv;
     this.Close();
 }
		void Button1Click(object sender, EventArgs e)
		{
			//Choose existing
			OpenFileDialog sfd = new OpenFileDialog();
			sfd.Multiselect = false;
			sfd.Filter = "FireCrypt Volumes (*.FireCrypt)|*.FireCrypt|All files (*.*)|*.*"  ;
			DialogResult dr = sfd.ShowDialog();
			if (dr == DialogResult.OK)
			{
				string tvfl = sfd.FileName; //test volume file location
				VolumeFileLocation = tvfl;
				if (tvfl.EndsWith(".FireCrypt"))
				{
					tvfl = Path.GetDirectoryName(tvfl);
				}
				string vaultLoc = tvfl;
				label4.Text = VolumeFileLocation;
				try
				{
					FireCryptVolume fcv  = new FireCryptVolume(VolumeFileLocation);
					ValidVolume = true;
					finishBtn.Enabled = ValidVolume;
					FinalVolume = fcv;
				}
				catch
				{
					ValidVolume = false;
					finishBtn.Enabled = ValidVolume;
					MessageBox.Show("Invalid Volume selected.");
				}
			}
		}
		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)+Path.DirectorySeparatorChar+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.");
				}
			}
		}