コード例 #1
0
        private void WriteIntro(StreamWriter f, SolutionNode solution)
        {
            f.WriteLine("# Makefile for {0} generated by Prebuild ( http://dnpb.sf.net )", solution.Name);
            f.WriteLine("# Do not edit.");
            f.WriteLine("#");

            f.Write("# Configurations:");
            foreach (ConfigurationNode conf in solution.Configurations)
            {
                f.Write(" {0}", conf.Name);
            }
            f.WriteLine();

            f.WriteLine("# Projects:");
            foreach (ProjectNode proj in solution.Projects)
            {
                f.WriteLine("#\t{0}", proj.Name);
            }

            f.WriteLine("#");
            f.WriteLine("# Building:");
            f.WriteLine("#\t\"make\" to build everything under the default(first) configuration");
            f.WriteLine("#\t\"make CONF\" to build every project under configuration CONF");
            f.WriteLine("#\t\"make PROJ\" to build project PROJ under the default(first) configuration");
            f.WriteLine("#\t\"make PROJ-CONF\" to build project PROJ under configuration CONF");
            f.WriteLine("#");
            f.WriteLine("# Cleaning (removing results of build):");
            f.WriteLine("#\t\"make clean\" to clean everything, that's what you probably want");
            f.WriteLine("#\t\"make CONF\" to clean everything for a configuration");
            f.WriteLine("#\t\"make PROJ\" to clean everything for a project");
            f.WriteLine("#\t\"make PROJ-CONF\" to clea project PROJ under configuration CONF");
            f.WriteLine();
        }
コード例 #2
0
        void TreeNodeCreated(object sender, TreeViewEventArgs e)
        {
            SolutionNode sn = e.Node as SolutionNode;

            if (sn != null)
            {
                OverlayIconManager.Enqueue(sn);
            }
            else
            {
                DirectoryNode dn = e.Node as DirectoryNode;
                if (dn != null)
                {
                    OverlayIconManager.Enqueue(dn);
                }
                else
                {
                    FileNode fn = e.Node as FileNode;
                    if (fn != null)
                    {
                        OverlayIconManager.Enqueue(fn);
                    }
                }
            }
        }
コード例 #3
0
        internal DigitalPointDocument(Device device, SolutionNode parent, DevicePoint dataModel, int folderId)
        {
            InitializeComponent();

            //报警组
            var items = new List <object>();

            for (int i = 0; i < 16; i++)
            {
                items.Add(new
                {
                    text  = (i + 1).ToString(),
                    value = (1 << i)
                });
            }
            cmd_AlarmGroup.ItemsSource = items;

            //安全区
            items = new List <object>();
            for (int i = 0; i < 26; i++)
            {
                items.Add(new
                {
                    text  = ((char)(((int)('A')) + i)).ToString(),
                    value = (1 << i)
                });
            }
            cmbSafeArea.ItemsSource = items;

            Controller = new PointDocumentController(this, gridProperty, device, DevicePoint_TypeEnum.Digital, parent, dataModel, folderId);
            this.Title = Controller.OriginalModel.Name;
        }
コード例 #4
0
        void TreeNodeCreated(object sender, TreeViewEventArgs e)
        {
            SolutionNode sn = e.Node as SolutionNode;

            if (sn != null)
            {
                if (CanBeVersionControlledDirectory(sn.Solution.Directory))
                {
                    OverlayIconManager.Enqueue(sn);
                }
            }
            else
            {
                DirectoryNode dn = e.Node as DirectoryNode;
                if (dn != null)
                {
                    if (CanBeVersionControlledDirectory(dn.Directory))
                    {
                        OverlayIconManager.Enqueue(dn);
                    }
                }
                else
                {
                    FileNode fn = e.Node as FileNode;
                    if (fn != null)
                    {
                        if (CanBeVersionControlledFile(fn.FileName))
                        {
                            OverlayIconManager.Enqueue(fn);
                        }
                    }
                }
            }
        }
コード例 #5
0
            SolutionNode(
                SolutionNode top,
                SolutionNode parent,
                Guid projectGuid,
                Project project,
                ProjectConfiguration configuration,
                string relativePath)
            {
                Top           = top ?? throw new ArgumentNullException(nameof(top));
                Parent        = parent ?? throw new ArgumentNullException(nameof(parent));
                Guid          = projectGuid;
                Project       = project ?? throw new ArgumentNullException(nameof(project));
                Configuration = configuration;
                Name          = Path.GetFileNameWithoutExtension(project.FullPath);
                RelativePath  = relativePath;

                switch (Path.GetExtension(project.FullPath).ToLowerInvariant())
                {
                case ".csproj":
                    TypeGuid = csprojTypeGuid;
                    break;

                case ".fsproj":
                    TypeGuid = fsprojTypeGuid;
                    break;

                case ".vbproj":
                    TypeGuid = vbprojTypeGuid;
                    break;

                case ".shproj":
                    TypeGuid = shprojTypeGuid;
                    break;
                }
            }
コード例 #6
0
        private void ShowSlnInfo()
        {
            StringBuilder info = new StringBuilder();

            Solution3    sln = DTEObject.Solution as Solution3;
            SolutionNode sn  =
                new SolutionNode {
                FileName = sln.FileName, FullName = sln.FullName
            };

            foreach (Project proj in sln.Projects)
            {
                if (proj.Kind == ProjectKinds.vsProjectKindSolutionFolder)
                {
                    AddSolutionFolder(sn, proj);
                    //sn.SolutionFolderList.Add();
                }
                else
                {
                    AddProject(sn, proj);
                    //info.AppendLine(proj.FullName);
                }
            }

            //MessageBox.Show(info.ToString());
            Solution3 newSln = DTEObject.Solution as Solution3;

            newSln.Create(@"C:\solutions", "mySln");
            MessageBox.Show(newSln.FullName);
        }
コード例 #7
0
        private void WriteSolution(SolutionNode solution)
        {
            m_Kernel.Log.Write("Creating makefile for {0}", solution.Name);
            m_Kernel.CurrentWorkingDirectory.Push();

            string       file = "Makefile";// Helper.MakeFilePath(solution.FullPath, solution.Name, "make");
            StreamWriter f    = new StreamWriter(file);

            Helper.SetCurrentDir(Path.GetDirectoryName(file));

            using (f)
            {
                WriteIntro(f, solution);
                WritePhony(f, solution);

                foreach (ProjectNode project in solution.Projects)
                {
                    m_Kernel.Log.Write("...Creating Project: {0}", project.Name);
                    WriteProject(f, solution, project);
                }
            }

            m_Kernel.Log.Write("");
            m_Kernel.CurrentWorkingDirectory.Pop();
        }
コード例 #8
0
        private static List <CompletionNode> GetSolutionTreeLeaves(SolutionNode tableauSolution)
        {
            var leaves = new List <CompletionNode>();

            tableauSolution.AddLeaves(leaves);
            return(leaves);
        }
コード例 #9
0
 private void WriteSolutionFiles(SolutionNode solution, TextWriter ss)
 {
     if (solution.Files != null && solution.Files.Count > 0)
     {
         WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
     }
 }
コード例 #10
0
 private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject)
 {
     if (solution.Files != null && solution.Files.Count > 0)
     {
         WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
     }
 }
コード例 #11
0
        private void AddProject(SolutionNode sn, Project proj)
        {
            ProjectNode pn = new ProjectNode();

            pn.Name = proj.Name;
            VSProject2 vsProj = proj.Object as VSProject2;

            foreach (Reference reference in vsProj.References)
            {
                ReferenceNode rn = new ReferenceNode();
                rn.Name = reference.Name;
                rn.Path = reference.Path;
                pn.ReferenceList.Add(rn);
            }

            foreach (ProjectItem item in proj.ProjectItems)
            {
                FileNode fn = new FileNode();
                fn.FileName = item.Name;
                //fn.FullName = item.Document.FullName;
                pn.FileList.Add(fn);
            }

            sn.ProjectList.Add(pn);
        }
コード例 #12
0
        void TreeNodeCreated(object sender, TreeViewEventArgs e)
        {
            SolutionNode sn = e.Node as SolutionNode;

            if (sn != null)
            {
                GitStatusCache.ClearCachedStatus(sn.Solution.FileName);
                OverlayIconManager.Enqueue(sn);
            }
            else
            {
                DirectoryNode dn = e.Node as DirectoryNode;
                if (dn != null)
                {
                    OverlayIconManager.Enqueue(dn);
                }
                else
                {
                    FileNode fn = e.Node as FileNode;
                    if (fn != null)
                    {
                        OverlayIconManager.Enqueue(fn);
                    }
                }
            }
        }
コード例 #13
0
        private string BuildReference(SolutionNode solution, ReferenceNode refr)
        {
            string ret = "\t\t<Reference type=\"";

            if (solution.ProjectsTable.ContainsKey(refr.Name))
            {
                ret += "Project\" refto=\"" + refr.Name;
                ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
            }
            else
            {
                ProjectNode project = (ProjectNode)refr.Parent;
                string      fileRef = FindFileReference(refr.Name, project);

                if (refr.Path != null || fileRef != null)
                {
                    ret += "Assembly\" refto=\"";

                    string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;

                    ret += finalPath;
                    ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
                    return(ret);
                }

                ret += "Gac\" refto=\"";
                ret += refr.Name;
                ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
            }

            return(ret);
        }
コード例 #14
0
        private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
        {
            if (!String.IsNullOrEmpty(refr.Path))
            {
                return(refr.Path);
            }

            if (solution.ProjectsTable.ContainsKey(refr.Name))
            {
                ProjectNode projectRef = (ProjectNode)solution.ProjectsTable[refr.Name];
                string      finalPath  =
                    Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/');
                return(finalPath);
            }

            ProjectNode project = (ProjectNode)refr.Parent;

            // Do we have an explicit file reference?
            string fileRef = FindFileReference(refr.Name, project);

            if (fileRef != null)
            {
                return(fileRef);
            }

            // Is there an explicit path in the project ref?
            if (refr.Path != null)
            {
                return(Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/'));
            }

            // No, it's an extensionless GAC ref, but nant needs the .dll extension anyway
            return(refr.Name + ".dll");
        }
コード例 #15
0
        public override void Run()
        {
            SolutionNode solutionNode = ProjectBrowserPad.Instance.SelectedNode as SolutionNode;

            if (solutionNode != null)
            {
                OpenContainingFolderInExplorer(solutionNode.Solution.FileName);
                return;
            }

            SolutionItemNode solutionItemNode = ProjectBrowserPad.Instance.SelectedNode as SolutionItemNode;

            if (solutionItemNode != null)
            {
                OpenContainingFolderInExplorer(solutionItemNode.FileName);
                return;
            }

            FileNode fileNode = ProjectBrowserPad.Instance.SelectedNode as FileNode;

            if (fileNode != null)
            {
                OpenContainingFolderInExplorer(fileNode.FileName);
                return;
            }

            ProjectNode projectNode = ProjectBrowserPad.Instance.SelectedNode as ProjectNode;

            if (projectNode != null)
            {
                OpenContainingFolderInExplorer(projectNode.Project.FileName);
                return;
            }
        }
コード例 #16
0
        public PointDocumentController(BaseDocument container, Grid gridProperty, Device device, DevicePoint_TypeEnum type, SolutionNode parent, DevicePoint dataModel, int folderId)
        {
            _container    = container;
            _gridProperty = gridProperty;
            Device        = device;
            _parentNode   = parent;
            OriginalModel = dataModel;
            if (OriginalModel == null)
            {
                OriginalModel = new DevicePoint()
                {
                    Type     = type,
                    DeviceId = this.Device.id,
                    FolderId = folderId
                };
            }

            //复制一份,给刷新按钮使用
            _pointModel                  = OriginalModel.Clone <DevicePoint>();
            _container.DataContext       = _pointModel;
            _pointModel.PropertyChanged += _pointModel_PropertyChanged;
            if (_pointModel.AddrSetting.IsBlank() == false)
            {
                _PointJsonDict = _pointModel.AddrSetting.JsonToObject <Dictionary <string, string> >();
            }
            setPointPropertyInput();
        }
コード例 #17
0
        public TextView GetView(SolutionNode node)
        {
            var representation = string.Empty;

            if (node is ContradictionNode)
            {
                representation = "X";
            }
            else if (node is CompletionNode)
            {
            }
            else
            {
                var formulaRepresentation = node.Formula.Apply(TextFormulaVisitor);
                var truthLabel            = node.TruthLabel.GetStringRepresentation();

                if (!HasParenthesis(formulaRepresentation))
                {
                    formulaRepresentation = $"({formulaRepresentation})";
                }

                representation = $"{truthLabel}{formulaRepresentation}";
            }

            return(new TextView()
            {
                Width = (uint)representation.Length,
                Height = 1,
                Representation = representation
            });
        }
コード例 #18
0
ファイル: AutotoolsTarget.cs プロジェクト: LaNani/opensim
        private void CleanSolution(SolutionNode solution)
        {
            m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);

            string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");

            Helper.DeleteIfExists(slnFile);

            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
            Helper.DeleteIfExists(slnFile);

            slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
            Helper.DeleteIfExists(slnFile);

            slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
            Helper.DeleteIfExists(slnFile);

            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
            Helper.DeleteIfExists(slnFile);

            foreach (ProjectNode project in solution.Projects)
            {
                CleanProject(project);
            }

            m_Kernel.Log.Write("");
        }
コード例 #19
0
ファイル: AutotoolsTarget.cs プロジェクト: LaNani/opensim
        private void WriteCombine(SolutionNode solution)
        {
            #region "Create Solution directory if it doesn't exist"
            string solutionDir = Path.Combine(solution.FullPath,
                                              Path.Combine("autotools",
                                                           solution.Name));
            chkMkDir(solutionDir);
            #endregion

            #region "Write Solution-level files"
            XsltArgumentList argList = new XsltArgumentList();
            argList.AddParam("solutionName", "", solution.Name);
            // $solutionDir is $rootDir/$solutionName/
            transformToFile(Path.Combine(solutionDir, "configure.ac"),
                            argList, "/Autotools/SolutionConfigureAc");
            transformToFile(Path.Combine(solutionDir, "Makefile.am"),
                            argList, "/Autotools/SolutionMakefileAm");
            transformToFile(Path.Combine(solutionDir, "autogen.sh"),
                            argList, "/Autotools/SolutionAutogenSh");
            #endregion

            foreach (ProjectNode project in solution.ProjectsTableOrder)
            {
                m_Kernel.Log.Write(String.Format("Writing project: {0}",
                                                 project.Name));
                WriteProject(solution, project);
            }
        }
コード例 #20
0
        public void RepoSolutionCircle()
        {
            var circlesService = new CirclesService();
            var solutionA      = new SolutionNode("SolutionA");
            var solutionB      = new SolutionNode("SolutionB");
            var solutionC      = new SolutionNode("SolutionC");
            var artifactA      = solutionA.CreatesArtifact("ArtifactA", "a");
            var artifactD      = solutionA.CreatesArtifact("ArtifactD", "d");

            var artifactB = solutionB.CreatesArtifact("ArtifactB", "b");
            var artifactC = solutionC.CreatesArtifact("ArtifactC", "c");

            // the circle
            artifactA.DependsOn(artifactB);
            artifactB.DependsOn(artifactC);
            artifactC.DependsOn(artifactD);

            NodeRepository repo = new NodeRepository();

            repo.Add(solutionA);
            repo.Add(solutionB);
            repo.Add(solutionC);
            IList <ICircle> circles = circlesService.FindCircles(repo);

            Assert.IsNotNull(circles, "Even when there is no circle, there should be a valid list");
            Assert.AreEqual(1, circles.Count, "list should have one circles");
            Assert.AreEqual("SolutionA:ArtifactA,SolutionB:ArtifactB,SolutionC:ArtifactC,SolutionA:ArtifactD", circles[0].ToString());
        }
コード例 #21
0
        private void WriteProjectFiles(StreamWriter f, SolutionNode solution, ProjectNode project)
        {
            // Write list of source code files
            f.WriteLine("SOURCES_{0} = \\", project.Name);
            foreach (string file in project.Files)
            {
                if (project.Files.GetBuildAction(file) == BuildAction.Compile)
                {
                    f.WriteLine("\t{0} \\", NicePath(project, file));
                }
            }
            f.WriteLine();

            // Write list of resource files
            f.WriteLine("RESOURCES_{0} = \\", project.Name);
            foreach (string file in project.Files)
            {
                if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource)
                {
                    string path = NicePath(project, file);
                    f.WriteLine("\t-resource:{0},{1} \\", path, Path.GetFileName(path));
                }
            }
            f.WriteLine();

            // There's also Content and None in BuildAction.
            // What am I supposed to do with that?
        }
コード例 #22
0
        private static string BuildReference(SolutionNode solution, ReferenceNode refr)
        {
            string ret = "<ProjectReference type=\"";

            if (solution.ProjectsTable.ContainsKey(refr.Name))
            {
                ret += "Project\"";
                ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />";
            }
            else
            {
                ProjectNode project = (ProjectNode)refr.Parent;
                string      fileRef = FindFileReference(refr.Name, project);

                if (refr.Path != null || fileRef != null)
                {
                    ret += "Assembly\" refto=\"";

                    string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;

                    ret += finalPath;
                    ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
                    return(ret);
                }

                ret += "Gac\"";
                ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\"";
                ret += " refto=\"";
                try
                {
                    /*
                     * Day changed to 28 Mar 2007
                     * ...
                     * 08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ?
                     * 08:09 < jonp> no
                     * 08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the
                     *            ability to load any assembly version by-name was an inherently
                     *            bad idea
                     * 08:11 < cj> I'm thinking of a bunch of four-letter words right now...
                     * 08:11 < cj> security through making it difficult for the developer!!!
                     * 08:12 < jonp> just use the Obsolete API
                     * 08:12 < jonp> it should still work
                     * 08:12 < cj> alrighty.
                     * 08:12 < jonp> you just get warnings when using it
                     */
                    Assembly assem = Assembly.LoadWithPartialName(refr.Name);
                    ret += assem.FullName;
                    //ret += refr.Name;
                }
                catch (System.NullReferenceException e)
                {
                    e.ToString();
                    ret += refr.Name;
                }
                ret += "\" />";
            }

            return(ret);
        }
コード例 #23
0
        private async void OnOpenSolutionFile()
        {
            var solutionWorkspace = MSBuildWorkspace.Create();
            var solution          = await solutionWorkspace.OpenSolutionAsync(SolutionFilePath);

            var solutionNode = new SolutionNode(solution);

            RootNodes = new[] { solutionNode };
        }
コード例 #24
0
        private void CleanSolution(SolutionNode solution)
        {
            m_Kernel.Log.Write("Cleaning makefile for {0}", solution.Name);

            string file = Helper.MakeFilePath(solution.FullPath, solution.Name, "make");

            Helper.DeleteIfExists(file);

            m_Kernel.Log.Write("");
        }
コード例 #25
0
        /// <summary>
        /// 绑定子节点
        /// </summary>
        void bindChildren()
        {
            var settingNode = new SolutionNode()
            {
                Text = "单元配置",
            };

            if (true)
            {
                settingNode.Nodes.Add(new SolutionNode()
                {
                    Text = "报警",
                    DoublicClickHandler = alarmSetting_doubleClick,
                });
                settingNode.Nodes.Add(new SolutionNode()
                {
                    Text = "趋势",
                    DoublicClickHandler = trendSetting_doubleClick,
                });
                settingNode.Nodes.Add(new SolutionNode()
                {
                    Text = "MMI",
                    DoublicClickHandler = mmiSetting_doubleClick,
                });
            }
            this.Nodes.Add(settingNode);

            this.Nodes.Add(new ControlWindowContainerNode(this.Data.id.Value, null)
            {
                Text = "监视画面",
            });

            this.Text = this.Data.Name + " Loading...";
            Helper.Remote.Invoke <SunRizServer.Device[]>("GetDeviceList", (ret, err) => {
                this.Text = this.Data.Name;
                if (err != null)
                {
                    MessageBox.Show(MainWindow.Instance, err);
                }
                else
                {
                    foreach (var data in ret)
                    {
                        var node = new DeviceNode(data);
                        node.ContextMenuItems.Add(new ContextMenuItem()
                        {
                            Text         = "重命名",
                            ClickHandler = editDeviceClick,
                            Tag          = node,
                        });
                        this.Nodes.Add(node);
                    }
                }
            }, this.Data.id);
        }
コード例 #26
0
ファイル: SolutionTree.cs プロジェクト: JanSnoh/HaseUndIgel
        public void TestTreePath()
        {
            var root = new SolutionNode {
                children = new List <SolutionNode>()
            };

            MakeNode(root, 0);
            var bestNode = SolutionNode.ResolveTree(root, boardInit.spielers[boardInit.currentSpielerIndex], boardInit);

            Assert.IsNotNull(bestNode);
        }
コード例 #27
0
    // this is how I create and add project sections, using Section and PropertyLine
    private SlnProject CreateProject(SolutionNode sn)
    {
        List <Section>      projectSections     = CreateProjectSections(sn);
        List <PropertyLine> versionControlLines = CreateVersionControlLines(sn);
        List <PropertyLine> projectConfigurationPlatformsLines = CreateProjectConfigurationPlatformsLines(sn);
        string parentGuid   = (sn.Parent is Sln ? null : sn.Parent.InstanceGuidSt);
        string relativePath = (sn is Project) ? (sn as Project).ProjFile.ObjectRelativePath : sn.ObjectRelativePath;

        return(new CWDev.SLNTools.Core.Project(_slnFile, sn.InstanceGuidSt, sn.TypeGuidSt, sn.Name, relativePath, parentGuid,
                                               projectSections, versionControlLines, projectConfigurationPlatformsLines));
    }
コード例 #28
0
        private static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
        {
            SolutionNode node = solution;

            while (node.Parent is SolutionNode)
            {
                node = node.Parent as SolutionNode;
            }

            return(FindProjectInSolutionRecursively(name, node));
        }
コード例 #29
0
 SolutionNode(
     SolutionNode top,
     SolutionNode parent,
     string folderName)
 {
     Top          = top ?? throw new ArgumentNullException(nameof(top));
     Parent       = parent ?? throw new ArgumentNullException(nameof(parent));
     Name         = folderName ?? throw new ArgumentNullException(nameof(folderName));
     RelativePath = folderName;
     Guid         = CreateVersion5Guid(parent.Guid, folderName);
     TypeGuid     = solutionFolderTypeGuid;
 }
コード例 #30
0
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.JoinableTaskFactory.Run(async delegate
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                // TODO 遅延で取らないとnullになる
                if ((this.DteObject = (await package.GetServiceAsync(typeof(DTE))) as DTE2) == null)
                {
                    return;
                }

                // ソリューションの情報を引っ張る
                SolutionNode node = SolutionNode.Create(this.DteObject);
                var project       = node.FindProjectByName(TargetProjectName);
                if (project == null)
                {
                    Instance.OutputPane.OutputString($"ProjectName'{ TargetProjectName }' not found\n");
                    return;
                }

                var baseComponentName = "Egliss::Reflection::Reflectable";
                var vcClasses         = project.RootNode
                                        .FindAllOf <ClassNode>();
                var baseComponent = vcClasses.Where(m => m.FullName == "global::" + baseComponentName).FirstOrDefault();
                if (baseComponent == null)
                {
                    Instance.OutputPane.OutputString($"the class({baseComponentName}) not found\n");
                    return;
                }
                var components = vcClasses
                                 .Where(m => m.VCClass.IsDerivedFrom[baseComponentName])
                                 .ToList();

                if (components.Count == 0)
                {
                    Instance.OutputPane.OutputString($"{baseComponentName}'s child class not found\n");
                    return;
                }

                var tree        = TypeDeriverTree.MakeTree(components, baseComponent);
                var description = TypeDescription
                                  .CreateDescription(tree)
                                  .Select(m => m.Value)
                                  .OrderBy(m => m.Id)
                                  .ToList();
                var directory = Path.GetDirectoryName(project.Project.FileName);
                ClassExporter.OutputCppFile(description, $"{directory}\\Sources\\Reflection\\DynamicType.cpp");
                ClassExporter.OutputInlineFile(description, $"{directory}\\Sources\\Reflection\\StaticType.inl");
                Instance.OutputPane.OutputString($"class export succeed.\n");
            });
        }
コード例 #31
0
			public void WhenCreatingSolutionWithInvalidName_ThenThrows()
			{
				var solution = ServiceProvider.GetService<IVsSolution>();
				var hierarchy = solution as IVsHierarchy;

				var solutionNode = new SolutionNode(
                    new VsSolutionHierarchyNode(hierarchy, VSConstants.VSITEMID_ROOT),
					Mock.Of<ITreeNodeFactory<IVsSolutionHierarchyNode>>(),
                    Mock.Of<ISolutionExplorerNodeFactory>(),
                    Mock.Of<IServiceLocator>(),
                    Mock.Of<IAdapterService>(),
					Mock.Of<ISolutionEvents>(),
                    Mock.Of<IUIThread>());

				Assert.Throws<ArgumentException>(() => solutionNode.Create("foo"));
			}
コード例 #32
0
			public void WhenCreatingSolution_ThenIsOpenReturnsTrue()
			{
				var solution = ServiceProvider.GetService<IVsSolution>();
				var hierarchy = solution as IVsHierarchy;

				var solutionNode = new SolutionNode(
					new VsSolutionHierarchyNode(hierarchy, VSConstants.VSITEMID_ROOT),
                    Mock.Of<ITreeNodeFactory<IVsSolutionHierarchyNode>>(),
                    Mock.Of<ISolutionExplorerNodeFactory>(),
                    Mock.Of<IServiceLocator>(),
                    Mock.Of<IAdapterService>(),
					Mock.Of<ISolutionEvents>(),
                    Mock.Of<IUIThread>());

				solutionNode.Create(GetFullPath(TestContext.TestDeploymentDir, "foo.sln"));

				Assert.True(solutionNode.IsOpen);
			}
コード例 #33
0
ファイル: SolutionNodeSpec.cs プロジェクト: BO45/clide
            public void WhenSolutionIsOpened_ThenIsOpenReturnsTrue()
            {
                var solution = ServiceProvider.GetService<IVsSolution>();
                var hierarchy = solution as IVsHierarchy;

                var solutionNode = new SolutionNode(
                    new VsSolutionHierarchyNode(hierarchy, VSConstants.VSITEMID_ROOT),
                    Mock.Of<ITreeNodeFactory<IVsSolutionHierarchyNode>>(),
                    Mock.Of<ISolutionExplorerNodeFactory>(),
                    Mock.Of<IServiceLocator>(),
                    Mock.Of<IAdapterService>(),
                    Mock.Of<ISolutionEvents>(),
                    Mock.Of<IUIThread>());

                solutionNode.Open(GetFullPath("SampleSolution\\SampleSolution.sln"));

                Assert.True(solutionNode.IsOpen);
            }
コード例 #34
0
            public void WhenGettingParent_ThenReturnsNull()
            {
                var solution = ServiceProvider.GetService<IVsSolution>();
                var hierarchy = solution as IVsHierarchy;

                var solutionNode = new SolutionNode(
                    new VsSolutionHierarchyNode(hierarchy, VSConstants.VSITEMID_ROOT),
                    Mock.Of<ITreeNodeFactory<IVsSolutionHierarchyNode>>(),
                    Mock.Of<ISolutionExplorerNodeFactory>(),
                    Mock.Of<IServiceLocator>(),
                    Mock.Of<IAdapterService>(),
                    Mock.Of<ISolutionEvents>(),
                    Mock.Of<IUIThread>());

                Assert.Null(solutionNode.Parent);
            }