Пример #1
0
        /// <summary>
        /// Utility method to get the settings
        /// </summary>
        /// <param name="lookUp">IDynamoLookUp instance</param>
        /// <param name="updateManager"></param>
        /// <returns></returns>
        public static UpdateManagerConfiguration GetSettings(IDynamoLookUp lookUp, IUpdateManager updateManager = null)
        {
            string filePath;
            var    exists = TryGetConfigFilePath(out filePath);

#if DEBUG
            //This code is just to create the default config file to
            //save the default settings, which later on can be modified
            //to re-direct it to other download target for testing.
            if (!exists)
            {
                var umConfig = new UpdateManagerConfiguration();
                umConfig.Save(filePath, updateManager);
            }
#endif
            if (!exists)
            {
                return new UpdateManagerConfiguration()
                       {
                           DynamoLookUp = lookUp
                       }
            }
            ;

            var config = Load(filePath, updateManager);
            if (null != config)
            {
                config.DynamoLookUp = lookUp;
            }

            return(config);
        }
Пример #2
0
        /// <summary>
        /// Utility method to get the settings
        /// </summary>
        /// <param name="updateManager"></param>
        /// <returns></returns>
        public static UpdateManagerConfiguration GetSettings(IUpdateManager updateManager = null)
        {
            string filePath;
            var    exists = TryGetConfigFilePath(out filePath);

#if DEBUG
            //This code is just to create the default config file to
            //save the default settings, which later on can be modified
            //to re-direct it to other download target for testing.
            if (!exists)
            {
                var config = new UpdateManagerConfiguration();
                config.Save(filePath, updateManager);
            }
#endif
            return(exists ? Load(filePath, updateManager) : new UpdateManagerConfiguration());
        }
Пример #3
0
        /// <summary>
        /// Utility method to get the settings
        /// </summary>
        /// <param name="updateManager"></param>
        /// <returns></returns>
        public static UpdateManagerConfiguration GetSettings(IUpdateManager updateManager = null)
        {
            string location = Assembly.GetExecutingAssembly().Location;
            string filePath = Path.Combine(
                Path.GetDirectoryName(location),
                DEFAULT_CONFIG_FILE_S);

#if DEBUG
            //This code is just to create the default config file to
            //save the default settings, which later on can be modified
            //to re-direct it to other download target for testing.
            if (!File.Exists(filePath))
            {
                var config = new UpdateManagerConfiguration();
                config.Save(filePath, updateManager);
            }
#endif
            return(File.Exists(filePath) ? Load(filePath, updateManager) : new UpdateManagerConfiguration());
        }
Пример #4
0
        /// <summary>
        /// Utility method to get the settings
        /// </summary>
        /// <param name="lookUp">IDynamoLookUp instance</param>
        /// <param name="updateManager"></param>
        /// <returns></returns>
        public static UpdateManagerConfiguration GetSettings(IDynamoLookUp lookUp, IUpdateManager updateManager = null)
        {
            string filePath;
            var exists = TryGetConfigFilePath(out filePath);
#if DEBUG
            //This code is just to create the default config file to
            //save the default settings, which later on can be modified
            //to re-direct it to other download target for testing.
            if (!exists)
            {
                var umConfig = new UpdateManagerConfiguration();
                umConfig.Save(filePath, updateManager);
            }
#endif
            if (!exists) 
                return new UpdateManagerConfiguration() { DynamoLookUp = lookUp };

            var config = Load(filePath, updateManager);
            if (null != config)
                config.DynamoLookUp = lookUp;

            return config;
        }
Пример #5
0
        /// <summary>
        /// Utility method to get the settings
        /// </summary>
        /// <param name="updateManager"></param>
        /// <returns></returns>
        public static UpdateManagerConfiguration GetSettings(IUpdateManager updateManager = null)
        {
            string location = Assembly.GetExecutingAssembly().Location;
            string filePath = Path.Combine(
                Path.GetDirectoryName(location),
                DEFAULT_CONFIG_FILE_S);
#if DEBUG
            //This code is just to create the default config file to
            //save the default settings, which later on can be modified
            //to re-direct it to other download target for testing.
            if (!File.Exists(filePath))
            {
                var config = new UpdateManagerConfiguration();
                config.Save(filePath, updateManager);
            }
#endif
            return File.Exists(filePath) ? Load(filePath, updateManager) : new UpdateManagerConfiguration();
        }
Пример #6
0
 public void ConfigurationSerialization()
 {
     var config = new UpdateManagerConfiguration()
     {
         DownloadSourcePath = DOWNLOAD_SOURCE_PATH_S,
         SignatureSourcePath = SIGNATURE_SOURCE_PATH_S
     };
     
     //save to a temp file.
     var tempFile = Path.GetTempFileName();
     Assert.DoesNotThrow(() => config.Save(tempFile, null));
     
     //read from a temp file.
     UpdateManagerConfiguration savedConfig = null;
     Assert.DoesNotThrow(() => savedConfig = UpdateManagerConfiguration.Load(tempFile, null));
     
     //Compare parameters.
     Assert.IsNotNull(savedConfig);
     Assert.AreEqual(config.CheckNewerDailyBuild, savedConfig.CheckNewerDailyBuild);
     Assert.AreEqual(config.SignatureSourcePath, savedConfig.SignatureSourcePath);
     Assert.AreEqual(config.DownloadSourcePath, savedConfig.DownloadSourcePath);
     Assert.AreEqual(config.ForceUpdate, savedConfig.ForceUpdate);
 }