Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 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;
         }
     }
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 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());
         }
     }
 }
Exemplo n.º 6
0
 private static RegistryKey OpenRegistryKey(string KeyName, bool writable = false)
 {
     return(POL.OpenRegistryKey(POL.SelectedRegion_, KeyName, writable));
 }
Exemplo n.º 7
0
 public static RegistryKey OpenAppConfigKey(string ID, bool writable = false)
 {
     return(POL.OpenAppConfigKey(ID, POL.SelectedRegion_, writable));
 }
Exemplo n.º 8
0
 public static bool IsAppInstalled(string ID, Region Region)
 {
     return(POL.GetApplicationPath(ID, Region) != null);
 }
Exemplo n.º 9
0
 public static bool IsAppInstalled(string ID)
 {
     return(POL.IsAppInstalled(ID, POL.SelectedRegion_));
 }
Exemplo n.º 10
0
 public static string GetApplicationPath(string ID)
 {
     return(POL.GetApplicationPath(ID, POL.SelectedRegion_));
 }
Exemplo n.º 11
0
 public static RegistryKey OpenPOLUtilsConfigKey(string SubKey)
 {
     return(POL.OpenPOLUtilsConfigKey(SubKey, false));
 }
Exemplo n.º 12
0
 public static RegistryKey OpenPOLUtilsConfigKey(bool MachineWide)
 {
     return(POL.OpenPOLUtilsConfigKey(null, MachineWide));
 }
Exemplo n.º 13
0
 public static RegistryKey OpenPOLUtilsConfigKey()
 {
     return(POL.OpenPOLUtilsConfigKey(null, false));
 }
Exemplo n.º 14
0
 private static RegistryKey OpenRegistryKey(Region Region, string KeyName)
 {
     return(POL.OpenRegistryKey(Region, KeyName, false));
 }
Exemplo n.º 15
0
 private static RegistryKey OpenRegistryKey(string KeyName)
 {
     return(POL.OpenRegistryKey(POL.SelectedRegion_, KeyName, false));
 }
Exemplo n.º 16
0
 public static RegistryKey OpenAppConfigKey(string ID)
 {
     return(POL.OpenAppConfigKey(ID, POL.SelectedRegion_));
 }