Разработка приложения FileInfo по средствам среды программирования Microsoft Visual C#

Курсовой проект - Компьютеры, программирование

Другие курсовые по предмету Компьютеры, программирование

?айла:\n" + tmp_fname;(fileinf.Extension == ".txt")

{.Enabled = true;

}

{.Enabled = false;

}

}void button1_Click(object sender, EventArgs e)

{(openFileDialog1.ShowDialog() == DialogResult.OK)

{= new FileInfo(openFileDialog1.FileName);_fname_info(fileinf.Name);.Visible = true;.Text = "Информация о файле:\n"

+ "Размер: "+fileinf.Length.ToString()+" байт.\n"

+ "Создан: "+fileinf.CreationTime.ToString()

+ "\nИзменён: " + fileinf.LastWriteTime.ToString()

+ "\nОткрыт: " + fileinf.LastAccessTime.ToString();.Enabled = true;.Enabled = true;.Enabled = true;.Enabled = true;

}

}void button6_Click(object sender, EventArgs e)

{form_attrib = new Form2();_attrib.fname = fileinf.FullName;((fileinf.Attributes & FileAttributes.Archive) == FileAttributes.Archive) //Является ли архивным?

{_attrib.checkBox1.Checked = true;

}((fileinf.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)//Является ли скрытым?

{_attrib.checkBox2.Checked = true;

}((fileinf.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) //Является ли только для чтения?

{_attrib.checkBox3.Checked = true;

}((fileinf.Attributes & FileAttributes.NotContentIndexed) == FileAttributes.NotContentIndexed) //Является ли включенным в индексацию?

{_attrib.checkBox4.Checked = false;

}((fileinf.Attributes & FileAttributes.System) == FileAttributes.System) //Является ли системным?

{_attrib.checkBox5.Checked = true;

}_attrib.ShowDialog();.Refresh();

}void button2_Click(object sender, EventArgs e)

{(check_exists(fileinf.FullName))

{form_rename = new Form3(); //Создаём форму 3 - окно переименования_rename.textBox1.Text = fileinf.Name;_rename.ShowDialog(); //выводим форму(form_rename.change_name == true) //проверяем, изменили имя файла или нет

{

{.MoveTo(fileinf.DirectoryName +@"\" +form_rename.textBox1.Text);_fname_info(fileinf.Name); //обновляем в программе название файла

}(Exception err)

{.Show(err.Message.ToString());

}

}

}

}void button3_Click(object sender, EventArgs e)

{(check_exists(fileinf.FullName))

{(folderBrowserDialog1.ShowDialog() == DialogResult.OK)

{.MoveTo(folderBrowserDialog1.SelectedPath + @"\" + fileinf.Name);.Show("Файл перемещён в " + folderBrowserDialog1.SelectedPath.ToString());

}

}

}void button4_Click(object sender, EventArgs e)

{(check_exists(fileinf.FullName))

{(folderBrowserDialog1.ShowDialog() == DialogResult.OK)

{.CopyTo(folderBrowserDialog1.SelectedPath + @"\" + fileinf.Name);.Show("Файл скопирован в " + folderBrowserDialog1.SelectedPath.ToString());

}

}

}void button5_Click(object sender, EventArgs e)

{(check_exists(fileinf.FullName))

{

1024*1024*1024)slov = 0; //объявляем переменные для статистикиstrok = 0;sym = 0;sym_all = 0;cur_line="";str_have_sym ;reader = new StreamReader(fileinf.OpenRead()); // создаём объект для чтение содержимого файла(true)">// if (fileinf.Length > 1024*1024*1024)slov = 0; //объявляем переменные для статистикиstrok = 0;sym = 0;sym_all = 0;cur_line="";str_have_sym ;reader = new StreamReader(fileinf.OpenRead()); // создаём объект для чтение содержимого файла(true)

{_line = reader.ReadLine(); //считываем 1 строку(cur_line != null) //Если строка существует

{_have_sym = false;(int i = 0; i < cur_line.Length; i++)

{_all++; //считаем все символы(cur_line[i] == ) // Не является ли текущий символ пробелом?

{(((i + 1) < cur_line.Length) && (cur_line[i + 1] != )) // если символ не является последним и не явл. пробелом

{++;

}

}

{_have_sym = true; //Строка имеет символы++; //Считаем символы, без пробелов

}

}(str_have_sym == true)

{++;

}++;

}

{; //Выход из бесконечного цикла

}

}.Close(); //Закрываем файл для чтения содержимого.Show("Строк: " + strok.ToString() + "\n"

+ "Слов: " + slov.ToString() + "\n"

+ "Символов всего: " + sym_all.ToString() + "\n"

+ "Символов без пробелов: " + sym.ToString() + "\n");

}

}

}

}

Form2.cs:

using System;System.Collections.Generic;System.ComponentModel;System.Data;System.Drawing;System.Linq;System.Text;System.Windows.Forms;System.IO;File_info

{partial class Form2 : Form

{string fname;Form2()

{();

}void button2_Click(object sender, EventArgs e)

{.Close();

}void button1_Click(object sender, EventArgs e)

{fileinf = new FileInfo(fname); //Fileinf - объект класса FileInfo(checkBox1.Checked == true)

{.Attributes |= FileAttributes.Archive; // устанавливаем аттрибут

}

{.Attributes ^= FileAttributes.Archive; //снимаем аттрибут

}(checkBox2.Checked == true)

{.Attributes |= FileAttributes.Hidden;

}

{.Attributes ^= FileAttributes.Hidden;

}(checkBox3.Checked == true)

{.Attributes |= FileAttributes.ReadOnly;

}

{.Attributes ^= FileAttributes.ReadOnly;

}(checkBox4.Checked == false)

{.Attributes |= FileAttributes.NotContentIndexed;

}

{.Attributes ^= FileAttributes.NotContentIndexed;

}(checkBox5.Checked == true)

{.Attributes |= FileAttributes.System;

}

{.Attributes ^= FileAttributes.System;

}.Close();

}void checkBox1_CheckedChanged(object sender, EventArgs e)

{

}

}

}

Form3.cs:

using System;System.Collections.Generic;System.ComponentModel;System.Data;System.Drawing;System.Linq;System.Text;System.Windows.Forms;File_info

{partial class Form3 : Form

{bool change_name = false;Form3()

{();

}void button1_Click(object sender, EventArgs e)

{_name = true;.Close();

}void button2_Click(object sender, EventArgs e)

{

this.Close();

}void label1_Click(object sender, EventArgs e)

{

}void textBox1_TextChanged(object sender, EventArgs e)

{

}

}

}