BuildingCoder.CmdInstallLocation.Execute C# (CSharp) Method

Execute() public method

public Execute ( ExternalCommandData commandData, string &message, ElementSet elements ) : System.Result
commandData ExternalCommandData
message string
elements ElementSet
return System.Result
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            Application app = commandData.Application.Application;

              string reg_path_product
            = RegPathForFlavour(
              app.Product, app.VersionNumber );

              string product_code
            = GetRevitProductCode( reg_path_product );

              string install_location
            = GetRevitInstallLocation( product_code );

              string msg = FormatData(
            "Running application",
            app.VersionName,
            product_code,
            install_location );

              foreach( ProductType p in
            Enum.GetValues( typeof( ProductType ) ) )
              {
            try
            {
              reg_path_product = RegPathForFlavour(
            p, app.VersionNumber );

              product_code = GetRevitProductCode(
            reg_path_product );

              install_location = GetRevitInstallLocation(
            product_code );

              msg += FormatData(
            "\n\nInstalled product",
            p.ToString(),
            product_code,
            install_location );
            }
            catch( Exception )
            {
            }
              }

              Util.InfoMsg( msg );

              return Result.Failed;
        }