aboutsummaryrefslogtreecommitdiffstatsci
path: root/CrowIDE/src/Project.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-09 18:46:40 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-02-09 18:46:40 +0100
commitd783669223da5bfe8caa1b95c0ff6e1c5046e09e (patch)
tree08e156330c147d73aff48d018d60df6bfa50e259 /CrowIDE/src/Project.cs
parent8678c71d24bd88ceca04dc71b0d1b93a2f51cecf (diff)
Squashed commit devel branch:
commit 7f91f7c2e83f7cfb2922ea83586f156f03f88a59 Author: Jean-Philippe Bruyère <jp_bruyere@hotmail.com> Date: Fri Feb 9 18:13:59 2018 +0100 go back to OpenTK-2, waiting for an official release commit 125f32758a584c4976d3536eab3702fd37a8a7a9 Author: Jean-Philippe Bruyère <jp_bruyere@hotmail.com> Date: Fri Feb 9 17:26:00 2018 +0100 LoadInterface replaced by AddWidget overload, [ide] property view item templates in separate template file commit 7c48cd2f0332d2ec82006edb755fcd37ab1f2b4a Author: Jean-Philippe Bruyère <jp_bruyere@hotmail.com> Date: Fri Feb 9 12:10:13 2018 +0100 Tooltips, CrowIDE improvements, Fetch subdata when test not eq TypeOf, debug listener in basicTest, RemoveWidget in iface modifié : Crow.ControlsLib/Crow.ControlsLib.csproj modifié : Crow.csproj modifié : Crow.sln modifié : CrowIDE/CrowIDE.csproj modifié : CrowIDE/src/CrowIDE.cs modifié : CrowIDE/src/ImlVisualEditor.cs nouveau fichier : CrowIDE/src/Project.cs nouveau fichier : CrowIDE/src/Solution.cs nouveau fichier : CrowIDE/src/VerticalLine.cs nouveau fichier : CrowIDE/ui/ProjectProperties.crow nouveau fichier : CrowIDE/ui/ProjectTree.template nouveau fichier : CrowIDE/ui/TreeExpandable.template modifié : CrowIDE/ui/imlEditor.crow modifié : Default.style nouveau fichier : Icons/assembly.svg nouveau fichier : Templates/Tooltip.template modifié : Tests/BasicTests.cs modifié : Tests/HelloWorld.cs modifié : Tests/Interfaces/Divers/0.crow modifié : Tests/Interfaces/Divers/testShape.crow modifié : Tests/Interfaces/Divers/welcome.crow modifié : Tests/Tests.csproj modifié : src/CompilerServices/CompilerServices.cs modifié : src/GraphicObjects/FileDialog.cs modifié : src/GraphicObjects/GraphicObject.cs modifié : src/GraphicObjects/MessageBox.cs modifié : src/Instantiator.cs modifié : src/Interface.cs modifié : src/ItemTemplate.cs
Diffstat (limited to 'CrowIDE/src/Project.cs')
-rw-r--r--CrowIDE/src/Project.cs164
1 files changed, 164 insertions, 0 deletions
diff --git a/CrowIDE/src/Project.cs b/CrowIDE/src/Project.cs
new file mode 100644
index 00000000..2c724311
--- /dev/null
+++ b/CrowIDE/src/Project.cs
@@ -0,0 +1,164 @@
+//
+// Project.cs
+//
+// Author:
+// jp <>
+//
+// Copyright (c) 2013-2017 Jean-Philippe Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Xml;
+using System.IO;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace CrowIDE
+{
+ public class Project {
+ string path;
+ XmlDocument xmlDoc;
+ XmlNode nodeProject;
+ XmlNode nodeProps;
+ XmlNodeList nodesItems;
+ Solution solution;
+
+ public string Name {
+ get { return solution.projects.FirstOrDefault(p=>p.ProjectGuid == ProjectGuid).ProjectName; }
+ }
+
+ #region Project properties
+ public string RootDir {
+ get { return Path.GetDirectoryName (path); }
+ }
+ public string ToolsVersion {
+ get { return nodeProject?.Attributes ["ToolsVersion"]?.Value; }
+ }
+ public string DefaultTargets {
+ get { return nodeProject?.Attributes ["DefaultTargets"]?.Value; }
+ }
+ public string ProjectGuid {
+ get { return nodeProps["ProjectGuid"]?.InnerText; }
+ }
+ public string AssemblyName {
+ get { return nodeProps["AssemblyName"]?.InnerText; }
+ }
+ public string OutputType {
+ get { return nodeProps["OutputType"]?.InnerText; }
+ }
+ public string RootNamespace {
+ get { return nodeProps["RootNamespace"]?.InnerText; }
+ }
+ public bool AllowUnsafeBlocks {
+ get { return bool.Parse (nodeProps["AllowUnsafeBlocks"]?.InnerText); }
+ }
+ public bool NoStdLib {
+ get { return bool.Parse (nodeProps["NoStdLib"]?.InnerText); }
+ }
+ public bool TreatWarningsAsErrors {
+ get { return bool.Parse (nodeProps["TreatWarningsAsErrors"]?.InnerText); }
+ }
+ public bool SignAssembly {
+ get { return bool.Parse (nodeProps["SignAssembly"]?.InnerText); }
+ }
+ public string TargetFrameworkVersion {
+ get { return nodeProps["TargetFrameworkVersion"]?.InnerText; }
+ }
+ public string Description {
+ get { return nodeProps["Description"]?.InnerText; }
+ }
+ public string OutputPath {
+ get { return nodeProps["OutputPath"]?.InnerText; }
+ }
+ public string IntermediateOutputPath {
+ get { return nodeProps["IntermediateOutputPath"]?.InnerText; }
+ }
+ #endregion
+
+ public List<ProjectItem> Items {
+ get {
+ List<ProjectItem> tmp = new List<ProjectItem> ();
+ foreach (XmlNode i in nodesItems) {
+ foreach (XmlNode f in i.ChildNodes) {
+ tmp.Add (new ProjectItem (this, f));
+ }
+ }
+ return tmp;
+ }
+ }
+
+ public List<ProjectNode> RootItems {
+ get {
+ ProjectNode root = new ProjectNode (this, ItemType.VirtualGroup, RootNamespace);
+ List<ProjectItem> items = Items;
+
+ ProjectNode refs = new ProjectNode (this, ItemType.ReferenceGroup, "References");
+ root.ChildNodes.Add (refs);
+
+ foreach (ProjectItem pn in items) {
+ switch (pn.Type) {
+ case ItemType.Reference:
+ refs.ChildNodes.Add (pn);
+ break;
+ case ItemType.Compile:
+ case ItemType.None:
+ case ItemType.EmbeddedResource:
+ ProjectNode curNode = root;
+ string[] folds = pn.Path.Split ('\\', '/');
+ for (int i = 0; i < folds.Length - 1; i++) {
+ ProjectNode nextNode = curNode.ChildNodes.FirstOrDefault (n => n.DisplayName == folds [i] && n.Type == ItemType.VirtualGroup);
+ if (nextNode == null) {
+ nextNode = new ProjectNode (this, ItemType.VirtualGroup, folds [i]);
+ curNode.ChildNodes.Add (nextNode);
+ }
+ curNode = nextNode;
+ }
+ curNode.ChildNodes.Add (pn);
+ break;
+ }
+ }
+ root.SortChilds ();
+
+ return root.ChildNodes;
+ }
+
+ }
+ public Project () {}
+
+ public Project (string _path, Solution _solution){
+ solution = _solution;
+ path = _path;
+ xmlDoc = new XmlDocument();
+ using (Stream ins = new FileStream (_path, FileMode.Open)) {
+ xmlDoc.Load (new XmlTextReader(ins) { Namespaces = false });
+ }
+
+ nodeProject = xmlDoc.SelectSingleNode("Project");
+ XmlNodeList nodesProps = xmlDoc.SelectNodes ("/Project/PropertyGroup");
+
+ foreach (XmlNode n in nodesProps) {
+ if (n.Attributes ["Condition"] == null)
+ nodeProps = n;
+ }
+ nodesItems = xmlDoc.SelectNodes ("/Project/ItemGroup");
+
+ }
+ }
+}
+