~ubuntu-branches/ubuntu/raring/banshee/raring

« back to all changes in this revision

Viewing changes to src/Libraries/Mtp/Mtp/File.cs

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2012-01-23 23:16:49 UTC
  • mfrom: (6.3.22 experimental)
  • Revision ID: package-import@ubuntu.com-20120123231649-safm1f8eycltcgsf
Tags: 2.3.4.ds-1ubuntu1
* Merge from Debian Experimental, remaining changes:
  + Enable and recommend SoundMenu and Disable NotificationArea by default
  + Disable boo and karma extensions
  + Enable and suggest u1ms
  + Move desktop file for Meego UI to /usr/share/une/applications
  + Change the url for the Amazon store redirector
  + [08dea2c] Revert "Fix invalid cast causing ftbfs with libgpod"
* [b617fe0] Convert Ubuntu-specific patches to gbp-pq patches
* Also fixes Launchpad bugs:
  - Fixes race condition while starting (LP: #766303)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *  File.cs
 
3
 *
 
4
 *  Copyright (C) 2006-2007 Alan McGovern
 
5
 *  Authors:
 
6
 *  Alan McGovern (alan.mcgovern@gmail.com)
 
7
 ****************************************************************************/
 
8
 
 
9
/*  THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
 
10
 *
 
11
 *  Permission is hereby granted, free of charge, to any person obtaining a
 
12
 *  copy of this software and associated documentation files (the "Software"),
 
13
 *  to deal in the Software without restriction, including without limitation
 
14
 *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
15
 *  and/or sell copies of the Software, and to permit persons to whom the
 
16
 *  Software is furnished to do so, subject to the following conditions:
 
17
 *
 
18
 *  The above copyright notice and this permission notice shall be included in
 
19
 *  all copies or substantial portions of the Software.
 
20
 *
 
21
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
22
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
23
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
24
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
25
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
26
 *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
27
 *  DEALINGS IN THE SOFTWARE.
 
28
 */
 
29
 
 
30
using System;
 
31
using System.Runtime.InteropServices;
 
32
 
 
33
namespace Mtp
 
34
{
 
35
    public class File
 
36
    {
 
37
        [DllImport("libmtp.dll")]
 
38
        private static extern IntPtr LIBMTP_new_file_t (); // LIBMTP_file_t *
 
39
 
 
40
        [DllImport("libmtp.dll")]
 
41
        private static extern void LIBMTP_destroy_file_t (ref File file); // LIBMTP_file_t *
 
42
 
 
43
        [DllImport("libmtp.dll")]
 
44
        private static extern string LIBMTP_Get_Filetype_Description (FileType type); // char const *
 
45
 
 
46
        [DllImport("libmtp.dll")]
 
47
        private static extern IntPtr LIBMTP_Get_Filelisting (MtpDeviceHandle handle); // LIBMTP_file_t *
 
48
 
 
49
        [DllImport("libmtp.dll")]
 
50
        private static extern IntPtr LIBMTP_Get_Filelisting_With_Callback (MtpDeviceHandle handle, ProgressFunction function, IntPtr data); // LIBMTP_file_t *
 
51
 
 
52
        [DllImport("libmtp.dll")]
 
53
        private static extern IntPtr LIBMTP_Get_Filemetadata (MtpDeviceHandle handle, uint fileid); // LIBMTP_file_t *
 
54
 
 
55
        [DllImport("libmtp.dll")]
 
56
        private static extern int LIBMTP_Get_File_To_File (MtpDeviceHandle handle, uint fileId, string path, ProgressFunction function, IntPtr data);
 
57
 
 
58
        [DllImport("libmtp.dll")]
 
59
        private static extern void LIBMTP_destroy_filesampledata_t (ref FileSampleData data); // LIBMTP_filesampledata_t *
 
60
 
 
61
        [DllImport("libmtp.dll")]
 
62
        private static extern int LIBMTP_Get_Representative_Sample_Format (MtpDeviceHandle handle, FileType type, IntPtr data_array);
 
63
 
 
64
        [DllImport("libmtp.dll")]
 
65
        private static extern int LIBMTP_Send_Representative_Sample (MtpDeviceHandle handle, uint id, ref FileSampleData sample);
 
66
 
 
67
    }
 
68
 
 
69
    [StructLayout(LayoutKind.Sequential)]
 
70
    internal struct FileStruct
 
71
    {
 
72
        public int item_id;
 
73
        public int parent_id;
 
74
        public int storage_id;
 
75
 
 
76
        [MarshalAs(UnmanagedType.LPStr)]public string filename;
 
77
        public long filesize;
 
78
        public FileType filetype;
 
79
        public IntPtr next; // LIBMTP_file_t*
 
80
        /*
 
81
        public File? Next
 
82
        {
 
83
            get
 
84
            {
 
85
                if (next == IntPtr.Zero)
 
86
                    return null;
 
87
                return (File)Marshal.PtrToStructure(next, typeof(File));
 
88
            }
 
89
        }*/
 
90
    }
 
91
}