Example #1
0
        static private ProjectType MakeProject(JadeData.Workspace.ProjectItem proj)
        {
            ProjectType result = new ProjectType();

            result.Path = proj.Path;
            Persistence.Project.Writer.Write(proj, proj.Path);
            return result;
        }
Example #2
0
 private static JadeData.Project.IProject MakeProject(string workspaceDir, ProjectType xml)
 {
     string path = xml.Path;
     if (System.IO.Path.IsPathRooted(path) == false)
     {
         path = System.IO.Path.Combine(workspaceDir, path);
     }
     return Persistence.Project.Reader.Read(path);
 }
Example #3
0
File: test.cs Project: JadeHub/Jade
        static public string Write(JadeData.Workspace.IWorkspace workspace, string path)
        {
            string workspaceDir = System.IO.Path.GetDirectoryName(path);

            JadeData.Workspace.IFolder folder = workspace;
            WorkspaceType result = new WorkspaceType();

            result.Name = workspace.Name;

            FolderType[] subs = new FolderType[folder.Folders.Count];
            for (int i = 0; i < folder.Folders.Count; i++)
            {
                subs[i] = MakeFolder(folder.Folders[i], workspaceDir);
            }
            result.Folders = subs;

            List<JadeData.Workspace.ProjectItem> projTemps = new List<JadeData.Workspace.ProjectItem>();
            foreach (JadeData.Workspace.ProjectItem proj in folder.Items.OfType<JadeData.Workspace.ProjectItem>())
            {
                projTemps.Add(proj);
            }
            ProjectType[] projs = new ProjectType[projTemps.Count];
            for (int i = 0; i < projTemps.Count; i++)
            {
                projs[i] = MakeProject(projTemps[i], workspaceDir);
            }
            result.Projects = projs;

            System.Xml.XmlDocument doc = new XmlDocument();
            System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(result.GetType());
            System.IO.TextWriter stream = new System.IO.StreamWriter(path); 
            try
            {                    
                serializer.Serialize(stream, result);
                stream.Close();
                return "";
            }
            catch
            {
                throw;
            }
            finally
            {
                stream.Close();
                stream.Dispose();
            }
        }
Example #4
0
File: test.cs Project: JadeHub/Jade
        static private FolderType MakeFolder(JadeData.Workspace.IFolder folder, string workspaceDir)
        {
            FolderType result = new FolderType();
            result.Name = folder.Name;

            FolderType[] subs = new FolderType[folder.Folders.Count];
            for (int i = 0; i < folder.Folders.Count; i++)
            {
                subs[i] = MakeFolder(folder.Folders[i], workspaceDir);
            }
            result.Folders = subs;

            List<JadeData.Workspace.ProjectItem> projTemps = new List<JadeData.Workspace.ProjectItem>();
            foreach (JadeData.Workspace.ProjectItem proj in folder.Items.OfType<JadeData.Workspace.ProjectItem>())
            {
                projTemps.Add(proj);
            }
            ProjectType[] projs = new ProjectType[projTemps.Count];
            for(int i=0;i<projTemps.Count;i++)
            {
                projs[i] = MakeProject(projTemps[i], workspaceDir);
            }
            result.Projects = projs;

            return result;
        }
Example #5
0
File: test.cs Project: JadeHub/Jade
        static private ProjectType MakeProject(JadeData.Workspace.ProjectItem proj, string workspaceDir)
        {
            ProjectType result = new ProjectType();

            string absPath = proj.Path;

            if (System.IO.Path.IsPathRooted(absPath) == false)
            {
                absPath = System.IO.Path.Combine(workspaceDir, absPath);
            }

            result.Path = proj.Path;
            Persistence.Project.Writer.Write(proj, absPath);
            return result;
        }