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)); }
private static Icon GetPOLConfigIcon(ushort ResourceID) { string POLPath = POL.GetApplicationPath("1000"); if (POLPath == null) { return(null); } return(Icons.GetIcon(Path.Combine(POLPath, Path.Combine("polcfg", "polcfg.exe")), ResourceID)); }
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); }
public static void ChooseRegion(Form Parent) { POL.DetectRegions(); if (POL.MultipleRegionsAvailable) { using (ChooseRegionDialog CRD = new ChooseRegionDialog()) CRD.ShowDialog(Parent); } else // No multiple regions installed? No choice to be made then! { POL.SelectedRegion_ = POL.AvailableRegions_; } using (RegistryKey POLKey = POL.OpenPOLUtilsConfigKey()) { if (POLKey != null) { POLKey.SetValue("Region", POL.SelectedRegion_.ToString()); } } }
private static RegistryKey OpenRegistryKey(string KeyName, bool writable = false) { return(POL.OpenRegistryKey(POL.SelectedRegion_, KeyName, writable)); }
public static RegistryKey OpenAppConfigKey(string ID, bool writable = false) { return(POL.OpenAppConfigKey(ID, POL.SelectedRegion_, writable)); }
public static bool IsAppInstalled(string ID, Region Region) { return(POL.GetApplicationPath(ID, Region) != null); }
public static bool IsAppInstalled(string ID) { return(POL.IsAppInstalled(ID, POL.SelectedRegion_)); }
public static string GetApplicationPath(string ID) { return(POL.GetApplicationPath(ID, POL.SelectedRegion_)); }
public static RegistryKey OpenPOLUtilsConfigKey(string SubKey) { return(POL.OpenPOLUtilsConfigKey(SubKey, false)); }
public static RegistryKey OpenPOLUtilsConfigKey(bool MachineWide) { return(POL.OpenPOLUtilsConfigKey(null, MachineWide)); }
public static RegistryKey OpenPOLUtilsConfigKey() { return(POL.OpenPOLUtilsConfigKey(null, false)); }
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)); }
public static RegistryKey OpenAppConfigKey(string ID) { return(POL.OpenAppConfigKey(ID, POL.SelectedRegion_)); }