Microsoft.HockeyApp.Channel.Storage.GetApplicationFolder C# (CSharp) Méthode

GetApplicationFolder() private méthode

private GetApplicationFolder ( ) : DirectoryInfo
Résultat System.IO.DirectoryInfo
        private DirectoryInfo GetApplicationFolder()
        {
            IDictionary environment = Environment.GetEnvironmentVariables();

            var folderOption1 = new { RootPath = environment["LOCALAPPDATA"] as string,   AISubFolder = @"Microsoft\HockeyApp" };
            var folderOption2 = new { RootPath = environment["TEMP"] as string,           AISubFolder = @"Microsoft\HockeyApp" };
            var folderOption3 = new { RootPath = environment["ProgramData"] as string,    AISubFolder = @"Microsoft HockeyApp" };

            foreach (var folderOption in new[] { folderOption1, folderOption2, folderOption3 })
            {
                try
                {
                    if (!string.IsNullOrEmpty(folderOption.RootPath))
                    {
                        var root = new DirectoryInfo(folderOption.RootPath);
                        string subdirectoryPath = Path.Combine(folderOption.AISubFolder, this.storageFolderName);
                        DirectoryInfo telemetryDirectory = root.CreateSubdirectory(subdirectoryPath);
                        CheckAccessPermissions(telemetryDirectory);
                        return telemetryDirectory;
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    continue;
                }
            }

            return null;
        }