File: CameraList.cs

package info (click to toggle)
f-spot 0.6.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 21,784 kB
  • ctags: 16,078
  • sloc: cs: 108,718; sh: 17,053; xml: 13,852; ansic: 3,187; makefile: 2,324
file content (96 lines) | stat: -rw-r--r-- 2,503 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * CameraList.cs
 *
 * Author(s):
 *	Stephane Delcroix <stephane@delcroix.org
 *	Ewen Cheslack-Postava <echeslack@gmail.com>
 *	Larry Ewing <lewing@novell.com>
 *
 * Copyright (c) 2005-2009 Novell, Inc.
 *
 * This is open source software. See COPYING for details.
 */

using System;
using System.Runtime.InteropServices;

namespace GPhoto2
{
	public class CameraList : GPObject 
	{
		[DllImport ("libgphoto2.so")]
		internal static extern ErrorCode gp_list_new (out IntPtr list);
		[DllImport ("libgphoto2.so")]
		internal static extern ErrorCode gp_list_unref (HandleRef list);

		public CameraList () : base (gp_list_unref)
		{
			IntPtr native;
			Error.CheckError (gp_list_new (out native));
					  
			this.handle = new HandleRef (this, native);
		}
		
		[DllImport ("libgphoto2.so")]
		internal static extern ErrorCode gp_list_count (HandleRef list);
		
		public int Count {
			get { return Error.CheckError (gp_list_count (handle)); }
		}
		
		[DllImport ("libgphoto2.so")]
		internal static extern ErrorCode gp_list_set_name (HandleRef list, int index, [MarshalAs(UnmanagedType.LPTStr)] string name);

		public void SetName (int n, string name)
		{
			Error.CheckError (gp_list_set_name(this.Handle, n, name));
		}

		[DllImport ("libgphoto2.so")]
		internal static extern ErrorCode gp_list_get_name (HandleRef list, int index, out IntPtr name);

		public string GetName (int index)
		{
			IntPtr name;
			Error.CheckError (gp_list_get_name(this.Handle, index, out name));

			return Marshal.PtrToStringAnsi (name);
		}
		
		[DllImport ("libgphoto2.so")]
		internal static extern ErrorCode gp_list_set_value (HandleRef list, int index, [MarshalAs (UnmanagedType.LPTStr)] string value);

		public void SetValue (int n, string value)
		{
			Error.CheckError (gp_list_set_value (this.Handle, n, value));
		}
		
		
		[DllImport ("libgphoto2.so")]
		internal static extern ErrorCode gp_list_get_value (HandleRef list, int index, out IntPtr value);

		public string GetValue (int index)
		{
			IntPtr value;
			Error.CheckError (gp_list_get_value(this.Handle, index, out value));

			return Marshal.PtrToStringAnsi (value);
		}
		
		[DllImport ("libgphoto2.so")]
		internal static extern ErrorCode gp_list_reset (HandleRef list);

		public void Reset ()
		{
			Error.CheckError (gp_list_reset(this.Handle));
		}
		
		[DllImport ("libgphoto2.so")]
		internal static extern ErrorCode gp_list_sort (HandleRef list);

		public void Sort ()
		{
			Error.CheckError (gp_list_sort(this.Handle));
		}
	}
}