samplecryptprovider.cs.txt

来自「ajax是未来之星」· 文本 代码 · 共 73 行

TXT
73
字号
// *******************************************************************************************
//
// Ajax.NET Professional - The free AJAX implementation for the Microsoft.NET Framework
//
// Copyright (C) 2005 Michael Schwarz, info@schwarz-interactive.de
//
// *******************************************************************************************
using System;

namespace AjaxProSample
{
	public class SampleCryptProvider : AjaxPro.IAjaxCryptProvider
	{
		private AjaxPro.IAjaxKeyProvider _key = null;

		#region IAjaxCrypt Member

		public string Encrypt(string json)
		{
			char[] x = new char[json.Length];
			for(int i=0; i<json.Length; i++)
				x[json.Length -1 -i] = json[i];

			return new String(x);
		}

		public string Decrypt(string jsoncrypt)
		{
			return Encrypt(jsoncrypt);
		}

		public AjaxPro.IAjaxKeyProvider KeyProvider
		{
			set
			{
				_key = value;
			}
		}

		public string ClientScript
		{
			get
			{
				string s = @"

var __sampleCrypt = new Object();
__sampleCrypt.encrypt = function(data)
	{
		var d = [];
		for(var i=data.length -1; i>=0; i--)
			d.push(data.substr(i,1));

		return d.join("""");
	}
__sampleCrypt.decrypt = function(data)
	{
		return this.encrypt(data);
	}

AjaxPro.cryptProvider = __sampleCrypt;

";
				return s;
			}
		}

		#endregion

	}


}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?