Conductivity bug fixes, DB import/export works OK with root user password.
This commit is contained in:
@@ -57,12 +57,12 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
|
||||
public bool E15;
|
||||
public bool E16;
|
||||
public bool E21;
|
||||
public bool E36;
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
public bool E26;
|
||||
public bool E27;
|
||||
public bool E28;
|
||||
#endif
|
||||
public bool E36;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
TriggerCfg() {}
|
||||
@@ -80,7 +80,7 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
EventSource = "Results"; /// 0
|
||||
EventSource = "Výsledky"; /// 0
|
||||
FailedWMsPct = 20; /// 1
|
||||
Mid1Name = "I1"; /// 2
|
||||
Mid1ErrAfterCorr = 0.3; /// 3
|
||||
@@ -114,12 +114,12 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
|
||||
E15 = false; /// 31
|
||||
E16 = false; /// 32
|
||||
E21 = false; /// 33
|
||||
E36 = true; /// 34
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
E26 = false; /// 35
|
||||
E27 = false; /// 36
|
||||
E28 = false; /// 37
|
||||
E26 = false; /// 34
|
||||
E27 = false; /// 35
|
||||
E28 = false; /// 36
|
||||
#endif
|
||||
E36 = true; /// 34 or 37
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
@@ -158,12 +158,12 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
|
||||
"E15", /// 31
|
||||
"E16", /// 32
|
||||
"E21", /// 33
|
||||
"E36", /// 34
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
"E26", /// 35
|
||||
"E27", /// 36
|
||||
"E28", /// 37
|
||||
"E26", /// 34
|
||||
"E27", /// 35
|
||||
"E28", /// 36
|
||||
#endif
|
||||
"E36", /// 34 or 37
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
@@ -222,11 +222,13 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
|
||||
case 31: return E15 ? Strings.yes : Strings.no;
|
||||
case 32: return E16 ? Strings.yes : Strings.no;
|
||||
case 33: return E21 ? Strings.yes : Strings.no;
|
||||
case 34: return E36 ? Strings.yes : Strings.no;
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
case 35: return E26 ? Strings.yes : Strings.no;
|
||||
case 36: return E27 ? Strings.yes : Strings.no;
|
||||
case 37: return E28 ? Strings.yes : Strings.no;
|
||||
case 34: return E26 ? Strings.yes : Strings.no;
|
||||
case 35: return E27 ? Strings.yes : Strings.no;
|
||||
case 36: return E28 ? Strings.yes : Strings.no;
|
||||
case 37: return E36 ? Strings.yes : Strings.no;
|
||||
#else
|
||||
case 34: return E36 ? Strings.yes : Strings.no;
|
||||
#endif
|
||||
default: return string.Empty;
|
||||
}
|
||||
@@ -270,11 +272,13 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
|
||||
case 31: E15 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 32: E16 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 33: E21 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 34: E36 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
case 35: E26 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 36: E27 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 37: E28 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 34: E26 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 35: E27 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 36: E28 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
case 37: E36 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
#else
|
||||
case 34: E36 = (strValue == Strings.yes); return CfgUpdateFlags.AnyChange;
|
||||
#endif
|
||||
default: return CfgUpdateFlags.None;
|
||||
}
|
||||
@@ -390,12 +394,12 @@ namespace TBF.BenchControl.Output.EventTriggers.Standard
|
||||
prms.E15 = this.E15; /// 31
|
||||
prms.E16 = this.E16; /// 32
|
||||
prms.E21 = this.E21; /// 33
|
||||
prms.E36 = this.E36; /// 34
|
||||
#if TURA_IPERL || TURA_SPECIAL
|
||||
prms.E26 = this.E26; /// 35
|
||||
prms.E27 = this.E27; /// 36
|
||||
prms.E28 = this.E28; /// 37
|
||||
prms.E26 = this.E26; /// 34
|
||||
prms.E27 = this.E27; /// 35
|
||||
prms.E28 = this.E28; /// 36
|
||||
#endif
|
||||
prms.E36 = this.E36; /// 34 or 37
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace TBF.BenchControl.Sequences
|
||||
public static FloatBox PressUp = new FloatBox() { Name = "Pressure Up", Format = "F2" }; /// [bar]
|
||||
public static FloatBox PressDown = new FloatBox() { Name = "Pressure Dn", Format = "F2" }; /// [bar]
|
||||
public static FloatBox PressDelta = new FloatBox() { Name = "Pressure Delta", Format = "F2" }; /// [bar]
|
||||
public static FloatBox Conductivity = new FloatBox() { Name = "Conductivity", Format = "F0" }; /// [uS/cm]
|
||||
public static FloatBox Conductivity = new FloatBox(750) { Name = "Conductivity", Format = "F0" }; /// [uS/cm], default is 750
|
||||
|
||||
public static double LtrPerRefPulse; /// to calculate the ref.volume
|
||||
public static int RefPulses;
|
||||
|
||||
@@ -1503,6 +1503,8 @@ namespace TBF.BenchControl.Sequences
|
||||
tstRslt.TempUpMax = 20.0f;
|
||||
tstRslt.TempDownMax = 20.0f;
|
||||
tstRslt.TempDivMax = 20.0f;
|
||||
tstRslt.ConductMin = Conductivity.Val;
|
||||
tstRslt.ConductMax = Conductivity.Val;
|
||||
|
||||
tstRslt.DensityIn = Config.Formulas.RealDensity();
|
||||
tstRslt.DensityLine = Config.Formulas.RealDensity();
|
||||
@@ -1638,6 +1640,8 @@ namespace TBF.BenchControl.Sequences
|
||||
tstRslt.TempUpMax = 20.0f;
|
||||
tstRslt.TempDownMax = 20.0f;
|
||||
tstRslt.TempDivMax = 20.0f;
|
||||
tstRslt.ConductMin = Conductivity.Val;
|
||||
tstRslt.ConductMax = Conductivity.Val;
|
||||
|
||||
tstRslt.FlowMean = (float)RefFlowStat.Average;
|
||||
tstRslt.FlowStart = (float)RefFlowStat.First;
|
||||
@@ -1767,6 +1771,8 @@ namespace TBF.BenchControl.Sequences
|
||||
tstRslt.TempUpMax = 20.0f;
|
||||
tstRslt.TempDownMax = 20.0f;
|
||||
tstRslt.TempDivMax = 20.0f;
|
||||
tstRslt.ConductMin = Conductivity.Val;
|
||||
tstRslt.ConductMax = Conductivity.Val;
|
||||
|
||||
tstRslt.FlowMean = 0; /// TODO
|
||||
tstRslt.FlowMax = 0; /// TODO
|
||||
|
||||
+10
-23
@@ -964,41 +964,28 @@ namespace TBF.UI
|
||||
{
|
||||
string databaseName = Config.Utils.GetDBName(connectionString);
|
||||
string userName = Config.Utils.GetDBUser(connectionString);
|
||||
string password = Config.Utils.GetDBPassword(connectionString); /// TODO: Use password
|
||||
string password = Config.Utils.GetDBPassword(connectionString);
|
||||
|
||||
try
|
||||
{
|
||||
string credFileName = "tempfile";
|
||||
using (TextWriter writer = new StreamWriter(credFileName))
|
||||
const string CredFileName = "tempfile";
|
||||
using (TextWriter writer = new StreamWriter(CredFileName))
|
||||
{
|
||||
writer.WriteLine("[mysqldump]");
|
||||
writer.WriteLine(string.Format("user={0}", userName));
|
||||
writer.WriteLine(string.Format("password={0}", password));
|
||||
writer.WriteLine("host=localhost");
|
||||
writer.WriteLine("default-character-set=utf8");
|
||||
writer.WriteLine("[client]");
|
||||
writer.WriteLine(string.Format("password=\"{0}\"", password));
|
||||
}
|
||||
|
||||
System.Diagnostics.Process proc = new System.Diagnostics.Process();
|
||||
proc.StartInfo.FileName = @"C:\xampp\mysql\bin\mysqldump";
|
||||
///proc.StartInfo.Arguments = string.Format("--defaults-file={0} --quick -- {1} -r {2}", credFileName, databaseName, outputFileName);
|
||||
proc.StartInfo.Arguments = string.Format("--defaults-file={0} --quick -- {1}", credFileName, databaseName);
|
||||
proc.StartInfo.Arguments = string.Format("--defaults-file={0} --user={1} --host=localhost --protocol=tcp --port=3306 --default-character-set=utf8 --skip-triggers \"{2}\" -r {3}",
|
||||
CredFileName, userName, databaseName, outputFileName);
|
||||
proc.StartInfo.RedirectStandardOutput = true;
|
||||
proc.StartInfo.UseShellExecute = false;
|
||||
proc.StartInfo.CreateNoWindow = true;
|
||||
//proc.StartInfo.Verb = "runas"; /// To run mysqldump.exe as administrator
|
||||
proc.Start();
|
||||
proc.WaitForExit();
|
||||
|
||||
using (TextWriter writer = new StreamWriter(File.OpenWrite(outputFileName)))
|
||||
{
|
||||
proc.Start();
|
||||
while (!proc.StandardOutput.EndOfStream)
|
||||
{
|
||||
string line = proc.StandardOutput.ReadLine();
|
||||
writer.WriteLine(line);
|
||||
}
|
||||
proc.WaitForExit();
|
||||
}
|
||||
|
||||
File.Delete(credFileName);
|
||||
File.Delete(CredFileName);
|
||||
|
||||
log.ErrorFormat("Database {0} exported into file {1}", databaseName, outputFileName);
|
||||
return true;
|
||||
|
||||
@@ -489,11 +489,8 @@ namespace TBF.UI.Settings
|
||||
{
|
||||
using (TextWriter writer = new StreamWriter(CredFileName))
|
||||
{
|
||||
writer.WriteLine("[mysql]");
|
||||
writer.WriteLine(string.Format("user={0}", userName));
|
||||
writer.WriteLine(string.Format("password={0}", password));
|
||||
writer.WriteLine("host=localhost");
|
||||
writer.WriteLine("default-character-set=utf8");
|
||||
writer.WriteLine("[client]");
|
||||
writer.WriteLine(string.Format("password=\"{0}\"", password));
|
||||
}
|
||||
|
||||
System.Diagnostics.Process proc = new System.Diagnostics.Process();
|
||||
@@ -501,11 +498,11 @@ namespace TBF.UI.Settings
|
||||
proc.StartInfo.FileName = @"C:\xampp\mysql\bin\mysql.exe";
|
||||
if (string.IsNullOrEmpty(databaseToBeUsed))
|
||||
{
|
||||
proc.StartInfo.Arguments = string.Format("--defaults-file={0}", CredFileName);
|
||||
proc.StartInfo.Arguments = string.Format("--defaults-file={0} --user={1} --host=localhost --protocol=tcp --port=3306 --default-character-set=utf8", CredFileName, userName);
|
||||
}
|
||||
else
|
||||
{
|
||||
proc.StartInfo.Arguments = string.Format("--defaults-file={0} --database={1}", CredFileName, databaseToBeUsed);
|
||||
proc.StartInfo.Arguments = string.Format("--defaults-file={0} --user={1} --host=localhost --protocol=tcp --port=3306 --default-character-set=utf8 --database={2}", CredFileName, userName, databaseToBeUsed);
|
||||
}
|
||||
proc.StartInfo.UseShellExecute = false; /// Must be false to redirect standard input or standard output
|
||||
proc.StartInfo.RedirectStandardOutput = false;
|
||||
|
||||
Reference in New Issue
Block a user