Annotation of cleanflash/CleanFlashCommon/SystemInfo.cs, revision 1.1.1.1

1.1       root        1: using System;
                      2: using System.Collections.Generic;
                      3: using System.IO;
                      4: 
                      5: namespace CleanFlashCommon {
                      6:     public class SystemInfo {
                      7: 
                      8:         private static string system32Path = Environment.GetFolderPath(Environment.SpecialFolder.SystemX86);
                      9:         private static string system64Path = Environment.GetFolderPath(Environment.SpecialFolder.System);
                     10:         private static string program32Path = Environment.GetEnvironmentVariable("PROGRAMFILES(X86)") ?? Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
                     11:         private static string flashProgram32Path = Path.Combine(program32Path, "Flash Player");
                     12:         private static string macromed32Path = Path.Combine(system32Path, "Macromed");
                     13:         private static string macromed64Path = Path.Combine(system64Path, "Macromed");
                     14:         private static string flash32Path = Path.Combine(macromed32Path, "Flash");
                     15:         private static string flash64Path = Path.Combine(macromed64Path, "Flash");
                     16:         private static string version = UpdateChecker.GetFlashVersion();
                     17:         private static string versionPath = version.Replace(".", "_");
                     18:         private static string versionComma = version.Replace(".", ",");
                     19:         private static Dictionary<string, string> replacementStrings = new Dictionary<string, string>() {
                     20:             { "${SYSTEM_32_PATH}", system32Path.Replace(@"\", @"\\") },
                     21:             { "${SYSTEM_64_PATH}", system64Path.Replace(@"\", @"\\") },
                     22:             { "${PROGRAM_32_PATH}", program32Path.Replace(@"\", @"\\") },
                     23:             { "${PROGRAM_FLASH_32_PATH}", flashProgram32Path.Replace(@"\", @"\\") },
                     24:             { "${FLASH_32_PATH}", flash32Path.Replace(@"\", @"\\") },
                     25:             { "${FLASH_64_PATH}", flash64Path.Replace(@"\", @"\\") },
                     26:             { "${VERSION}", version },
                     27:             { "${VERSION_PATH}", versionPath },
                     28:             { "${VERSION_COMMA}", versionComma },
                     29:             { "${ARCH}", Environment.Is64BitOperatingSystem ? "64" : "32" }
                     30:         };
                     31: 
                     32:         public static string GetSystem32Path() {
                     33:             return system32Path;
                     34:         }
                     35: 
                     36:         public static string GetSystem64Path() {
                     37:             return system64Path;
                     38:         }
                     39: 
                     40:         public static string GetProgram32Path()
                     41:         {
                     42:             return program32Path;
                     43:         }
                     44: 
                     45:         public static string GetProgramFlash32Path()
                     46:         {
                     47:             return flashProgram32Path;
                     48:         }
                     49: 
                     50:         public static string[] GetSystemPaths() {
                     51:             if (Environment.Is64BitOperatingSystem) {
                     52:                 return new string[] { system32Path, system64Path };
                     53:             } else {
                     54:                 return new string[] { system32Path };
                     55:             }
                     56:         }
                     57: 
                     58:         public static string GetMacromed32Path() {
                     59:             return macromed32Path;
                     60:         }
                     61: 
                     62:         public static string GetMacromed64Path() {
                     63:             return macromed64Path;
                     64:         }
                     65: 
                     66:         public static string[] GetMacromedPaths() {
                     67:             if (Environment.Is64BitOperatingSystem) {
                     68:                 return new string[] { macromed32Path, macromed64Path };
                     69:             } else {
                     70:                 return new string[] { macromed32Path };
                     71:             }
                     72:         }
                     73: 
                     74:         public static string GetFlash32Path() {
                     75:             return flash32Path;
                     76:         }
                     77: 
                     78:         public static string GetFlash64Path() {
                     79:             return flash64Path;
                     80:         }
                     81: 
                     82:         public static string GetVersionPath() {
                     83:             return versionPath;
                     84:         }
                     85: 
                     86:         public static bool IsLegacyWindows() {
                     87:             System.Version version = Environment.OSVersion.Version;
                     88: 
                     89:             return version.Major <= 6 && (version.Major != 6 || version.Minor < 2);
                     90:         }
                     91: 
                     92:         public static Dictionary<string, string> GetReplacementStrings() {
                     93:             return replacementStrings;
                     94:         }
                     95: 
                     96:         public static string FillString(string str) {
                     97:             // Some registry values require special strings to be filled out.
                     98:             foreach (KeyValuePair<string, string> pair in replacementStrings) {
                     99:                 str = str.Replace(pair.Key, pair.Value);
                    100:             }
                    101: 
                    102:             return str;
                    103:         }
                    104:     }
                    105: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.