Beispiel #1
0
        private void StartInternal()
        {
            _socketServer = new ResponseSocket(EndpointProvider.Address);

            while (true)
            {
                byte[] load = null;

                try
                {
                    load = _socketServer.ReceiveFrameBytes(out bool hasMore);
                }
                catch (System.Net.Sockets.SocketException)
                {
                    // we can ignore socket exceptions that might
                    // occur when the app is shutting down
                    if (_socketServer is null)
                    {
                        return;
                    }

                    throw;
                }

                string message = Encoding.UTF8.GetString(load);

                if (string.IsNullOrEmpty(message))
                {
                    return;
                }

                if (message.StartsWith("list:", StringComparison.Ordinal))
                {
                    string repositoryNamePattern = message.Substring("list:".Length);

                    string answer = "(no repositories found)";
                    try
                    {
                        var repos = RepositorySource.GetMatchingRepositories(repositoryNamePattern);
                        if (repos.Any())
                        {
                            var serializedRepositories = repos
                                                         .Where(r => r != null)
                                                         .Select(r => r.ToString());

                            answer = string.Join(Environment.NewLine, serializedRepositories);
                        }
                    }
                    catch (Exception ex)
                    {
                        answer = ex.Message;
                    }

                    _socketServer.SendFrame(Encoding.UTF8.GetBytes(answer));
                }

                Thread.Sleep(100);
            }
        }
Beispiel #2
0
 object IList.this[int index]
 {
     get
     {
         // Obtain the information we need from the collection
         Debug.WriteLine("Requested item " + index.ToString(CultureInfo.InvariantCulture));
         var result = RepositorySource.GetImagesFromRepositoryAsync(index, 1).Result;
         return(result.GetEnumerator().Current);
     }
     set
     {
         throw new NotImplementedException();
     }
 }
Beispiel #3
0
        private void AddRepositories([NotNull] List <PackageSourceManager.PackageSourceDescriptor> sources)
        {
            Debug.ArgumentNotNull(sources, nameof(sources));

            var repositoryList = RepositoryManager.GetRepository(RepositoryManager.Packages);

            var index = 0;

            foreach (var entry in repositoryList.Entries)
            {
                var attribute = new PackageSourceAttribute("Local Repositories", entry.Name, 2000 + index);

                var source = new RepositorySource(entry);

                var descriptor = new PackageSourceManager.PackageSourceDescriptor(source, attribute);

                sources.Add(descriptor);

                index++;
            }
        }
Beispiel #4
0
 public static string GetFileName(this RepositorySource repositorySource)
 {
     return(ConfigFiles.RepoConfigName(repositorySource.Domain, repositorySource.Name));
 }
Beispiel #5
0
 public MainViewModel(IGithubService service)
 {
     _repositoriesSource = new RepositorySource(service);
     Repositories        = new IncrementalLoadingCollection <Repository, RepositorySource>(_repositoriesSource);
 }
        public RepositorySource WriteServiceRepositories(RepositorySource repositorySource)
        {
            var file = _fileConfigManager.WriteData(repositorySource, repositorySource.GetFileName(), ConfigPaths.Repositories);

            return(file);
        }
Beispiel #7
0
 public MainViewModel(IGithubService service)
 {
     _repositoriesSource = new RepositorySource(service);
     Repositories = new IncrementalLoadingCollection<Repository, RepositorySource>(_repositoriesSource);
 }
Beispiel #8
0
 protected virtual TSrc FetchSrc(Guid id)
 {
     return(RepositorySource.Get(id));
 }