Office 2010 Toolkit and EZ-Activator.

Discussion in 'MDL Projects and Applications' started by CODYQX4, Apr 27, 2010.

Thread Status:
Not open for further replies.
  1. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,775
    150
    Pkey-config is useless. People backed it up to frankenbuild and believe its needed for RTM. They replaced RTM with BETA to use beta key. pkey-config is same for all RTM office and never changes.

    Restore is likely to fail after reformat/reinstall for some reason.
     
  2. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,775
    150
    #922 CODYQX4, Sep 18, 2010
    Last edited: Sep 18, 2010
    (OP)
    Perhaps someone could help me solve a quick problem.

    Here's a if statement that is not working.
    if (Common.ExcelRetailLicenseInstalled == true && (Common.ExcelRetailLicType.Contains("Trial") || Common.ExcelRetailLicType.Contains("Subscription") || (Common.ExcelRetailLicType.Contains("Retail") && Common.ExcelRetailLicStatus != "Activated")));


    Always ends up true (and VS says possible mistaken empty statement).

    What it does is a function previously got license details. A retail app can be Bypass (which we ignore and leave alone since its guaranteed activated. Trial, subscription, or Retail (MSDN or otherwise).

    Trial/Subscription can be marked as Activated (This means Licensed, as in not Rearm or Notifications, even though trial = 60 days). We get rid of it period. Retail if activated is activated forever so we don't want to uninstall it.

    The if statement needs to tell the first variable is true, if not, do not do the if statement.
    If true, check the license status. It will either contain the text, "subscription, retail, or trial" If subscription or trial, if is true, if retail, check if activated, if activated, then remove, not activated means if statement is false.

    This is used by EZ-Activator to decide whether or not to remove retail keys. Since this statement is messed up its giving true and attempting to remove retail keys indiscriminately and even if that retail product is not installed.

    EDIT: I'd like to do it in one if statement, as there are like 20 of these, so nested ifs or elses really add up. I was doing the Trial, Sub, or retail check as a nested if under License installed, with the remove key call there 3 times.
     
  3. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    #923 MasterDisaster, Sep 19, 2010
    Last edited: Sep 19, 2010
    Try this

    if (Common.ExcelRetailLicenseInstalled == true && (Common.ExcelRetailLicType.Contains("Trial") || Common.ExcelRetailLicType.Contains("Subscription") || Common.ExcelRetailLicType.Contains("Retail")) && Common.ExcelRetailLicStatus != "Activated");

    You have made a small mistake of using OR on the last two statements.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,775
    150
    Didn't work.
     
  5. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    How about this

    if (Common.ExcelRetailLicenseInstalled == true & (Common.ExcelRetailLicType.Contains("Trial") || Common.ExcelRetailLicType.Contains("Subscription") || Common.ExcelRetailLicType.Contains("Retail")) & Common.ExcelRetailLicStatus != "Activated");

    By using logical AND (&&) if the first statement is true it will not check the next statement, but in bitwise AND (&) all the statements will be evaluated.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Bosh

    Bosh MDL Developer

    May 30, 2010
    613
    297
    30
    #926 Bosh, Sep 19, 2010
    Last edited: Sep 19, 2010
    Try this code, let me know if it worked.

    if (Common.ExcelRetailLicenseInstalled == true && ((Common.ExcelRetailLicType.Contains("Trial") || Common.ExcelRetailLicType.Contains("Subscription")) || (Common.ExcelRetailLicType.Contains("Retail")) && Common.ExcelRetailLicStatus != "Activated")));

    Here's what it does:

    The ExcelRetailLicenseInstalled has to be true
    AND
    (
    ( If it contains "Trial" OR "Subscription" the if is executed )
    OR
    ( If it contains "Retail" AND the RetailLicStatus is "Activated )
    )
     
  7. Bosh

    Bosh MDL Developer

    May 30, 2010
    613
    297
    30
    I think it's the other way around, you're describing the OR statement, the logical AND && evaluates left-to-right and stops evaluating if one of the statements is false.
     
  8. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,775
    150
    Neither work. I don't even know if its possible to do all that in one if statement...
     
  10. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    What kind of scenario are you checking?

    eg. Excel is Installed and activated
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,775
    150
    Checking if its anything but Activated permanently. Trial is 60 activated and 30 days unactivated, subscription is something activated and 30 days unactivated. Retail key can be installed at 30 days and unactivated, or permanently activated.

    If the key is trial, immediately remove it. Same with subscription. If Retail non trial/subscription key, Only remove it if its not permanently activated (which I determine earlier just fine).
     
  12. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    #932 MasterDisaster, Sep 19, 2010
    Last edited: Sep 19, 2010
    if (Common.ExcelRetailLicenseInstalled == true & (Common.ExcelRetailLicType.Contains("Trial") | Common.ExcelRetailLicType.Contains("Subscription")) || (Common.ExcelRetailLicType.Contains("Retail") & Common.ExcelRetailLicStatus != "Activated"));

    Hope the above works. So, trial or subscription should be removed whether it is activated or not and Retail should be removed only if not activated.

    Is Common.ExcelRetailLicenseInstalled bool type, if yes it is redundant to check '== true'
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,775
    150
    Still no go.
     
  14. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    Epic fail on my part

    There is ; at the end of the statement. Did you remove it before compiling?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,775
    150
    That got rid of the syntax error, but its not getting the trial key.
     
  16. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    Is your scenario the following?
    string LicType = "Trial";
    bool LicenseInstalled = true;
    string LicStatus = "Activated";
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,775
    150
    In my current scenario, trial, isinstalled, not activated. Checking activation should only come into play when LicType="Retail", otherwise get red of that key if trial or subscription without concern about whether its activated. Maybe one of the past examples worked but had the ; in it.
     
  18. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,255
    675
    60
    Try this


    if (Common.ExcelRetailLicenseInstalled & (Common.ExcelRetailLicType.Contains("Trial") | Common.ExcelRetailLicType.Contains("Subscription")) | (Common.ExcelRetailLicType.Contains("Retail") & Common.ExcelRetailLicStatus != "Activated"))
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. CODYQX4

    CODYQX4 MDL Developer

    Sep 4, 2009
    4,813
    45,775
    150
    OK I got it to remove trial key.
     
  20. Bosh

    Bosh MDL Developer

    May 30, 2010
    613
    297
    30