Skip to content

Commit

Permalink
.NET 1.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelschwarz committed Apr 24, 2007
1 parent 46cd938 commit f9b73b3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
23 changes: 19 additions & 4 deletions AjaxPro/Handler/TypeJavaScriptHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
using System.IO;
using System.Security.Permissions;
using System.Web.Security;
#if(NET20)
using System.Collections.Generic;
#endif

namespace AjaxPro
{
Expand Down Expand Up @@ -168,10 +170,15 @@ public void ProcessRequest(HttpContext context)

// find all methods that are able to be used with AjaxPro

MethodInfo[] mi = type.GetMethods();
MethodInfo method;
#if(NET20)
List<MethodInfo> methods = new List<MethodInfo>();
MethodInfo[] mi = type.GetMethods();

#else
MethodInfo[] methods = new MethodInfo[mi.Length]; // maximum length
int mc = 0;
#endif

for (int y = 0; y < mi.Length; y++)
{
method = mi[y];
Expand All @@ -190,8 +197,8 @@ public void ProcessRequest(HttpContext context)
bool permissionDenied = true;
for (int p = 0; p < ppa.Length && permissionDenied; p++)
{
#if(NET20)
if (1 == 2 && Roles.Enabled)
#if(_____NET20)
if (Roles.Enabled)
{
try
{
Expand All @@ -217,7 +224,11 @@ public void ProcessRequest(HttpContext context)
continue;
}

#if(NET20)
methods.Add(method);
#else
methods[mc++] = method;
#endif
}


Expand Down Expand Up @@ -249,7 +260,11 @@ public void ProcessRequest(HttpContext context)

jsp.RenderNamespace();
jsp.RenderClassBegin();
#if(NET20)
jsp.RenderMethods(methods.ToArray());
#else
jsp.RenderMethods(methods);
#endif
jsp.RenderClassEnd();

context.Response.Write(sb.ToString());
Expand Down
13 changes: 7 additions & 6 deletions AjaxPro/Handler/TypeJavaScriptProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
#if(NET20)
using System.Collections.Generic;
#endif

namespace AjaxPro
{
Expand Down Expand Up @@ -151,15 +153,14 @@ public virtual void RenderClassEnd()
sb.Append("_class();\r\n");
}

public virtual void RenderMethods(List<MethodInfo> methods)
public virtual void RenderMethods(MethodInfo[] methods)
{
for(int i=0; i<methods.Count; i++)
for(int i=0; i<methods.Length; i++)
{
MethodInfo method = methods[i];
string methodName = GetClientMethodName(method);
ParameterInfo[] pi = method.GetParameters();


sb.Append("\t");
sb.Append(methodName);
sb.Append(": function(");
Expand Down Expand Up @@ -210,11 +211,11 @@ public override void RenderClassEnd()

}

public override void RenderMethods(List<MethodInfo> methods)
public override void RenderMethods(MethodInfo[] methods)
{
string clientNS = GetClientNamespace();

for (int i = 0; i < methods.Count; i++)
for (int i = 0; i < methods.Length; i++)
{
MethodInfo method = methods[i];
string methodName = GetClientMethodName(method);
Expand Down

0 comments on commit f9b73b3

Please sign in to comment.