예제 #1
0
        public override void Connect(Uri uri, string username, string password)
        {
            string domain = uri.Host;
            string[] pathParts = Uri.UnescapeDataString(uri.AbsolutePath).Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            string instance = pathParts[0];
            string volName = pathParts[1];

            _odsClient = new OpticalDiscServiceClient();
            foreach (var service in _odsClient.LookupServices(domain))
            {
                if (service.DisplayName == instance)
                {
                    _service = service;
                    _service.Connect(Environment.UserName, Environment.MachineName, 30);

                    foreach (var disk in _service.AdvertisedDiscs)
                    {
                        if (disk.VolumeLabel == volName)
                        {
                            _disk = disk.Name;
                        }
                    }
                }
            }

            if (_disk == null)
            {
                throw new FileNotFoundException("No such disk", uri.ToString());
            }
        }
예제 #2
0
        public override void Connect(Uri uri, string username, string password)
        {
            string domain = uri.Host;

            string[] pathParts = Uri.UnescapeDataString(uri.AbsolutePath).Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            string   instance  = pathParts[0];
            string   volName   = pathParts[1];

            _odsClient = new OpticalDiscServiceClient();
            foreach (var service in _odsClient.LookupServices(domain))
            {
                if (service.DisplayName == instance)
                {
                    _service = service;
                    _service.Connect(Environment.UserName, Environment.MachineName, 30);

                    foreach (var disk in _service.AdvertisedDiscs)
                    {
                        if (disk.VolumeLabel == volName)
                        {
                            _disk = disk.Name;
                        }
                    }
                }
            }

            if (_disk == null)
            {
                throw new FileNotFoundException("No such disk", uri.ToString());
            }
        }