Skip to content

Commit 7be4b4d

Browse files
committed
v2.3.7
1 parent 360db76 commit 7be4b4d

File tree

145 files changed

+745
-533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+745
-533
lines changed

source code/MySqlBackup(Devart-Express)/EventArgs/ExportCompleteArgs.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ namespace Devart.Data.MySql
66
{
77
public class ExportCompleteArgs
88
{
9-
DateTime _timeStart, _timeEnd;
10-
TimeSpan _timeUsed = new TimeSpan();
9+
MySqlBackup.ProcessEndType _completionType;
10+
DateTime _timeStart;
11+
DateTime _timeEnd;
12+
TimeSpan _timeUsed;
1113
Exception _exception;
1214

13-
MySqlBackup.ProcessEndType _completionType = MySqlBackup.ProcessEndType.UnknownStatus;
14-
1515
/// <summary>
1616
/// The Starting time of export process.
1717
/// </summary>
@@ -25,14 +25,14 @@ public class ExportCompleteArgs
2525
/// <summary>
2626
/// Total time used in current export process.
2727
/// </summary>
28-
public TimeSpan TimeUsed { get { return _timeUsed;}}
28+
public TimeSpan TimeUsed { get { return _timeUsed; } }
2929

3030
public MySqlBackup.ProcessEndType CompletionType { get { return _completionType; } }
3131

3232
public Exception LastError { get { return _exception; } }
3333

34-
public bool HasError { get { if (LastError != null) return true; return false; } }
35-
34+
public bool HasError { get { if (_exception != null) return true; return false; } }
35+
3636
public ExportCompleteArgs(DateTime timeStart, DateTime timeEnd, MySqlBackup.ProcessEndType endType, Exception exception)
3737
{
3838
_completionType = endType;

source code/MySqlBackup(Devart-Express)/EventArgs/ImportCompleteArgs.cs

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ namespace Devart.Data.MySql
66
{
77
public class ImportCompleteArgs
88
{
9+
MySqlBackup.ProcessEndType _completionType;
10+
DateTime _timeStart;
11+
DateTime _timeEnd;
12+
TimeSpan _timeUsed;
13+
Exception _exception;
14+
915
/// <summary>
1016
/// The starting time of import process.
1117
/// </summary>
12-
public DateTime TimeStart;
18+
public DateTime TimeStart { get { return _timeStart; } }
1319

1420
/// <summary>
1521
/// The ending time of import process.
1622
/// </summary>
17-
public DateTime TimeEnd;
23+
public DateTime TimeEnd { get { return _timeEnd; } }
1824

1925
/// <summary>
20-
/// Enum of completion type
26+
/// The completion type of current import processs.
2127
/// </summary>
22-
public enum CompleteType
23-
{
24-
UnknownStatus,
25-
Completed,
26-
Cancelled,
27-
Error
28-
}
28+
public MySqlBackup.ProcessEndType CompleteType { get { return _completionType; } }
2929

3030
/// <summary>
3131
/// Indicates whether the import process has error(s).
@@ -35,16 +35,20 @@ public enum CompleteType
3535
/// <summary>
3636
/// The last error (exception) occur in import process.
3737
/// </summary>
38-
public Exception LastError = null;
39-
40-
// <summary>
41-
/// The completion type of current import processs.
42-
/// </summary>
43-
public CompleteType CompletedType = CompleteType.Completed;
38+
public Exception LastError { get { return _exception; } }
4439

4540
/// <summary>
4641
/// Total time used in current import process.
4742
/// </summary>
48-
public TimeSpan TimeUsed => TimeEnd - TimeStart;
43+
public TimeSpan TimeUsed { get { return _timeUsed; } }
44+
45+
public ImportCompleteArgs(MySqlBackup.ProcessEndType completionType, DateTime timeStart, DateTime timeEnd, Exception exception)
46+
{
47+
_completionType = completionType;
48+
_timeStart = timeStart;
49+
_timeEnd = timeEnd;
50+
_timeUsed = timeEnd - timeStart;
51+
_exception = exception;
52+
}
4953
}
5054
}

source code/MySqlBackup(Devart-Express)/EventArgs/ImportProgressArgs.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class ImportProgressArgs : EventArgs
88
{
99
long _curBytes = 0L;
1010
long _totalBytes = 0L;
11+
double _percentComplete = 0d;
1112

1213
/// <summary>
1314
/// Number of processed bytes in current import process.
@@ -22,12 +23,21 @@ public class ImportProgressArgs : EventArgs
2223
/// <summary>
2324
/// Percentage of completeness.
2425
/// </summary>
25-
public int PercentageCompleted { get { return (int)(CurrentBytes *100L / TotalBytes); } }
26+
public double PercentageCompleted { get { return _percentComplete; } }
2627

2728
public ImportProgressArgs(long currentBytes, long totalBytes)
2829
{
2930
_curBytes = currentBytes;
3031
_totalBytes = totalBytes;
32+
33+
if (currentBytes == 0L || totalBytes == 0L)
34+
{
35+
_percentComplete = 0d;
36+
}
37+
else
38+
{
39+
_percentComplete = (double)currentBytes / (double)totalBytes * 100d;
40+
}
3141
}
3242
}
3343
}

source code/MySqlBackup(Devart-Express)/Methods/CryptoExpress.cs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,44 +29,44 @@ public static string ConvertByteArrayToHexString(byte[] ba)
2929
return new string(c);
3030
}
3131

32-
public static string RandomString(int size)
33-
{
34-
byte[] randBuffer = new byte[size + (10)];
35-
RandomNumberGenerator.Create().GetBytes(randBuffer);
36-
return System.Convert.ToBase64String(randBuffer).Replace("/", string.Empty).Replace("+", string.Empty).Replace("=", string.Empty).Remove(size);
37-
}
32+
//public static string RandomString(int size)
33+
//{
34+
// byte[] randBuffer = new byte[size + (10)];
35+
// RandomNumberGenerator.Create().GetBytes(randBuffer);
36+
// return System.Convert.ToBase64String(randBuffer).Replace("/", string.Empty).Replace("+", string.Empty).Replace("=", string.Empty).Remove(size);
37+
//}
3838

39-
public static string Sha128Hash(string input)
40-
{
41-
SHA1CryptoServiceProvider sha = new SHA1CryptoServiceProvider();
42-
byte[] ba = Encoding.UTF8.GetBytes(input);
43-
byte[] ba2 = sha.ComputeHash(ba);
44-
sha = null;
45-
return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
46-
}
39+
//public static string Sha128Hash(string input)
40+
//{
41+
// SHA1CryptoServiceProvider sha = new SHA1CryptoServiceProvider();
42+
// byte[] ba = Encoding.UTF8.GetBytes(input);
43+
// byte[] ba2 = sha.ComputeHash(ba);
44+
// sha = null;
45+
// return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
46+
//}
4747

48-
public static string Sha256Hash(string input)
49-
{
50-
byte[] ba = Encoding.UTF8.GetBytes(input);
51-
return Sha256Hash(ba);
52-
}
48+
//public static string Sha256Hash(string input)
49+
//{
50+
// byte[] ba = Encoding.UTF8.GetBytes(input);
51+
// return Sha256Hash(ba);
52+
//}
5353

54-
public static string Sha256Hash(byte[] ba)
55-
{
56-
SHA256Managed sha2 = new SHA256Managed();
57-
byte[] ba2 = sha2.ComputeHash(ba);
58-
sha2 = null;
59-
return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
60-
}
54+
//public static string Sha256Hash(byte[] ba)
55+
//{
56+
// SHA256Managed sha2 = new SHA256Managed();
57+
// byte[] ba2 = sha2.ComputeHash(ba);
58+
// sha2 = null;
59+
// return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
60+
//}
6161

62-
public static string Sha512Hash(string input)
63-
{
64-
byte[] ba = Encoding.UTF8.GetBytes(input);
65-
SHA512Managed sha5 = new SHA512Managed();
66-
byte[] ba2 = sha5.ComputeHash(ba);
67-
sha5 = null;
68-
return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
69-
}
62+
//public static string Sha512Hash(string input)
63+
//{
64+
// byte[] ba = Encoding.UTF8.GetBytes(input);
65+
// SHA512Managed sha5 = new SHA512Managed();
66+
// byte[] ba2 = sha5.ComputeHash(ba);
67+
// sha5 = null;
68+
// return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
69+
//}
7070

7171
//public static string AES_Encrypt(string input, string password)
7272
//{

source code/MySqlBackup(Devart-Express)/Methods/QueryExpress.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -90,37 +90,37 @@ static void escape_string(StringBuilder sb, char c)
9090
switch (c)
9191
{
9292
case '\\': // Backslash
93-
sb.AppendFormat("\\\\");
93+
sb.Append("\\\\");
9494
break;
9595
case '\0': // Null
96-
sb.AppendFormat("\\0");
96+
sb.Append("\\0");
9797
break;
9898
case '\r': // Carriage return
99-
sb.AppendFormat("\\r");
99+
sb.Append("\\r");
100100
break;
101101
case '\n': // New Line
102-
sb.AppendFormat("\\n");
102+
sb.Append("\\n");
103+
break;
104+
case '\a': // Vertical tab
105+
sb.Append("\\a");
103106
break;
104-
//case '\a': // Vertical tab
105-
// builder.AppendFormat("\\a");
106-
// break;
107107
case '\b': // Backspace
108-
sb.AppendFormat("\\b");
108+
sb.Append("\\b");
109+
break;
110+
case '\f': // Formfeed
111+
sb.Append("\\f");
112+
break;
113+
case '\t': // Horizontal tab
114+
sb.Append("\\t");
115+
break;
116+
case '\v': // Vertical tab
117+
sb.Append("\\v");
109118
break;
110-
//case '\f': // Formfeed
111-
// builder.AppendFormat("\\f");
112-
// break;
113-
//case '\t': // Horizontal tab
114-
// sb.AppendFormat("\\t");
115-
// break;
116-
//case '\v': // Vertical tab
117-
// builder.AppendFormat("\\v");
118-
// break;
119119
case '\"': // Double quotation mark
120-
sb.AppendFormat("\\\"");
120+
sb.Append("\\\"");
121121
break;
122122
case '\'': // Single quotation mark
123-
sb.AppendFormat("''");
123+
sb.Append("''");
124124
break;
125125
default:
126126
sb.Append(c);

source code/MySqlBackup(Devart-Express)/MySqlBackup(Devart-Express).csproj

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>NET48;NET472;NET461;NET452;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;net5.0</TargetFrameworks>
4+
<TargetFrameworks>net46;net47;net48;net481</TargetFrameworks>
55
<RootNamespace>Devart.Data.MySql</RootNamespace>
66
<AssemblyName>MySqlBackupNet.DevartExpress</AssemblyName>
77
<ApplicationIcon>logo.ico</ApplicationIcon>
@@ -13,14 +13,12 @@
1313
<Description>A tool to backup and restore MySQL database in C#/VB.NET/ASP.NET. A special build for Devart Express (MySql) dotConnect.</Description>
1414
<Copyright>MySqlBackup.NET</Copyright>
1515
<PackageProjectUrl>https://github.com/MySqlBackupNET/MySqlBackup.Net</PackageProjectUrl>
16-
<PackageIcon>logo128.png</PackageIcon>
1716
<RepositoryUrl>https://github.com/MySqlBackupNET/MySqlBackup.Net.git</RepositoryUrl>
1817
<RepositoryType>git</RepositoryType>
1918
<PackageTags>mysqlbackup;devart;mysql</PackageTags>
20-
<Version>2.3.6.2</Version>
21-
<AssemblyVersion>2.3.6.2</AssemblyVersion>
22-
<FileVersion>2.3.6.2</FileVersion>
23-
<PackageReadmeFile>README.md</PackageReadmeFile>
19+
<Version>2.3.7</Version>
20+
<AssemblyVersion>2.3.7</AssemblyVersion>
21+
<FileVersion>2.3.7</FileVersion>
2422
</PropertyGroup>
2523

2624
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
@@ -92,25 +90,7 @@
9290
</ItemGroup>
9391

9492
<ItemGroup>
95-
<None Include="..\Test_WinForm\Resources\logo128.png">
96-
<Pack>True</Pack>
97-
<PackagePath></PackagePath>
98-
</None>
99-
<None Include="bin\Release\README.md">
100-
<Pack>True</Pack>
101-
<PackagePath></PackagePath>
102-
</None>
103-
</ItemGroup>
104-
105-
<ItemGroup>
106-
<PackageReference Include="dotConnect.Express.for.MySQL" Version="8.19.1985" />
107-
</ItemGroup>
108-
109-
<ItemGroup>
110-
<None Update="logo128.png">
111-
<Pack>True</Pack>
112-
<PackagePath></PackagePath>
113-
</None>
93+
<PackageReference Include="dotConnect.Express.for.MySQL" Version="9.0.0" />
11494
</ItemGroup>
11595

11696
</Project>

source code/MySqlBackup(Devart-Express)/MySqlBackup.cs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,30 +1385,21 @@ void ReportEndProcess()
13851385
ReportProgress();
13861386
if (ImportCompleted != null)
13871387
{
1388-
ImportCompleteArgs.CompleteType completedType;
1388+
MySqlBackup.ProcessEndType completedType = ProcessEndType.UnknownStatus;
13891389
switch (processCompletionType)
13901390
{
13911391
case ProcessEndType.Complete:
1392-
completedType = ImportCompleteArgs.CompleteType.Completed;
1392+
completedType = MySqlBackup.ProcessEndType.Complete;
13931393
break;
13941394
case ProcessEndType.Error:
1395-
completedType = ImportCompleteArgs.CompleteType.Error;
1395+
completedType = MySqlBackup.ProcessEndType.Error;
13961396
break;
13971397
case ProcessEndType.Cancelled:
1398-
completedType = ImportCompleteArgs.CompleteType.Cancelled;
1399-
break;
1400-
default:
1401-
completedType = ImportCompleteArgs.CompleteType.UnknownStatus;
1398+
completedType = MySqlBackup.ProcessEndType.Cancelled;
14021399
break;
14031400
}
14041401

1405-
ImportCompleteArgs arg = new ImportCompleteArgs()
1406-
{
1407-
LastError = _lastError,
1408-
CompletedType = completedType,
1409-
TimeStart = timeStart,
1410-
TimeEnd = timeEnd,
1411-
};
1402+
ImportCompleteArgs arg = new ImportCompleteArgs(completedType, timeStart, timeEnd, _lastError);
14121403
ImportCompleted(this, arg);
14131404
}
14141405
}

source code/MySqlBackup(Devart-Express)/MySqlScript/MySqlScript.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public int Execute()
156156
// therefore safely allow the use of user variables. no one should be using
157157
// this connection while we are using it so we can temporarily tell it
158158
// to allow the use of user variables
159-
bool allowUserVars = true;
159+
//bool allowUserVars = true;
160160

161161
try
162162
{

0 commit comments

Comments
 (0)