예제 #1
0
        /// <summary>
        /// Notes the current time as an attempt to download a particular feed.
        /// </summary>
        private static void SetLastCheckAttempt(FeedUri feedUri)
        {
            // Determine timestamp file path
            string path = Path.Combine(
                Locations.GetCacheDirPath("0install.net", false, "injector", "last-check-attempt"),
                feedUri.PrettyEscape());

            // Set modification time to now
            FileUtils.Touch(path);
        }
예제 #2
0
        /// <summary>
        /// Determines the most recent point in time an attempt was made to download a particular feed.
        /// </summary>
        private static DateTime GetLastCheckAttempt(FeedUri feedUri)
        {
            // Determine timestamp file path
            var file = new FileInfo(Path.Combine(
                                        Locations.GetCacheDirPath("0install.net", false, "injector", "last-check-attempt"),
                                        feedUri.PrettyEscape()));

            // Check last modification time
            return(file.Exists ? file.LastWriteTimeUtc : new DateTime());
        }
예제 #3
0
 private static IEnumerable <FeedUri> GetNativeFeedPaths(FeedUri interfaceUri)
 {
     return(Locations.GetLoadDataPaths("0install.net", true, "native_feeds", interfaceUri.PrettyEscape())
            .Select(x => new FeedUri(x)));
 }
예제 #4
0
 /// <summary>
 /// Removes an entry from the list of uninstallable applications.
 /// </summary>
 /// <param name="uri">The feed to be removed.</param>
 /// <param name="machineWide">Apply the registration machine-wide instead of just for the current user.</param>
 /// <exception cref="IOException">A problem occurred while writing to the filesystem or registry.</exception>
 /// <exception cref="UnauthorizedAccessException">Write access to the filesystem or registry is not permitted.</exception>
 public static void Unregister(FeedUri uri, bool machineWide)
 => Unregister(uri.PrettyEscape(), machineWide);
예제 #5
0
        public static InterfacePreferences LoadFor([NotNull] FeedUri interfaceUri)
        {
            #region Sanity checks
            if (interfaceUri == null)
            {
                throw new ArgumentNullException("interfaceUri");
            }
            #endregion

            var path = Locations.GetLoadConfigPaths("0install.net", true, "injector", "interfaces", interfaceUri.PrettyEscape()).FirstOrDefault();
            if (string.IsNullOrEmpty(path))
            {
                return(new InterfacePreferences());
            }

            Log.Debug("Loading interface preferences for " + interfaceUri.ToStringRfc() + " from: " + path);
            return(XmlStorage.LoadXml <InterfacePreferences>(path));
        }
예제 #6
0
        /// <summary>
        /// Saves these <see cref="InterfacePreferences"/> for a specific interface.
        /// </summary>
        /// <param name="interfaceUri">The interface to save the preferences for.</param>
        /// <exception cref="IOException">A problem occurs while writing the file.</exception>
        /// <exception cref="UnauthorizedAccessException">Write access to the file is not permitted.</exception>
        public void SaveFor([NotNull] FeedUri interfaceUri)
        {
            #region Sanity checks
            if (interfaceUri == null)
            {
                throw new ArgumentNullException("interfaceUri");
            }
            #endregion

            var path = Locations.GetSaveConfigPath("0install.net", true, "injector", "interfaces", interfaceUri.PrettyEscape());

            Log.Debug("Saving interface preferences for " + interfaceUri.ToStringRfc() + " to: " + path);
            this.SaveXml(path);
        }
 private static IEnumerable<FeedUri> GetNativeFeedPaths(FeedUri interfaceUri)
 {
     return Locations.GetLoadDataPaths("0install.net", true, "native_feeds", interfaceUri.PrettyEscape())
         .Select(x => new FeedUri(x));
 }
예제 #8
0
        /// <summary>
        /// Saves these <see cref="FeedPreferences"/> for a specific feed.
        /// </summary>
        /// <param name="feedUri">The feed to save the preferences for.</param>
        /// <exception cref="IOException">A problem occurs while writing the file.</exception>
        /// <exception cref="UnauthorizedAccessException">Write access to the file is not permitted.</exception>
        public void SaveFor([NotNull] FeedUri feedUri)
        {
            #region Sanity checks
            if (feedUri == null)
            {
                throw new ArgumentNullException(nameof(feedUri));
            }
            #endregion

            Normalize();

            var path = Locations.GetSaveConfigPath("0install.net", true, "injector", "feeds", feedUri.PrettyEscape());

            Log.Debug("Saving feed preferences for " + feedUri.ToStringRfc() + " to: " + path);
            this.SaveXml(path);
        }
예제 #9
0
        /// <summary>
        /// Notes the current time as an attempt to download a particular feed.
        /// </summary>
        private static void SetLastCheckAttempt(FeedUri feedUri)
        {
            // Determine timestamp file path
            string path = Path.Combine(
                Locations.GetCacheDirPath("0install.net", false, "injector", "last-check-attempt"),
                feedUri.PrettyEscape());

            // Set modification time to now
            FileUtils.Touch(path);
        }
예제 #10
0
        /// <summary>
        /// Determines the most recent point in time an attempt was made to download a particular feed.
        /// </summary>
        private static DateTime GetLastCheckAttempt(FeedUri feedUri)
        {
            // Determine timestamp file path
            var file = new FileInfo(Path.Combine(
                Locations.GetCacheDirPath("0install.net", false, "injector", "last-check-attempt"),
                feedUri.PrettyEscape()));

            // Check last modification time
            return file.Exists ? file.LastWriteTimeUtc : new DateTime();
        }
예제 #11
0
 private static IEnumerable <string> GetNativeFeedPaths(FeedUri interfaceUri)
 => Locations.GetLoadDataPaths("0install.net", true, "native_feeds", interfaceUri.PrettyEscape());