Example #1
0
        private static T ReadXml <T>(string fileName)
        {
            var path = Path.Combine(DeploymentEnvironmentVariables.RootDirectory, fileName);

            try
            {
                return(SettingsProcessor.ReadSettings <T>(path));
            }
            catch (UnauthorizedAccessException ex)
            {
                ExitInstallation(ex, $"Failed to read {path}. Access to the file denied", ExitCode.FailedToReadSettings);
            }
            catch (InvalidOperationException ex)
            {
                ExitInstallation(ex, $"Failed to deserialized {path}. Verify that {path} is a valid xml file", ExitCode.FailedToReadSettings);
            }
            catch (Exception ex)
            {
                ExitInstallation(ex, $"Failed to read {path}", ExitCode.FailedToReadSettings);
            }
            return(default(T));
        }