本文整理汇总了C#中System.StringHelper类的典型用法代码示例。如果您正苦于以下问题:C# StringHelper类的具体用法?C# StringHelper怎么用?C# StringHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringHelper类属于System命名空间,在下文中一共展示了StringHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 );
}
示例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 );
}
示例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 );
}
}
示例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());
}
示例5: TestFixtureSetup
public void TestFixtureSetup()
{
_stringHelper = new StringHelper(new StringComparison());
}
示例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 );
}
示例7: TestStringHelper_Integration
public void TestStringHelper_Integration()
{
StringHelper sh = new StringHelper();
string result = sh.ReverseAsync("abc").Result;
Assert.AreEqual("cba", result);
}
示例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 );
}
示例9: HasProperty
public bool HasProperty( string propertyName )
{
StringHelper propertyNameStr = new StringHelper( propertyName );
return awe_jsobject_has_property( instance, propertyNameStr.Value );
}
示例10: SetCustomResponsePage
public static void SetCustomResponsePage(int statusCode, string filePath)
{
StringHelper filePathStr = new StringHelper(filePath);
awe_webcore_set_custom_response_page(statusCode, filePathStr.value());
}
示例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);
}
示例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);
}
示例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>();
}
示例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);
}
}
//.........这里部分代码省略.........
示例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 );
}