Example #1
0
 private static void Encrypt(string input, string output, IResourceCryptographyService crypto)
 {
     using (var outputFs = new FileStream(output, FileMode.Create))
         using (var inputFs = new FileStream(input, FileMode.Open))
             using (var cryptoFs = crypto.Write(outputFs))
             {
                 inputFs.CopyTo(cryptoFs);
             }
 }
        public GameResourceManager(IOptions <AppSettings> appSettings, IResourceCryptographyService resourceCryptographyService)
        {
            var settings = appSettings.Value;

            _rootDir = settings.Resources?.Path ?? "";
            if (_rootDir.StartsWith("~/"))
            {
                _rootDir = _rootDir.Replace("~/", "");
                _rootDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), _rootDir);
            }
            _resourceCryptographyService = resourceCryptographyService;
        }