using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace intChanger
{
public partial class Form1 : Form
{
BackgroundWorker _bgwCopyOperation
= new BackgroundWorker
();
public Form1()
{
InitializeComponent();
_bgwCopyOperation.WorkerReportsProgress = true;
_bgwCopyOperation.WorkerSupportsCancellation = true;
}
private void Form1_Load(object sender, EventArgs e)
{
}
string Dirr;
string Dirr2;
int no = 0;
int Count = 0;
int Count2 = 0;
private void _bgwCopyOperation_DoWork(object sender, DoWorkEventArgs e, string sourceDirName, string destDirName, bool copySubDirs)
{
if (no == 0)
{
no = 1;
Dirr = sourceDirName;
Dirr2 = destDirName;
Count = Directory.GetFiles(Dirr, "*.*", SearchOption.AllDirectories).Length;
Count = 100 / Count;
}
// Get the subdirectories for the specified directory.
DirectoryInfo dir
= new DirectoryInfo
(sourceDirName
);
if (!dir.Exists)
{
throw new DirectoryNotFoundException
(
"Source directory does not exist or could not be found: "
+ sourceDirName);
}
DirectoryInfo[] dirs = dir.GetDirectories();
// If the destination directory doesn't exist, create it.
if (!Directory.Exists(destDirName))
{
Directory.CreateDirectory(destDirName);
}
// Get the files in the directory and copy them to the new location.
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
string temppath = Path.Combine(destDirName, file.Name);
file.CopyTo(temppath, false);
Count2 = Count2 + 1;
//Update progressbar here
_bgwCopyOperation.ReportProgress(Count2 * Count);
}
// If copying subdirectories, copy them and their contents to new location.
if (copySubDirs)
{
foreach (DirectoryInfo subdir in dirs)
{
string temppath = Path.Combine(destDirName, subdir.Name);
//Foo((object)new object[] { (object)"1", (object)"2" }));
_bgwCopyOperation
.RunWorkerAsync((object)new object[] { (object)subdir
.FullName,
(object)temppath,
(object)copySubDirs
});
//_bgwCopyOperation.RunWorkerAsync(subdir.FullName, temppath, copySubDirs);
}
}
}
private void button1_Click(object sender, EventArgs e)
{
if (_bgwCopyOperation.IsBusy != true)
{
// Start the asynchronous operation.
_bgwCopyOperation
.RunWorkerAsync((object)new object[] { (object)@"C:\Users\Stefan\Downloads\Portable Python 2.7.15 Basic (x64)\Portable Python 2.7.15 x64",
(object)@"C:\Users\Stefan\Documents\Backuppers_Backups\Portable Python 2.7.15 x64",
(object)true });
}
}
private void _bgwCopyOperation_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}