亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? jscompressor.cs

?? 用JavaScript做的文件壓縮文件
?? CS
字號(hào):
namespace com.sarmal.scriptutil.text.compress.js
{
	using System;
	using System.IO;
	using System.Text;
	using System.Text.RegularExpressions;
	using System.Collections;

	using com.sarmal.scriptutil.constant;

	/// <summary>
	///		<disclaimer>2003-2005 (C) - sarmal.com - http://www.sarmal.com </disclaimer>
	///		<meta-data>
	///			<version>1.0.3</version>
	///			<author>
	///				<name>Volkan 謟鏴lik</name>
	///				<e-mail>volkan@sarmal.com</e-mail>
	///			</author>
	///		</meta-data>
	///		<description>
	///			<p>This class is used to compress a JavaScript file to a single
	///			line.</p>
	///		
	///			<p>To make life easier on my side I have not implemented
	///			several issues. So please note them before using this
	///			class:</p>
	///			
	///			<ul>
	///			<li>You need to terminate your statements with a semi column (;)
	///			Normally it is optional in js. However the Compressor assumes a (;)
	///			at the end of each statement. If not the compressed code will generate
	///			JavaScript errors.</li>
	///			</ul>
	///		
	///		</description>
	/// </summary>
	public class JSCompressor:CodeCompressor
	{
		/// <summary>
		/// remove C-style comments and multi-line comments.
		/// </summary>
		private bool removeComments = true;
		
		/// <summary>
		/// trim lines and remove multiple blank lines.
		/// </summary>
		private bool removeAndTrimBlankLines = true;
		
		/// <summary>
		/// remove all CRLF characters.
		/// </summary>
		private bool removeCarriageReturns = true;
		
		/// <summary>
		/// skim the rest of the code.
		/// </summary>
		private bool removeEverthingElse = true;
		
		/// <summary>
		/// Matches /* c-style comments. 
		/// */
		/// </summary>
		private Regex regCStyleComment;

		/// <summary>
		/// Matches //line comments.
		/// </summary>
		private Regex regLineComment;

		/// <summary>
		/// Matches any white space including CRLF at the end of line.
		/// </summary>
		private Regex regSpaceLeft;
		
		/// <summary>
		/// Matches any whitespace at the beginning of the line.
		/// </summary>
		private Regex regSpaceRight;

		/// <summary>
		/// Matches any space-tab combination.
		/// </summary>
		private Regex regWhiteSpaceExceptCRLF;

		/// <summary>
		/// Quotes and regular expressions.
		/// </summary>
		private Regex regSpecialElement;

		/// <summary>
		/// Matches opening curly brace "{".
		/// </summary>
		private Regex regLeftCurlyBrace;

		/// <summary>
		/// Matches closing curly brace "}".
		/// </summary>
		private Regex regRightCurlyBrace;
	
		/// <summary>
		/// Matches a comma surrounded by whitespace characters.
		/// </summary>
		private Regex regComma;	

		/// <summary>
		/// Matches a semi-column surrounded by whitespace characters.
		/// </summary>
		private Regex regSemiColumn;

		/// <summary>
		/// Matches CRLF characters.
		/// </summary>
		private Regex regNewLine;

		private Regex regCarriageAfterKeyword;
		
		/// <summary>
		/// Hashtable to store the captured special elements.
		/// </summary>
		private Hashtable htCaptureFields;

		/// <summary>
		/// Hashtable to store pre-compiled regular expressions for special elements.
		/// </summary>
		private Hashtable htRegSpecialElement;
	
		/// <summary>
		/// The total number of special elements captured.
		/// </summary>
		private int specialItemCount;

		/// <summary>
		/// If <code>true</code> comments will be removed.
		/// Default value is <code>true</code>.
		/// </summary>
		public bool RemoveComments {
			set {
				removeComments = value;
			}
		}

		/// <summary>
		/// If <code>true</code> lines will be trimmed and multiple blank
		/// new lines will be removed.
		/// Default value is <code>true</code>.
		/// </summary>
		public bool TrimLines {
			set {
				removeAndTrimBlankLines = value;
			}
		}

		/// <summary>
		/// If <code>true</code> all CRLF characters will be removed.
		/// Default value is <code>true</code>.
		/// </summary>
		public bool RemoveCRLF {
			set {
				removeCarriageReturns = value;
			}
		}

		/// <summary>
		/// If <code>true</code> some additional compression will be done.
		/// Default value is <code>true</code>.
		/// </summary>
		public bool RemoveEverthingElse {
			set {
				removeEverthingElse = value;
			}
		}

		/// <summary>
		/// Constructor
		/// </summary>
		public JSCompressor() {
			/* initialize members */

			regCStyleComment = new Regex("/\\*.*?\\*/",RegexOptions.Compiled|RegexOptions.Singleline);
			regLineComment = new Regex("//.*\r\n",RegexOptions.Compiled|RegexOptions.ECMAScript);
			regSpaceLeft = new Regex("^\\s*",RegexOptions.Compiled|RegexOptions.Multiline);
			regSpaceRight = new Regex("\\s*\\r\\n",RegexOptions.Compiled|RegexOptions.ECMAScript);
			regWhiteSpaceExceptCRLF = new Regex("[ \\t]+",RegexOptions.Compiled|RegexOptions.ECMAScript);
			regSpecialElement = new Regex(
				"\"[^\"\\r\\n]*\"|'[^'\\r\\n]*'|/[^/\\*](?<![/\\S]/.)([^/\\\\\\r\\n]|\\\\.)*/(?=[ig]{0,2}[^\\S])",
				RegexOptions.Compiled|RegexOptions.Multiline);
			regLeftCurlyBrace = new Regex("\\s*{\\s*",RegexOptions.Compiled|RegexOptions.ECMAScript);
			regRightCurlyBrace = new Regex("\\s*}\\s*",RegexOptions.Compiled|RegexOptions.ECMAScript);
			regComma = new Regex("\\s*,\\s*",RegexOptions.Compiled|RegexOptions.ECMAScript);
			regSemiColumn = new Regex("\\s*;\\s*",RegexOptions.Compiled|RegexOptions.ECMAScript);
			regNewLine = new Regex("\\r\\n",RegexOptions.Compiled|RegexOptions.ECMAScript);

			regCarriageAfterKeyword = new Regex(
				"\\r\\n(?<=\\b(abstract|boolean|break|byte|case|catch|char|class|const|continue|default|delete|do|double|else|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|var|void|while|with)\\r\\n)",
				RegexOptions.Compiled|RegexOptions.ECMAScript);

			htCaptureFields = new Hashtable();
			htRegSpecialElement = new Hashtable();
			
			specialItemCount = 0;
		}

		/// <summary>
		/// Compresses the given String.
		/// </summary>
		/// <param name="toBeCompressed">The String to be compressed.</param>
		public void Compress(ref String toBeCompressed) {
			/*clean the hasthable*/
			htCaptureFields.Clear();
			htRegSpecialElement.Clear();
			specialItemCount = 0;


			
			/* mark special elements */
			MarkQuotesAndRegExps(ref toBeCompressed);
			
			if(removeComments) {
				/* remove line comments */
				RemoveLineComments(ref toBeCompressed);
				/* remove C Style comments */
				RemoveCStyleComments(ref toBeCompressed);
			}
			
			if(removeAndTrimBlankLines) {
				/* trim left */
				TrimLinesLeft(ref toBeCompressed);
				/* trim right */
				TrimLinesRight(ref toBeCompressed);
			}

			if(removeEverthingElse) {
				/* { */
				ReplaceLeftCurlyBrace(ref toBeCompressed);
				/* } */
				ReplaceRightCurlyBrace(ref toBeCompressed);
				/* , */
				ReplaceComma(ref toBeCompressed);
				/* ; */
				ReplaceSemiColumn(ref toBeCompressed);		
			}
			
			if(removeCarriageReturns) {			
				/* 
				 * else[CRLF]
				 * return
				 */
				ReplaceCarriageAfterKeyword(ref toBeCompressed);
				/* clear all CRLF's */
				ReplaceNewLine(ref toBeCompressed);
			}

			/* restore the formerly stored elements. */
			RestoreQuotesAndRegExps(ref toBeCompressed);
			
			StringBuilder buffer = new StringBuilder();

			buffer.Append(
// This part is for my API, so commented out for the CodeProject version.
//				"/* Copyright   : 2003-2005 (C) Volkan Ozcelik (volkan@sarmal.com)\r\n"+
//				" * Terms of use: This file (s@rdalya API) is distributed under CC license.\r\n"+
//				" *               see http://ww.sarmal.com/sardalya/Terms.aspx for details.\r\n"+
//				" *//*Code Compressed with JS Code Compressor v.1.0.3 - http://www.sarmal.com/*/"
				" /*Code Compressed with JS Code Compressor v.1.0.3 - http://www.sarmal.com/*/"
			);

			buffer.Append(toBeCompressed);
			toBeCompressed = buffer.ToString();
		}

		/// <summary>
		/// Reads the text file on sourcePath, and creates a file with compressed
		/// content on the destinationPath.
		/// </summary>
		/// <param name="sourcePath">The fully qualified path to the file to read.</param>
		/// <param name="destinationPath">The fully qualified path to the file to write.</param>
		public void Compress(String sourcePath, String destinationPath) {
			/* 
			 * Localization is always an issue if you are non-English. 
			 * System.Text.Encoding class helps sort out this problem.
			 */
			Encoding locale = System.Text.Encoding.GetEncoding(Constant.CODEPAGE);

			StreamReader sr = new StreamReader(sourcePath,locale);
			
			String strCompress = sr.ReadToEnd();
			sr.Close();

			Compress(ref strCompress);

			StreamWriter sw = new StreamWriter(destinationPath, false, locale);

			sw.Write(strCompress);
			sw.Close();
		}

		/// <summary>
		/// Replaces the stored special elements back to their places.
		/// </summary>
		/// <param name="input">The input String to process.</param>
		private void RestoreQuotesAndRegExps(ref String input) {
			int captureCount = htCaptureFields.Count;
			for(int i=0;i<captureCount;i++) {
				input = ((Regex) htRegSpecialElement[i]).Replace(input,(String)htCaptureFields[i]);
			}
		}

		/// <summary>
		/// Quotes and regular expressions should be untouched and unprocessed at all times.
		/// So we mark and store them beforehand in a private Hashtable for later use.
		/// </summary>
		/// <param name="input">The input String to process. It should be a single line.</param>
		private void MarkQuotesAndRegExps(ref String input) {
			MatchCollection matches = regSpecialElement.Matches(input);

			int count=matches.Count;
			Match currentMatch;
			
			/* store strings and regular expressions */
			for(int i=0;i<count;i++) {
				currentMatch = matches[i];
				htCaptureFields.Add(specialItemCount,currentMatch.Value);
				/* we added one more special item to our Hashtable */
				specialItemCount++;
			}

			/* replace strings and regular expressions */
			for(int i=0;i<count;i++) {
				/* 
				 * compile and add the Regex to the hashtable
				 * so that it executes faster at the Restore phase.
				 *
				 * A trade off between Regex compilation speed and 
				 * memory. 
				 */
				htRegSpecialElement.Add (i,new Regex("____SPECIAL_ELEMENT____"+(i)+"____",
					RegexOptions.ECMAScript|RegexOptions.Compiled));
				
				input = regSpecialElement.Replace(input,"____SPECIAL_ELEMENT____"+(i)+"____",1);
			}
		}

		/// <summary>
		/// Removes any multi-line single line /* c style comments */
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void RemoveCStyleComments(ref String input) {
			input = regCStyleComment.Replace(input,"");
		}

		/// <summary>
		/// Removes all \\line comments.
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void RemoveLineComments(ref String input) {
			input = regLineComment.Replace(input,"");
		}
		
		/// <summary>
		/// Replaces any duplicate space-tab combinations with a single space.
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void ReplaceDuplicateWhiteSpace(ref String input) {
			input = regWhiteSpaceExceptCRLF.Replace(input," ");
		}

		/// <summary>
		/// Trims all the trailing whitespace characters in a line with "".
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void TrimLinesLeft(ref String input) {
			input = regSpaceLeft.Replace(input,"");
		}

		/// <summary>
		/// Trims all whitespace after the end of the line, and the proceeding CRLF characters
		/// with a single CRLF.
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void TrimLinesRight(ref String input) {
			input = regSpaceRight.Replace(input,"\r\n");
		}

		/// <summary>
		/// Replaces any whitespace before and after "{" characters with "".
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void ReplaceLeftCurlyBrace(ref String input) {
			input = regLeftCurlyBrace.Replace(input,"{");
		}

		/// <summary>
		/// Replaces any whitespace before and after "}" characters with "".
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void ReplaceRightCurlyBrace(ref String input) {
			input = regRightCurlyBrace.Replace(input,"}");
		}

		private void ReplaceCarriageAfterKeyword(ref String input) {
			input = regCarriageAfterKeyword.Replace(input," ");
		}
		
		/// <summary>
		/// Replaces any whitespace before and after "," characters with "".
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void ReplaceComma(ref String input) {
			input = regComma.Replace(input,",");
		}

		/// <summary>
		/// Replaces any whitespace before and after ";" characters with "".
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void ReplaceSemiColumn(ref String input) {
			input = regSemiColumn.Replace(input,";");
		}

		/// <summary>
		/// Replaces all CRLF characters in the input to "".
		/// </summary>
		/// <param name="input">The input String to replace.</param>
		private void ReplaceNewLine(ref String input) {
			input = regNewLine.Replace(input,"");
		}
	}//class
}//namespace

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲精品在线观看| 国产日产欧美一区二区视频| 欧美xxxx老人做受| 成人免费一区二区三区视频| 美洲天堂一区二卡三卡四卡视频| 成人成人成人在线视频| 欧美浪妇xxxx高跟鞋交| 亚洲欧洲精品一区二区三区不卡| 麻豆传媒一区二区三区| 欧美视频你懂的| 亚洲国产精品国自产拍av| 日本欧美肥老太交大片| 在线观看三级视频欧美| 麻豆91在线播放免费| 欧美亚洲愉拍一区二区| 国产精品久久久一本精品 | 日本不卡一区二区| 91成人免费电影| 国产精品久久久久影视| 国产寡妇亲子伦一区二区| 日韩欧美在线观看一区二区三区| 亚洲国产人成综合网站| 99久久亚洲一区二区三区青草| 久久亚洲综合色| 紧缚奴在线一区二区三区| 欧美一区二区三区性视频| 午夜精品福利在线| 欧美三级午夜理伦三级中视频| 亚洲三级在线免费观看| 91同城在线观看| 中文字幕日本不卡| 成人app网站| ...av二区三区久久精品| 成人av中文字幕| 综合av第一页| 91成人免费电影| 污片在线观看一区二区| 正在播放亚洲一区| 蜜臀av一级做a爰片久久| 日韩精品一区二区三区四区| 久久精品二区亚洲w码| 精品乱人伦小说| 国产成人av电影在线播放| 国产欧美日韩在线视频| 9久草视频在线视频精品| 国产精品久久看| 91国产视频在线观看| 天天操天天干天天综合网| 3d动漫精品啪啪1区2区免费| 久久不见久久见免费视频7| 精品日韩一区二区三区| 成人一区二区三区| 一区二区高清视频在线观看| 欧美三级一区二区| 久久99国产精品久久99| 国产精品视频在线看| 91麻豆swag| 美女久久久精品| 国产精品久久久久婷婷| 欧美男男青年gay1069videost | 国产精品欧美一区喷水| 色婷婷久久99综合精品jk白丝| 亚洲午夜av在线| www国产亚洲精品久久麻豆| gogo大胆日本视频一区| 亚洲无人区一区| 久久午夜电影网| 在线免费精品视频| 国产一区视频导航| 亚洲最大的成人av| 精品少妇一区二区三区| 91婷婷韩国欧美一区二区| 欧美群妇大交群中文字幕| 国产乱码精品一区二区三区忘忧草| 亚洲欧洲性图库| 欧美精品一区二区三区在线| 91免费在线看| 国产精品一区一区| 午夜免费久久看| 国产精品美女久久久久久久久久久| 欧美日韩国产区一| 成人91在线观看| 久久激五月天综合精品| 亚洲人精品午夜| 久久精品一区二区三区四区| 欧美日韩在线不卡| heyzo一本久久综合| 国模一区二区三区白浆| 天天操天天色综合| 亚洲欧美激情小说另类| 国产亚洲自拍一区| 精品理论电影在线| 8v天堂国产在线一区二区| 色悠悠亚洲一区二区| 成人深夜福利app| 国产伦精品一区二区三区免费| 亚洲高清免费观看高清完整版在线观看| 国产女人18水真多18精品一级做 | 成人av网在线| 国产精品白丝av| 久久国产剧场电影| 日韩av在线免费观看不卡| 一区二区三区精品在线观看| 国产精品久久毛片a| 欧美国产丝袜视频| 久久九九久精品国产免费直播| 欧美一区二区观看视频| 欧美精品久久久久久久多人混战| 色天天综合色天天久久| 91一区二区在线观看| 91一区二区三区在线播放| 成人黄色免费短视频| 国产成人亚洲综合a∨婷婷| 国产在线乱码一区二区三区| 极品少妇xxxx精品少妇偷拍| 国内精品视频一区二区三区八戒 | 国产成人日日夜夜| 国产精品影音先锋| 国产成人精品免费| 成人免费视频视频在线观看免费| 成人在线综合网| av电影在线不卡| 色婷婷综合久色| 欧美日韩国产免费一区二区 | 日韩一区二区三区视频在线观看 | 日日欢夜夜爽一区| 天天色 色综合| 久久av资源网| 国产精品99久久久久久宅男| 成人毛片老司机大片| 91农村精品一区二区在线| 欧美日韩综合在线免费观看| 91精品国产麻豆| 久久久久久日产精品| 国产精品福利影院| 亚洲五月六月丁香激情| 青青青伊人色综合久久| 国产精品白丝av| 91欧美一区二区| 欧美日韩一级片网站| 日韩女优毛片在线| 国产精品免费人成网站| 一区二区成人在线| 精品中文字幕一区二区| 成人免费不卡视频| 欧美日韩夫妻久久| 国产欧美日韩综合| 亚洲1区2区3区视频| 国产一区二区三区蝌蚪| 色综合久久天天| 日韩视频国产视频| 中文字幕日韩av资源站| 蜜桃一区二区三区在线观看| 处破女av一区二区| 91精品国产aⅴ一区二区| 国产欧美一区二区三区沐欲| 亚洲午夜激情网站| 国产福利不卡视频| 欧美日韩国产免费一区二区| 久久精品人人爽人人爽| 亚洲黄色片在线观看| 国模娜娜一区二区三区| 在线视频你懂得一区| 国产婷婷色一区二区三区 | 欧美无砖专区一中文字| 精品国产免费一区二区三区四区| 亚洲欧美二区三区| 国产精品综合网| 欧美一区日韩一区| 一区二区三区在线免费| 国产suv精品一区二区6| 欧美一区午夜视频在线观看| 中文字幕一区三区| 国产曰批免费观看久久久| 欧美色图天堂网| 亚洲欧美日韩电影| 国产不卡视频在线观看| 精品久久久久久综合日本欧美| 亚洲一区二区欧美日韩| av一区二区三区四区| 国产欧美日韩激情| 国产永久精品大片wwwapp| 日韩欧美中文一区二区| 亚洲成a人片在线不卡一二三区| av成人动漫在线观看| 国产欧美一区视频| 国产精品性做久久久久久| 欧美成人精品1314www| 欧美a级理论片| 3751色影院一区二区三区| 亚洲一区av在线| 色女孩综合影院| 国产精品久久久爽爽爽麻豆色哟哟 | 在线影视一区二区三区| 亚洲欧美另类久久久精品| 不卡的av网站| 国产精品初高中害羞小美女文| 成人美女在线观看| 亚洲欧洲日产国码二区| av午夜精品一区二区三区|