public static RegistryKey OpenAppConfigKey(string ID, Region Region, bool writable = false) { string BaseKey; switch (Region) { case Region.Europe: BaseKey = "SquareEnix"; break; case Region.Japan: BaseKey = "SQUARE"; break; case Region.NorthAmerica: BaseKey = "SquareEnix"; break; default: return(null); } string AppKey; if (ID == AppID.FFXI) { AppKey = "FinalFantasyXI"; } else if (ID == AppID.TetraMaster) { AppKey = "TetraMaster"; } else if (ID == AppID.POLViewer) { AppKey = "PlayOnlineViewer"; } else { return(null); } return(POL.OpenRegistryKey(Region, Path.Combine(BaseKey, AppKey), writable)); }
public static void DetectRegions() { // Get configured region using (RegistryKey SettingsKey = POL.OpenPOLUtilsConfigKey(true)) { if (SettingsKey != null) { string UserRegion = SettingsKey.GetValue("Region", "None") as string; try { POL.SelectedRegion_ = (Region)Enum.Parse(typeof(Region), UserRegion, true); } catch { POL.SelectedRegion_ = Region.None; } } } // Check for installed POL software foreach (Region R in Enum.GetValues(typeof(Region))) { using (RegistryKey POLKey = POL.OpenRegistryKey(R, "InstallFolder")) { if (POLKey != null) { POL.AvailableRegions_ |= R; } } } // If user's choice is not available, clear that selection if ((POL.AvailableRegions_ & POL.SelectedRegion_) != POL.SelectedRegion_) { POL.SelectedRegion_ = Region.None; } // Select a region based on what's available if (POL.SelectedRegion_ == Region.None) { if ((POL.AvailableRegions_ & Region.NorthAmerica) != 0) { POL.SelectedRegion_ = Region.NorthAmerica; } else if ((POL.AvailableRegions_ & Region.Europe) != 0) { POL.SelectedRegion_ = Region.Europe; } else if ((POL.AvailableRegions_ & Region.Japan) != 0) { POL.SelectedRegion_ = Region.Japan; } } }
public static string GetApplicationPath(string ID, Region Region) { if ((POL.AvailableRegions & Region) == 0) { return(null); } RegistryKey POLKey = POL.OpenRegistryKey(Region, "InstallFolder"); if (POLKey == null) { return(null); } string InstallPath = POLKey.GetValue(ID, null) as string; POLKey.Close(); return(InstallPath); }
private static RegistryKey OpenRegistryKey(string KeyName, bool writable = false) { return(POL.OpenRegistryKey(POL.SelectedRegion_, KeyName, writable)); }
private static RegistryKey OpenRegistryKey(Region Region, string KeyName) { return(POL.OpenRegistryKey(Region, KeyName, false)); }
private static RegistryKey OpenRegistryKey(string KeyName) { return(POL.OpenRegistryKey(POL.SelectedRegion_, KeyName, false)); }