コード例 #1
0
ファイル: ScriptTemplate.cs プロジェクト: rudybear/moai-ide
        /// <summary>
        /// Creates a new empty Lua script in the specified project, in the specified folder.
        /// </summary>
        /// <param name="data">The solution creation data, usually derived from the user's input in a NewSolutionForm.</param>
        /// <returns>A new solution that can be loaded.</returns>
        public override Moai.Platform.Management.File Create(string name, Project project, Folder folder)
        {
            File f = null;

            // Determine where to place the file.
            if (folder == null)
            {
                // Place the file in the root of the project
                f = new File(project, project.ProjectInfo.DirectoryName, name);
                project.AddFile(f);
            }
            else
            {
                // Place the file in the specified folder
                f = new File(project, project.ProjectInfo.DirectoryName, System.IO.Path.Combine(folder.FolderInfo.Name, name));
                folder.Add(f);
            }

            // Write the contents of the data into the file.
            using (System.IO.StreamWriter writer = new System.IO.StreamWriter(f.FileInfo.FullName))
            {
                writer.WriteLine("-- An empty script file.");
                writer.WriteLine();
            }

            return f;
        }
コード例 #2
0
ファイル: ProjectTreeNode.cs プロジェクト: rudybear/moai-ide
 public ProjectTreeNode(Project project)
 {
     this.Project = project;
     this.Tag = project;
     this.Project.SyncDataChanged += (sender, e) =>
         {
             this.Resync();
         };
     this.Resync();
 }
コード例 #3
0
ファイル: File.cs プロジェクト: rudybear/moai-ide
 /// <summary>
 /// Creates a new File object based on an relative path and a Project object.
 /// </summary>
 /// <param name="p">The project that owns this folder.</param>
 /// <param name="parent">The parent directory (the directory the project file is located in).</param>
 /// <param name="relpath">The relative path to the file.</param>
 public File(Project p, string parent, string relpath)
 {
     if (p != null && parent != null)
     {
         this.p_Project = p;
         this.p_FileInfo = new FileInfo(Path.Combine(parent, relpath));
     }
     else if (p == null && parent == null)
     {
         this.p_Project = null;
         this.p_FileInfo = new FileInfo(relpath);
     }
     else
         throw new NotSupportedException();
 }
コード例 #4
0
ファイル: FolderTemplate.cs プロジェクト: rudybear/moai-ide
        /// <summary>
        /// Creates a new empty folder in the specified project, in the specified folder.
        /// </summary>
        /// <param name="data">The solution creation data, usually derived from the user's input in a NewSolutionForm.</param>
        /// <returns>A new solution that can be loaded.</returns>
        public override Moai.Platform.Management.File Create(string name, Project project, Folder folder)
        {
            Folder ff = null;

            // Determine where to place the folder.
            if (folder == null)
            {
                // Place the folder in the root of the project
                ff = new Folder(project, project.ProjectInfo.DirectoryName, name);
                project.AddFile(ff);
            }
            else
            {
                // Place the folder in the specified folder
                ff = new Folder(project, project.ProjectInfo.DirectoryName, Path.Combine(folder.FolderInfo.Name, name));
                folder.Add(ff);
            }

            // Create the new folder on disk.
            if (!Directory.Exists(ff.FolderInfo.FullName))
                Directory.CreateDirectory(ff.FolderInfo.FullName);

            return ff;
        }
コード例 #5
0
ファイル: BaseTemplate.cs プロジェクト: rudybear/moai-ide
 public abstract File Create(string name, Project project, Folder folder);
コード例 #6
0
 private TreeNode Wrap(Project project)
 {
     TreeNode tn = new ProjectTreeNode(project);
     foreach (File f in project.Files)
     {
         if (f is Folder)
             tn.Nodes.Add(this.Wrap(f as Folder));
         else
             tn.Nodes.Add(new FileTreeNode(f));
     }
     return tn;
 }
コード例 #7
0
ファイル: File.cs プロジェクト: rudybear/moai-ide
 /// <summary>
 /// A protected constructor so that derived classes such as Folder only have
 /// to provide the project as an argument to the constructor.
 /// </summary>
 /// <param name="p">The project that owns this folder.</param>
 protected File(Project p)
 {
     this.p_Project = p;
 }
コード例 #8
0
 /// <summary>
 /// Creates a new item object representing the project information.
 /// </summary>
 /// <param name='project'>The project to represent.</param>
 public SolutionItem(Project project)
 {
     if (project == null)
         throw new ArgumentNullException("project");
     try
     {
         m_Log.Debug("Creating new solution item to represent project '" + project.ProjectInfo.Name + "'.");
     }
     catch
     {
         m_Log.Debug("Creating new solution item to represent project '<unknown>'.");
     }
     this.m_Project = project;
 }
コード例 #9
0
ファイル: Project.cs プロジェクト: rudybear/moai-ide
        /// <summary>
        /// Creates a new project on disk with the specified name in the
        /// specified directory.  The resulting location of the file will
        /// be path\name.mproj
        /// </summary>
        /// <param name="name">The name of the solution.</param>
        /// <param name="path">The path to the solution.</param>
        public static Project Create(string name, string path)
        {
            // Create the directory if it does not exist.
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            // Create a new empty instance.
            Project p = new Project();

            // Associate a FileInfo instance with it.
            p.p_ProjectInfo = new FileInfo(Path.Combine(path, name + ".mproj"));

            // Request that the project be saved.
            p.Save();

            // Return the new project.
            return p;
        }