Annotation to upgrade error

Dec 18, 2015 at 10:50 AM
Hi Oleg,
here is Olga. I would like to remark to you which MA seem to work and which not. I'm using debug mode for check the behaviour.
All MA including "OSVersionDetection" work fine. I have to admit though that "RemoveStep" is seems to be executed in spite of the fact that this MA isn't indicated. Detection from isUpgrading variable seems to fail. Can you recognize what goes wrong?
public static ActionResult RemoveStep(Session session)
{
#if DEBUG
System.Diagnostics.Debugger.Launch();
#endif
ActionResult ret = ActionResult.Failure;

bool isUpgraded = false;
using (RegistryKey ndpKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.Users,
"").OpenSubKey(@".DEFAULT\Software\GMC Systems\GMC Konverter Client\"))
{
if (ndpKey.ValueCount > 1)
{
string version = ndpKey.GetValue("Client Version", "").ToString();

int tmpupdate = 2;//Update für die Version
int tmplocal = 0;
if (Int32.TryParse(version, out tmplocal) == true && ((tmplocal != 0) && (tmplocal < tmpupdate)))
{ isUpgraded = true; }
}
}
if (isUpgraded == true)
session["isUpgraded"] = "TRUE";
else
session["isUpgraded"] = "FALSE";
#if DEBUG
MessageBox.Show("isUpgrading: " + session.Property("isUpgraded") + " .");
#endif
if (session["isUpgraded"] == "TRUE")
{
return ret = ActionResult.Success;
}
StringBuilder path = new StringBuilder(260);
SHGetSpecialFolderPath(IntPtr.Zero, path, CSIDL_COMMON_STARTMENU, false);
string commonStartMenuPath = path.ToString();
string appStartMenuPath = System.IO.Path.Combine(commonStartMenuPath, "Programs");
string QMAXappStartMenuPath = System.IO.Path.Combine(appStartMenuPath, "Qmax");
session["MWSC"] = QMAXappStartMenuPath;
if (!String.IsNullOrEmpty(session["MWSC"]) && session["MWSC"] != "LEER")
{
String remdir = System.IO.Path.Combine(session["MWSC"], "GMC Konverter");
#if DEBUG
MessageBox.Show("Entferne: " + remdir);
#endif
if (System.IO.Directory.Exists(remdir))
{
if (Tools.RemoveDir(remdir))
#if DEBUG
MessageBox.Show(remdir + " wurde entfernt.");
#endif
ret = ActionResult.Success;
}
else
ret = ActionResult.Success;
}
ret = RemoveDirectories(session);
return ret;
}
Olga