当前位置: 首页>>代码示例>>C#>>正文


C# StringBuilder.str方法代码示例

本文整理汇总了C#中StringBuilder.str方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.str方法的具体用法?C# StringBuilder.str怎么用?C# StringBuilder.str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringBuilder的用法示例。


在下文中一共展示了StringBuilder.str方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetRuntime

		public static IClrRuntimeInfo GetRuntime(IEnumUnknown runtimes, String version)
		{			
		    Object[] temparr = new Object[3];
		    UInt32 fetchedNum;
		    do
		    {			    	
		        runtimes.Next(Convert.ToUInt32(temparr.Length), temparr, out fetchedNum);
		
		        for (Int32 i = 0; i < fetchedNum; i++)
		        {
		            IClrRuntimeInfo t = (IClrRuntimeInfo)temparr[i];
		
		            // version not specified we return the first one
		            if (String.IsNullOrEmpty(version))
		            {
		                return t;
		            }
		
		            // initialize buffer for the runtime version string
		            StringBuilder sb = new StringBuilder(16);
		            UInt32 len = Convert.ToUInt32(sb.Capacity);
		            t.GetVersionString(sb, ref len);
		            "version: {0}".info(sb.str());
		            if (sb.ToString().StartsWith(version, StringComparison.Ordinal))
		            {
		                return t;
		            }
		        }
		    } while (fetchedNum == temparr.Length);
		
		    return null;
		}	
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:32,代码来源:API_CLR.cs

示例2: errors_Details

 public static string errors_Details(this SyntaxTree tree)
 {
     var details = new StringBuilder();
     foreach (var error in tree.errors())
         details.AppendLine(error.str());
     return details.str();
 }
开发者ID:njmube,项目名称:FluentSharp,代码行数:7,代码来源:API_Roslyn_ExtensionMethods_Trees.cs

示例3: GetControlText

		public static string GetControlText(IntPtr hwnd)
		{			
			var size =  (int)WinAPI.SendMessage(hwnd,  WinAPI.WM_GETTEXTLENGTH, 0, 0 );
			if (size > 0)
			{			
				var text = new StringBuilder(size + 1);				 				
				WinAPI.SendMessage(hwnd,( int)WinAPI.WM_GETTEXT, text.Capacity, text);
				return text.str();
			}
			return null;
		}
开发者ID:paul-green,项目名称:O2.Platform.Scripts,代码行数:11,代码来源:Win32_Helper_Methods.cs

示例4: console_Run_GetConsoleOut

 	public static string console_Run_GetConsoleOut(this API_NUnit nUnitApi, string projectOrAssembly, string extraStartupOptions)
 	{
 		var consoleOut = new StringBuilder();
 		nUnitApi.console_Run(projectOrAssembly, extraStartupOptions, (line) => consoleOut.AppendLine(line.info()))  
 				.WaitForExit();
 		return consoleOut.str();    	
 	}
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:7,代码来源:API_NUnit.cs

示例5: hash_SHA256

 public static string hash_SHA256(this string text, string salt)
 {
     var stringToHash = text + salt;
     var sha256 = SHA256.Create();
     var hashBytes = sha256.ComputeHash(stringToHash.asciiBytes());
     var hashString = new StringBuilder();
     foreach (byte b in hashBytes)
         hashString.Append(b.ToString("x2"));
     return hashString.str();
 }
开发者ID:roman87,项目名称:Dev,代码行数:10,代码来源:Crypto.cs

示例6: DoHttpProcessing

        private void DoHttpProcessing(TcpClient client)
        {      
        	var threadId = Thread.CurrentThread.ManagedThreadId;
        	if (ProxyDisabled)
        	{
        		"[DoHttpProcessing]: ProxyDisabled is set, aborting request".error();
        		return;
        	}
        	
            Stream clientStream = client.GetStream();
            Stream outStream = clientStream; //use this stream for writing out - may change if we use ssl
            SslStream sslStream = null;
            StreamReader clientStreamReader = new StreamReader(clientStream);
            
            MemoryStream cacheStream = null;			
            
            try
            {
            	HttpWebRequest webReq = null;
                HttpWebResponse response = null;
                var rawRequestHeaders = new StringBuilder();
                var rawResponseHeaders = new StringBuilder();
                byte[] requestPostBytes = null;                                								                              
                var contentLen = 0;
                var skipRemaingSteps = false; 
                
                //read the first line HTTP command
                String httpCmd = clientStreamReader.ReadLine();
                if (String.IsNullOrEmpty(httpCmd))
                {
                    clientStreamReader.Close();
                    clientStream.Close();
                    return;
                }
                //break up the line into three components
                String[] splitBuffer = httpCmd.Split(spaceSplit, 3);

                String method = splitBuffer[0];
                String remoteUri = splitBuffer[1];
                Version version = new Version(1, 0);

                ExtraLogging.ifDebug("[{2}][DoHttpProcessing]: Got request for: {0} {1} [{2}]", method, remoteUri, threadId);
                
                Action handleSLL_CONNECT_withCaller = 
                	()=>{
                			if (skipRemaingSteps)
								return;
																						
			                if (splitBuffer[0].ToUpper() == "CONNECT")
			                {
			                	ExtraLogging.ifInfo("[{1}][DoHttpProcessing][handleSLL_CONNECT_withCaller] {0} [{1}]", remoteUri, threadId);
			                    //Browser wants to create a secure tunnel
			                    //instead = we are going to perform a man in the middle "attack"
			                    //the user's browser should warn them of the certification errors however.
			                    //Please note: THIS IS ONLY FOR TESTING PURPOSES - you are responsible for the use of this code
			                    remoteUri = "https://" + splitBuffer[1];
			                    
			                    ExtraLogging.ifInfo("[{1}][DoHttpProcessing][handleSLL_CONNECT_withCaller] updated remoteUri {0}, [{1}]", remoteUri, threadId);
			                    
			                    while (!String.IsNullOrEmpty(clientStreamReader.ReadLine())) ;
			                    
			                    ExtraLogging.ifInfo("[{0}][DoHttpProcessing][handleSLL_CONNECT_withCaller] after clientStreamReader.ReadLine [{0}]", threadId);
			                    
			                    StreamWriter connectStreamWriter = new StreamWriter(clientStream);
			                    connectStreamWriter.WriteLine("HTTP/1.0 200 Connection established");
			                    connectStreamWriter.WriteLine(String.Format("Timestamp: {0}", DateTime.Now.ToString()));
			                    connectStreamWriter.WriteLine("Proxy-agent: O2 Platform Web Proxy");
			                    connectStreamWriter.WriteLine();
			                    			                    
			                    connectStreamWriter.Flush();
			        //            ExtraLogging.ifDebug("[{0}][DoHttpProcessing][handleSLL_CONNECT_withCaller] afterFlush [{0}]", threadId);
			                    //connectStreamWriter.Close();   //see if it has side effects with ssl sites
			                    //ExtraLogging.ifDebug("[DoHttpProcessing][handleSLL_CONNECT_withCaller] afterClose");
/*			                }
						};

				Action handleSLL_CONNECT_withRemote = 
                	()=>{
                	
                			if (skipRemaingSteps)
								return;							
*/							
//			                if (splitBuffer[0].ToUpper() == "CONNECT")
//			                {			                			
			                	//ExtraLogging.ifInfo("[DoHttpProcessing][handleSLL_CONNECT_withRemote] {0}", remoteUri);								
			                    
			                    try
			                    {
			                    	var keepStreamOpen = true;
			                    	var checkCertificateRevocation = true;
			                    	ExtraLogging.ifInfo("[{1}][DoHttpProcessing][handleSLL_CONNECT_withCaller] creating sslStream and AuthenticateAsServer {0} [{1}]", remoteUri, threadId);
			                    	//sslStream = new SslStream(clientStream, false);		//original
			                    	sslStream = new SslStream(clientStream, keepStreamOpen);
			                        //sslStream.AuthenticateAsServer(_certificate, false, SslProtocols.Tls | SslProtocols.Ssl3 | SslProtocols.Ssl2, true);   //original
			                        //sslStream.AuthenticateAsServer(_certificate, false, SslProtocols.Tls | SslProtocols.Ssl3 | SslProtocols.Ssl2, false);			                        
			                        sslStream.AuthenticateAsServer(_certificate, false, SslProtocols.Tls | SslProtocols.Ssl3 | SslProtocols.Ssl2, checkCertificateRevocation);			                        			                        
			                    }
			                    catch (Exception ex)
			                    {
			                    	skipRemaingSteps = true;			                        
//.........这里部分代码省略.........
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:101,代码来源:ProxyServer.cs

示例7: hexToAscii

 public static string hexToAscii(this List<string> hexNumbers)
 {
     var asciiString = new StringBuilder();
     foreach(var hexNumber in hexNumbers)
         asciiString.Append(hexNumber.hexToAscii());
     return asciiString.str();
 }
开发者ID:sempf,项目名称:FluentSharp,代码行数:7,代码来源:String_ExtensionMethods.cs

示例8: GetO2Logs

 public string GetO2Logs()
 {
     var logs = (PublicDI.log.LogRedirectionTarget as Logger_DiagnosticsDebug).LogData.str();
     var logData = new StringBuilder();
     foreach (var line in logs.lines())
     {
         var color = "black";
         if (line.starts("DEBUG:"))
             color = "green";
         else if (line.starts("ERROR:"))
             color = "red";
         logData.Append("<span style='color:{0}'>{1}<span><br/>".format(color, Server.HtmlEncode(line)));
     }
     return logData.str();
 }
开发者ID:pombredanne,项目名称:DotNet_ANSA,代码行数:15,代码来源:WebService.cs

示例9: hexString

 public static string hexString(this byte[] bytes)
 {
     if (bytes.isNull())
         return "";
     var stringBuilder = new StringBuilder();
     for (int i = 0; i < bytes.Length; i++)
         stringBuilder.Append(bytes[i].hex());
     return stringBuilder.str();
 }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:9,代码来源:Byte_ExtensionMethods.cs


注:本文中的StringBuilder.str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。