private void label1_DragDrop(object sender, DragEventArgs e) { this.Activate(); string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false); ArrayList imgpaths = new ArrayList(); foreach (string fpath in s) { if (Inc.IsWebImg(fpath)) { imgpaths.Add(fpath); } } if (imgpaths.Count != 0) { foreach (string item in imgpaths) { Inc.ImgToBase64(item); } MessageBox.Show("转换完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
static void Main(string[] args) { if (args.Length != 0) { string a = Inc.IsCssOrImg(args[0].ToString()).ToString(); switch (a) { case "img": Inc.ImgToBase64(args[0].ToString()); break; case "css": Inc.Base64ToImg(args[0].ToString(), Inc.GenerateTimeStamp()); break; } } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } }