Esempio n. 1
0
        private void metroButton2_Click(object sender, EventArgs e)
        {
            Security_AES256 aes = new Security_AES256("hthr7799");

            byte[] encFile = aes.EncryptByte(InitialFile);

            int NumberOfCopies = int.Parse(metroTextBox2.Text);

            OuterID = Class_FilePartition.ChooseOuterID();
            Class_FilePartition.FileNameSpaciel(FileName);
            Class_Data.FileNameToOuterID.Add(Class_Data.FileName, OuterID);
            Class_Data.OuterID = OuterID;
            int         encFileLength   = encFile.Length;
            int         ItemLength      = Class_FilePartition.ItemLength(encFileLength);
            int         LastBytesLength = Class_FilePartition.LastBitsPart(encFileLength, ItemLength);
            List <Item> ItemList        = Class_FilePartition.FileDivision(encFile, ItemLength, LastBytesLength, OuterID);


            for (int i = 0; i < NumberOfCopies; i++)
            {
                int[] FoldersFirstCopy = Class_ItemStorage.PathDetermination(ItemList, NumberOfUsers, Class_Data.GeneralPathToSave);
                for (int g = 0; g < FoldersFirstCopy.Length; g++)
                {
                    Data DataToList = new Data(OuterID, g, FoldersFirstCopy[g]);
                    Class_Data.DataList.Add(DataToList);
                }
                Class_ItemStorage.ItemSaving(ItemList, FoldersFirstCopy, Class_Data.GeneralPathToSave);
            }

            System.Windows.Forms.MessageBox.Show(Class_Data.FileName + " was successfully saved!");
        }
Esempio n. 2
0
        private void metroButton4_Click(object sender, EventArgs e)
        {
            string SelectedFile     = metroComboBox1.Text;
            int    OuterIDToRecover = Class_Data.FileNameToOuterID[SelectedFile];



            List <Data> FinalDataList = Class_FileRecovery.FinalRestoredFileDataList(OuterIDToRecover);

            byte[] FinalFile = Class_FileRecovery.FileRecreation(FinalDataList);

            Security_AES256 aes = new Security_AES256("hthr7799");

            byte[] decFile = aes.DecryptByte(FinalFile);

            File.WriteAllBytes(Class_Data.FinalLocation + SelectedFile, decFile);

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo.FileName = Class_Data.FinalLocation + SelectedFile;
            process.Start();


            System.Windows.Forms.MessageBox.Show(SelectedFile + " has been successfully restored!");
        }