Exemplo n.º 1
0
        public override string Create(string path)
        {
            List <string> results = new List <string>();
            //
            var files = Directory.GetFiles(path);

            foreach (var file in files)
            {
                var oper = IOper.GetSupportOper(file);
                if (null != oper)
                {
                    var r = oper.Create(file);
                    results.Add(r);
                }
            }
            var dirs = Directory.GetDirectories(path);

            foreach (var dir in dirs)
            {
                var oper = IOper.GetSupportOper(dir);
                if (null != oper)
                {
                    var r = oper.Create(dir);
                    results.Add(r);
                }
            }
            //
            return(string.Join("\n", results.ToArray()));
        }
Exemplo n.º 2
0
 static void Main()
 {
     IOper.Init();
     //
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new FrmMain());
 }
Exemplo n.º 3
0
        public static IOper GetSupportOper(string file)
        {
            IOper result = null;

            foreach (var item in All)
            {
                if (item.Support(file))
                {
                    return(item);
                }
            }
            return(result);
        }
Exemplo n.º 4
0
 private void FrmMain_DragDrop(object sender, DragEventArgs e)
 {
     try
     {
         var path = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
         var oper = IOper.GetSupportOper(path);
         if (null != oper)
         {
             var msg = oper.Create(path);
             MessageBox.Show(this, "Succeed:\n" + msg, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show(this, "Not supported.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }