本文整理汇总了C#中EncodeType类的典型用法代码示例。如果您正苦于以下问题:C# EncodeType类的具体用法?C# EncodeType怎么用?C# EncodeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EncodeType类属于命名空间,在下文中一共展示了EncodeType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CharEncode
public static string CharEncode(string origString, string EncChars, EncodeType Type)
{
string newString = "";
Char[] origArray = origString.ToCharArray();
foreach (Char strArray in origArray)
{
if (EncChars.Contains(strArray.ToString()))
{
if (Type == EncodeType.UrlEncode)
newString += "%" + charToHexString(strArray);
if (Type == EncodeType.UrlEncodeUTF8)
newString += "%u00" + charToHexString(strArray);
if (Type == EncodeType.AmpHex)
newString += "�" + charToHexString(strArray) + ";";
if (Type == EncodeType.AmpHash)
newString += "�" + AmpHash(strArray.ToString()) + ";";
if (Type == EncodeType.HtmlEncode)
newString += HttpUtility.HtmlEncode(strArray.ToString());
}
else
{
newString += strArray;
}
}
return newString;
}
开发者ID:mcorrientes,项目名称:Web-Security-Toolset,代码行数:26,代码来源:Encode.cs
示例2: EncodeUrlParameter
public static string EncodeUrlParameter(EncodeType encodeType, string name, string value, UrlParameterSeparator prepend = UrlParameterSeparator.None, bool allowBlank = true)
{
if (null == name) { throw new ArgumentNullException("name"); }
if (null == value) { throw new ArgumentNullException("value"); }
value = value.Trim();
if (allowBlank || !string.IsNullOrEmpty(value))
{
Func<string, string> encoder = (s) => { return EncodeType.Url == encodeType ? HttpUtility.UrlEncode(s) : HttpUtility.HtmlEncode(s); };
return String.Format(CultureInfo.InvariantCulture, "{0}{1}={2}", prepend.ToEnumValueString(), encoder(name), encoder(value));
}
return string.Empty;
}
开发者ID:Iristyle,项目名称:Authentic,代码行数:14,代码来源:Helpers.cs
示例3: ProcessSymbolFieldInstruction
private void ProcessSymbolFieldInstruction(DocumentNode dn, string instr, ref int i, ref EncodeType encodeType)
{
int iStart = 0;
switch (instr[i++])
{
case 'a':
encodeType = EncodeType.Ansi;
break;
case 'u':
encodeType = EncodeType.Unicode;
break;
case 'j':
encodeType = EncodeType.ShiftJis;
break;
case 'h':
// linespacing instruction: ignore
break;
case 's':
if (i < instr.Length && instr[i] == ' ')
i++;
// font size in points, not half-points
iStart = i;
for (; i < instr.Length && instr[i] != ' '; i++)
{
continue;
}
string ptString = instr.Substring(iStart, i - iStart);
// Now convert number part
bool ret = true;
double d = 0f;
try
{
d = System.Convert.ToDouble(ptString, CultureInfo.InvariantCulture);
}
catch (System.OverflowException)
{
ret = false;
}
catch (System.FormatException)
{
ret = false;
}
if (ret)
{
dn.FormatState.FontSize = (long)((d * 2) + 0.5);
}
break;
case 'f':
// Font Name
if (i < instr.Length && instr[i] == ' ')
{
i++;
}
if (i < instr.Length && instr[i] == '"')
{
i++;
}
iStart = i;
for (; i < instr.Length && instr[i] != '"'; i++)
{
continue;
}
string name = instr.Substring(iStart, i - iStart);
// Move past trailing double-quote
i++;
if (name != null && name.Length > 0)
{
dn.FormatState.Font = _converterState.FontTable.DefineEntryByName(name);
}
break;
}
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:76,代码来源:RtfToXamlReader.cs
示例4: Current
/// <summary>
/// Get a list of unresolved notifications for an account or server. More
/// information about the data structure can be found in the storm/alerts/details
/// method.
/// </summary>
public static string Current(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Notifications/current";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:10,代码来源:Notifications.cs
示例5: Delete
/// <summary>
/// Delete a volume, including any and all data stored on it. The volume must not
/// be attached to any instances to call this method.
/// </summary>
public static string Delete(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Storage/Block/Volume/delete";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:9,代码来源:Storage.cs
示例6: Shutdown
/// <summary>
/// Stop a server. The 'force' flag will do a hard stop of the server from the
/// parent server. Otherwise, it will issue a halt command to the server and
/// shutdown normally.
/// </summary>
public static string Shutdown(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Storm/Server/shutdown";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:10,代码来源:Storm.cs
示例7: Restore
/// <summary>
/// Re-images a server with the template requested. If the 'force' flag is passed
/// it will rebuild the filesystem on the server before restoring. This option is not
/// usually needed, but if regular restores are failing, it can fix some scenarios.
/// </summary>
public static string Restore(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Storm/Template/restore";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:10,代码来源:Storm.cs
示例8: GetActive
/// <summary>
/// Returns the details of the active support alert.
/// </summary>
public static string GetActive(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Support/Alert/getActive";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:8,代码来源:Support.cs
示例9: CreateUser
public static bool CreateUser(string name, string passwd, EncodeType encodeType)
{
string response = ExecuteWith(String.Format("-cb{0} {1} {2} {3}", (char) encodeType, Db, name, passwd));
return response.Contains("created.");
}
开发者ID:FaustinoLeiras,项目名称:CodeGarten,代码行数:5,代码来源:PasswordManager.cs
示例10: Clone
/// <summary>
/// Clone a server.
/// </summary>
/// <returns>
/// Returns the information about the newly created clone.
/// </returns>
public static string Clone(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Server/clone";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:11,代码来源:Server.cs
示例11: History
/// <summary>
/// Get a list of notifications for a specific server. Information about the data
/// returned can here be found in storm/alerts/details
/// </summary>
public static string History(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Server/history";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:9,代码来源:Server.cs
示例12: ListOrphans
/// <summary>
/// Lists the domains for an account that are not linked to a server.
/// </summary>
public static string ListOrphans(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Server/VirtualDomain/listOrphans";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:8,代码来源:Server.cs
示例13: ReLink
/// <summary>
/// Links an existing orphaned add-on domain to a shared subaccnt.
/// </summary>
public static string ReLink(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Server/VirtualDomain/relink";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:8,代码来源:Server.cs
示例14: FreeCount
/// <summary>
/// Returns the number of free VIRs a given type of shared account receives.
/// </summary>
public static string FreeCount(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Server/VirtualDomain/freecount";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:8,代码来源:Server.cs
示例15: Make
/// <summary>
/// Charges the credit card on file for the given account the given amount, and
/// applies those new funds to the account. Currently this method is only useful
/// for credit card accounts. A forbidden exception will be thrown if used with
/// a check account.
/// </summary>
public static string Make(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Billing/Payment/make";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:11,代码来源:Billing.cs
示例16: Next
/// <summary>
/// Returns a projection of what the given account's next bill will look like
/// at their next bill date.
/// </summary>
public static string Next(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Billing/Invoice/next";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:9,代码来源:Billing.cs
示例17: ConvertSymbolCharValueToText
private void ConvertSymbolCharValueToText(DocumentNode dn, int nChar, EncodeType encodeType)
{
switch (encodeType)
{
case EncodeType.Unicode:
if (nChar < 0xFFFF)
{
char[] unicodeChar = new char[1];
unicodeChar[0] = (char)nChar;
dn.AppendXamlEncoded(new string(unicodeChar));
}
break;
case EncodeType.ShiftJis:
if (nChar < 0xFFFF)
{
// NB: How to interpret this numeric value as Shift-JIS?
Encoding ec = Encoding.GetEncoding(932);
int nChars = nChar > 256 ? 2 : 1;
byte[] ba = new byte[2];
if (nChars == 1)
{
ba[0] = (byte)nChar;
}
else
{
ba[0] = (byte)((nChar >> 8) & 0xFF);
ba[1] = (byte)(nChar & 0xFF);
}
dn.AppendXamlEncoded(ec.GetString(ba, 0, nChars));
}
break;
default:
if (nChar < 256)
{
// Keep the byte char value as the unicode
char singleChar = (char) nChar;
dn.AppendXamlEncoded(new string(singleChar, 1));
}
break;
}
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:44,代码来源:RtfToXamlReader.cs
示例18: Close
/// <summary>
/// Closes a ticket
/// </summary>
public static string Close(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Support/Ticket/close";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:8,代码来源:Support.cs
示例19: Version
/// <summary>
/// Returns the version of the of the api your are using.
/// </summary>
public static string Version( EncodeType encoding = EncodeType.JSON)
{
object options = string.Empty;
string method = "/Utilities/Info/version";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:9,代码来源:Utilities.cs
示例20: Create
/// <summary>
/// Fires off a process to image the server right now. Since the image
/// won't be created immediately, we can't return the information about it.
/// </summary>
public static string Create(object options, EncodeType encoding = EncodeType.JSON)
{
string method = "/Storm/Image/create";
return APIHandler.Post (method, options, encoding);
}
开发者ID:pfhawkins,项目名称:CSharp-StormOnDemand,代码行数:9,代码来源:Storm.cs
注:本文中的EncodeType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论