private void Local_Minus_Load(object sender, EventArgs e) { //폼실행시 기준 경로가 파일이라 ㄱㅊ //string[] allLines = File.ReadAllLines(@"C:\Temp\test.txt", Encoding.Default); string[] allLines = new_list; hex_handler hex = new hex_handler(); int hex_length = hex.hex_length(); int start_point = 0x500; //string[] allLines = new string[j]; allLines[0] = hex.hex_read(0x500); for (int y = 0; y < hex_length; y++) { allLines[y] = hex.hex_read(start_point); start_point += 0x100; } MessageBox.Show("얻은 길이 " + hex.hex_length()); int i; for (i = 0; i < hex_length; i++) { if (!allLines[i].Equals("")) { FolderAccess access = new FolderAccess(); //access.panja_inherit_recover(allLines[i]); } TreeNode rootNode = new TreeNode(allLines[i]); //rootNode.Text = allLines[i]; rootNode.ImageIndex = 2; rootNode.SelectedImageIndex = 2; List_own.Nodes.Add(rootNode); } List_own.FullRowSelect = true; /* * int i; * for (i = 0; i < allLines.Length; i++) * { * TreeNode rootNode = new TreeNode(allLines[i]); * //rootNode.Text = allLines[i]; * rootNode.ImageIndex = 2; * rootNode.SelectedImageIndex = 2; * List_own.Nodes.Add(rootNode); * //Fill(rootNode, allLines[i]); * } */ }
static void Main(string[] args) { //폴더 권한 제어 객체 생성 FolderAccess rgs = new FolderAccess(); string total_dir = Environment.CurrentDirectory + "\\Panja_Project.exe"; //string total_dir = @"C:\Users\rooto\Source\Repos\Panja_Project\Panja_Project\bin\Debug\Panja_Project.exe"; //args(파라미터 갯수 체크 ) int argsCount = args.Length; //레지스트 체크 및 등록 rgs.RegistryChecker(total_dir); //파라미터 2개 존재시 --> 우클릭 했을 케이스 if (argsCount == 2) { //Switch Checker & data confirm // MessageBox.Show("this is 2"); // MessageBox.Show("[0] :" + args[0]+"[1] : "+args[1] ); //해당 명령을 우클릭에서 처리 string command = args[1]; string target_folder_dir = args[0]; //rdg.RegistryChecker(targetAddress); rgs.rightClick(command, target_folder_dir); } //파라미터 3개 존재시 --> 바로가기 더블 클릭 케이스 else if (argsCount == 3) { MessageBox.Show("this is 3"); MessageBox.Show("[0] : " + args[0] + " [1] : " + args[1] + " [2] : " + args[2]); //파라미터 체크용 string sample1 = args[0]; string sample2 = args[1]; string sample3 = args[2]; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Local_Explorer(sample2, args[2])); } //우클릭이 아닌 일반적인 실행의 경우 else { MessageBox.Show("this is exe"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainUI()); //Application.Run(new Login()); } }
//이건 보호해제하는건데 갖다버려라 private void button1_Click(object sender, EventArgs e) { System.Diagnostics.ProcessStartInfo proinfo = new System.Diagnostics.ProcessStartInfo(); System.Diagnostics.Process pro = new System.Diagnostics.Process(); proinfo.FileName = @"cmd"; proinfo.CreateNoWindow = false; //띄우기 안띄우기 proinfo.UseShellExecute = false; proinfo.RedirectStandardOutput = true; proinfo.RedirectStandardInput = true; proinfo.RedirectStandardError = true; pro.StartInfo = proinfo; pro.Start(); int i; //added 폴더 int lastnum = selectlist.Items.Count; for (i = 0; i < lastnum; i++) { //added_Folder : 해당 보호폴더 첫 헤더 폴더 (타겟폴더) added_Folder[i] = selectlist.Items[i].Text; //윤식 : 이부분 input ACL //AccessAuthority aauth = new AccessAuthority(added_Folder[i]); //aauth.folderSecu_Recover(); FolderAccess rgs = new FolderAccess(); rgs.panja_inherit_recover(added_Folder[i]); pro.StandardInput.Write("attrib " + '\u0022' + added_Folder[i] + '\u0022' + " -r -s -h" + Environment.NewLine); } pro.StandardInput.Close(); pro.Close(); }
private void button3_Click(object sender, EventArgs e) { if (List_go.Items.Count != 0) { System.Diagnostics.ProcessStartInfo proinfo = new System.Diagnostics.ProcessStartInfo(); System.Diagnostics.Process pro = new System.Diagnostics.Process(); proinfo.FileName = @"cmd"; proinfo.CreateNoWindow = false; //띄우기 안띄우기 proinfo.UseShellExecute = false; proinfo.RedirectStandardOutput = true; proinfo.RedirectStandardInput = true; proinfo.RedirectStandardError = true; pro.StartInfo = proinfo; pro.Start(); hex_handler hex = new hex_handler(); int i; length = hex.hex_length(); //added 폴더 int lastnum = List_go.Items.Count; string target_dir; for (i = 0; i < length; i++) { for (int z = 0; z < lastnum; z++) { if (new_list[i] == List_go.Items[z].Text) { target_dir = new_list[i]; new_list[i] = null; hex.hex_length_set(hex.hex_length() - 1); //윤식 : 이부분 input ACL FolderAccess rgs = new FolderAccess(); if (new_list[i] == null) { rgs.panja_inherit_recover(target_dir); pro.StandardInput.Write("attrib " + '\u0022' + target_dir + '\u0022' + " -r -s -h" + Environment.NewLine); } } } } //length = hex.hex_length(); int start_point = 0x500 - 0x001; for (int j = 0; j < length; j++) { if (new_list[j] == null) { continue; } hex.hex_write1(new_list[j], start_point); start_point += 0x100; //System.IO.File.AppendAllText(@"C:\Temp\test.txt", Environment.NewLine + folder_path[i] , Encoding.Default); } pro.StandardInput.Close(); pro.Close(); this.Close(); } }
void treeview_fill() { hex_handler hex = new hex_handler(); //string absTemp = @"C:\Users\rooto\Source\Repos\Panja_Project\Panja_Project\Properties"; //삭제 //absPro = @"C:\Program Files (x86)\Default Company Name\SetupSample\Panja\Properties\test.txt"; //확인용 //MessageBox.Show("얻은 문자열 " + hex.hex_read(0x500)); /* * * string[] allLines = File.ReadAllLines(absPro, Encoding.Default); * * int i; * for (i = 0; i < allLines.Length; i++) * { * if (!allLines[i].Equals("")) * { * FolderAccess access = new FolderAccess(); * access.panja_inherit_recover(allLines[i]); * } * TreeNode rootNode = new TreeNode(allLines[i]); * //rootNode.Text = allLines[i]; * rootNode.ImageIndex = 2; * rootNode.SelectedImageIndex = 2; * treeView1.Nodes.Add(rootNode); * Fill(rootNode, allLines[i]); * } */ int j = hex.hex_length(); int start_point = 0x500; //string[] allLines = new string[j]; allLines[0] = hex.hex_read(0x500); for (int y = 0; y < j; y++) { allLines[y] = hex.hex_read(start_point); start_point += 0x100; } //MessageBox.Show("얻은 길이 " + hex.hex_length()); int i; for (i = 0; i < j; i++) { if (!allLines[i].Equals("")) { FolderAccess access = new FolderAccess(); //access.panja_inherit_recover(allLines[i]); } TreeNode rootNode = new TreeNode(allLines[i]); //rootNode.Text = allLines[i]; rootNode.ImageIndex = 2; rootNode.SelectedImageIndex = 2; treeView1.Nodes.Add(rootNode); Fill(rootNode, allLines[i]); } listView1.FullRowSelect = true; }