GetDownloadsPath() 공개 정적인 메소드

public static GetDownloadsPath ( ) : string
리턴 string
예제 #1
0
        private void DownloadModBundle(string downloadUrlAddress)
        {
            var wc            = new WebClient();
            var localFilePath = Path.Combine(Util.GetDownloadsPath(), "gta5eyetracking_bundle.zip");

            wc.DownloadFile(downloadUrlAddress, localFilePath);
        }
예제 #2
0
        private void DownloadScriptHookV(string downloadUrlAddress)
        {
            var wc = new WebClient();

            wc.Headers.Add("Referer", "http://www.dev-c.com/gtav/scripthookv/");

            var localFilePath = Path.Combine(Util.GetDownloadsPath(), "scripthookv.zip");

            wc.DownloadFile(downloadUrlAddress, localFilePath);
        }
예제 #3
0
        private bool InstallModBundle()
        {
            var localFilePath = Path.Combine(Util.GetDownloadsPath(), "gta5eyetracking_bundle.zip");

            if (!File.Exists(localFilePath))
            {
                return(false);
            }

            try
            {
                var extractPath = Path.Combine(Util.GetDownloadsPath(), "gta5eyetracking_bundle");
                if (Directory.Exists(extractPath))
                {
                    Directory.Delete(extractPath, true);
                }

                using (var zipFile = ZipFile.Open(localFilePath, ZipArchiveMode.Read))
                {
                    zipFile.ExtractToDirectory(extractPath);
                }
                File.Delete(localFilePath);

                var scriptHookFiles = new List <string>
                {
                    "ScriptHookV.dll",
                    "NativeTrainer.asi",
                    "dinput8.dll"
                };

                var scriptHookVVersion = GetScriptHookVVersion(Path.Combine(extractPath, "ScriptHookV.dll"));

                var scriptHookVDllPath   = Path.Combine(_settings.GtaPath, "bin", "ScriptHookV.dll");
                var dinput8DllPath       = Path.Combine(_settings.GtaPath, "bin", "dinput8.dll");
                var nativeTrainerAsiPath = Path.Combine(_settings.GtaPath, "bin", "NativeTrainer.asi");

                var skipScriptHook = File.Exists(scriptHookVDllPath) &&
                                     File.Exists(dinput8DllPath) &&
                                     File.Exists(nativeTrainerAsiPath) &&
                                     IsVersionLower(scriptHookVVersion, GetInstalledScriptHookVVersion());

                Util.DirectoryCopy(Path.Combine(extractPath), _settings.GtaPath, true, true, true,
                                   skipScriptHook ? scriptHookFiles : new List <string>());
            }
            catch
            {
                return(false);
                //Failed to forceInstall
            }

            ModInstalled(this, new EventArgs());
            return(true);
        }
예제 #4
0
        private bool InstallScriptHookV()
        {
            var localFilePath = Path.Combine(Util.GetDownloadsPath(), "scripthookv.zip");

            if (!File.Exists(localFilePath))
            {
                return(false);
            }

            try
            {
                var extractPath = Path.Combine(Util.GetDownloadsPath(), "scripthookv");
                if (Directory.Exists(extractPath))
                {
                    Directory.Delete(extractPath, true);
                }
                using (var zipFile = ZipFile.Open(localFilePath, ZipArchiveMode.Read))
                {
                    zipFile.ExtractToDirectory(extractPath);
                }
                File.Delete(localFilePath);

                var scriptHookVDllPath       = Path.Combine(extractPath, "bin", "ScriptHookV.dll");
                var scriptHookVDllPathDest   = Path.Combine(_settings.GtaPath, "ScriptHookV.dll");
                var dinput8DllPath           = Path.Combine(extractPath, "bin", "dinput8.dll");
                var dinput8DllPathDest       = Path.Combine(_settings.GtaPath, "dinput8.dll");
                var nativeTrainerAsiPath     = Path.Combine(extractPath, "bin", "NativeTrainer.asi");
                var nativeTrainerAsiPathDest = Path.Combine(_settings.GtaPath, "NativeTrainer.asi");


                if (File.Exists(scriptHookVDllPathDest))
                {
                    if (File.Exists(scriptHookVDllPathDest + ".bak"))
                    {
                        File.Delete(scriptHookVDllPathDest + ".bak");
                    }
                    File.Move(scriptHookVDllPathDest, scriptHookVDllPathDest + ".bak");
                }
                if (File.Exists(dinput8DllPathDest))
                {
                    if (File.Exists(dinput8DllPathDest + ".bak"))
                    {
                        File.Delete(dinput8DllPathDest + ".bak");
                    }
                    File.Move(dinput8DllPathDest, dinput8DllPathDest + ".bak");
                }
                if (File.Exists(nativeTrainerAsiPathDest))
                {
                    if (File.Exists(nativeTrainerAsiPathDest + ".bak"))
                    {
                        File.Delete(nativeTrainerAsiPathDest + ".bak");
                    }
                    File.Move(nativeTrainerAsiPathDest, nativeTrainerAsiPathDest + ".bak");
                }

                File.Copy(scriptHookVDllPath, Path.Combine(_settings.GtaPath, Path.GetFileName(scriptHookVDllPath)), true);
                File.Copy(dinput8DllPath, Path.Combine(_settings.GtaPath, Path.GetFileName(dinput8DllPath)), true);
                File.Copy(nativeTrainerAsiPath, Path.Combine(_settings.GtaPath, Path.GetFileName(nativeTrainerAsiPath)), true);
            }
            catch (Exception e)
            {
                return(false);
                //Failed to forceInstall
            }

            ScriptHookVInstalled(this, new EventArgs());
            return(true);
        }