예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdaterConfiguration"/> class.
 /// </summary>
 /// <param name="assemblyAccessor">The assembly accessor.</param>
 public UpdaterConfiguration(IAssemblyAccessor assemblyAccessor) : base(assemblyAccessor)
 {
     // We want to handle this all manually at app startup and on user request
     DidRunOnce     = true;
     IsFirstRun     = false;
     CheckForUpdate = false;
 }
예제 #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="assemblyName">the assembly name</param>
 /// <param name="isReflectionAccesorUsed"><c>true</c> if reflection is used to access the attributes.</param>
 public AssemblyAccessor(string assemblyName, bool isReflectionAccesorUsed)
 {
     if (isReflectionAccesorUsed)
     {
         _internalAccessor = new AssemblyReflectionAccessor(assemblyName);
     }
     else
     {
         _internalAccessor = new AssemblyDiagnosticsAccessor(assemblyName);
     }
 }
 public Configuration(IAssemblyAccessor assemblyAccessor)
 {
     try
     {
         ApplicationName = assemblyAccessor.AssemblyProduct;
         InstalledVersion = assemblyAccessor.AssemblyVersion;
     }
     catch(Exception exception)
     {
         // TODO NKO WTF IS THIS?
         if(exception.Message.Contains("STOP:"))
         {
             throw;
         }
     }
 }
예제 #4
0
        /// <summary>
        /// Constructor for Configuration -- should load values by the end of the constructor!
        /// </summary>
        /// <param name="assemblyAccessor">Object that accesses version, title, etc. info for the application
        /// you would like to check for updates for</param>
        public Configuration(IAssemblyAccessor assemblyAccessor)
        {
            // set default values
            InitWithDefaultValues();

            try
            {
                // set some value from the binary
                AssemblyAccessor = assemblyAccessor;
                ApplicationName  = assemblyAccessor.AssemblyProduct;
                InstalledVersion = assemblyAccessor.AssemblyVersion;
            }
            catch
            {
                CheckForUpdate = false;
            }
        }
예제 #5
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public Configuration(string assemblyName,
                             bool useReflectionBasedAssemblyAccessor)
        {
            try
            {
                CheckForUpdate = true;
                SkipThisVersion = string.Empty;

                // set some value from the binary
                this.accessor = new AssemblyAccessor(
                    assemblyName, useReflectionBasedAssemblyAccessor);
            }
            catch (Exception)
            {
                // disable update checks when exception was called 
                CheckForUpdate = false;
            }
        }
예제 #6
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public Configuration(string assemblyName,
                             bool useReflectionBasedAssemblyAccessor)
        {
            try
            {
                CheckForUpdate  = true;
                SkipThisVersion = string.Empty;

                // set some value from the binary
                this.accessor = new AssemblyAccessor(
                    assemblyName, useReflectionBasedAssemblyAccessor);
            }
            catch (Exception)
            {
                // disable update checks when exception was called
                CheckForUpdate = false;
            }
        }
예제 #7
0
 /// <summary>
 /// Constructor for a configuration that saves and loads its configuration data to and
 /// from a JSON file that resides on disk. This Configuration can be used on any
 /// operating system.
 /// </summary>
 /// <param name="assemblyAccessor">Object that accesses version, title, etc. info for the application
 /// you would like to check for updates for</param>
 /// <param name="savePath">location to save the JSON configuration data to; can be null or empty string.
 /// If not null or empty string, must represent a valid path on disk (directories must already be created).
 /// This class will take care of creating/overwriting the file at that path if necessary.</param>
 /// <exception cref="NetSparkleException">Thrown when the configuration data cannot be read or saved</exception>
 public JSONConfiguration(IAssemblyAccessor assemblyAccessor, string savePath)
     : base(assemblyAccessor)
 {
     _savePath = savePath != null && string.IsNullOrWhiteSpace(savePath) ? savePath : GetSavePath();
     try
     {
         // get the save path
         _savePath = GetSavePath();
         // load the values
         LoadValuesFromPath(_savePath);
     }
     catch (NetSparkleException e)
     {
         // disable update checks when exception occurred -- can't read/save necessary update file
         CheckForUpdate = false;
         throw new NetSparkleException("Can't read/save configuration data: " + e.Message);
     }
 }
예제 #8
0
        /// <summary>
        /// Constructor for a configuration that saves and loads information from the Windows registry.
        /// This should only be used on Windows!
        /// </summary>
        /// <param name="assemblyAccessor">Object that accesses version, title, etc. info for the application
        /// you would like to check for updates for</param>
        /// <param name="registryPath">Location in the registry where configuration data should be stored and
        /// loaded from</param>
        public RegistryConfiguration(IAssemblyAccessor assemblyAccessor, string registryPath)
            : base(assemblyAccessor)
        {
            _registryPath = registryPath;
            try
            {
                // build the reg path
                string regPath = BuildRegistryPath();

                // load the values
                LoadValuesFromPath(regPath);
            }
            catch (NetSparkleException e)
            {
                // disable update checks when exception occurred -- can't read/save necessary update file
                CheckForUpdate = false;
                throw new NetSparkleException("Can't read/save configuration data: " + e.Message);
            }
        }
예제 #9
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public AssemblyAccessor(string assemblyName, bool bUseReflectionAccesor)
        {
            try
            {
                this.internalAccessor = (bUseReflectionAccesor ?
                    (IAssemblyAccessor)
                    new AssemblyReflectionAccessor(assemblyName) :
                    new AssemblyDiagnosticsAccessor(assemblyName));
            }
            catch (Exception ex)
            {
                Log.ErrorException(ex,
                    "アセンブリ情報の取得に失敗しました。");

                this.internalAccessor = (!bUseReflectionAccesor ?
                    (IAssemblyAccessor)
                    new AssemblyDiagnosticsAccessor(assemblyName) :
                    new AssemblyReflectionAccessor(assemblyName));
            }
        }
예제 #10
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public AssemblyAccessor(string assemblyName, bool bUseReflectionAccesor)
        {
            try
            {
                this.internalAccessor = (bUseReflectionAccesor ?
                                         (IAssemblyAccessor)
                                         new AssemblyReflectionAccessor(assemblyName) :
                                         new AssemblyDiagnosticsAccessor(assemblyName));
            }
            catch (Exception ex)
            {
                Log.ErrorException(ex,
                                   "アセンブリ情報の取得に失敗しました。");

                this.internalAccessor = (!bUseReflectionAccesor ?
                                         (IAssemblyAccessor)
                                         new AssemblyDiagnosticsAccessor(assemblyName) :
                                         new AssemblyReflectionAccessor(assemblyName));
            }
        }
예제 #11
0
 /// <summary>
 /// Constructor for a configuration that saves and loads information from the Windows registry.
 /// This should only be used on Windows!
 /// </summary>
 /// <param name="assemblyAccessor">Object that accesses version, title, etc. info for the application
 /// you would like to check for updates for</param>
 public RegistryConfiguration(IAssemblyAccessor assemblyAccessor)
     : this(assemblyAccessor, "")
 {
 }
예제 #12
0
 /// <summary>
 /// Constructor for a configuration that saves and loads its configuration data to and
 /// from a JSON file that resides on disk. This Configuration can be used on any
 /// operating system.
 /// </summary>
 /// <param name="assemblyAccessor">Object that accesses version, title, etc. info for the application
 /// you would like to check for updates for</param>
 public JSONConfiguration(IAssemblyAccessor assemblyAccessor)
     : this(assemblyAccessor, string.Empty)
 {
 }