Ejemplo n.º 1
0
        private void Convert(ImageFormat format)
        {
            List <string> paths = new List <string>();

            FileSelectTool.SelectFiles(out paths);
            if (paths.Count == 0)
            {
                return;
            }
            for (int i = 0; i < paths.Count; i++)
            {
                string _path = Path.GetDirectoryName(paths[i]);
                string _name = Path.GetFileNameWithoutExtension(paths[i]);
                Shell.WriteLine(string.Format("图片名:{0}", _name));
                Image img = Image.FromFile(paths[i]);
                if (format == ImageFormat.Jpeg)
                {
                    img.Save(_path + @"/" + _name + ".jpg", format);
                }
                else
                {
                    img.Save(_path + @"/" + _name + ".png", format);
                }
                img.Dispose();
            }
            Shell.WriteLine(string.Format("完成"));
        }
Ejemplo n.º 2
0
 private void selectFilesBtn_Click(object sender, EventArgs e)
 {
     fileNameLists.Clear();
     FileSelectTool.SelectFiles(out fileNameLists);
     foreach (var _name in fileNameLists)
     {
         Shell.WriteLine(Path.GetFileName(_name));
     }
 }
Ejemplo n.º 3
0
 private void importExcelBtn_Click(object sender, EventArgs e)
 {
     excelPathsList.Clear();
     FileSelectTool.SelectFiles(out excelPathsList);
     Shell.WriteLine("导入的表");
     foreach (string file in excelPathsList)
     {
         Shell.WriteLine(Path.GetFileName(file));
     }
 }
Ejemplo n.º 4
0
        private void jsonFormatBtn_Click(object sender, EventArgs e)
        {
            List <string> paths = new List <string>();

            FileSelectTool.SelectFiles(out paths);
            Shell.WriteLine("格式化开始");
            foreach (string file in paths)
            {
                Shell.WriteLine(file);
                string str = File.ReadAllText(file);
                str = FileTool.ConvertJsonString(str);
                FileTool.WriteToTxt(str, file, true);
            }
            Shell.WriteLine("完成");
        }
Ejemplo n.º 5
0
 private void selectChangeWHbtn_Click(object sender, EventArgs e)
 {
     SelectChangImgPaths.Clear();
     FileSelectTool.SelectFiles(out SelectChangImgPaths);
 }
Ejemplo n.º 6
0
 private void selectImgBtn_Click(object sender, EventArgs e)
 {
     FileSelectTool.SelectFiles(out compressImgPaths);
 }