示例#1
0
 public AppInstanceBootstrapper(
     PackageDownloadManager packageDownloadManager,
     UdpPeerDiscovery udpPeerDiscovery,
     IPeerRegistry peerRegistry,
     IPackageRegistry packageRegistry,
     LocalPackageManager localPackageManager,
     PeersCluster peersCluster
     )
 {
     PackageDownloadManager = packageDownloadManager ?? throw new ArgumentNullException(nameof(packageDownloadManager));
     UdpPeerDiscovery       = udpPeerDiscovery ?? throw new ArgumentNullException(nameof(udpPeerDiscovery));
     PeerRegistry           = peerRegistry ?? throw new ArgumentNullException(nameof(peerRegistry));
     PackageRegistry        = packageRegistry ?? throw new ArgumentNullException(nameof(packageRegistry));
     LocalPackageManager    = localPackageManager ?? throw new ArgumentNullException(nameof(localPackageManager));
     PeersCluster           = peersCluster ?? throw new ArgumentNullException(nameof(peersCluster));
 }
示例#2
0
        public void Start(AppInstanceSettings settings)
        {
            if (settings.DownloadEverything)
            {
                PackageRegistry.RemotePackageDiscovered += (package) =>
                {
                    if (PackageDownloadManager.GetDiscoveredPackageAndStartDownloadPackage(package, out var task))
                    {
                        task.Wait();
                    }
                };
            }

            UdpPeerDiscovery.EnableAutoSearch(
                allowListener: settings.EnableUdpDiscoveryListener,
                allowClient: settings.EnableUdpDiscoveryClient
                );

            PackageDownloadManager.RestoreUnfinishedDownloads();
        }