示例#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()));
        }
示例#2
0
 static void Main()
 {
     IOper.Init();
     //
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new FrmMain());
 }
示例#3
0
        public static IOper GetSupportOper(string file)
        {
            IOper result = null;

            foreach (var item in All)
            {
                if (item.Support(file))
                {
                    return(item);
                }
            }
            return(result);
        }
示例#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);
     }
 }