Пример #1
0
        protected override bool DoInsertData(DataAction action, MarkupPointer begin, MarkupPointer end)
        {
            //hack: drive the selection textRange to the caret (before calling InsertImages)
            EditorContext.MarkupServices.CreateMarkupRange(begin, end).ToTextRange().select();

            List <string> files = new List <string>();

            DirectoryLister lister = new DirectoryLister(DataMeister.FileData.Files[0].ContentsPath, false, true);

            foreach (string file in lister.GetFiles())
            {
                if (PathHelper.IsPathImage(file))
                {
                    files.Add(Path.Combine(lister.RootPath, file));
                }
            }

            return(DoInsertDataCore(files, action, begin, end));
        }
Пример #2
0
        public static bool CanCreateFrom(DataObjectMeister data)
        {
            // see if there are files at the top-level of the file data
            FileData fileData = data.FileData;

            if (fileData != null && fileData.Files.Length == 1 && fileData.Files[0].IsDirectory)
            {
                DirectoryLister lister = new DirectoryLister(fileData.Files[0].ContentsPath, false, true);
                foreach (string file in lister.GetFiles())
                {
                    if (PathHelper.IsPathImage(file))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }