Пример #1
0
        public static Tuple <List <ClassNode>, List <BaseNode> > ReadNodes(Stream input, ReClassNetProject templateProject, ILogger logger)
        {
            Contract.Requires(input != null);
            Contract.Requires(logger != null);
            Contract.Ensures(Contract.Result <Tuple <List <ClassNode>, List <BaseNode> > >() != null);

            using (var project = new ReClassNetProject())
            {
                templateProject?.Classes.ForEach(project.AddClass);

                var file = new ReClassNetFile(project);
                file.Load(input, logger);

                var classes = new List <ClassNode>();

                var nodes = new List <BaseNode>();

                var serialisationClassNode = project.Classes.FirstOrDefault(c => c.Name == SerialisationClassName);
                if (serialisationClassNode != null)
                {
                    if (templateProject != null)
                    {
                        classes.AddRange(project.Classes.Where(c => c != serialisationClassNode).Where(classNode => !templateProject.ContainsClass(classNode.Uuid)));
                    }

                    nodes.AddRange(serialisationClassNode.Nodes);

                    project.Remove(serialisationClassNode);
                }

                return(Tuple.Create(classes, nodes));
            }
        }
Пример #2
0
        private void deleteClassToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var treeNode = classesTreeView.SelectedNode as ClassTreeNode;

            if (treeNode != null)
            {
                try
                {
                    project.Remove(treeNode.ClassNode);
                }
                catch (ClassReferencedException ex)
                {
                    Program.Logger.Log(ex);
                }
            }
        }