示例#1
0
 public static void ReduceImages(MainWindow ConfMainWindow, string NewPath)
 {
     if ((bool)ConfMainWindow.To8bitGray.IsChecked) //24bitGrayTo8bitGray やらない選択肢があるから,やらない場合は24bitGrayが存在してしまう,強制化はできない.
     {
         ImageAlgorithm.ColorOrGray(NewPath);
     }
     if ((bool)ConfMainWindow.MarginRemove.IsChecked)
     {
         ImageAlgorithm.RemoveMarginEntry(ConfMainWindow, NewPath);//該当ファイルのあるフォルダの奴はすべて実行される別フォルダに単体コピーが理想*/
     }
     if ((bool)ConfMainWindow.PNGout.IsChecked)
     {
         ImageAlgorithm.ExecutePNGout(ConfMainWindow, in NewPath);
     }
     ImageAlgorithm.CarmineCliAuto(in NewPath);
 }
示例#2
0
 public void FileOrFolder(MainWindow ConfMainWindow, System.Collections.Specialized.StringCollection filespath)
 {
     ConfMainWindow.FolderLog.Text = "";
     ConfMainWindow.FolderLog.Text = "";
     foreach (string PathName in filespath)  //Enumerate acquired paths
     {
         ConfMainWindow.FolderLog.Text += "\n" + PathName;
         ConfMainWindow.FilesLog.Text  += "\n" + PathName + "\n";            //Show path
         if (File.GetAttributes(PathName).HasFlag(FileAttributes.Directory)) //フォルダ //JudgeFileOrDirectory
         {
             if ((bool)ConfMainWindow.ExecutFilesRename.IsChecked)           //リネームするか?
             {
                 if (!RenameFiles.Entry(ConfMainWindow, in PathName))
                 {
                     return;//リネーム失敗
                 }
             }
             long[] FilesSize = new long[2];
             FilesSize[0] = StandardAlgorithm.Directory.GetDirectorySize(new DirectoryInfo(PathName));
             ImageAlgorithm.ReduceImages(ConfMainWindow, PathName);
             FilesSize[1] = StandardAlgorithm.Directory.GetDirectorySize(new DirectoryInfo(PathName));
             DiplayFilesSize(ConfMainWindow, FilesSize);
             if (!(bool)ConfMainWindow.NotArchive.IsChecked)
             {
                 CreateZip(ConfMainWindow, PathName);
             }
         }
         else    //ファイルはnewをつくりそこで実行
         {
             string NewPath = System.IO.Path.GetDirectoryName(PathName) + "\\new\\";
             System.IO.Directory.CreateDirectory(NewPath);                              //"\\new"
             System.IO.File.Copy(PathName, NewPath + Path.GetFileName(PathName), true); //"\\new\\hoge.jpg"
             ImageAlgorithm.ReduceImages(ConfMainWindow, NewPath);
         }
     }
     CompressLogsWith7z(ConfMainWindow);
     using (var player = new System.Media.SoundPlayer(@"Alarm03.wav")) {
         player.Play();
     }
 }