Example #1
0
        public SolutionInfo(FiledropsFile solutionfile, SolutionManager manager, FiledropsFileSystem fs)
        {
            this.FileSystem = fs;
            this.Manager = manager;
            this.Solutionfile = solutionfile;
            this.Root = solutionfile.Parent;
            projects = new Dictionary<string, SolutionProjectInfo>();

            initSolutionFile();
            initSolutionProjects();
        }
Example #2
0
        public DynamicProjectForm(FiledropsFile fi, ProjectInfo pi)
        {
            this.FI = fi;
            this.Project = pi;
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Save, saveFile));
            this.ProjectSystem = pi.FileSystem;

            XmlDocument doc = new XmlDocument();
            doc.Load(fi.FullName);

            Setup(doc);
        }
Example #3
0
 public ProjectLayoutDocument(ProjectInfo pi, FiledropsFile fi, GetIcon iconfunction)
 {
     this._pi = pi;
     this._fi = fi;
     this.Title = fi.NameWithoutExtension;
     if (iconfunction != null)
         this.IconSource = iconfunction(fi, null, 32);
     if (this.IconSource == null)
         this.IconSource = fi.Icon32x32;
     this.Closed += CloseDoc;
     this.Closing += new EventHandler<System.ComponentModel.CancelEventArgs>(TryClose);
 }
Example #4
0
        public ProjectInfo(FiledropsFile projectfile, ProjectManager manager, FiledropsFileSystem fs)
        {
            fs.GetFileIcon = this.GetFileIcon;
            fs.GetClosedDirIcon = this.GetClosedDirIcon;
            fs.GetOpenDirIcon = this.GetOpenDirIcon;
            fs.WorkingDirectory = projectfile.Parent;

            this.FileSystem = fs;
            projectfile.FileSystem = this.FileSystem;
            projectfile.Parent.FileSystem = this.FileSystem;

            this.ProjectFile = projectfile;
            this.Root = projectfile.Parent;
            _openfiles = new Dictionary<string, ProjectLayoutDocument>();
            this.Manager = manager;
        }
Example #5
0
        /// <summary>
        /// This method parses an xml file, and will return any errors if they are found.
        /// the schemafile will be found in the directory: "currentdirectory\xml_docuemtns\xmls\"
        /// followed by the value of the xsi:noNamespaceSchemaLocation attribute.
        /// </summary>
        /// <param name="f">The xml file</param>
        /// <returns>whether the file is Valid.</returns>
        public static Boolean Validate(FiledropsFile f, XmlSchema schema)
        {
            if (f == null || schema == null) { Log.Info("no schema/file was given"); return false; }

            succes = true;
            XmlDocument document = new XmlDocument();
            try
            {
                path = f.FullName;
                document.Load(f.FullName);

                return Validate(document, schema);
            }
            catch (Exception e)
            {
                Log.Info("Problem with xml file load. Perhaps the file isn't an xml document?");
                Log.Info(e.Message);
                return false;
            }
        }
Example #6
0
 public bool IsFileEmpty(FiledropsFile file)
 {
     file.Read();
     return file.BytesContent.Length == 0;
 }
Example #7
0
 public void openDocument(FiledropsFile f)
 {
     Project.Open(f);
 }
Example #8
0
        /// <summary>
        /// Opens the selected document in a new tab
        /// the newly created tab contains a form representing the info in the selected file
        /// </summary>
        /// <param name="f">the selected file</param>
        public virtual void openDocument(FiledropsFile f, ProjectInfo pi)
        {
            if (!pi.IsOpen(f.FullName))
            {
                // create new tab and add it to the documentContainer
                ProjectLayoutDocument layout = new ProjectLayoutDocument(pi, f, GetIcon);

                bool ok;
                if (IsFileEmpty(f))
                {
                    ok = XmlValidator.Validate(f, XmlSchemaUtilities.getXmlSchemaFromXml(f.FullName));
                }
                else
                {
                    ok = true;
                }
                if (ok)
                {
                    ScrollViewer scroller = new ScrollViewer();
                    scroller.Content = FormFactory.GetNewForm(f, pi);
                    layout.Content = scroller;
                }
                else
                {
                    string messageBoxText = "File invalid, see log files for more info.";
                    string caption = "Filedrops";
                    MessageBoxButton button = MessageBoxButton.OK;
                    MessageBoxImage icon = MessageBoxImage.Warning;
                    MessageBox.Show(messageBoxText, caption, button, icon);
                }

                if (layout.Content != null)
                {
                    DocPane.Children.Add(layout);									 // add to documentContainer
                    layout.IsActive = true;                                          // focus on tab
                    pi.fileOpened(f.FullName, layout);
                }
            }
            else
            {
                pi.SetFocus(f.FullName);
            }
        }
 public virtual DynamicProjectForm GetNewForm(FiledropsFile fi, ProjectInfo pi)
 {
     DynamicProjectForm form = new DynamicProjectForm(fi, pi);
     return form;
 }
Example #10
0
 public void initSolution(FiledropsFile f)
 {
     FiledropsFileSystem sfs = this.FileSystem.Clone<FiledropsFileSystem>();
     sfs.WorkingDirectory = f.Parent;
     f.Parent.FileSystem = sfs;
     f.FileSystem = sfs;
     SolutionInfo si = new SolutionInfo(f, this, sfs);
     solutions.Add(f.FullName, si);
     solutionTree.addRoot(f.Parent, si);
 }
Example #11
0
 public BitmapImage GetFileIcon(FiledropsFile f, int size)
 {
     BitmapImage img = null;
     if (f.Extension != null)
     {
         ProjectManager.FILE_ICONS.TryGetValue(f.Extension.Substring(1), out img);
     }
     return img;
 }
Example #12
0
 public ProjectFileNode(ProjectInfo pi, FiledropsFile fi, Binding showext)
     : base(fi, showext)
 {
     this._pi = pi;
     this.MouseDoubleClick += (sender, args) => { pi.Open(fi); };
 }
Example #13
0
        public void addProjectToSolutionAndRename(FiledropsFile projectfile, SolutionInfo si)
        {
            SolutionRootNode solutionsRoot = null;
            foreach (ISolutionNode n in this.Items)
            {
                if (n.getSolution().Solutionfile.FullName.Equals(si.Solutionfile.FullName))
                {
                    solutionsRoot = n as SolutionRootNode;
                }
            }

            if (solutionsRoot != null)
            {
                FolderTreeNodeFilter filter = new FolderTreeNodeFilter(new string[] { }, accepteddirs.Keys.ToArray());
                FolderTreeNode item = solutionsRoot.createFolderNode(projectfile.Parent, filter, false);
                //item.Tag = "TopFolder";
                item.FontWeight = FontWeights.Normal;
                buildProjectFolder(item);
                solutionsRoot.Items.Add(item);
                item.RenameNode();
            }
        }
Example #14
0
 public void initProject(FiledropsFile f)
 {
     // add project
     FiledropsFileSystem pfs = this.FileSystem.Clone<FiledropsFileSystem>();
     pfs.WorkingDirectory = f.Parent;
     ProjectInfo pi = new ProjectInfo(f, this, pfs);
     f.Parent.FileSystem = pfs;
     f.FileSystem = pfs;
     projectTree.AddRoot(f.Parent, pi);
     projects.Add(f.FullName, pi);
 }
Example #15
0
 public void initSolutionProject(FiledropsFile f, FiledropsFileSystem fs)
 {
     SolutionProjectInfo spi = new SolutionProjectInfo(this, f, Manager, fs);
     initSolutionProject(spi);
 }
Example #16
0
        public void addProject(FiledropsFile f)
        {
            // Initialize this project
            initSolutionProject(f, f.FileSystem);

            AddProjectToSolutionFile(f);
        }
Example #17
0
        private void AddProjectToSolutionFile(FiledropsFile f)
        {
            // Add this project to the .fdsln xmlfile
            XmlDocument doc = new XmlDocument();
            doc.Load(Solutionfile.FullName);
            XmlNode root = doc.DocumentElement;

            XmlElement newproject = doc.CreateElement("Project");
            XmlElement location = doc.CreateElement("Location");
            location.InnerText = f.FullName;
            newproject.AppendChild(location);
            root.AppendChild(newproject);

            Solutionfile.Create(doc.OuterXml);
        }
Example #18
0
 public BitmapImage GetSchemaImage(FiledropsFile f, int size)
 {
     Assembly assembly = Assembly.GetEntryAssembly();
     string imagesresource = "Com.Xploreplus.Filedrops.Client.Resources.Images.schema.filetype_";
     return EmbeddedResourceTools.GetImage(imagesresource + f.NameWithoutExtension.ToLower() + ".png", size);
 }
Example #19
0
 public SolutionProjectInfo(SolutionInfo solution, FiledropsFile projectfile, ProjectManager manager, FiledropsFileSystem fs)
     : base(projectfile, manager, fs)
 {
     this.solution = solution;
 }
Example #20
0
 public override FileTreeNode CreateFileNode(FiledropsFile file)
 {
     return new ProjectFileNode(this.Project, file, this.ShowExtBinding);
 }
Example #21
0
 public void Open(FiledropsFile f)
 {
     // if tab is not Open yet, otherwise just focus.
     if (!IsOpen(f.FullName))
     {
         this.Manager.openDocument(f, this);
     }
     else
     {
         SetFocus(f.FullName);
     }
 }