コード例 #1
0
ファイル: MainForm.cs プロジェクト: nohbdy/ffxivmodelviewer
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Sound.SoundManager.Init();
            Cache.CacheManager.Init();

            System.Threading.Thread thread = new System.Threading.Thread(() =>
            {
                using (CacheProgress progressFrm = new CacheProgress())
                {
                    progressFrm.ShowDialog();
                }
            });
            thread.Start();

            try
            {
                // If dir not set, try to load from registry
                if (Settings.Default.GameDirectory.IsNullOrWhiteSpace())
                {
                    string installLocation = null;
                    string displayName = null;
                    string path;
                    string gameVerPath;
                    installLocation = Microsoft.Win32.Registry.GetValue(RegKeyx64, "InstallLocation", null) as string;
                    if (installLocation != null)
                    {
                        displayName = Microsoft.Win32.Registry.GetValue(RegKeyx64, "DisplayName", null) as string;
                        path = Path.Combine(installLocation, displayName);
                        gameVerPath = Path.Combine(path, "game.ver");
                        if (File.Exists(gameVerPath))
                        {
                            Settings.Default.GameDirectory = path;
                            Settings.Default.Save();
                        }
                    }
                    else
                    {
                        installLocation = Microsoft.Win32.Registry.GetValue(RegKeyx32, "InstallLocation", null) as string;
                        if (installLocation != null)
                        {
                            displayName = Microsoft.Win32.Registry.GetValue(RegKeyx64, "DisplayName", null) as string;
                            path = Path.Combine(installLocation, displayName);
                            gameVerPath = Path.Combine(path, "game.ver");
                            if (File.Exists(gameVerPath))
                            {
                                Settings.Default.GameDirectory = path;
                                Settings.Default.Save();
                            }
                        }
                    }
                }

                if (Settings.Default.GameDirectory.IsNullOrWhiteSpace())
                {
                    if (!OpenPreferenceWindow())
                    {
                        return;
                    }
                }
                else
                {
                    LoadCharaData();
                    LoadScriptData();
                }

                if (Cache.CacheManager.CacheIsStale)
                {
                    Cache.CacheManager.ReloadCache();
                }
            }
            finally
            {
                thread.Abort();
            }
        }
コード例 #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Sound.SoundManager.Init();
            Cache.CacheManager.Init();

            System.Threading.Thread thread = new System.Threading.Thread(() =>
            {
                using (CacheProgress progressFrm = new CacheProgress())
                {
                    progressFrm.ShowDialog();
                }
            });
            thread.Start();

            try
            {
                // If dir not set, try to load from registry
                if (Settings.Default.GameDirectory.IsNullOrWhiteSpace())
                {
                    string installLocation = null;
                    string displayName     = null;
                    string path;
                    string gameVerPath;
                    installLocation = Microsoft.Win32.Registry.GetValue(RegKeyx64, "InstallLocation", null) as string;
                    if (installLocation != null)
                    {
                        displayName = Microsoft.Win32.Registry.GetValue(RegKeyx64, "DisplayName", null) as string;
                        path        = Path.Combine(installLocation, displayName);
                        gameVerPath = Path.Combine(path, "game.ver");
                        if (File.Exists(gameVerPath))
                        {
                            Settings.Default.GameDirectory = path;
                            Settings.Default.Save();
                        }
                    }
                    else
                    {
                        installLocation = Microsoft.Win32.Registry.GetValue(RegKeyx32, "InstallLocation", null) as string;
                        if (installLocation != null)
                        {
                            displayName = Microsoft.Win32.Registry.GetValue(RegKeyx64, "DisplayName", null) as string;
                            path        = Path.Combine(installLocation, displayName);
                            gameVerPath = Path.Combine(path, "game.ver");
                            if (File.Exists(gameVerPath))
                            {
                                Settings.Default.GameDirectory = path;
                                Settings.Default.Save();
                            }
                        }
                    }
                }

                if (Settings.Default.GameDirectory.IsNullOrWhiteSpace())
                {
                    if (!OpenPreferenceWindow())
                    {
                        return;
                    }
                }
                else
                {
                    LoadCharaData();
                    LoadScriptData();
                }

                if (Cache.CacheManager.CacheIsStale)
                {
                    Cache.CacheManager.ReloadCache();
                }
            }
            finally
            {
                thread.Abort();
            }
        }