Пример #1
0
        public CameraList ListFolders(string folder, Context context)
        {
            CameraList file_list = new CameraList();

            Error.CheckError(gp_camera_folder_list_folders(this.Handle, folder, file_list.Handle, context.Handle));

            return(file_list);
        }
Пример #2
0
        public CameraList ListFolders(string folder, Context context)
        {
            CameraList list = new CameraList();

            Error.CheckError(gp_filesystem_list_folders(this.Handle, folder, list.Handle, context.Handle));

            return(list);
        }
        public CameraList ListFolders(string folder, Context context)
        {
            ErrorCode  result;
            CameraList list = new CameraList();

            unsafe
            {
                result = gp_filesystem_list_folders(this.Handle, folder, list.Handle, context.Handle);
            }
            if (Error.IsError(result))
            {
                throw Error.ErrorException(result);
            }
            return(list);
        }
	public GPhotoCamera()
	{
		context = new Context();

		port_info_list = new PortInfoList ();
		port_info_list.Load ();
			
		abilities_list = new CameraAbilitiesList ();
		abilities_list.Load (context);
			
		camera_list = new CameraList();
			
		selected_camera__camera_list_index = -1;

		camera = null;
		port_info = null;
		camera_fs = null;
	}
Пример #5
0
		public CameraList ListFolders (string folder, Context context)
		{
			CameraList file_list = new CameraList();

			Error.CheckError (gp_camera_folder_list_folders (this.Handle, folder, file_list.Handle, context.Handle));

			return file_list;
		}
		public CameraSelectionDialog (CameraList camera_list) 
		{
			camlist = camera_list;
		}
Пример #7
0
 public void Detect(PortInfoList info_list, CameraList l, Context context)
 {
     Error.CheckError(gp_abilities_list_detect(this.handle, info_list.Handle,
                                               l.Handle, context.Handle));
 }
		public CameraList ListFolders (string folder, Context context)
		{
			ErrorCode result;
			CameraList list = new CameraList();
			unsafe
			{
				result = gp_filesystem_list_folders (this.Handle, folder, list.Handle, context.Handle);
			}
			if (Error.IsError(result)) throw Error.ErrorException(result);
			return list;
		}
		public void Detect (PortInfoList info_list, CameraList l, Context context)
		{
			Error.CheckError (gp_abilities_list_detect (this.handle, info_list.Handle, 
								    l.Handle, context.Handle));
		}
Пример #10
0
        public CameraList ListFolders(string folder, Context context)
        {
            CameraList list = new CameraList ();

            Error.CheckError(gp_filesystem_list_folders (this.Handle, folder, list.Handle, context.Handle));

            return list;
        }
Пример #11
0
        // FIXME: The actual conditions for ignoring 'usb:' ones is
        // when it is the only entry for that device. I'm not 100% how
        // to handle to of the same device when they are represented by
        // 'usb:' as opposed to the fully qualified name
        private static CameraList RemoveDuplicates(CameraList cameras)
        {
            CameraList list = new CameraList();
            try
            {
                int count = cameras.Count();
                for(int i=0; i < count; i++)
                {
                    string name = cameras.GetName(i);
                    string value = cameras.GetValue(i);

                    if(value == "usb:")
                        continue;

                    list.Append(name, value);
                }
            }
            catch
            {
                list.Dispose();
                throw;
            }

            return list;
        }
Пример #12
0
        /// <summary>
        /// Detects all usable cameras which are connected to the system
        /// </summary>
        /// <returns>A list containing all cameras which can be connected to</returns>
        public static List<Camera> Detect()
        {
            if (Utilities.Is64Bit && Environment.OSVersion.Platform != PlatformID.Unix)
            {
                Console.WriteLine("A 64bit windows system has been detected. This is not supported");
                Console.WriteLine("due to the complexity of interoperating with libgphoto2");
                Console.WriteLine("as it exposes variable length 'long' types in it's API.");
                Console.WriteLine("The API is unlikely to change before version 3 of the library");
                Console.WriteLine("The current status of this can be found on the libgphoto2");
                Console.WriteLine("mailing list. A detailed explanation can be found in the");
                Console.WriteLine("README file for libgphoto2-sharp");
                return new List<Camera>();
            }

            List<Camera> cameras = new List<Camera>();
            Context c = new Context();

            using (CameraAbilitiesList abilities = new CameraAbilitiesList())
            using (PortInfoList portInfoList = new PortInfoList())
            using (CameraList cameraList = new CameraList())
            {
                // Get the list of all devices that are currently supported
                abilities.Load(c);

                // Get the list of all the (usb?) ports that are currently available
                portInfoList.Load();

                // Create the list of all the connected devices which can be used
                abilities.Detect(portInfoList, cameraList, c);

                // Scan through all the detected cameras and remove any duplicates
                using (CameraList cams = RemoveDuplicates(cameraList))
                {
                    int count = cams.Count();
                    for(int i = 0; i < count; i++)
                    {
                        CameraAbilities ability = abilities.GetAbilities(abilities.LookupModel(cams.GetName(i)));
                        PortInfo portInfo = portInfoList.GetInfo(portInfoList.LookupPath(cams.GetValue(i)));
                        cameras.Add(new Gphoto2.Camera(ability, portInfo, c));
                    }
                }
            }

            return cameras;
        }