本文整理匯總了C#中MimeKit.ContentType.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# ContentType.ToString方法的具體用法?C# ContentType.ToString怎麽用?C# ContentType.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MimeKit.ContentType
的用法示例。
在下文中一共展示了ContentType.ToString方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestBreakingOfLongParamValues
public void TestBreakingOfLongParamValues()
{
string encoded, expected;
ContentType type;
expected = "Content-Type: text/plain; charset=iso-8859-1;\n\tname*0=\"this is a really really long filename that should force MimeKi\";\n\tname*1=\"t to break it apart - yay!.html\"";
type = new ContentType ("text", "plain");
type.Parameters.Add ("charset", "iso-8859-1");
type.Parameters.Add ("name", "this is a really really long filename that should force MimeKit to break it apart - yay!.html");
encoded = type.ToString (Encoding.UTF8, true);
Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
}
示例2: TestEncodingOfLongParamValues
public void TestEncodingOfLongParamValues()
{
string encoded, expected;
ContentType type;
expected = "Content-Type: text/plain; charset=utf-8;\n\tname*0*=iso-8859-1''%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5;\n\tname*1*=%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5;\n\tname*2*=%E5%E5%E5%E5";
type = new ContentType ("text", "plain");
type.Parameters.Add ("charset", "utf-8");
type.Parameters.Add ("name", new string ('å', 40));
encoded = type.ToString (Encoding.UTF8, true);
Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
}
示例3: TestEncodingOfParamValues
public void TestEncodingOfParamValues()
{
string encoded, expected;
ContentType type;
expected = "Content-Type: text/plain; charset=iso-8859-1;\n\tname*=iso-8859-1''Kristoffer%20Br%E5nemyr";
type = new ContentType ("text", "plain");
type.Parameters.Add ("charset", "iso-8859-1");
type.Parameters.Add ("name", "Kristoffer Brånemyr");
encoded = type.ToString (Encoding.UTF8, true);
Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
}
示例4: TestEncodingOfLongParamValues
public void TestEncodingOfLongParamValues ()
{
string expected = "Content-Type: text/plain; charset=utf-8;\n\tname*0*=iso-8859-1''%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5;\n\tname*1*=%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5%E5";
if (FormatOptions.Default.NewLineFormat != NewLineFormat.Unix)
expected = expected.Replace ("\n", "\r\n");
var type = new ContentType ("text", "plain");
type.Parameters.Add ("charset", "utf-8");
type.Parameters.Add ("name", new string ('å', 40));
var encoded = type.ToString (Encoding.UTF8, true);
Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
}
示例5: TestEncodingOfParamValues
public void TestEncodingOfParamValues ()
{
string expected = "Content-Type: text/plain; charset=iso-8859-1;\n\tname*=iso-8859-1''Kristoffer%20Br%E5nemyr";
if (FormatOptions.Default.NewLineFormat != NewLineFormat.Unix)
expected = expected.Replace ("\n", "\r\n");
var type = new ContentType ("text", "plain");
type.Parameters.Add ("charset", "iso-8859-1");
type.Parameters.Add ("name", "Kristoffer Brånemyr");
var encoded = type.ToString (Encoding.UTF8, true);
Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
}
示例6: TestBreakingOfLongParamValues
public void TestBreakingOfLongParamValues ()
{
string expected = "Content-Type: text/plain; charset=iso-8859-1;\n\tname*0=\"this is a really really long filename that should force MimeKit to b\";\n\tname*1=\"reak it apart - yay!.html\"";
if (FormatOptions.Default.NewLineFormat != NewLineFormat.Unix)
expected = expected.Replace ("\n", "\r\n");
var type = new ContentType ("text", "plain");
type.Parameters.Add ("charset", "iso-8859-1");
type.Parameters.Add ("name", "this is a really really long filename that should force MimeKit to break it apart - yay!.html");
var encoded = type.ToString (Encoding.UTF8, true);
Assert.AreEqual (expected, encoded, "Encoded Content-Type does not match: {0}", expected);
}