コード例 #1
0
ファイル: Project.cs プロジェクト: liuyisi/Compiler
        void itemAddFolder_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            InputBox dialog = new InputBox();
            if ((bool)dialog.ShowDialog())
            {
                Folder folder = new Folder(this) { Name = dialog.Content, Path = "/" + dialog.Content };
                System.IO.Directory.CreateDirectory(Path + folder.Path);
                Items.Add(folder);

                Save();
                ProjectManager.GetManager().ProjectUpdated();
            }
        }
コード例 #2
0
ファイル: ProjectManager.cs プロジェクト: liuyisi/Compiler
        private FileItem ParseProject(XElement elem, Project project)
        {
            if (elem.Name == "Folder")
            {
                Folder folder = new Folder(project)
                {
                    Name = elem.Attribute("Name").Value,
                    Path = elem.Attribute("Path").Value,
                    UUID = Guid.Parse(elem.Attribute("UUID").Value)
                };

                foreach (var u in elem.Elements())
                {
                    folder.Items.Add(ParseProject(u, project));
                }

                return folder;
            }
            else if (elem.Name == "File")
            {
                Source source = new Source(project)
                {
                    Name = elem.Attribute("Name").Value,
                    Path = elem.Attribute("Path").Value,
                    UUID = Guid.Parse(elem.Attribute("UUID").Value)
                };
                return source;
            }
            else
            {
                throw new Exception("Illegal Node");
            }
        }