示例#1
0
        public static bool BuildTree(this IMediaStorage media, ref MediaInfo info, string path)
        {
            bool endSearch = false;

            info.CurrentPath = path;
            media.MediaTree.Add(info);

            return endSearch;
        }
示例#2
0
        public void CopyToPC(MediaInfo mediaToCopy)
        {
            MimeStructure attachment = mediaToCopy.attachment as MimeStructure;

            Image image;

            if (System.Diagnostics.Debugger.IsAttached)
                image = Image.FromStream(
                    new System.IO.MemoryStream(imap.PeekDataByUID(attachment)));
            else
                image = Image.FromStream(
                    new System.IO.MemoryStream(imap.GetDataByUID(attachment)));

            image.Save(mediaToCopy.FullName);
        }
示例#3
0
 public void Delete(MediaInfo mediaToDelete)
 {
     string ret = DeleteFile(mediaToDelete.CurrentPath + "/" + mediaToDelete.Name);
 }
示例#4
0
 public void CopyToPC(MediaInfo infoToCopy)
 {
     PullFile(infoToCopy.CurrentPath + "/" + infoToCopy.Name, infoToCopy.DestinationPath);
 }
示例#5
0
        private MediaInfo UnixFileInfoToMediaInfo(string fileinfo)
        {
            MediaInfo mediainfo = null;

            Regex x = new Regex(" +");
            string[] splitInfo = x.Split(fileinfo);

            int ix = 0;

            // '-' means file
            // only process if this is a file of directory
            char type = splitInfo[ix++].FirstOrDefault();
            if (type == 'd' || type == '-')
            {
                mediainfo = new MediaInfo();

                if (type == 'd')
                    mediainfo.SetAsDirectory();

                // user (skip)
                ix++;

                // dir? (skip)
                ix++;

                // Files have a size here, so skip if this is a file.
                if (!mediainfo.IsDirectory())
                    ix++;

                mediainfo.CreationTime = DateTime.Parse(splitInfo[ix++] + " " + splitInfo[ix++]);

                mediainfo.Name = splitInfo[ix];
            }

            return mediainfo;
        }
示例#6
0
        private bool IsMediaDir(ref MediaInfo info, string path)
        {
            bool endSearch = false;
            if (info.Name == TransferMedia.MediaDir)
            {
                MainMediaPath = path + (path.EndsWith("/") ? null : "/") + info.Name;
                endSearch = true;
            }

            return endSearch;
        }
示例#7
0
        private MediaInfo MessageInfoToMediaInfo(MessageInfo messageinfo, MimeStructure attachment)
        {
            MediaInfo mediainfo = new MediaInfo();

            mediainfo.CreationTime = messageinfo.Envelope.Date.GetValueOrDefault(DateTime.Now);
            mediainfo.Name = attachment.SafeFileName;
            return mediainfo;
        }
示例#8
0
 public void Delete(MediaInfo mediaToDelete)
 {
     // not going to delete media from mail so just leaving this method empty
 }
示例#9
0
        private MediaInfo FileSystemInfoToMediaInfo(FileSystemInfo file)
        {
            MediaInfo mediainfo = new MediaInfo();
            if ((file.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
                mediainfo.SetAsDirectory();

            mediainfo.CreationTime = file.CreationTime;
            mediainfo.Name = file.Name;
            return mediainfo;
        }
示例#10
0
 public void Delete(MediaInfo mediaToDelete)
 {
     File.Delete(
         Path.Combine(mediaToDelete.CurrentPath, mediaToDelete.Name));
 }
示例#11
0
 public void CopyToPC(MediaInfo mediaToCopy)
 {
     File.Copy(
         Path.Combine(mediaToCopy.CurrentPath, mediaToCopy.Name),
         mediaToCopy.FullName);
 }