[mapguide-commits] r5124 - in trunk/Tools/Maestro: Maestro/LoginForm Maestro/ResourceEditors MaestroAPI MaestroAPI/Generated MaestroAPI/RuntimeClasses

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Sep 8 09:59:53 EDT 2010


Author: jng
Date: 2010-09-08 13:59:53 +0000 (Wed, 08 Sep 2010)
New Revision: 5124

Added:
   trunk/Tools/Maestro/MaestroAPI/ReservedChar.cs
Modified:
   trunk/Tools/Maestro/Maestro/LoginForm/OSGeo.MapGuide.Maestro.LoginForm.csproj
   trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs
   trunk/Tools/Maestro/MaestroAPI/Generated/MapDefinition-1.0.0.cs
   trunk/Tools/Maestro/MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
   trunk/Tools/Maestro/MaestroAPI/RuntimeClasses/RuntimeMap.cs
Log:
Fix #1424: Use a non-printable character (NUL) as the path separator

Modified: trunk/Tools/Maestro/Maestro/LoginForm/OSGeo.MapGuide.Maestro.LoginForm.csproj
===================================================================
--- trunk/Tools/Maestro/Maestro/LoginForm/OSGeo.MapGuide.Maestro.LoginForm.csproj	2010-09-08 05:22:48 UTC (rev 5123)
+++ trunk/Tools/Maestro/Maestro/LoginForm/OSGeo.MapGuide.Maestro.LoginForm.csproj	2010-09-08 13:59:53 UTC (rev 5124)
@@ -3,7 +3,7 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
+    <ProductVersion>9.0.21022</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{4B79021A-5117-4894-BBC0-39452E4F40E3}</ProjectGuid>
     <OutputType>Library</OutputType>
@@ -75,12 +75,15 @@
   <ItemGroup>
     <EmbeddedResource Include="FormLogin.resx">
       <DependentUpon>FormLogin.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="HttpLoginCtrl.resx">
       <DependentUpon>HttpLoginCtrl.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="LocalNativeLoginCtrl.resx">
       <DependentUpon>LocalNativeLoginCtrl.cs</DependentUpon>
+      <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Strings\FormLogin.resx">
       <Generator>ResXFileCodeGenerator</Generator>

Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs	2010-09-08 05:22:48 UTC (rev 5123)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs	2010-09-08 13:59:53 UTC (rev 5124)
@@ -157,15 +157,15 @@
             int index = m_map.LayerGroups.IndexOf((OSGeo.MapGuide.MaestroAPI.MapLayerGroupType)trvLayerGroups.SelectedNode.Tag);
             if (index >= 0)
             {
-                string new_folder_path = m_map.LayerGroups[index].GetFullPath("/", m_map) + "/";
-                string prev_folder_path = new_folder_path.Substring(0, new_folder_path.Length - args.NewName.Length - 1) + args.PreviousName + "/";
+                string new_folder_path = m_map.LayerGroups[index].GetFullPath(ReservedChar.PATH_SEPARATOR, m_map) + ReservedChar.PATH_SEPARATOR;
+                string prev_folder_path = new_folder_path.Substring(0, new_folder_path.Length - args.NewName.Length - 1) + args.PreviousName + ReservedChar.PATH_SEPARATOR;
 
                 for (int i = 0; i < m_map.Layers.Count; i++)
-                    if (m_map.Layers[i].Group == args.PreviousName && m_map.Layers[i].GetFullPath("/", m_map) == null)
+                    if (m_map.Layers[i].Group == args.PreviousName && m_map.Layers[i].GetFullPath(ReservedChar.PATH_SEPARATOR, m_map) == null)
                         m_map.Layers[i].Group = args.NewName;
 
                 for (int i = 0; i < m_map.LayerGroups.Count; i++)
-                    if (m_map.LayerGroups[i].Group == args.PreviousName && m_map.LayerGroups[i].GetFullPath("/", m_map) == null)
+                    if (m_map.LayerGroups[i].Group == args.PreviousName && m_map.LayerGroups[i].GetFullPath(ReservedChar.PATH_SEPARATOR, m_map) == null)
                         m_map.LayerGroups[i].Group = args.NewName;
 
                 m_editor.HasChanged();
@@ -227,7 +227,7 @@
 					ArrayList toRemove = new ArrayList();
 					foreach(OSGeo.MapGuide.MaestroAPI.MapLayerGroupType group in unmapped)
 					{
-						TreeNodeCollection parent = FindParentNode(group.GetFullPath("/", m_map));
+                        TreeNodeCollection parent = FindParentNode(group.GetFullPath(ReservedChar.PATH_SEPARATOR, m_map));
 						if (parent != null)
 						{
 							TreeNode tn = new TreeNode(group.Name, m_editor.ResourceEditorMap.FolderIcon, m_editor.ResourceEditorMap.FolderIcon);
@@ -258,7 +258,8 @@
 					tn.Tag = layer;
 					tn.ImageIndex = tn.SelectedImageIndex = 0;
 
-					TreeNodeCollection parent = FindParentNode(layer.GetFullPath("/", m_map));
+                    var path = layer.GetFullPath(ReservedChar.PATH_SEPARATOR, m_map);
+                    TreeNodeCollection parent = FindParentNode(path);
                     if (parent == null)
                     {
                         layer.Group = "";
@@ -337,7 +338,7 @@
             if (fullpath == null)
                 return null;
 
-			string[] path = fullpath.Split('/');
+			string[] path = fullpath.Split(Char.Parse(ReservedChar.PATH_SEPARATOR));
 			TreeNodeCollection nodes = trvLayerGroups.Nodes;
 			bool found = true;
 			for(int i = 0; i < path.Length - 1; i++)
@@ -1272,11 +1273,11 @@
 			int index = m_map.LayerGroups.IndexOf((OSGeo.MapGuide.MaestroAPI.MapLayerGroupType)trvLayerGroups.SelectedNode.Tag);
 			if (index >= 0)
 			{
-                string folder_path = m_map.LayerGroups[index].GetFullPath("/", m_map) + "/";
+                string folder_path = m_map.LayerGroups[index].GetFullPath(ReservedChar.PATH_SEPARATOR, m_map) + ReservedChar.PATH_SEPARATOR;
 
                 for (int i = 0; i < m_map.Layers.Count; i++)
                 {
-                    string path = m_map.Layers[i].GetFullPath("/", m_map);
+                    string path = m_map.Layers[i].GetFullPath(ReservedChar.PATH_SEPARATOR, m_map);
                     if (path.StartsWith(folder_path))
                     {
                         m_map.Layers.RemoveAt(i);
@@ -1286,7 +1287,7 @@
 
                 for (int i = 0; i < m_map.LayerGroups.Count; i++)
                 {
-                    string path = m_map.LayerGroups[i].GetFullPath("/", m_map);
+                    string path = m_map.LayerGroups[i].GetFullPath(ReservedChar.PATH_SEPARATOR, m_map);
                     if (path.StartsWith(folder_path))
                     {
                         m_map.LayerGroups.RemoveAt(i);
@@ -2543,13 +2544,13 @@
 
             List<MaestroAPI.MapLayerType> layers = new List<OSGeo.MapGuide.MaestroAPI.MapLayerType>();
             List<MaestroAPI.MapLayerGroupType> groups = new List<OSGeo.MapGuide.MaestroAPI.MapLayerGroupType>();
-            
-            string grouppath = g.GetFullPath("/", m_map) + "/";
 
+            string grouppath = g.GetFullPath(ReservedChar.PATH_SEPARATOR, m_map) + ReservedChar.PATH_SEPARATOR;
+
             bool hasInvisible = false;
             foreach (MaestroAPI.MapLayerType l in m_map.Layers)
             {
-                string lpath = l.GetFullPath("/", m_map);
+                string lpath = l.GetFullPath(ReservedChar.PATH_SEPARATOR, m_map);
                 if (lpath != null && lpath.StartsWith(grouppath))
                 {
                     layers.Add(l);
@@ -2560,7 +2561,7 @@
 
             foreach (MaestroAPI.MapLayerGroupType lg in m_map.LayerGroups)
             {
-                string lpath = lg.GetFullPath("/", m_map);
+                string lpath = lg.GetFullPath(ReservedChar.PATH_SEPARATOR, m_map);
                 if (lpath != null && lpath.StartsWith(grouppath))
                     groups.Add(lg);
             }

Modified: trunk/Tools/Maestro/MaestroAPI/Generated/MapDefinition-1.0.0.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/Generated/MapDefinition-1.0.0.cs	2010-09-08 05:22:48 UTC (rev 5123)
+++ trunk/Tools/Maestro/MaestroAPI/Generated/MapDefinition-1.0.0.cs	2010-09-08 13:59:53 UTC (rev 5124)
@@ -612,17 +612,15 @@
 				if (m_parent == null)
 					return null;
 
-				string s = this.GetFullPath("/", m_parent);
+                string s = this.GetFullPath(ReservedChar.PATH_SEPARATOR, m_parent);
 				MapLayerTypeCollection layers = new MapLayerTypeCollection();
 				foreach(MapLayerType ml in m_parent.Layers)
-					if (ml.GetFullPath("/", m_parent).StartsWith(s))
+                    if (ml.GetFullPath(ReservedChar.PATH_SEPARATOR, m_parent).StartsWith(s))
 						layers.Add(ml);
 
 				return layers;
 			}
 		}
-
-
     }
     
     /// <remarks/>

Modified: trunk/Tools/Maestro/MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj	2010-09-08 05:22:48 UTC (rev 5123)
+++ trunk/Tools/Maestro/MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj	2010-09-08 13:59:53 UTC (rev 5124)
@@ -299,6 +299,7 @@
     <Compile Include="RequestBuilder.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="ReservedChar.cs" />
     <Compile Include="ResourceIdentifier.cs" />
     <Compile Include="RuntimeClasses\RuntimeMap.cs">
       <SubType>Code</SubType>

Added: trunk/Tools/Maestro/MaestroAPI/ReservedChar.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/ReservedChar.cs	                        (rev 0)
+++ trunk/Tools/Maestro/MaestroAPI/ReservedChar.cs	2010-09-08 13:59:53 UTC (rev 5124)
@@ -0,0 +1,30 @@
+#region Disclaimer / License
+// Copyright (C) 2010, Jackie Ng
+// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie at gmail.com
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// 
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+// 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+// 
+#endregion
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OSGeo.MapGuide.MaestroAPI
+{
+    public static class ReservedChar
+    {
+        public static readonly string PATH_SEPARATOR = Char.ConvertFromUtf32(0);
+    }
+}

Modified: trunk/Tools/Maestro/MaestroAPI/RuntimeClasses/RuntimeMap.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/RuntimeClasses/RuntimeMap.cs	2010-09-08 05:22:48 UTC (rev 5123)
+++ trunk/Tools/Maestro/MaestroAPI/RuntimeClasses/RuntimeMap.cs	2010-09-08 13:59:53 UTC (rev 5124)
@@ -655,10 +655,10 @@
 				if (m_parent == null)
 					return null;
 
-				string s = this.GetFullPath("/", m_parent);
+				string s = this.GetFullPath(ReservedChar.PATH_SEPARATOR, m_parent);
 				RuntimeMapLayerCollection layers = new RuntimeMapLayerCollection();
 				foreach(RuntimeMapLayer ml in m_parent.Layers)
-					if (ml.GetFullPath("/", m_parent).StartsWith(s))
+                    if (ml.GetFullPath(ReservedChar.PATH_SEPARATOR, m_parent).StartsWith(s))
 						layers.Add(ml);
 
 				return layers;



More information about the mapguide-commits mailing list