コード例 #1
0
        public static List <FileContent> DropOutlookAttachment(this DragEventArgs e)
        {
            if (!e.CanHandleOutlookAttachment())
            {
                return(null);
            }

            List <FileContent> response = new List <FileContent>();

            OutlookDataObject dataObject = new OutlookDataObject(e.Data);

            string[]       filenames   = (string[])dataObject.GetData("FileGroupDescriptor");
            MemoryStream[] filestreams = (MemoryStream[])dataObject.GetData("FileContents");

            for (int fileIndex = 0; fileIndex < filenames.Length; fileIndex++)
            {
                string       filename   = filenames[fileIndex];
                MemoryStream filestream = filestreams[fileIndex];

                byte[] data = ReadFully(filestream);

                response.Add(new FileContent(filename, data));
            }

            return(response);
        }
コード例 #2
0
        public static List<Tuple<string, byte[]>> DropOutlookAttachment(this DragEventArgs e)
        {
            if (!e.CanHandleOutlookAttachment())
                return null;

            List<Tuple<string, byte[]>> response = new List<Tuple<string, byte[]>>(); 

            OutlookDataObject dataObject = new OutlookDataObject(e.Data);

            string[] filenames = (string[])dataObject.GetData("FileGroupDescriptor");
            MemoryStream[] filestreams = (MemoryStream[])dataObject.GetData("FileContents");

            for (int fileIndex = 0; fileIndex < filenames.Length; fileIndex++)
            {
                string filename = filenames[fileIndex];
                MemoryStream filestream = filestreams[fileIndex];

                byte[] data = ReadFully(filestream);

                response.Add(new Tuple<string,byte[]>(filename, data));
            }

            return response;
        }