コード例 #1
0
ファイル: frmMain.cs プロジェクト: Praetox/Tools_rarelyUseful
        private void Move_GO_Click(object sender, EventArgs e)
        {
            lockMe();
            string root   = Move_src.Text.Trim('\\', '/');
            string target = Move_dst.Text.Trim('\\', '/');

            string[] mask = Move_flt.Text.Split(';');
            for (int a = 0; a < mask.Length; a++)
            {
                mask[a] = mask[a].Trim();
            }
            string[] files = null;
            if (Move_srcC.Checked)
            {
                files = System.IO.File.ReadAllText("flist.txt",
                                                   Encoding.UTF8).Replace("\r", "").Trim('\n')
                        .Split('\n');
            }
            else
            {
                Recurser rc = new Recurser();
                rc.parse(root, mask);
                files = rc.getFiles();
            }
            for (int a = 0; a < files.Length; a++)
            {
                MoveRel(root, files[a], target);
            }
            unlockMe();
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: Praetox/Tools_rarelyUseful
        private void extract_GO_Click(object sender, EventArgs e)
        {
            lockMe();
            string sevZ = Environment.GetEnvironmentVariable("temp") + "\\7z.exe";

            System.IO.File.Copy(Application.StartupPath + "\\7z.exe", sevZ, true);
            string root = extract_src.Text;

            if (root == defExtract)
            {
                root =
                    Application.StartupPath;
            }
            Recurser rc = new Recurser();

            rc.parse(root, new string[] { "*.zip" });
            string[] zips = rc.getFiles();

            for (int a = 0; a < zips.Length; a++)
            {
                frmw.msg = "Extracting" + "\r\n" +
                           "------------" + "\r\n" +
                           (a + 1) + " of " + zips.Length;

                zips[a] = root + "\\" + zips[a];
                string dir = zips[a].Substring(0, zips[a].Length - 4);
                System.IO.Directory.CreateDirectory(dir);
                System.IO.File.Move(zips[a], dir + "\\tmp_rena.zip");

                string batch = dir + "\\ignoreme.bat";
                System.IO.File.WriteAllText(batch,
                                            szDec_parm.Text + "\r\n" +
                                            "del ignoreme.bat");
                System.Diagnostics.Process prc =
                    new System.Diagnostics.Process();
                prc.StartInfo.FileName         = batch;
                prc.StartInfo.WorkingDirectory = dir;
                prc.StartInfo.UseShellExecute  = true;
                if (!extract_dbg.Checked)
                {
                    prc.StartInfo.WindowStyle = System.
                                                Diagnostics.ProcessWindowStyle.Hidden;
                }
                prc.Start();

                while (System.IO.File.Exists(batch))
                {
                    System.Threading.Thread.Sleep(200);
                    Application.DoEvents();
                }
                System.IO.File.Move(dir +
                                    "\\tmp_rena.zip", zips[a]);
            }
            unlockMe();
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: Praetox/Tools_rarelyUseful
        private void Treegen_GO_Click(object sender, EventArgs e)
        {
            lockMe(); Recurser rc  = new Recurser();
            string             src = Treegen_src.Text.Trim('\\', '/');
            string             dst = Treegen_dst.Text.Trim('\\', '/');

            string[] mask = Treegen_flt.Text.Split(';');
            for (int a = 0; a < mask.Length; a++)
            {
                mask[a] = mask[a].Trim();
            }
            rc.parse(src, mask);
            string dirs = rc.getPaths();

            System.IO.File.WriteAllText(src +
                                        "\\" + dst, dirs, Encoding.UTF8);
            unlockMe();
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: Praetox/Tools_rarelyUseful
        private void Polydir_GO_Click(object sender, EventArgs e)
        {
            lockMe(); Recurser rc  = new Recurser();
            string             src = Polydir_src.Text.Trim('\\', '/');

            string[] mask = Polydir_flt.Text.Split(';');
            for (int a = 0; a < mask.Length; a++)
            {
                mask[a] = mask[a].Trim();
            }
            rc.parse(src, mask);
            //string[] files = rc.getFiles();
            string ret = "\n";

            string[] dirs = rc.getFiles();

            StringBuilder sb = new StringBuilder();

            for (int a = 0; a < dirs.Length; a++)
            {
                sb.Append(dirs[a] + "\r\n");
            }
            System.IO.File.WriteAllText("flist.txt",
                                        sb.ToString(), Encoding.UTF8);

            if (dirs.Length > 1 || dirs[0] != "")
            {
                for (int a = 0; a < dirs.Length; a++)
                {
                    dirs[a] = dirs[a].Substring(0,
                                                dirs[a].LastIndexOf("\\"));
                }
                for (int a = 0; a < dirs.Length; a++)
                {
                    for (int b = 0; b < a; b++)
                    {
                        if (dirs[a] == dirs[b] &&
                            !ret.Contains("\n" +
                                          dirs[a] + "\n"))
                        {
                            ret += dirs[a] + "\n";
                        }
                    }
                }
                ListBox  lb    = new ListBox();
                string[] itens = ret.Trim('\n').Split('\n');
                for (int a = 0; a < itens.Length; a++)
                {
                    lb.Items.Add(itens[a]);
                }
                lb.MouseDoubleClick += delegate(object lol, MouseEventArgs wut) {
                    int i = lb.IndexFromPoint(wut.Location);
                    System.Diagnostics.Process.Start("explorer",
                                                     "\"" + Polydir_src.Text + "\\" +
                                                     lb.Items[i].ToString() + "\"");
                };
                lb.Dock = DockStyle.Fill;
                Form frm = new Form();
                frm.Size          = new Size(640, 480);
                frm.StartPosition =
                    FormStartPosition
                    .CenterScreen;
                frm.Controls.Add(lb);
                frm.Show();
            }
            unlockMe();
        }