本文整理汇总了C#中OutputFormat.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# OutputFormat.ToString方法的具体用法?C# OutputFormat.ToString怎么用?C# OutputFormat.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputFormat
的用法示例。
在下文中一共展示了OutputFormat.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ForFormat
public static WikiOutput ForFormat(OutputFormat aFormat, WikiOutput parent)
{
switch (aFormat)
{
case OutputFormat.HTML:
return new HTMLWikiOutput(parent);
case OutputFormat.Testing:
return new TestWikiOutput(parent);
default:
throw new Exception("Unsupported output type requested: " + aFormat.ToString());
}
}
示例2: Translate
public Translation Translate(string text, LangPair lang, OutputFormat? format = null, bool options = false)
{
RestRequest request = new RestRequest("translate");
request.AddParameter("key", _key);
request.AddParameter("text", text);
if (lang.OutputLang != Lang.None)
{
if (lang.InputLang == Lang.None)
request.AddParameter("lang", lang.OutputLang.ToString().ToLowerInvariant());
else
request.AddParameter("lang", lang.ToString().ToLowerInvariant());
}
if (format.HasValue)
request.AddParameter("format", format.ToString().ToLowerInvariant());
if (options)
request.AddParameter("options", "1");
return SendRequest<Translation>(request);
}
示例3: GetFilenameFromPattern
public static string GetFilenameFromPattern(string pattern, OutputFormat imageFormat, ICaptureDetails captureDetails)
{
return FillPattern(pattern, captureDetails, true) + "." + imageFormat.ToString().ToLower();
}
示例4: CreateSessionImpl
private string CreateSessionImpl(
Template template,
string billingRef,
string answers,
string[] markedVariables,
InterviewFormat interviewFormat,
OutputFormat outputFormat,
Dictionary<string, string> settings,
string theme,
bool showDownloadLinks,
bool uploadPackage)
{
if (!(template.Location is PackageTemplateLocation))
throw new Exception("HotDocs Cloud Services requires the use of template packages. Please use a PackageTemplateLocation derivative.");
PackageTemplateLocation packageTemplateLocation = (PackageTemplateLocation)template.Location;
if (uploadPackage)
{
UploadPackage(packageTemplateLocation.PackageID, billingRef, packageTemplateLocation.GetPackageStream());
}
var timestamp = DateTime.UtcNow;
string hmac = HMAC.CalculateHMAC(
SigningKey,
timestamp,
SubscriberId,
packageTemplateLocation.PackageID,
billingRef,
interviewFormat,
outputFormat,
settings); // Additional settings = null for this app
StringBuilder urlBuilder = new StringBuilder(string.Format(
"{0}/newsession/{1}/{2}?interviewformat={3}&outputformat={4}",
EmbeddedEndpointAddress, SubscriberId, packageTemplateLocation.PackageID,
interviewFormat.ToString(), outputFormat.ToString()));
if (markedVariables != null && markedVariables.Length > 0)
{
urlBuilder.AppendFormat("&markedvariables={0}", string.Join(",", markedVariables));
}
if (!string.IsNullOrEmpty(theme))
{
urlBuilder.AppendFormat("&theme={0}", theme);
}
if (!string.IsNullOrEmpty(billingRef))
{
urlBuilder.AppendFormat("&billingref={0}", billingRef);
}
if (showDownloadLinks)
{
urlBuilder.Append("&showdownloadlinks=true");
}
if (settings != null)
{
foreach (KeyValuePair<string, string> kv in settings)
{
urlBuilder.AppendFormat("&{0}={1}", kv.Key, kv.Value ?? "");
}
}
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlBuilder.ToString());
request.Method = "POST";
request.ContentType = "text/xml; charset=utf-8";
request.Headers["x-hd-date"] = timestamp.ToString("r");
request.Headers[HttpRequestHeader.Authorization] = hmac;
byte[] data = null;
if (answers != null)
{
data = Encoding.UTF8.GetBytes(answers);
}
request.ContentLength = data != null ? data.Length : 0;
if (!string.IsNullOrEmpty(ProxyServerAddress))
{
request.Proxy = new WebProxy(ProxyServerAddress);
}
else
{
request.Proxy = null;
}
Stream stream = request.GetRequestStream();
if (data != null)
{
stream.Write(data, 0, data.Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
return reader.ReadLine();
}
示例5: OutputFormatToString
private static string OutputFormatToString(OutputFormat value)
{
return value.ToString().ToLowerInvariant();
}
示例6: OutputFormatToString
private static string OutputFormatToString(OutputFormat value)
{
// serge: boost 1.60 requires uppercase input
return value.ToString(); //.ToLowerInvariant();
}
示例7: OutputFormatToString
internal static string OutputFormatToString(OutputFormat value)
{
// serge: boost 1.60 requires uppercase input
return value.ToString();
}
示例8: Format
/// <summary>
/// Sets the output format to use. By default, the original format (or the closest match) is used.
/// </summary>
/// <param name="format">The desired output format</param>
public OutputExpression Format(OutputFormat format)
{
builder.SetParameter(OutputCommands.Format, format.ToString().ToLowerInvariant());
return this;
}
示例9: SaveToTmpFile
/// <summary>
/// Helper method to create a temp image file
/// </summary>
/// <param name="image"></param>
/// <returns></returns>
public static string SaveToTmpFile(Image image, OutputFormat outputFormat, int quality, bool reduceColors)
{
string tmpFile = Path.GetRandomFileName() + "." + outputFormat.ToString();
// Prevent problems with "other characters", which could cause problems
tmpFile = Regex.Replace(tmpFile, @"[^\d\w\.]", "");
string tmpPath = Path.Combine(Path.GetTempPath(), tmpFile);
LOG.Debug("Creating TMP File : " + tmpPath);
try {
ImageOutput.Save(image, tmpPath, true, quality, reduceColors, false);
tmpFileCache.Add(tmpPath, tmpPath);
} catch (Exception) {
return null;
}
return tmpPath;
}