[mapguide-commits] r8486 - in trunk/Tools/Maestro: OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI.Http OSGeo.MapGuide.MaestroAPI.Local OSGeo.MapGuide.MaestroAPI.Native OSGeo.MapGuide.ObjectModels/IO
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Dec 29 08:35:04 PST 2014
Author: jng
Date: 2014-12-29 08:35:04 -0800 (Mon, 29 Dec 2014)
New Revision: 8486
Removed:
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/BindingListExtensions.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IO/
Modified:
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Enums.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ExtensionMethods.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/IO/Utf8XmlWriter.cs
Log:
More code cleanup
- Remove redundant ReadOnlyRewindableStream and BindingList extension methods
- Make Utf8XmlWriter internal
Deleted: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/BindingListExtensions.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/BindingListExtensions.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/BindingListExtensions.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -1,65 +0,0 @@
-#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 Disclaimer / License
-
-using System.ComponentModel;
-
-namespace OSGeo.MapGuide.MaestroAPI
-{
- /// <summary>
- /// Extension method class
- /// </summary>
- public static class BindingListExtensions
- {
- //We target .net 2.0 so we have to roll our own extension methods
-
- /// <summary>
- /// Gets an array from the specified binding list
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="list"></param>
- /// <returns></returns>
- public static T[] ToArray<T>(this BindingList<T> list)
- {
- T[] values = new T[list.Count];
- int i = 0;
- foreach (T v in list)
- {
- values[i] = v;
- i++;
- }
- return values;
- }
- }
-}
-
-/*
-//A well known hack to get extension methods working in .net framework 2.0
-
-namespace System.Runtime.CompilerServices
-{
- /// <summary>
- /// Compiler attribute to support extension methods
- /// </summary>
- public class ExtensionAttribute : Attribute
- {
- }
-}*/
\ No newline at end of file
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Enums.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Enums.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Enums.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -122,33 +122,6 @@
}
}
- internal class EnumHelper
- {
- private static string[] ResourceTypeNames = new string[]
- {
- "MapDefinition", //NOXLATE
- "LayerDefinition", //NOXLATE
- "FeatureSource", //NOXLATE
- "WebLayout", //NOXLATE
- "Map", //NOXLATE
- string.Empty, //NOXLATE
- "ApplicationDefinition", //NOXLATE
- };
-
- internal static string ResourceName(ResourceTypes type)
- {
- return ResourceName(type, false);
- }
-
- internal static string ResourceName(ResourceTypes type, bool prefixWithDot)
- {
- if (type == ResourceTypes.Folder || !prefixWithDot)
- return ResourceTypeNames[(int)type];
- else
- return "." + ResourceTypeNames[(int)type]; //NOXLATE
- }
- }
-
/// <summary>
/// Flags that can be used for the QueryMapFeatures operation
/// </summary>
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ExtensionMethods.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ExtensionMethods.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/ExtensionMethods.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -36,6 +36,29 @@
{
public static class ExtensionMethods
{
+ /// <summary>
+ /// Generates the session resource id.
+ /// </summary>
+ /// <param name="conn">The conn.</param>
+ /// <param name="resType">Type of the res.</param>
+ /// <returns></returns>
+ public static string GenerateSessionResourceId(this IServerConnection conn, string resType)
+ {
+ Guid id = Guid.NewGuid();
+ return conn.GenerateSessionResourceId(id.ToString(), resType);
+ }
+
+ /// <summary>
+ /// Generates the session resource id.
+ /// </summary>
+ /// <param name="conn">The conn.</param>
+ /// <param name="name">The name.</param>
+ /// <param name="resType">Type of the res.</param>
+ /// <returns></returns>
+ public static string GenerateSessionResourceId(this IServerConnection conn, string name, string resType)
+ {
+ return "Session:" + conn.SessionID + "//" + name + "." + resType; //NOXLATE
+ }
}
}
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/IServerConnection.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -253,34 +253,4 @@
this.Data = data;
}
}
-
- /// <summary>
- /// Extension method class
- /// </summary>
- public static class ConnectionExtensionMethods
- {
- /// <summary>
- /// Generates the session resource id.
- /// </summary>
- /// <param name="conn">The conn.</param>
- /// <param name="resType">Type of the res.</param>
- /// <returns></returns>
- public static string GenerateSessionResourceId(this IServerConnection conn, string resType)
- {
- Guid id = Guid.NewGuid();
- return conn.GenerateSessionResourceId(id.ToString(), resType);
- }
-
- /// <summary>
- /// Generates the session resource id.
- /// </summary>
- /// <param name="conn">The conn.</param>
- /// <param name="name">The name.</param>
- /// <param name="resType">Type of the res.</param>
- /// <returns></returns>
- public static string GenerateSessionResourceId(this IServerConnection conn, string name, string resType)
- {
- return "Session:" + conn.SessionID + "//" + name + "." + resType; //NOXLATE
- }
- }
}
\ No newline at end of file
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/OSGeo.MapGuide.MaestroAPI.csproj 2014-12-29 16:35:04 UTC (rev 8486)
@@ -79,7 +79,6 @@
<Link>SignedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ArgumentParser.cs" />
- <Compile Include="BindingListExtensions.cs" />
<Compile Include="Capability\NsDoc.cs" />
<Compile Include="Commands\CreateRuntimeMap.cs" />
<Compile Include="Commands\DescribeRuntimeMap.cs" />
@@ -132,7 +131,6 @@
<Compile Include="Feature\ReaderBase.cs" />
<Compile Include="Feature\RecordBase.cs" />
<Compile Include="Internal\FixedWKTReader.cs" />
- <Compile Include="IO\NsDoc.cs" />
<Compile Include="Mapping\Collections.cs" />
<Compile Include="Mapping\NsDoc.cs" />
<Compile Include="CsHelper.cs" />
@@ -165,7 +163,6 @@
<Compile Include="Schema\RasterPropertyDefinition.cs" />
<Compile Include="Schema\SchemaElement.cs" />
<Compile Include="IConnectionCapabilities.cs" />
- <Compile Include="IO\ReadOnlyRewindableStream.cs" />
<Compile Include="MaestroApiProviderAttribute.cs" />
<Compile Include="ConnectionProviderRegistry.cs" />
<Compile Include="CoordinateSystem\CoordinateSystem.cs" />
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -22,10 +22,10 @@
using GeoAPI.Geometries;
using OSGeo.MapGuide.MaestroAPI.CoordinateSystem;
-using OSGeo.MapGuide.MaestroAPI.IO;
using OSGeo.MapGuide.MaestroAPI.Schema;
using OSGeo.MapGuide.MaestroAPI.Services;
using OSGeo.MapGuide.ObjectModels;
+using OSGeo.MapGuide.ObjectModels.IO;
using OSGeo.MapGuide.ObjectModels.ApplicationDefinition;
using OSGeo.MapGuide.ObjectModels.Capabilities;
using OSGeo.MapGuide.ObjectModels.Capabilities.v1_0_0;
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -43,6 +43,7 @@
using System.Diagnostics;
using System.Drawing;
using System.IO;
+using System.Linq;
using System.Net;
using System.Text;
using System.Xml;
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Local/LocalConnection.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -41,6 +41,7 @@
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
+using System.Linq;
using System.Text;
namespace OSGeo.MapGuide.MaestroAPI.Local
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/LocalNativeConnection.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -39,6 +39,7 @@
using System.Drawing;
using System.Globalization;
using System.IO;
+using System.Linq;
using System.Text;
namespace OSGeo.MapGuide.MaestroAPI.Native
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Native/MgReadOnlyStream.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -20,7 +20,7 @@
#endregion Disclaimer / License
-using OSGeo.MapGuide.MaestroAPI.IO;
+using OSGeo.MapGuide.ObjectModels.IO;
using System;
namespace OSGeo.MapGuide.MaestroAPI.Native
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/IO/Utf8XmlWriter.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/IO/Utf8XmlWriter.cs 2014-12-29 16:18:37 UTC (rev 8485)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.ObjectModels/IO/Utf8XmlWriter.cs 2014-12-29 16:35:04 UTC (rev 8486)
@@ -30,7 +30,7 @@
/// <summary>
/// Overrides the default XmlWriter, to ensure that the Xml is Utf8 and with whitespaces, as the MapGuide server requires Utf8
/// </summary>
- public class Utf8XmlWriter : System.Xml.XmlTextWriter
+ internal class Utf8XmlWriter : System.Xml.XmlTextWriter
{
/// <summary>
/// Initializes a new instance of the <see cref="Utf8XmlWriter"/> class.
More information about the mapguide-commits
mailing list