本文整理汇总了C#中ContentType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ContentType.ToString方法的具体用法?C# ContentType.ToString怎么用?C# ContentType.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentType
的用法示例。
在下文中一共展示了ContentType.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCleanTextTypeFromDocument
protected void TestCleanTextTypeFromDocument(string fileName, ContentType contentType, string[] textThatShouldntBeCleaned)
{
fileName = TESTFILE_DIR + fileName;
string outFileName = fileName + "_cleaned.doc";
File.Copy(fileName, outFileName, true);
using (Workshare.FCS.Lite.WordDocumentReader docReader = new WordDocumentReader(outFileName, true))
{
docReader.Clean(BuildContentTypeList(contentType));
}
using (WordDocumentReader docReader2 = new WordDocumentReader(outFileName, false))
{
DocumentText dt = docReader2.Read();
IAbstractTextType tt = dt.GetUniqueTextType(contentType);
IAbstractTextType ttHid = dt.GetUniqueTextType(ContentType.HiddenText);
if (tt == null && ttHid == null)
{
CheckHaventCleanedTooMuch(dt.GetUniqueTextType(ContentType.Paragraph), textThatShouldntBeCleaned);
return;
}
if (tt != null)
Assert.AreEqual(0, tt.Nodes.Count, "Expected all the items of type " + contentType.ToString() + " to have been cleaned");
if (ttHid != null)
Assert.AreEqual(0, ttHid.Nodes.Count, "Expected no significant hidden text to show up");
}
}
示例2: UploadPictureAsync
/// <summary>
/// UploadPicture method that does all the uploading work.
/// </summary>
/// <param name="stream">The <see cref="Stream"/> object containing the pphoto to be uploaded.</param>
/// <param name="fileName">The filename of the file to upload. Used as the title if title is null.</param>
/// <param name="title">The title of the photo (optional).</param>
/// <param name="description">The description of the photograph (optional).</param>
/// <param name="tags">The tags for the photograph (optional).</param>
/// <param name="isPublic">false for private, true for public.</param>
/// <param name="isFamily">true if visible to family.</param>
/// <param name="isFriend">true if visible to friends only.</param>
/// <param name="contentType">The content type of the photo, i.e. Photo, Screenshot or Other.</param>
/// <param name="safetyLevel">The safety level of the photo, i.e. Safe, Moderate or Restricted.</param>
/// <param name="hiddenFromSearch">Is the photo hidden from public searches.</param>
/// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
public void UploadPictureAsync(Stream stream, string fileName, string title, string description, string tags,
bool isPublic, bool isFamily, bool isFriend, ContentType contentType,
SafetyLevel safetyLevel, HiddenFromSearch hiddenFromSearch,
Action<FlickrResult<string>> callback)
{
CheckRequiresAuthentication();
var uploadUri = new Uri(UploadUrl);
var parameters = new Dictionary<string, string>();
if (title != null && title.Length > 0)
{
parameters.Add("title", title);
}
if (description != null && description.Length > 0)
{
parameters.Add("description", description);
}
if (tags != null && tags.Length > 0)
{
parameters.Add("tags", tags);
}
parameters.Add("is_public", isPublic ? "1" : "0");
parameters.Add("is_friend", isFriend ? "1" : "0");
parameters.Add("is_family", isFamily ? "1" : "0");
if (safetyLevel != SafetyLevel.None)
{
parameters.Add("safety_level", safetyLevel.ToString("D"));
}
if (contentType != ContentType.None)
{
parameters.Add("content_type", contentType.ToString("D"));
}
if (hiddenFromSearch != HiddenFromSearch.None)
{
parameters.Add("hidden", hiddenFromSearch.ToString("D"));
}
parameters.Add("api_key", apiKey);
if (!string.IsNullOrEmpty(OAuthAccessToken))
{
parameters.Remove("api_key");
OAuthGetBasicParameters(parameters);
parameters.Add("oauth_token", OAuthAccessToken);
string sig = OAuthCalculateSignature("POST", uploadUri.AbsoluteUri, parameters, OAuthAccessTokenSecret);
parameters.Add("oauth_signature", sig);
}
else
{
parameters.Add("auth_token", apiToken);
}
UploadDataAsync(stream, fileName, uploadUri, parameters, callback);
}
示例3: DefaultCtor_ExpectedDefaultPropertyValues
public static void DefaultCtor_ExpectedDefaultPropertyValues()
{
var ct = new ContentType();
Assert.Null(ct.Boundary);
Assert.Null(ct.CharSet);
Assert.Equal("application/octet-stream", ct.MediaType);
Assert.Empty(ct.Parameters);
Assert.Null(ct.Name);
Assert.Equal("application/octet-stream", ct.ToString());
}
示例4: GetDiscoveredTextType
protected static IAbstractTextType GetDiscoveredTextType(string fileName, ContentType contentType)
{
Workshare.FCS.Lite.WordDocumentReader docReader = new WordDocumentReader(TESTFILE_DIR + fileName);
DocumentText docText = docReader.Read();
IAbstractTextType ttresult = docText.GetUniqueTextType(contentType);
Assert.IsNotNull(ttresult, "we unexpectedly found no text of content type " + contentType.ToString());
return ttresult;
}
示例5: ResultByMetadataType
public ResultByMetadataType(ContentType ct)
{
m_type = ct;
m_typeText = m_type.ToString();
m_iBothPerfect = 0;
m_iBothTheSame = 0;
m_iAPIDidBetter = 0;
m_iLightSpeedDidBetter = 0;
m_iOther = 0;
}
示例6: Post
public WebHookParamBuilder Post(ContentType type, string data)
{
_params[TaskParamKeys.Verb] = "POST";
var contentParam = new Dictionary<string,string>
{
{TaskParamKeys.DataType, type.ToString().ToLower()},
{TaskParamKeys.Data, data},
};
_params[TaskParamKeys.Content] = contentParam;
return this;
}
示例7: CreateProgramManager
protected virtual IProgramManager CreateProgramManager(ICollection<Uri> source, ContentType contentType, ContentType streamContentType)
{
if (ContentTypes.M3U != contentType && ContentTypes.M3U8 != contentType)
{
throw new NotSupportedException($"Content type {(null == contentType ? "<unknown>" : contentType.ToString())} not supported by this program manager");
}
var programManager = _programManagerFactory();
programManager.Initialize(source, contentType, streamContentType);
return programManager;
}
示例8: GetBlock
public static BlockModel GetBlock(string name,ContentType type)
{
using (var ctx = new OffwindEntities())
{
var ctBlock = type.ToString();
var content = ctx.DContents.FirstOrDefault(c => c.TypeId == ctBlock && c.Name == name);
var block = new BlockModel();
if (content != null)
{
block.Name = content.Name;
block.Title = content.Title;
block.Content = content.Content;
block.Image = content.Announce;
}
return block;
}
}
示例9: PostWeChatTimeLineUrl
public string PostWeChatTimeLineUrl(string requestUrl, ContentType contentType, string title, string[] mediaList,
string mediaUrl, string contentUrl, string coordinates)
{
requestUrl += "timeline.format";
if (_postArgumentList == null)
_postArgumentList = new List<KeyValuePair<string, object>>();
_postArgumentList.Add(new KeyValuePair<string, object>("content_type",contentType.ToString().ToLower()));
_postArgumentList.Add(new KeyValuePair<string, object>("title", title));
_postArgumentList.Add(new KeyValuePair<string, object>("media_list", mediaList));
_postArgumentList.Add(new KeyValuePair<string, object>("media_url", mediaUrl));
_postArgumentList.Add(new KeyValuePair<string, object>("content_url",contentUrl));
_postArgumentList.Add(new KeyValuePair<string, object>("coordinates", coordinates));
return requestUrl;
}
示例10: AttachEmail
public static bool AttachEmail(this IEmailService service, int contactId, string fromName, string fromAddress,
string toAddress, string ccAddresses, string bccAddresses,
ContentType contentType, string subject, string htmlBody, string textBody,
string header, string receivedDate, string sentDate, EmailSentType emailSentType)
{
return service.AttachEmail(contactId,
fromName,
fromAddress,
toAddress,
ccAddresses,
bccAddresses,
contentType.ToString(),
subject,
htmlBody,
textBody,
header,
receivedDate,
sentDate,
(int) emailSentType);
}
示例11: LogSuccessMessage
private void LogSuccessMessage(ContentType type, string name)
{
Logger.Info("Successfully saved: " + name + " of type " + type.ToString());
service.ContentUpdated -= LogSuccessMessage;
}
示例12: FileNameFor
public string FileNameFor(ContentType contentType, string contentFileName)
{
return _fileNames[FileSystem.Combine(contentType.ToString(), contentFileName)];
}
示例13: ExistsInApplicationDirectory
public bool ExistsInApplicationDirectory(ContentType contentType, string contentFileName)
{
return _fileSystem.FileExists(FubuMvcPackageFacility.GetApplicationPath(), "content", contentType.ToString(),
contentFileName);
}
示例14: PopulateContentType
private static string PopulateContentType(string inputString,ContentType contentType)
{
return inputString.Replace("<#ContentType#>",contentType.ToString());
}
示例15: CheckContent
public bool CheckContent(string path, ContentType expectedType)
{
AvailableCheckResult result = contentManager.CheckAvailabe(path, expectedType);
return checkSourceResult(result, path, expectedType.ToString(), checkLocation);
}