예제 #1
0
        void HandlePackagesImpl() {
            Tools.FileUtil.Ops.CreateDirectoryAndSetACLWithFallbackAndRetry(_gameDir);
            var syncPackagesPath = _gameDir.GetChildDirectoryWithName("syncpackages");
            if (!syncPackagesPath.Exists)
                return;

            var packages = syncPackagesPath.DirectoryInfo.EnumerateDirectories()
                .Where(x => File.Exists(Path.Combine(x.FullName, "package.config"))).ToArray();
            if (!packages.Any())
                return;

            var tempPath = Path.GetTempPath().ToAbsoluteDirectoryPath().GetChildDirectoryWithName("RpfGenerator");
            if (!tempPath.Exists)
                Directory.CreateDirectory(tempPath.ToString());

            var consts = new Uri("https://dl.dropboxusercontent.com/u/18252370/GTA/gta5_const.dat.gz");
            using (var wc = new WebClient()) {
                var data = wc.DownloadData(consts);
                var decompressed = Decompress(data);
                using (var ms = new MemoryStream(decompressed))
                    LoadConsts(ms);
            }

            var packager = new Packager(_gameDir,
                _gameDir.GetChildDirectoryWithName("mods"),
                tempPath,
                new Packager.PackagerConfig {
                    TreatImportsAsInserts = true,
                    BuilderConfig = new RpfListBuilder.RpfListBuilderConfig {AudioPathsOnly = true}
                });

            foreach (var p in packages)
                packager.PackageMod(p.FullName.ToAbsoluteDirectoryPath());
        }
예제 #2
0
 string FetchString(Uri uri) {
     using (var wcLifeTime = new WebClient()) {
         new AuthProvider(new AuthProviderSettingsStorage(DomainEvilGlobal.Settings)).HandleAuthInfo(uri, wcLifeTime);
         return wcLifeTime.DownloadString(uri);
     }
 }
예제 #3
0
 static Tuple<IWebClient, Action> OnExportLifetimeContextCreator() {
     var wc = new WebClient();
     return new Tuple<IWebClient, Action>(wc, wc.Dispose);
 }