Пример #1
0
        private RepositorySource CreateSource(RepositoryIndexEntry entry)
        {
            var repositoryPath = Path.Combine(RepositorySourceDirectory, entry.Id);

            PathEx.CreatePath(repositoryPath);

            return(new RepositorySource(entry.Url, repositoryPath));
        }
Пример #2
0
        //public bool TryGet(string name, out RepositorySource repository)
        //{
        //    return sources.TryGetValue(name, out repository);
        //}

        private RepositorySource CreateSource(RepositoryIndexEntry entry)
        {
            var repositoryPath = Path.Combine(RepositorySourceDirectory, entry.Id);

            if (!Directory.Exists(repositoryPath))
            {
                Directory.CreateDirectory(repositoryPath);
            }

            return(new RepositorySource(entry.Url, repositoryPath)
            {
                //...
            });
        }
Пример #3
0
        public RepositoryIndexEntry GetOrCreate(string url)
        {
            lock (lockHandle) {
                if (entries.TryGetValue(url, out var entry))
                {
                    return(entry);
                }

                entry        = new RepositoryIndexEntry(url);
                entries[url] = entry;

                try {
                    Save();
                }
                catch (Exception error) {
                    Log.Error("Failed to save repository index!", error);
                }

                return(entry);
            }
        }