示例#1
0
        private LoadedDocument CreateLoadedDocument(
            IVisitable <IGenericVisitor> type,
            string namespaceName,
            Action <LoadedDocument> addToDocumentAction,
            Action <Namespace> addToNamespaceAction)
        {
            type.Accept(new FixMethodBodyVisitor());
            LoadedDocument document = new LoadedDocument();

            if (string.IsNullOrWhiteSpace(namespaceName))
            {
                addToDocumentAction(document);
            }
            else
            {
                Namespace @namespace = new Namespace()
                {
                    Name = namespaceName,
                };
                addToNamespaceAction(@namespace);
                document.Namespaces.Add(@namespace);
            }

            return(document);
        }
示例#2
0
        protected void TestStruct(Type type)
        {
            IStruct        @struct       = TypeCache.Structs[type.Name()];
            string         namespaceName = new FindNamespaceForStructVisitor(@struct).Result;
            LoadedDocument document      = CreateLoadedDocument(new StructFactory(@struct).Value, namespaceName);
            string         documentText  = document.ToSourceCode();

            Verify(type, documentText);
        }
示例#3
0
        protected void TestStaticClass(Type type)
        {
            IStaticClass   @class        = TypeCache.StaticClasses[type.Name()];
            string         namespaceName = new FindNamespaceForClassVisitor(@class).Result;
            LoadedDocument document      = CreateLoadedDocument(new StaticClassFactory(@class).Value, namespaceName);
            string         documentText  = document.ToSourceCode();

            Verify(type, documentText);
        }
示例#4
0
 private void EntireClear()
 {
     this.document = null;
     this.attributeListBox.Items.Clear();
     this.propertyList.Items.Clear();
     this.projectList.Items.Clear();
     this.targetListView.Clear();
     this.targetPropBox.Items.Clear();
     this.codeTextBox.Clear();
     this.document      = null;
     LoadedProjects     = null;
     this.LoadedTargets = null;
 }
示例#5
0
        private void ExecuteLoader()
        {
            if (string.IsNullOrEmpty(SelectedFileName))
            {
                return;
            }
            //TODO: make it do some loading on a separate thread.
            Clear();
            ThreadStart loader = Generate;

            loadThread = new Thread(loader);
            document   = DocumentLoader.Load(SelectedFileName);
            Load();
        }
示例#6
0
        private void PersistCurrentOpenDocumentList()
        {
            _openDocuments = new List <LoadedDocument>();
            lock (_lock)
            {
                foreach (var d in _documentRegister.Value.OpenDocuments)
                {
                    var pointer = _documentRegister.Value.GetDocumentPointer(d);
                    if (pointer == null)
                    {
                        continue;
                    }

                    var dp = new LoadedDocument(pointer);
                    _openDocuments.Add(dp);
                }
            }
        }
示例#7
0
        private static LoadedDocument LoadProjects(FileSystemInfo fileInfo)
        {
            XmlDocument  xmlDocument         = new XmlDocument();
            const string projectSelectString = "/*";

            xmlDocument.Load(fileInfo.FullName);
            XmlNodeList projects = xmlDocument.SelectNodes(projectSelectString);
            //XmlNodeList includedDocuments = xmlDocument.SelectNodes("/project//include");
            LoadedDocument document = new LoadedDocument
            {
                FileName          = fileInfo.FullName,
                Projects          = new Projects(),
                IncludedDocuments = new Collection <LoadedDocument>()
            };

            if (projects == null)
            {
                return(null);
            }

            foreach (XmlNode proj in projects)
            {
                document.IncludedDocuments = LoadIncludedProjects(proj, fileInfo.FullName);
                Project project = new Project
                {
                    BaseDirectory = GetAttribute("basedir", proj),
                    DefaultTarget = GetAttribute("default", proj),
                    XmlNameSpace  = GetAttribute("xmlns", proj),
                    Name          = GetAttribute("name", proj),
                    Properties    = LoadProperties(proj),
                    Targets       = LoadTargets(proj),
                    Tasks         = LoadTasks(proj),
                    Attribute     = CreateAttributeList(proj),
                    Attributes    = CreateToString(proj),
                };

                project.AllProperties = project.Properties;
                project.AllTargets    = project.Targets;
                document.Projects.AddItem(project);
                CopyOver(document.IncludedDocuments, ref project);
            }
            return(document);
        }