コード例 #1
0
        /// <summary>
        /// Loads the specified type from the specified XML file.
        /// </summary>
        /// <param name="configurationFile">Configuration file containing XML declaration of the type.</param>
        /// <param name="type">Type that should be instantiated and initialized.</param>
        /// <returns>Returns the initialized object of the specified type.</returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        /// <exception cref="System.IO.FileNotFoundException"></exception>
        public static void Load()
        {
            string configurationFilePath = ConfigurationFile;

            //DebugFileAccess(configurationFilePath);

            if (!File.Exists(configurationFilePath))
            {
                throw new Exception(string.Format("Configuration file ({0}) cannot be found. Either it doesn't exist or access is denied.", ConfigurationFile));
            }

            FileStream fs = null;

            try
            {
                fs             = new FileStream(configurationFilePath, FileMode.Open, FileAccess.Read);
                _Configuration = (ExportConfiguration)LoadConfiguration(fs, typeof(ExportConfiguration));
            }
            finally
            {
                fs.Close();
            }
        }
コード例 #2
0
        /// <summary>
        /// Loads the specified type from the specified XML file.
        /// </summary>
        /// <param name="configurationFile">Configuration file containing XML declaration of the type.</param>
        /// <param name="type">Type that should be instantiated and initialized.</param>
        /// <returns>Returns the initialized object of the specified type.</returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        /// <exception cref="System.IO.FileNotFoundException"></exception>
        public static void Load()
        {
            string configurationFilePath = ConfigurationFile;
            //DebugFileAccess(configurationFilePath);

            if (!File.Exists(configurationFilePath))
            {
                throw new Exception(string.Format("Configuration file ({0}) cannot be found. Either it doesn't exist or access is denied.", ConfigurationFile));
            }

            FileStream fs = null;
            try
            {
                fs = new FileStream(configurationFilePath, FileMode.Open, FileAccess.Read);
                _Configuration = (ExportConfiguration)LoadConfiguration(fs, typeof(ExportConfiguration));
            }
            finally
            {
                fs.Close();
            }
        }
コード例 #3
0
 public static void New()
 {
     _Configuration = new ExportConfiguration();
     _Configuration.Version = Version;
 }
コード例 #4
0
 public static void New()
 {
     _Configuration         = new ExportConfiguration();
     _Configuration.Version = Version;
 }