本文整理汇总了C#中DataFormat类的典型用法代码示例。如果您正苦于以下问题:C# DataFormat类的具体用法?C# DataFormat怎么用?C# DataFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataFormat类属于命名空间,在下文中一共展示了DataFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RawTexture
public RawTexture()
{
Width = 0;
Height = 0;
Data = new byte[0];
Format = DataFormat.Invalid;
}
开发者ID:usagirei,项目名称:3DS-Theme-Editor,代码行数:7,代码来源:RawTexture.cs
示例2: OEmbed
public ActionResult OEmbed(string url, int maxwidth = 570, int maxheight = 400, DataFormat format = DataFormat.Json)
{
if (string.IsNullOrEmpty(url))
return HttpStatusCodeResult(HttpStatusCode.BadRequest, "URL not specified");
var route = new RouteInfo(new Uri(url), AppConfig.HostAddress).RouteData;
var controller = route.Values["controller"].ToString().ToLowerInvariant();
if (controller != "song" && controller != "s") {
return HttpStatusCodeResult(HttpStatusCode.BadRequest, "Only song embeds are supported");
}
int id;
if (controller == "s") {
var match = Regex.Match(route.Values["action"].ToString(), @"(\d+)");
id = int.Parse(match.Groups[1].Value);
}
else {
id = int.Parse(route.Values["id"].ToString());
}
var song = Services.Songs.GetSong(id);
var html = string.Format("<iframe src=\"{0}\" width=\"{1}\" height=\"{2}\"></iframe>",
VocaUriBuilder.CreateAbsolute(Url.Action("EmbedSong", new {songId = id})), maxwidth, maxheight);
return Object(new SongOEmbedResponse(song, maxwidth, maxheight, html), format);
}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:28,代码来源:ExtController.cs
示例3: Serialization
Serialization(DataFormat dataFormat, string streamName)
{
Dbg.Assert(!string.IsNullOrEmpty(streamName), "stream needs a name");
format = dataFormat;
this.streamName = streamName;
}
开发者ID:dfinke,项目名称:powershell,代码行数:7,代码来源:Serialization.cs
示例4: GetWireType
private WireType GetWireType(TypeCode code, DataFormat format, ref Type type, out int modelKey)
{
modelKey = -1;
if (type.IsEnum) return WireType.None;
switch (code)
{
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.UInt16:
case TypeCode.UInt32:
case TypeCode.UInt64:
case TypeCode.Boolean:
case TypeCode.SByte:
case TypeCode.Byte:
case TypeCode.Char:
return WireType.Variant;
case TypeCode.Double:
return WireType.Fixed64;
case TypeCode.Single:
return WireType.Fixed32;
case TypeCode.String:
case TypeCode.DateTime:
case TypeCode.Decimal:
return WireType.String;
}
if (type == typeof(byte[]) || type == typeof(TimeSpan)
|| type == typeof(Guid) || type == typeof(Uri)) return WireType.String;
if ((modelKey = GetKey(ref type)) >= 0)
{
return WireType.String;
}
return WireType.None;
}
开发者ID:martindevans,项目名称:DistributedServiceProvider,代码行数:35,代码来源:TypeModel.cs
示例5: ByPV
public ActionResult ByPV(PVService service, string pvId, ContentLanguagePreference? lang, string callback,
DataFormat format = DataFormat.Auto)
{
var song = Service.GetSongWithPV(s => new SongForApiContract(s, lang ?? ContentLanguagePreference.Default), service, pvId);
return Object(song, format, callback);
}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:7,代码来源:SongApiController.cs
示例6: ByPVBase
public ActionResult ByPVBase(PVService service, string pvId, string callback,
DataFormat format = DataFormat.Auto)
{
var song = Service.GetSongWithPV(s => new EntryBaseContract(s), service, pvId);
return Object(song, format, callback);
}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:7,代码来源:SongApiController.cs
示例7: Run
public static string Run(string data, DataFormat inputFormat, DataFormat outputFormat, Operation operation)
{
if (string.IsNullOrEmpty(data)) return string.Empty;
var bytes = GetBytes(data, inputFormat);
var result = Process(bytes, operation);
return GetString(result, outputFormat);
}
开发者ID:sagar1589,项目名称:Delta.Cryptography,代码行数:8,代码来源:ConversionEngine.cs
示例8: RESTfulInvocationHandler
/// <summary>
/// 实例化RESTfulInvocationHandler
/// </summary>
/// <param name="attribute"></param>
/// <param name="token"></param>
/// <param name="foramt"></param>
public RESTfulInvocationHandler(string url, PublishKindAttribute attribute, Token token, DataFormat foramt, int timeout)
{
this.format = foramt;
this.attribute = attribute;
this.token = token;
this.url = url;
this.timeout = timeout;
}
开发者ID:rajayaseelan,项目名称:mysoftsolution,代码行数:14,代码来源:RESTfulInvocationHandler.cs
示例9: UploadActivityAsync
/// <summary>
/// Uploads an activity.
/// </summary>
/// <param name="file">The path to the activity file on your local hard disk.</param>
/// <param name="dataFormat">The format of the file.</param>
/// <param name="activityType">The type of the activity.</param>
/// <returns>The status of the upload.</returns>
public async Task<UploadStatus> UploadActivityAsync(StorageFile file, DataFormat dataFormat, ActivityType activityType = ActivityType.Ride)
{
String format = String.Empty;
switch (dataFormat)
{
case DataFormat.Fit:
format = "fit";
break;
case DataFormat.FitGZipped:
format = "fit.gz";
break;
case DataFormat.Gpx:
format = "gpx";
break;
case DataFormat.GpxGZipped:
format = "gpx.gz";
break;
case DataFormat.Tcx:
format = "tcx";
break;
case DataFormat.TcxGZipped:
format = "tcx.gz";
break;
}
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", String.Format("Bearer {0}", Authentication.AccessToken));
MultipartFormDataContent content = new MultipartFormDataContent();
byte[] fileBytes = null;
using (IRandomAccessStreamWithContentType stream = await file.OpenReadAsync())
{
fileBytes = new byte[stream.Size];
using (DataReader reader = new DataReader(stream))
{
await reader.LoadAsync((uint)stream.Size);
reader.ReadBytes(fileBytes);
}
}
var byteArrayContent = new ByteArrayContent(fileBytes);
content.Add(byteArrayContent, "file", file.Name);
HttpResponseMessage result = await client.PostAsync(
String.Format("https://www.strava.com/api/v3/uploads?data_type={0}&activity_type={1}",
format,
activityType.ToString().ToLower()),
content);
String json = await result.Content.ReadAsStringAsync();
return Unmarshaller<UploadStatus>.Unmarshal(json);
}
开发者ID:TiBall,项目名称:stravadotnet,代码行数:63,代码来源:UploadClient.cs
示例10: Index
public ActionResult Index(string query, DiscType discType = DiscType.Unknown,
int start = 0, bool getTotalCount = false, AlbumSortRule sort = AlbumSortRule.Name,
NameMatchMode nameMatchMode = NameMatchMode.Exact, DataFormat format = DataFormat.Auto)
{
var queryParams = new AlbumQueryParams(query, discType, start, maxResults, false, getTotalCount, nameMatchMode, sort);
var entries = Service.Find(a => new AlbumForApiContract(a, LoginManager.LanguagePreference), queryParams);
return Object(entries, format);
}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:10,代码来源:AlbumApiController.cs
示例11: ByPVBase
public ActionResult ByPVBase(PVService? service, string pvId, string callback,
DataFormat format = DataFormat.Auto)
{
if (service == null)
return HttpStatusCodeResult(HttpStatusCode.BadRequest, "Service not specified or invalid");
var song = Service.GetSongWithPV(s => new EntryBaseContract(s), service.Value, pvId);
return Object(song, format, callback);
}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:10,代码来源:SongApiController.cs
示例12: Tracks
public ActionResult Tracks(int id = invalidId, DataFormat format = DataFormat.Auto,
ContentLanguagePreference lang = ContentLanguagePreference.Default)
{
if (id == invalidId)
return NoId();
var tracks = Service.GetAlbum(id, a => a.Songs.Select(s => new SongInAlbumContract(s, lang)).ToArray());
return Object(tracks, format);
}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:10,代码来源:AlbumApiController.cs
示例13: ConfigurationCell
/// <summary>
/// Creates a new <see cref="ConfigurationCell"/> from specified parameters.
/// </summary>
/// <param name="parent">The reference to parent <see cref="ConfigurationFrame"/> of this <see cref="ConfigurationCell"/>.</param>
/// <param name="idCode">The numeric ID code for this <see cref="ConfigurationCell"/>.</param>
/// <param name="isVirtual">Assigns flag that determines if this <see cref="ConfigurationCell"/> is virtual.</param>
public ConfigurationCell(ConfigurationFrame parent, ushort idCode, bool isVirtual)
: base(parent, idCode, int.MaxValue, int.MaxValue, int.MaxValue)
{
m_signalReferences = new Dictionary<SignalType, string[]>();
m_analogDataFormat = DataFormat.FloatingPoint;
m_frequencyDataFormat = DataFormat.FloatingPoint;
m_phasorDataFormat = DataFormat.FloatingPoint;
m_phasorCoordinateFormat = CoordinateFormat.Polar;
m_isVirtual = isVirtual;
}
开发者ID:avs009,项目名称:gsf,代码行数:16,代码来源:ConfigurationCell.cs
示例14: IDX
// constructor for reading an IDX file
public IDX(Stream in_stream, bool in_writing=false)
{
_idx_stream = in_stream;
// verify we can actually use this stream
Debug.Assert(_idx_stream.CanRead && _idx_stream.CanSeek);
_writing = in_writing;
if (_writing)
{
// just verify stream is writeable
Debug.Assert(_idx_stream.CanWrite == true);
}
// get our endianness
_idx_endianness = (Endianness)(255 * ReadUInt8() + ReadUInt8());
Debug.Assert(_idx_endianness == Endianness.BigEndian || _idx_endianness == Endianness.LittleEndian);
// get data format
_data_format = (DataFormat)ReadUInt8();
// number of dimensions
byte dimensions = ReadUInt8();
Debug.Assert(dimensions > 0);
// get number of rows
_rows = ReadUInt32();
// calculate length of each row
_row_length = 1;
for (int k = 1; k < dimensions; k++)
{
_row_length *= ReadUInt32();
}
_row_length_bytes = _row_length;
switch (_data_format)
{
case DataFormat.UInt8:
case DataFormat.SInt8:
_row_length_bytes *= 1;
break;
case DataFormat.SInt16:
_row_length_bytes *= 2;
break;
case DataFormat.SInt32:
case DataFormat.Single:
_row_length_bytes *= 4;
break;
case DataFormat.Double:
_row_length_bytes *= 8;
break;
}
// get size of the header
_header_size = (uint)_idx_stream.Position;
}
开发者ID:stozpark,项目名称:visual-rbm,代码行数:56,代码来源:IDX.cs
示例15: ConfigurationCell
/// <summary>
/// Creates a new <see cref="ConfigurationCell"/> from specified parameters.
/// </summary>
/// <param name="parent">The reference to parent <see cref="ConfigurationFrame"/> of this <see cref="ConfigurationCell"/>.</param>
/// <param name="idCode">The numeric ID code for this <see cref="ConfigurationCell"/>.</param>
public ConfigurationCell(ConfigurationFrame parent, ushort idCode)
: base(parent, idCode, int.MaxValue, int.MaxValue, int.MaxValue)
{
// Create a cached signal reference dictionary for generated signal references
m_generatedSignalReferenceCache = new string[Enum.GetValues(typeof(SignalKind)).Length][];
m_analogDataFormat = DataFormat.FloatingPoint;
m_frequencyDataFormat = DataFormat.FloatingPoint;
m_phasorDataFormat = DataFormat.FloatingPoint;
m_phasorCoordinateFormat = CoordinateFormat.Polar;
}
开发者ID:rmc00,项目名称:gsf,代码行数:16,代码来源:ConfigurationCell.cs
示例16: ParsePVUrl
public ActionResult ParsePVUrl(string pvUrl, string callback, DataFormat format = DataFormat.Auto)
{
var result = VideoServiceHelper.ParseByUrl(pvUrl, true);
if (!result.IsOk) {
return Json(new GenericResponse<string>(false, result.Exception.Message));
}
var contract = new PVContract(result, PVType.Original);
return Object(contract, format, callback);
}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:12,代码来源:SongApiController.cs
示例17: Versions
public ActionResult Versions(DataFormat format = DataFormat.Auto)
{
var versions = queries
.HandleQuery(ctx => ctx.Query()
.Where(a => !a.Deleted)
.Select(a => new { a.Id, a.Version })
.ToArray()
.Select(v => new EntryIdAndVersionContract(v.Id, v.Version))
.ToArray());
return ObjectLowercase(versions, format);
}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:12,代码来源:AlbumApiController.cs
示例18: OnLoad
/// <summary>
/// Raises the <see cref="E:System.Windows.Forms.UserControl.Load"/> event.
/// </summary>
/// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data.</param>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
foreach (var key in controlMapping.Keys)
{
var format = key;
var rb = controlMapping[format];
rb.Checked = format == DataFormat;
rb.CheckedChanged += (s, _) => DataFormat = format;
}
}
开发者ID:sagar1589,项目名称:Delta.Cryptography,代码行数:16,代码来源:DataFormatSelector.cs
示例19: ValueMember
/// <summary>
/// Creates a new ValueMember instance
/// </summary>
internal ValueMember(RuntimeTypeModel model, int fieldNumber, Type memberType, Type itemType, Type defaultType, DataFormat dataFormat)
{
if (memberType == null) throw new ArgumentNullException("memberType");
if (model == null) throw new ArgumentNullException("model");
this.fieldNumber = fieldNumber;
this.memberType = memberType;
this.itemType = itemType;
this.defaultType = defaultType;
this.model = model;
this.dataFormat = dataFormat;
}
开发者ID:helios57,项目名称:anrl,代码行数:15,代码来源:ValueMember.cs
示例20: Details
public ActionResult Details(int id = invalidId,
bool includeAlbums = true, bool includeArtists = true, bool includeNames = true, bool includePVs = false, bool includeTags = true, bool includeWebLinks = false,
string callback = null, DataFormat format = DataFormat.Auto,
ContentLanguagePreference lang = ContentLanguagePreference.Default)
{
if (id == invalidId)
return NoId();
var song = Service.GetSongWithMergeRecord(id, (s, m) => new SongForApiContract(s, m, lang, includeAlbums, includeArtists, includeNames, includePVs, includeTags, true, includeWebLinks));
return Object(song, format, callback);
}
开发者ID:realzhaorong,项目名称:vocadb,代码行数:12,代码来源:SongApiController.cs
注:本文中的DataFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论