Skip to content

Commit

Permalink
v2.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancs2 committed Oct 18, 2022
1 parent 360db76 commit 7be4b4d
Show file tree
Hide file tree
Showing 145 changed files with 745 additions and 533 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ namespace Devart.Data.MySql
{
public class ExportCompleteArgs
{
DateTime _timeStart, _timeEnd;
TimeSpan _timeUsed = new TimeSpan();
MySqlBackup.ProcessEndType _completionType;
DateTime _timeStart;
DateTime _timeEnd;
TimeSpan _timeUsed;
Exception _exception;

MySqlBackup.ProcessEndType _completionType = MySqlBackup.ProcessEndType.UnknownStatus;

/// <summary>
/// The Starting time of export process.
/// </summary>
Expand All @@ -25,14 +25,14 @@ public class ExportCompleteArgs
/// <summary>
/// Total time used in current export process.
/// </summary>
public TimeSpan TimeUsed { get { return _timeUsed;}}
public TimeSpan TimeUsed { get { return _timeUsed; } }

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

public Exception LastError { get { return _exception; } }

public bool HasError { get { if (LastError != null) return true; return false; } }
public bool HasError { get { if (_exception != null) return true; return false; } }

public ExportCompleteArgs(DateTime timeStart, DateTime timeEnd, MySqlBackup.ProcessEndType endType, Exception exception)
{
_completionType = endType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ namespace Devart.Data.MySql
{
public class ImportCompleteArgs
{
MySqlBackup.ProcessEndType _completionType;
DateTime _timeStart;
DateTime _timeEnd;
TimeSpan _timeUsed;
Exception _exception;

/// <summary>
/// The starting time of import process.
/// </summary>
public DateTime TimeStart;
public DateTime TimeStart { get { return _timeStart; } }

/// <summary>
/// The ending time of import process.
/// </summary>
public DateTime TimeEnd;
public DateTime TimeEnd { get { return _timeEnd; } }

/// <summary>
/// Enum of completion type
/// The completion type of current import processs.
/// </summary>
public enum CompleteType
{
UnknownStatus,
Completed,
Cancelled,
Error
}
public MySqlBackup.ProcessEndType CompleteType { get { return _completionType; } }

/// <summary>
/// Indicates whether the import process has error(s).
Expand All @@ -35,16 +35,20 @@ public enum CompleteType
/// <summary>
/// The last error (exception) occur in import process.
/// </summary>
public Exception LastError = null;

// <summary>
/// The completion type of current import processs.
/// </summary>
public CompleteType CompletedType = CompleteType.Completed;
public Exception LastError { get { return _exception; } }

/// <summary>
/// Total time used in current import process.
/// </summary>
public TimeSpan TimeUsed => TimeEnd - TimeStart;
public TimeSpan TimeUsed { get { return _timeUsed; } }

public ImportCompleteArgs(MySqlBackup.ProcessEndType completionType, DateTime timeStart, DateTime timeEnd, Exception exception)
{
_completionType = completionType;
_timeStart = timeStart;
_timeEnd = timeEnd;
_timeUsed = timeEnd - timeStart;
_exception = exception;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class ImportProgressArgs : EventArgs
{
long _curBytes = 0L;
long _totalBytes = 0L;
double _percentComplete = 0d;

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

public ImportProgressArgs(long currentBytes, long totalBytes)
{
_curBytes = currentBytes;
_totalBytes = totalBytes;

if (currentBytes == 0L || totalBytes == 0L)
{
_percentComplete = 0d;
}
else
{
_percentComplete = (double)currentBytes / (double)totalBytes * 100d;
}
}
}
}
68 changes: 34 additions & 34 deletions source code/MySqlBackup(Devart-Express)/Methods/CryptoExpress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,44 @@ public static string ConvertByteArrayToHexString(byte[] ba)
return new string(c);
}

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

public static string Sha128Hash(string input)
{
SHA1CryptoServiceProvider sha = new SHA1CryptoServiceProvider();
byte[] ba = Encoding.UTF8.GetBytes(input);
byte[] ba2 = sha.ComputeHash(ba);
sha = null;
return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
}
//public static string Sha128Hash(string input)
//{
// SHA1CryptoServiceProvider sha = new SHA1CryptoServiceProvider();
// byte[] ba = Encoding.UTF8.GetBytes(input);
// byte[] ba2 = sha.ComputeHash(ba);
// sha = null;
// return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
//}

public static string Sha256Hash(string input)
{
byte[] ba = Encoding.UTF8.GetBytes(input);
return Sha256Hash(ba);
}
//public static string Sha256Hash(string input)
//{
// byte[] ba = Encoding.UTF8.GetBytes(input);
// return Sha256Hash(ba);
//}

public static string Sha256Hash(byte[] ba)
{
SHA256Managed sha2 = new SHA256Managed();
byte[] ba2 = sha2.ComputeHash(ba);
sha2 = null;
return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
}
//public static string Sha256Hash(byte[] ba)
//{
// SHA256Managed sha2 = new SHA256Managed();
// byte[] ba2 = sha2.ComputeHash(ba);
// sha2 = null;
// return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
//}

public static string Sha512Hash(string input)
{
byte[] ba = Encoding.UTF8.GetBytes(input);
SHA512Managed sha5 = new SHA512Managed();
byte[] ba2 = sha5.ComputeHash(ba);
sha5 = null;
return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
}
//public static string Sha512Hash(string input)
//{
// byte[] ba = Encoding.UTF8.GetBytes(input);
// SHA512Managed sha5 = new SHA512Managed();
// byte[] ba2 = sha5.ComputeHash(ba);
// sha5 = null;
// return BitConverter.ToString(ba2).Replace("-", string.Empty).ToLower();
//}

//public static string AES_Encrypt(string input, string password)
//{
Expand Down
38 changes: 19 additions & 19 deletions source code/MySqlBackup(Devart-Express)/Methods/QueryExpress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,37 +90,37 @@ static void escape_string(StringBuilder sb, char c)
switch (c)
{
case '\\': // Backslash
sb.AppendFormat("\\\\");
sb.Append("\\\\");
break;
case '\0': // Null
sb.AppendFormat("\\0");
sb.Append("\\0");
break;
case '\r': // Carriage return
sb.AppendFormat("\\r");
sb.Append("\\r");
break;
case '\n': // New Line
sb.AppendFormat("\\n");
sb.Append("\\n");
break;
case '\a': // Vertical tab
sb.Append("\\a");
break;
//case '\a': // Vertical tab
// builder.AppendFormat("\\a");
// break;
case '\b': // Backspace
sb.AppendFormat("\\b");
sb.Append("\\b");
break;
case '\f': // Formfeed
sb.Append("\\f");
break;
case '\t': // Horizontal tab
sb.Append("\\t");
break;
case '\v': // Vertical tab
sb.Append("\\v");
break;
//case '\f': // Formfeed
// builder.AppendFormat("\\f");
// break;
//case '\t': // Horizontal tab
// sb.AppendFormat("\\t");
// break;
//case '\v': // Vertical tab
// builder.AppendFormat("\\v");
// break;
case '\"': // Double quotation mark
sb.AppendFormat("\\\"");
sb.Append("\\\"");
break;
case '\'': // Single quotation mark
sb.AppendFormat("''");
sb.Append("''");
break;
default:
sb.Append(c);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

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

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

<ItemGroup>
<None Include="..\Test_WinForm\Resources\logo128.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="bin\Release\README.md">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="dotConnect.Express.for.MySQL" Version="8.19.1985" />
</ItemGroup>

<ItemGroup>
<None Update="logo128.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<PackageReference Include="dotConnect.Express.for.MySQL" Version="9.0.0" />
</ItemGroup>

</Project>
19 changes: 5 additions & 14 deletions source code/MySqlBackup(Devart-Express)/MySqlBackup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1385,30 +1385,21 @@ void ReportEndProcess()
ReportProgress();
if (ImportCompleted != null)
{
ImportCompleteArgs.CompleteType completedType;
MySqlBackup.ProcessEndType completedType = ProcessEndType.UnknownStatus;
switch (processCompletionType)
{
case ProcessEndType.Complete:
completedType = ImportCompleteArgs.CompleteType.Completed;
completedType = MySqlBackup.ProcessEndType.Complete;
break;
case ProcessEndType.Error:
completedType = ImportCompleteArgs.CompleteType.Error;
completedType = MySqlBackup.ProcessEndType.Error;
break;
case ProcessEndType.Cancelled:
completedType = ImportCompleteArgs.CompleteType.Cancelled;
break;
default:
completedType = ImportCompleteArgs.CompleteType.UnknownStatus;
completedType = MySqlBackup.ProcessEndType.Cancelled;
break;
}

ImportCompleteArgs arg = new ImportCompleteArgs()
{
LastError = _lastError,
CompletedType = completedType,
TimeStart = timeStart,
TimeEnd = timeEnd,
};
ImportCompleteArgs arg = new ImportCompleteArgs(completedType, timeStart, timeEnd, _lastError);
ImportCompleted(this, arg);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public int Execute()
// therefore safely allow the use of user variables. no one should be using
// this connection while we are using it so we can temporarily tell it
// to allow the use of user variables
bool allowUserVars = true;
//bool allowUserVars = true;

try
{
Expand Down
Loading

0 comments on commit 7be4b4d

Please sign in to comment.