Exemplo n.º 1
0
 public static string GetProductName(string productCode)
 {
     string productName = (string) productCodesToNames[productCode];
     if(productName == null)
     {
         productName = new ProductInstallation(productCode).ProductName;
         productName = productName.Replace('\\', ' ');
         if(productNamesToCodes.Contains(productName))
         {
             string modifiedProductName = null;
             for(int i = 2; i < Int32.MaxValue; i++)
             {
                 modifiedProductName = productName + " [" + i + "]";
                 if(!productNamesToCodes.Contains(modifiedProductName)) break;
             }
             productName = modifiedProductName;
         }
         productCodesToNames[productCode] = productName;
         productNamesToCodes[productName] = productCode;
     }
     return productName;
 }