B2018-038 MathType replaces EQNEDT32.EXE

This commit is contained in:
Rich 2018-02-22 18:44:13 +00:00
parent 96e903968f
commit 97b3281553

View File

@ -1171,17 +1171,43 @@ namespace Volian.Controls.Library
folderPath = @"C:\Program Files\Common Files\Microsoft Shared\EQUATION\EQNEDT32.EXE"; folderPath = @"C:\Program Files\Common Files\Microsoft Shared\EQUATION\EQNEDT32.EXE";
fi = new System.IO.FileInfo(folderPath); fi = new System.IO.FileInfo(folderPath);
if (fi.Exists) return fi.FullName; if (fi.Exists) return fi.FullName;
// B2018-038 MathType replaces EqnEdt32.EXE
//folderPath = @"C:\Program Files\MathType\MathType.EXE";
//fi = new System.IO.FileInfo(folderPath);
//if (fi.Exists) return fi.FullName;
return null; return null;
} }
if (retval == null) if (retval == null)
_MyLog.WarnFormat("Equation Editor executable could not be found."); _MyLog.WarnFormat("Equation Editor executable could not be found.");
return retval; return retval;
} }
// B2018-038 MathType Replacement for EQNEDT32.EXE
private static string GetMathType()
{
string retval = null;
try
{
RegistryKey key = Registry.ClassesRoot;
string rootName = key.Name;
string clsid = GetDefaultKeyValue(key.Name + "\\DSEquations\\CLSID");
retval = GetDefaultKeyValue(key.Name + "\\CLSID\\" + clsid + "\\LocalServer32");
}
catch (Exception ex)
{
_MyLog.WarnFormat("MathType Equation Editor is not correctly configured in the registry.");
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
folderPath += @"\MathType\MathType.EXE";
System.IO.FileInfo fi = new System.IO.FileInfo(folderPath);
if (fi.Exists) return fi.FullName;
folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles).Replace(" (x86)", "");
folderPath += @"\MathType\MathType.EXE";
fi = new System.IO.FileInfo(folderPath);
if (fi.Exists) return fi.FullName;
folderPath = @"C:\Program Files\\MathType\MathType.EXE";
fi = new System.IO.FileInfo(folderPath);
if (fi.Exists) return fi.FullName;
return null;
}
if (retval == null)
_MyLog.WarnFormat("Equation Editor executable could not be found.");
return retval;
}
private static string GetVisio() // Added support for Visio private static string GetVisio() // Added support for Visio
{ {
string retval = _SpecifiedVisioPath; // use the Visio path specified by the user string retval = _SpecifiedVisioPath; // use the Visio path specified by the user
@ -1230,6 +1256,7 @@ namespace Volian.Controls.Library
{ {
_OleObjectEditors = 0;// no OLE Object Editors _OleObjectEditors = 0;// no OLE Object Editors
_EqnEdtPath = GetEqnEdt(); _EqnEdtPath = GetEqnEdt();
if (_EqnEdtPath == null) _EqnEdtPath = GetMathType();// B2018-038 MathType Replacement for EQNEDT32.EXE
// B2017-067 check for empty string as well as a null for paths to the Equation Editor and Visio // B2017-067 check for empty string as well as a null for paths to the Equation Editor and Visio
if (_EqnEdtPath != null && _EqnEdtPath != "") _OleObjectEditors += 1; if (_EqnEdtPath != null && _EqnEdtPath != "") _OleObjectEditors += 1;
_VisioPath = GetVisio(); _VisioPath = GetVisio();