Beispiel #1
0
        private void вставитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SavedRecord.Number_Inode_Property = Emulator.getFreeInode();
            RootDirRecord ForCopy = new RootDirRecord();

            ForCopy.Name_Property         = SavedRecord.Name_Property;
            ForCopy.Exstension_Property   = SavedRecord.Exstension_Property;
            ForCopy.Number_Inode_Property = SavedRecord.Number_Inode_Property;
            ForCopy.Name_Property         = ForCopy.Name_Property.Replace(" ", string.Empty);
            ForCopy.Name_Property         = SavedRecord.Name_Property.Replace(" ", string.Empty) + '_' + numofcopy;
            ForCopy.Name_Property        += (new string(' ', 20 - ForCopy.Name_Property.Length));
            numofcopy++;

            SavedInode.Number_Property      = ForCopy.Number_Inode_Property;
            SavedInode.File_Create_Property = DateTime.Now;
            SavedInode.File_Modif_Property  = DateTime.Now;
            for (int i = 0; i < SavedInode.Array_Of_Address_Property.Length; i++)
            {
                SavedInode.Array_Of_Address_Property[i] = 0;
            }

            Emulator.CreateRecord(ForCopy, SavedInode);
            Emulator.Bind(Emulator.RecCurPos.Number_Inode_Property);
            Emulator.FillData(ForCopy.Name_Property.Replace(" ", string.Empty), textdata);

            RefreshTreeList();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Inode inode = new Inode();
            if (checkBox1.Checked == true)
            {
                checkBox7.Checked = false;
                checkBox8.Checked = false;
                checkBox9.Checked = false;
            }
            string acc = "1";

            acc += (checkBox4.Checked == true) ? '1' : '0';
            acc += (checkBox7.Checked == true) ? '1' : '0';
            acc += (checkBox10.Checked == true) ? '1' : '0';
            acc += (checkBox5.Checked == true) ? '1' : '0';
            acc += (checkBox8.Checked == true) ? '1' : '0';
            acc += (checkBox11.Checked == true) ? '1' : '0';
            acc += (checkBox6.Checked == true) ? '1' : '0';
            acc += (checkBox9.Checked == true) ? '1' : '0';
            acc += (checkBox12.Checked == true) ? '1' : '0';

            acc += (checkBox1.Checked == true) ? '1' : '0';
            acc += (checkBox2.Checked == true) ? '1' : '0';
            acc += (checkBox3.Checked == true) ? '1' : '0';

            tempI.Access_Property      = Emulator.setAccess(acc);
            tempI.User_ID_Property     = Convert.ToByte(textBox3.Text);
            tempI.Group_ID_Property    = Convert.ToByte(textBox4.Text);
            tempI.File_Size_Property   = Convert.ToInt32(textBox5.Text);
            tempI.File_Create_Property = Convert.ToDateTime(textBox6.Text);
            tempI.File_Modif_Property  = Convert.ToDateTime(textBox7.Text);

            tempI.Number_Property = tempR.Number_Inode_Property;

            RootDirRecord newtempR = new RootDirRecord();

            newtempR.Name_Property         = textBox1.Text;
            newtempR.Name_Property        += (new string(' ', 20 - newtempR.Name_Property.Length));
            newtempR.Exstension_Property   = textBox2.Text;
            newtempR.Exstension_Property  += (new string(' ', 5 - newtempR.Exstension_Property.Length));
            newtempR.Number_Inode_Property = tempR.Number_Inode_Property;
            //&& OldEx== newtempR.Exstension_Property.Replace(" ", string.Empty)
            if (OldName == newtempR.Name_Property.Replace(" ", string.Empty))
            {
                this.Close();
                Emulator.Replacement(tempR.Name_Property.Replace(" ", string.Empty), newtempR, tempI);
            }
            else
            {
                if (Emulator.CheckRecord(newtempR.Name_Property.Replace(" ", string.Empty), newtempR.Exstension_Property.Replace(" ", string.Empty)) == true)
                {
                    this.Close();
                    Emulator.Replacement(tempR.Name_Property.Replace(" ", string.Empty), newtempR, tempI);
                }
                else
                {
                    MessageBox.Show("Запись с таким именем уже существует!");
                }
            }
        }
Beispiel #3
0
        private void копироватьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int index = listView1.SelectedIndices[0];

            SelectFile = listView1.Items[index].Text;
            SelectFile = SelectFile.Substring(0, SelectFile.LastIndexOf('.'));

            RootDirRecord tempR = Emulator.FindRec(SelectFile);
            Inode         tempI = Emulator.FindInode(tempR.Number_Inode_Property);

            if (Emulator.CheckID(Emulator.CurrentUser, tempI) == true)
            {
                SavedRecord = Emulator.FindRec(SelectFile);

                SavedInode = Emulator.FindInode(SavedRecord.Number_Inode_Property);

                textdata = Emulator.ReadData(SelectFile);

                numofcopy = 1;

                вставитьToolStripMenuItem.Enabled = true;
            }
            else
            {
                MessageBox.Show("У вас недостаточно прав!");
            }
        }
Beispiel #4
0
        private void свойстваToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int index = listView1.SelectedIndices[0];

            SelectFile = listView1.Items[index].Text;
            SelectFile = SelectFile.Substring(0, SelectFile.LastIndexOf('.'));
            RootDirRecord tempR = Emulator.FindRec(SelectFile);
            Inode         tempI = Emulator.FindInode(tempR.Number_Inode_Property);

            if (Emulator.CheckID(Emulator.CurrentUser, tempI) == true)
            {
                Change = true;
            }
            else
            {
                Change = false;
            }

            Prop P = new Prop();

            P.Owner = this;
            P.ShowDialog();

            удалитьToolStripMenuItem.Enabled    = false;
            копироватьToolStripMenuItem.Enabled = false;
            свойстваToolStripMenuItem.Enabled   = false;

            RefreshTreeList();
        }
Beispiel #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            Inode inode = new Inode();

            if (checkBox1.Checked == true)
            {
                checkBox7.Checked = false;
                checkBox8.Checked = false;
                checkBox9.Checked = false;
            }
            string acc = "1";

            acc += (checkBox4.Checked == true) ? '1' : '0';
            acc += (checkBox7.Checked == true) ? '1' : '0';
            acc += (checkBox10.Checked == true) ? '1' : '0';
            acc += (checkBox5.Checked == true) ? '1' : '0';
            acc += (checkBox8.Checked == true) ? '1' : '0';
            acc += (checkBox11.Checked == true) ? '1' : '0';
            acc += (checkBox6.Checked == true) ? '1' : '0';
            acc += (checkBox9.Checked == true) ? '1' : '0';
            acc += (checkBox12.Checked == true) ? '1' : '0';

            acc += (checkBox1.Checked == true) ? '1' : '0';
            acc += (checkBox2.Checked == true) ? '1' : '0';
            acc += (checkBox3.Checked == true) ? '1' : '0';

            inode.Access_Property      = Emulator.setAccess(acc);
            inode.User_ID_Property     = Convert.ToByte(textBox3.Text);
            inode.Group_ID_Property    = Convert.ToByte(textBox4.Text);
            inode.File_Size_Property   = Convert.ToInt32(textBox5.Text);
            inode.File_Create_Property = Convert.ToDateTime(textBox6.Text);
            inode.File_Modif_Property  = Convert.ToDateTime(textBox7.Text);
            inode.Block_Count_Property = 0;

            for (int i = 0; i < inode.Array_Of_Address_Property.Length; i++)
            {
                inode.Array_Of_Address_Property[i] = 0;
            }
            inode.Number_Property = Emulator.getFreeInode();

            RootDirRecord rec = new RootDirRecord();

            rec.Name_Property         = textBox1.Text;
            rec.Name_Property        += (new string(' ', 20 - rec.Name_Property.Length));
            rec.Exstension_Property   = '.' + textBox2.Text;
            rec.Exstension_Property  += (new string(' ', 5 - rec.Exstension_Property.Length));
            rec.Number_Inode_Property = inode.Number_Property;

            if (Emulator.CheckRecord(rec.Name_Property.Replace(" ", string.Empty), rec.Exstension_Property.Replace(" ", string.Empty)) == true)
            {
                this.Close();
                Emulator.CreateRecord(rec, inode);
                Emulator.Bind(Emulator.RecCurPos.Number_Inode_Property);
            }
            else
            {
                MessageBox.Show("Запись с таким именем уже существует!");
            }
        }
Beispiel #6
0
        private void Properties_Load(object sender, EventArgs e)
        {
            Work main = this.Owner as Work;

            if (main != null)
            {
                temptext = main.SelectFile;
                tempR    = Emulator.FindRec(temptext);
                tempI    = Emulator.FindInode(tempR.Number_Inode_Property);

                textBox1.Text = tempR.Name_Property.Replace(" ", string.Empty);
                OldName       = tempR.Name_Property.Replace(" ", string.Empty);
                textBox2.Text = tempR.Exstension_Property.Replace(" ", string.Empty);
                OldEx         = tempR.Exstension_Property.Replace(" ", string.Empty);
                textBox3.Text = tempI.User_ID_Property.ToString();
                textBox4.Text = tempI.Group_ID_Property.ToString();
                textBox5.Text = tempI.File_Size_Property.ToString();
                textBox6.Text = tempI.File_Create_Property.ToString();
                textBox7.Text = tempI.File_Modif_Property.ToString();

                string acc = Emulator.getAccess(tempI.Access_Property);

                checkBox4.Checked  = (Char.GetNumericValue(acc[1]) == 1) ? true : false;
                checkBox7.Checked  = (Char.GetNumericValue(acc[2]) == 1) ? true : false;
                checkBox10.Checked = (Char.GetNumericValue(acc[3]) == 1) ? true : false;
                checkBox5.Checked  = (Char.GetNumericValue(acc[4]) == 1) ? true : false;
                checkBox8.Checked  = (Char.GetNumericValue(acc[5]) == 1) ? true : false;
                checkBox11.Checked = (Char.GetNumericValue(acc[6]) == 1) ? true : false;
                checkBox6.Checked  = (Char.GetNumericValue(acc[7]) == 1) ? true : false;
                checkBox9.Checked  = (Char.GetNumericValue(acc[8]) == 1) ? true : false;
                checkBox12.Checked = (Char.GetNumericValue(acc[9]) == 1) ? true : false;

                checkBox1.Checked = (Char.GetNumericValue(acc[10]) == 1) ? true : false;
                checkBox2.Checked = (Char.GetNumericValue(acc[11]) == 1) ? true : false;
                checkBox3.Checked = (Char.GetNumericValue(acc[12]) == 1) ? true : false;

                if (main.Change == false)
                {
                    textBox1.Enabled   = false;
                    textBox2.Enabled   = false;
                    checkBox1.Enabled  = false;
                    checkBox2.Enabled  = false;
                    checkBox3.Enabled  = false;
                    checkBox4.Enabled  = false;
                    checkBox5.Enabled  = false;
                    checkBox6.Enabled  = false;
                    checkBox7.Enabled  = false;
                    checkBox8.Enabled  = false;
                    checkBox9.Enabled  = false;
                    checkBox10.Enabled = false;
                    checkBox11.Enabled = false;
                    checkBox12.Enabled = false;
                    button1.Enabled    = false;
                }
            }
        }
Beispiel #7
0
 private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (listView1.SelectedItems[0].ImageIndex == 0)
     {
         int index = listView1.SelectedIndices[0];
         SelectFile = listView1.Items[index].Text;
         RootDirRecord tempR = Emulator.FindRec(SelectFile);
         Inode         tempI = Emulator.FindInode(tempR.Number_Inode_Property);
         if (Emulator.CheckID(Emulator.CurrentUser, tempI) == true)
         {
             foreach (TreeNode node in treeView1.Nodes)
             {
                 if (node.Text == listView1.SelectedItems[0].Text)
                 {
                     treeView1.SelectedNode = node;
                     treeView1.Select();
                     break;
                 }
                 foreach (TreeNode innode in node.Nodes)
                 {
                     if (innode.Text == listView1.SelectedItems[0].Text)
                     {
                         treeView1.SelectedNode = innode;
                         treeView1.Select();
                         break;
                     }
                 }
             }
         }
         else
         {
             MessageBox.Show("У вас недостаточно прав!");
         }
     }
     else
     {
         int index = listView1.SelectedIndices[0];
         SelectFile = listView1.Items[index].Text;
         SelectFile = SelectFile.Substring(0, SelectFile.LastIndexOf('.'));
         RootDirRecord tempR = Emulator.FindRec(SelectFile);
         Inode         tempI = Emulator.FindInode(tempR.Number_Inode_Property);
         if (Emulator.CheckReadAccess(Emulator.CurrentUser, tempI) == true)
         {
             EditFile EF = new EditFile();
             EF.Owner = this;
             EF.ShowDialog();
             //удалитьToolStripMenuItem.Enabled = false;
             //копироватьToolStripMenuItem.Enabled = false;
             //свойстваToolStripMenuItem.Enabled = false;
         }
         else
         {
             MessageBox.Show("У вас недостаточно прав!");
         }
     }
 }
Beispiel #8
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            RootDirRecord tempR = Emulator.FindRec(e.Node.Text);
            Inode         tempI = Emulator.FindInode(tempR.Number_Inode_Property);

            if (Emulator.CheckID(Emulator.CurrentUser, tempI) == true)
            {
                listView1.Items.Clear();
                toolStripTextBox1.Text = e.Node.Name;
                Emulator.SetCurrentPosition(e.Node.Text);
                setListView();
            }
            else
            {
                MessageBox.Show("У вас недостаточно прав!");
            }
        }
Beispiel #9
0
        private void EditFile_Load(object sender, EventArgs e)
        {
            Work main = this.Owner as Work;

            if (main != null)
            {
                temptext          = main.SelectFile;
                richTextBox1.Text = Emulator.ReadData(temptext);

                RootDirRecord tempR = Emulator.FindRec(main.SelectFile);
                Inode         tempI = Emulator.FindInode(tempR.Number_Inode_Property);
                if (Emulator.CheckWriteAccess(Emulator.CurrentUser, tempI) == false)
                {
                    richTextBox1.Enabled = false;
                    button1.Enabled      = false;
                }
            }
        }
Beispiel #10
0
        private void удалитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int index = listView1.SelectedIndices[0];

            SelectFile = listView1.Items[index].Text;
            SelectFile = SelectFile.Substring(0, SelectFile.LastIndexOf('.'));

            RootDirRecord tempR = Emulator.FindRec(SelectFile);
            Inode         tempI = Emulator.FindInode(tempR.Number_Inode_Property);

            if (Emulator.CheckID(Emulator.CurrentUser, tempI) == true)
            {
                int[]    MainPosandNum = Emulator.FindBind(Emulator.CurrentPosition, SelectFile);
                int      Seek          = Emulator.FindRecSeek(SelectFile);
                UserInfo tempU         = Emulator.FindUser(tempI.User_ID_Property);
                Emulator.DeleteRIB(MainPosandNum[0], Seek, tempU, MainPosandNum[1], false);

                RefreshTreeList();
            }
            else
            {
                MessageBox.Show("У вас недостаточно прав!");
            }
            удалитьToolStripMenuItem.Enabled    = false;
            копироватьToolStripMenuItem.Enabled = false;
            свойстваToolStripMenuItem.Enabled   = false;


            RefreshTreeList();
            //this.Show();
            //Activate();
            //this.Activate();
            //this.OnActivated();
            //this.Activated;
            //this.Refresh();
        }