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

                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");
            }
        }
コード例 #3
0
ファイル: OpenedFileManager.cs プロジェクト: liuyisi/Compiler
 public void Close(Source file)
 {
     lstOpenedFiles.Remove(file);
     _UpdateOpenedFiles();
 }
コード例 #4
0
ファイル: OpenedFileManager.cs プロジェクト: liuyisi/Compiler
 public void Open(Source file)
 {
     lstOpenedFiles.Add(file);
     _UpdateOpenedFiles();
 }