本文整理汇总了C#中EncodeType类的典型用法代码示例。如果您正苦于以下问题:C# EncodeType类的具体用法?C# EncodeType怎么用?C# EncodeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EncodeType类属于命名空间,在下文中一共展示了EncodeType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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.");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}