本文整理汇总了C#中System.StringHelper类的典型用法代码示例。如果您正苦于以下问题:C# StringHelper类的具体用法?C# StringHelper怎么用?C# StringHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringHelper类属于System命名空间,在下文中一共展示了StringHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AppendExtraHeader
/// <summary>
/// Appends a new header to this request.
/// </summary>
/// <param name="name">The name of the header to append.</param>
/// <param name="value">The value of the header.</param>
public void AppendExtraHeader( string name, string value )
{
StringHelper nameStr = new StringHelper( name );
StringHelper valueStr = new StringHelper( value );
awe_resource_request_append_extra_header( instance, nameStr.Value, valueStr.Value );
}
开发者ID:Perikles,项目名称:AwesomiumSharp,代码行数:12,代码来源:ResourceRequest.cs
示例2: ResourceResponse
/// <summary>
/// Create a ResourceResponse from a byte array
/// </summary>
/// <param name="data">The data to be initialized from (a copy is made)</param>
/// <param name="mimeType">The mime-type of the data (for ex. "text/html")</param>
public ResourceResponse( byte[] data, string mimeType )
{
StringHelper mimeTypeStr = new StringHelper( mimeType );
IntPtr dataPtr = Marshal.AllocHGlobal( data.Length );
Marshal.Copy( data, 0, dataPtr, data.Length );
instance = awe_resource_response_create( (uint)data.Length, dataPtr, mimeTypeStr.Value );
Marshal.FreeHGlobal( dataPtr );
}
开发者ID:Perikles,项目名称:AwesomiumSharp,代码行数:16,代码来源:ResourceResponse.cs
示例3: StringHelper
public JSValue this[ string propertyName ]
{
get
{
StringHelper propertyNameStr = new StringHelper( propertyName );
return new JSValue( awe_jsobject_get_property( instance, propertyNameStr.Value ) );
}
set
{
StringHelper propertyNameStr = new StringHelper( propertyName );
awe_jsobject_set_property( instance, propertyNameStr.Value, value.Instance );
}
}
开发者ID:Perikles,项目名称:AwesomiumSharp,代码行数:13,代码来源:JSObject.cs
示例4: TestStringHelper_Reverse
public void TestStringHelper_Reverse()
{
// Create channel mock
Mock<IStringServiceChannel> channelMock = new Mock<IStringServiceChannel>(MockBehavior.Strict);
// setup the mock to expect the Reverse method
channelMock.Setup(c => c.ReverseStringAsync("abc")).Returns(Task.FromResult("cba"));
// create string helper and invoke the Reverse method
StringHelper sh = new StringHelper(channelMock.Object);
string result = sh.ReverseAsync("abc").Result;
Assert.AreEqual("cba", result);
//verify that the method was called on the mock
channelMock.Verify(c => c.ReverseStringAsync("abc"), Times.Once());
}
开发者ID:filipczaja,项目名称:BlogSamples,代码行数:16,代码来源:StringHelperTests.cs
示例5: TestFixtureSetup
public void TestFixtureSetup()
{
_stringHelper = new StringHelper(new StringComparison());
}
开发者ID:salimci,项目名称:Legacy-Remote-Recorder,代码行数:4,代码来源:StringHelperUnitTest.cs
示例6: FindNext
/// <summary>
/// Jump to the next match of a previously successful search.
/// </summary>
/// <param name="forward">
/// True to search forward, down the page. False otherwise. The default is true.
/// </param>
/// <exception cref="InvalidOperationException">
/// The member is called on an invalid <see cref="WebControl"/> instance
/// (see <see cref="UIElement.IsEnabled"/>).
/// </exception>
public void FindNext( bool forward = true )
{
VerifyLive();
if ( findRequest == null )
return;
StringHelper searchCStr = new StringHelper( findRequest.SearchText );
awe_webview_find( Instance, findRequest.RequestID, searchCStr.Value, forward, findRequest.CaseSensitive, true );
}
开发者ID:UIKit0,项目名称:AwesomiumSharp,代码行数:20,代码来源:WebControl.cs
示例7: TestStringHelper_Integration
public void TestStringHelper_Integration()
{
StringHelper sh = new StringHelper();
string result = sh.ReverseAsync("abc").Result;
Assert.AreEqual("cba", result);
}
开发者ID:filipczaja,项目名称:BlogSamples,代码行数:6,代码来源:StringHelperTests.cs
示例8: Find
/// <summary>
/// Start finding a certain string on the current web-page.
/// </summary>
/// <remarks>
/// All matches of the string will be highlighted on the page and you can jump to different
/// instances of the string by using the <see cref="FindNext"/> method.
/// To get actual stats about a certain query, please see <see cref="FindResultsReceived"/>.
/// </remarks>
/// <param name="searchStr">
/// The string to search for.
/// </param>
/// <param name="forward">
/// True to search forward, down the page. False otherwise. The default is true.
/// </param>
/// <param name="caseSensitive">
/// True to perform a case sensitive search. False otherwise. The default is false.
/// </param>
/// <exception cref="InvalidOperationException">
/// The member is called on an invalid <see cref="WebControl"/> instance
/// (see <see cref="UIElement.IsEnabled"/>).
/// </exception>
public void Find( string searchStr, bool forward = true, bool caseSensitive = false )
{
VerifyLive();
if ( findRequest != null )
{
StopFind( true );
}
findRequest = new FindData( findRequestRandomizer.Next(), searchStr, caseSensitive );
StringHelper searchCStr = new StringHelper( searchStr );
awe_webview_find( Instance, findRequest.RequestID, searchCStr.Value, forward, caseSensitive, false );
}
开发者ID:UIKit0,项目名称:AwesomiumSharp,代码行数:34,代码来源:WebControl.cs
示例9: HasProperty
public bool HasProperty( string propertyName )
{
StringHelper propertyNameStr = new StringHelper( propertyName );
return awe_jsobject_has_property( instance, propertyNameStr.Value );
}
开发者ID:Perikles,项目名称:AwesomiumSharp,代码行数:5,代码来源:JSObject.cs
示例10: SetCustomResponsePage
public static void SetCustomResponsePage(int statusCode, string filePath)
{
StringHelper filePathStr = new StringHelper(filePath);
awe_webcore_set_custom_response_page(statusCode, filePathStr.value());
}
开发者ID:Oceanswave,项目名称:AwesomiumSharp,代码行数:6,代码来源:WebCore.cs
示例11: GetCookies
public static String GetCookies(string url, bool excludeHttpOnly = true)
{
StringHelper urlStr = new StringHelper(url);
IntPtr temp = awe_webcore_get_cookies(urlStr.value(), excludeHttpOnly);
return StringHelper.ConvertAweString(temp);
}
开发者ID:Oceanswave,项目名称:AwesomiumSharp,代码行数:8,代码来源:WebCore.cs
示例12: ReadPrimitive
public static void ReadPrimitive(Stream stream, out string value)
{
uint totalBytes;
ReadPrimitive(stream, out totalBytes);
if (totalBytes == 0)
{
value = null;
return;
}
else if (totalBytes == 1)
{
value = string.Empty;
return;
}
totalBytes -= 1;
uint totalChars;
ReadPrimitive(stream, out totalChars);
var helper = s_stringHelper;
if (helper == null)
s_stringHelper = helper = new StringHelper();
var decoder = helper.Decoder;
var buf = helper.ByteBuffer;
char[] chars;
if (totalChars <= StringHelper.CHARBUFFERLEN)
chars = helper.CharBuffer;
else
chars = new char[totalChars];
int streamBytesLeft = (int)totalBytes;
int cp = 0;
while (streamBytesLeft > 0)
{
int bytesInBuffer = stream.Read(buf, 0, Math.Min(buf.Length, streamBytesLeft));
if (bytesInBuffer == 0)
throw new EndOfStreamException();
streamBytesLeft -= bytesInBuffer;
bool flush = streamBytesLeft == 0 ? true : false;
bool completed = false;
int p = 0;
while (completed == false)
{
int charsConverted;
int bytesConverted;
decoder.Convert(buf, p, bytesInBuffer - p,
chars, cp, (int)totalChars - cp,
flush,
out bytesConverted, out charsConverted, out completed);
p += bytesConverted;
cp += charsConverted;
}
}
value = new string(chars, 0, (int)totalChars);
}
开发者ID:benarinoam,项目名称:netserializer,代码行数:67,代码来源:Primitives.cs
示例13: Initialize
public static void Initialize(WebCore.Config config)
{
StringHelper userDataPathStr = new StringHelper(config.userDataPath);
StringHelper pluginPathStr = new StringHelper(config.pluginPath);
StringHelper logPathStr = new StringHelper(config.logPath);
StringHelper userAgentOverrideStr = new StringHelper(config.userAgentOverride);
StringHelper proxyServerStr = new StringHelper(config.proxyServer);
StringHelper proxyConfigScriptStr = new StringHelper(config.proxyConfigScript);
StringHelper customCSSStr = new StringHelper(config.customCSS);
awe_webcore_initialize(config.enablePlugins,
config.enableJavascript,
userDataPathStr.value(),
pluginPathStr.value(),
logPathStr.value(),
config.logLevel,
userAgentOverrideStr.value(),
proxyServerStr.value(),
proxyConfigScriptStr.value(),
config.saveCacheAndCookies,
config.maxCacheSize,
config.disableSameOriginPolicy,
customCSSStr.value());
activeWebViews = new List<Object>();
}
开发者ID:Oceanswave,项目名称:AwesomiumSharp,代码行数:26,代码来源:WebCore.cs
示例14: ContentChanged
void ContentChanged(Control ctrl)
{
LP_Temple lp = (LP_Temple)ctrl.Tag;
string str = ctrl.Text;
if (dsoFramerWordControl1.MyExcel == null)
{
return;
}
Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
Excel.Worksheet sheet;
ExcelAccess ea = new ExcelAccess();
ea.MyWorkBook = wb;
ea.MyExcel = wb.Application;
if (lp.KindTable != "")
{
activeSheetName = lp.KindTable;
sheet = wb.Application.Sheets[lp.KindTable] as Excel.Worksheet;
activeSheetIndex = sheet.Index;
}
else
{
sheet = wb.Application.Sheets[1] as Excel.Worksheet;
activeSheetIndex = sheet.Index;
activeSheetName = sheet.Name;
}
ea.ActiveSheet(activeSheetIndex);
unLockExcel(wb, sheet);
if (lp.CtrlType.Contains("uc_gridcontrol"))
{ FillTable(ea, lp, (ctrl as uc_gridcontrol).GetContent(String2Int(lp.WordCount.Split(pchar)))); return; }
else if (lp.CtrlType.Contains("DevExpress.XtraEditors.DateEdit"))
{
FillTime(ea, lp, (ctrl as DateEdit).DateTime);
return;
}
string[] arrCellpos = lp.CellPos.Split(pchar);
string[] arrtemp = lp.WordCount.Split(pchar);
arrCellpos = StringHelper.ReplaceEmpty(arrCellpos).Split(pchar);
arrtemp = StringHelper.ReplaceEmpty(arrtemp).Split(pchar);
List<int> arrCellCount = String2Int(arrtemp);
if (arrCellpos.Length == 1 || string.IsNullOrEmpty(arrCellpos[1]))
{
ea.SetCellValue(str, GetCellPos(lp.CellPos)[0], GetCellPos(lp.CellPos)[1]);
if (valuehs.ContainsKey(lp.LPID +"$" +lp.CellPos))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + lp.CellPos] as WF_TableFieldValue;
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(lp.CellPos)[0];
tfv.YExcelPos = GetCellPos(lp.CellPos)[1];
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue ();
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(lp.CellPos)[0];
tfv.YExcelPos = GetCellPos(lp.CellPos)[1];
valuehs.Add(lp.LPID + "$" + lp.CellPos, tfv);
}
}
else if (arrCellpos.Length > 1 && (!string.IsNullOrEmpty(arrCellpos[1])))
{
StringHelper help = new StringHelper();
if (lp.CellName == "编号")
{
for (int j = 0; j < arrCellpos.Length; j++)
{
if (str.IndexOf("\r\n") == -1 && str.Length <= help.GetFristLen(str, arrCellCount[j]))
{
string strNew = str.Substring(0, (str.Length > 0 ? str.Length : 1) - 1) + (j + 1).ToString();
ea.SetCellValue(strNew, GetCellPos(arrCellpos[j])[0], GetCellPos(arrCellpos[j])[1]);
if (valuehs.ContainsKey(lp.LPID + "$" + arrCellpos[j]))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellpos[j]] as WF_TableFieldValue;
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[j])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[j])[1];
tfv.ExcelSheetName = sheet.Name;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellpos[j])[0];
tfv.YExcelPos = GetCellPos(arrCellpos[j])[1];
tfv.ExcelSheetName = sheet.Name;
valuehs.Add(lp.LPID + "$" + arrCellpos[j], tfv);
}
}
//.........这里部分代码省略.........
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:101,代码来源:frmTemplate.cs
示例15: TranslatePage
/// <summary>
/// Attempt automatic translation of the current page via Google Translate.
/// </summary>
/// <remarks>
/// The defined language codes are ISO 639-2.
/// </remarks>
/// <param name="sourceLanguage">
/// The language to translate from (for ex. "en" for English).
/// </param>
/// <param name="targetLanguage">
/// The language to translate to (for ex. "fr" for French).
/// </param>
/// <exception cref="InvalidOperationException">
/// The member is called on an invalid <see cref="WebControl"/> instance
/// (see <see cref="UIElement.IsEnabled"/>).
/// </exception>
public void TranslatePage( string sourceLanguage, string targetLanguage )
{
VerifyLive();
StringHelper sourceLanguageStr = new StringHelper( sourceLanguage );
StringHelper targetLanguageStr = new StringHelper( targetLanguage );
awe_webview_translate_page( Instance, sourceLanguageStr.Value, targetLanguageStr.Value );
}
开发者ID:UIKit0,项目名称:AwesomiumSharp,代码行数:25,代码来源:WebControl.cs
示例16: FillMutilRowsT
public void FillMutilRowsT(ExcelAccess ea, LP_Temple lp, string str, int cellcount, string arrCellPos)
{
StringHelper help = new StringHelper();
//str = help.GetPlitString(str, cellcount);
string[] arrRst = str.Split(new string[] { "\r\n" },StringSplitOptions.None);
for (int i=0; i < arrRst.Length; i++)
{
ea.SetCellValue(arrRst[i], GetCellPos(arrCellPos)[0] + i, GetCellPos(arrCellPos)[1]);
if (valuehs.ContainsKey(lp.LPID + "$" + Convert.ToString(GetCellPos(arrCellPos)[0] + i) + "|" + GetCellPos(arrCellPos)[1]))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + Convert.ToString(GetCellPos(arrCellPos)[0] + i) + "|" + GetCellPos(arrCellPos)[1]] as WF_TableFieldValue;
tfv.ControlValue = arrRst[i];
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellPos)[0] + i;
tfv.YExcelPos = GetCellPos(arrCellPos)[1];
tfv.ExcelSheetName = activeSheetName;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = arrRst[i];
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellPos)[0] + i;
tfv.YExcelPos = GetCellPos(arrCellPos)[1];
tfv.ExcelSheetName = activeSheetName;
valuehs.Add(lp.LPID + "$" + Convert.ToString(GetCellPos(arrCellPos)[0] + i) + "|" + GetCellPos(arrCellPos)[1], tfv);
}
}
}
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:32,代码来源:frmTemplate.cs
示例17: FillMutilRows
public void FillMutilRows(ExcelAccess ea, int i, LP_Temple lp, string str, List<int> arrCellCount, string[] arrCellPos)
{
StringHelper help = new StringHelper();
str = help.GetPlitString(str, arrCellCount[1]);
string[] extraWord = lp.ExtraWord.Split(pchar);
string[] arrRst = str.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
int j = 0;
for (; i < arrCellPos.Length; i++)
{
if (j >= arrRst.Length)
break;
ea.SetCellValue(arrRst[j], GetCellPos(arrCellPos[i])[0], GetCellPos(arrCellPos[i])[1]);
if (valuehs.ContainsKey(lp.LPID + "$" + arrCellPos[i]))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + arrCellPos[i]] as WF_TableFieldValue;
tfv.ControlValue = arrRst[j];
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellPos[i])[0];
tfv.YExcelPos = GetCellPos(arrCellPos[i])[1];
tfv.ExcelSheetName = activeSheetName;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = arrRst[j];
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(arrCellPos[i])[0];
tfv.YExcelPos = GetCellPos(arrCellPos[i])[1];
tfv.ExcelSheetName = activeSheetName;
valuehs.Add(lp.LPID + "$" + arrCellPos[i], tfv);
}
j++;
}
}
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:38,代码来源:frmTemplate.cs
示例18: ctrl_Leave
void ctrl_Leave(object sender, EventArgs e)
{
LP_Temple lp = (LP_Temple)(sender as Control).Tag;
string str = (sender as Control).Text;
if (dsoFramerWordControl1.MyExcel==null)
{
return;
}
Excel.Workbook wb = dsoFramerWordControl1.AxFramerControl.ActiveDocument as Excel.Workbook;
ExcelAccess ea = new ExcelAccess();
ea.MyWorkBook = wb;
ea.MyExcel = wb.Application;
Excel.Worksheet xx;
if (lp.KindTable != "")
{
activeSheetName = lp.KindTable;
xx = wb.Application.Sheets[lp.KindTable] as Excel.Worksheet;
activeSheetIndex = xx.Index;
}
else
{
xx = wb.Application.Sheets[1] as Excel.Worksheet;
activeSheetIndex = xx.Index;
activeSheetName = xx.Name;
}
if (lp.KindTable != "")
{
ea.ActiveSheet(lp.KindTable);
}
else
{
ea.ActiveSheet(1);
}
if (lp.CellPos == "")
{
lp.CellPos = lp.CellPos;
if (valuehs.ContainsKey(lp.LPID))
{
WF_TableFieldValue tfv = valuehs[lp.LPID] as WF_TableFieldValue;
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = -1;
tfv.YExcelPos = -1;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = -1;
tfv.YExcelPos = -1;
tfv.ExcelSheetName = xx.Name;
valuehs.Add(lp.LPID, tfv);
}
return;
}
unLockExcel(wb,xx);
if (lp.CtrlType.Contains("uc_gridcontrol"))
{
FillTable(ea, lp, (sender as uc_gridcontrol).GetContent(String2Int(lp.WordCount.Split(pchar))));
LockExcel(wb, xx);
return;
}
else if (lp.CtrlType.Contains("DevExpress.XtraEditors.DateEdit"))
{
FillTime(ea, lp, (sender as DateEdit).DateTime);
LockExcel(wb, xx);
return;
}
string[] arrCellpos = lp.CellPos.Split(pchar);
string[] arrtemp = lp.WordCount.Split(pchar);
arrCellpos = StringHelper.ReplaceEmpty(arrCellpos).Split(pchar);
string[] extraWord = lp.ExtraWord.Split(pchar);
List<int> arrCellCount = String2Int(arrtemp);
if (arrCellpos.Length == 1 || string.IsNullOrEmpty(arrCellpos[1]))
{
ea.SetCellValue(str, GetCellPos(lp.CellPos)[0], GetCellPos(lp.CellPos)[1]);
if (valuehs.ContainsKey(lp.LPID + "$" + lp.CellPos))
{
WF_TableFieldValue tfv = valuehs[lp.LPID + "$" + lp.CellPos] as WF_TableFieldValue;
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
tfv.FieldName = lp.CellName;
tfv.XExcelPos = GetCellPos(lp.CellPos)[0];
tfv.YExcelPos = GetCellPos(lp.CellPos)[1];
tfv.ExcelSheetName = xx.Name;
}
else
{
WF_TableFieldValue tfv = new WF_TableFieldValue();
tfv.ControlValue = str;
tfv.FieldId = lp.LPID;
//.........这里部分代码省略.........
开发者ID:s7loves,项目名称:mypowerscgl,代码行数:101,代码来源:frmTemplate.cs
示例19: ConfirmIMEComposition
/// <exception cref="InvalidOperationException">
/// The member is called on an invalid <see cref="WebControl"/> instance
/// (see <see cref="UIElement.IsEnabled"/>).
/// </exception>
public void ConfirmIMEComposition( string inputStr )
{
VerifyLive();
StringHelper inputCStr = new StringHelper( inputStr );
awe_webview_confirm_ime_composition( Instance, inputCStr.Value );
}
开发者ID:UIKit0,项目名称:AwesomiumSharp,代码行数:11,代码来源:WebControl.cs
示例20: SetIMEComposition
/// <summary>
/// Create or update the current IME text composition.
/// </summary>
/// <param name="inputStr">The string generated by your IME.</param>
/// <param name="cursorPos">The current cursor position in your IME composition.</param>
/// <param name="targetStart">The position of the beginning of the selection.</param>
/// <param name="targetEnd">The position of the end of the selection.</param>
/// <exception cref="InvalidOperationException">
/// The member is called on an invalid <see cref="WebControl"/> instance
/// (see <see cref="UIElement.IsEnabled"/>).
/// </exception>
public void SetIMEComposition( string inputStr, int cursorPos, int targetStart, int targetEnd )
{
VerifyLive();
StringHelper inputCStr = new StringHelper( inputStr );
awe_webview_set_ime_composition( Instance, inputCStr.Value, cursorPos, targetStart, targetEnd );
}
开发者ID:UIKit0,项目名称:AwesomiumSharp,代码行数:18,代码来源:WebControl.cs
注:本文中的System.StringHelper类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论