本文整理汇总了C#中UniqueId.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# UniqueId.ToString方法的具体用法?C# UniqueId.ToString怎么用?C# UniqueId.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniqueId
的用法示例。
在下文中一共展示了UniqueId.ToString方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
public YieldCurveDefinitionDocument Get(UniqueId uniqueId)
{
var resp = _restTarget.Resolve("definitions", uniqueId.ToString()).Get<YieldCurveDefinitionDocument>();
if (resp == null || resp.UniqueId == null || resp.YieldCurveDefinition == null)
{
throw new ArgumentException("Not found", "uniqueId");
}
return resp;
}
示例2: GetSecurity
public ISecurity GetSecurity(UniqueId uid)
{
if (uid.IsLatest)
{
var securityDocument = _restTarget.Resolve("securities", uid.ToString()).Get<SecurityDocument>();
return securityDocument.Security;
}
else
{
var securityDocument = _restTarget.Resolve("securities", uid.ObjectID.ToString(), "versions", uid.Version).Get<SecurityDocument>();
return securityDocument.Security;
}
}
示例3: GetPortfolioOutputs
public IAvailableOutputs GetPortfolioOutputs(UniqueId portfolioId, string timeStamp = "now")
{
ArgumentChecker.NotNull(portfolioId, "portfolioId");
ArgumentChecker.NotNull(timeStamp, "timeStamp");
RestTarget target = _restTarget.Resolve("portfolio").Resolve(timeStamp);
if (_maxNodes > 0)
target = target.Resolve("nodes", _maxNodes.ToString());
if (_maxPositions > 0)
target = target.Resolve("positions", _maxPositions.ToString());
target = target.Resolve(portfolioId.ToString());
return target.Get<IAvailableOutputs>();
}
示例4: GetHistoricalTimeSeries
public ILocalDateDoubleTimeSeries GetHistoricalTimeSeries(UniqueId uid, DateTimeOffset start, bool includeStart, DateTimeOffset end, bool includeEnd)
{
var args = new List<Tuple<string, string>>();
if (uid.IsVersioned)
{
args.Add(Tuple.Create(uid.ToString(), uid.Version));
}
if (start != default(DateTimeOffset))
{
args.Add(Tuple.Create("start", DateToString(start.Date)));
args.Add(Tuple.Create("includeStart", includeStart.ToString()));
}
if (end != default(DateTimeOffset))
{
args.Add(Tuple.Create("end", DateToString(end.Date)));
args.Add(Tuple.Create("includeEnd", includeEnd.ToString()));
}
RestTarget target = _rest.Resolve("hts")
.Resolve(uid.ObjectID.ToString(), args.ToArray());
return target.Get<ILocalDateDoubleTimeSeries>("timeSeries");
}
示例5: GetSecurity
public ISecurity GetSecurity(UniqueId uid)
{
var target = _restTarget.Resolve("securities").Resolve("security").Resolve(uid.ToString());
return target.Get<ISecurity>();
}
示例6: GetFetchRange
static string GetFetchRange(UniqueId min, UniqueId? max)
{
if (max.HasValue && max.Value.Id == min.Id)
return min.ToString ();
var maxValue = max.HasValue ? max.Value.Id.ToString () : "*";
return string.Format ("{0}:{1}", min.Id, maxValue);
}
示例7: Remove
public void Remove(UniqueId uniqueId)
{
_restTarget.Resolve("definitions").Resolve(uniqueId.ToString()).Delete();
}
示例8: RenderRelated
async void RenderRelated (IMailFolder folder, UniqueId uid, BodyPartMultipart related)
{
var start = related.ContentType.Parameters["start"];
BodyPartText root = null;
if (!string.IsNullOrEmpty (start)) {
// if the 'start' parameter is set, it overrides the default behavior of using the first
// body part as the main document.
root = related.BodyParts.OfType<BodyPartText> ().FirstOrDefault (x => x.ContentId == start);
} else if (related.BodyParts.Count > 0) {
// this will generally either be a text/html part (which is what we are looking for) or a multipart/alternative
var multipart = related.BodyParts[0] as BodyPartMultipart;
if (multipart != null) {
if (multipart.ContentType.Matches ("multipart", "alternative") && multipart.BodyParts.Count > 0) {
// find the last text/html part (which will be the closest to what the sender saw in their WYSIWYG editor)
// or, failing that, the last text part.
for (int i = multipart.BodyParts.Count; i > 0; i--) {
var bodyPart = multipart.BodyParts[i - 1] as BodyPartText;
if (bodyPart == null)
continue;
if (bodyPart.ContentType.Matches ("text", "html")) {
root = bodyPart;
break;
}
if (root == null)
root = bodyPart;
}
}
} else {
root = related.BodyParts[0] as BodyPartText;
}
}
if (root == null)
return;
var text = await folder.GetBodyPartAsync (uid, root) as TextPart;
if (text != null && text.ContentType.Matches ("text", "html")) {
var doc = new HtmlAgilityPack.HtmlDocument ();
var saved = new Dictionary<MimePart, string> ();
TextPart html;
doc.LoadHtml (text.Text);
// find references to related MIME parts and replace them with links to links to the saved attachments
foreach (var img in doc.DocumentNode.SelectNodes ("//img[@src]")) {
var src = img.Attributes["src"];
int index;
Uri uri;
if (src == null || src.Value == null)
continue;
// parse the <img src=...> attribute value into a Uri
if (Uri.IsWellFormedUriString (src.Value, UriKind.Absolute))
uri = new Uri (src.Value, UriKind.Absolute);
else
uri = new Uri (src.Value, UriKind.Relative);
// locate the index of the attachment within the multipart/related (if it exists)
if ((index = related.BodyParts.IndexOf (uri)) != -1) {
var bodyPart = related.BodyParts[index] as BodyPartBasic;
if (bodyPart == null) {
// the body part is not a basic leaf part (IOW it's a multipart or message-part)
continue;
}
var attachment = await folder.GetBodyPartAsync (uid, bodyPart) as MimePart;
// make sure the referenced part is a MimePart (as opposed to another Multipart or MessagePart)
if (attachment == null)
continue;
string fileName;
// save the attachment (if we haven't already saved it)
if (!saved.TryGetValue (attachment, out fileName)) {
fileName = attachment.FileName;
if (string.IsNullOrEmpty (fileName))
fileName = Guid.NewGuid ().ToString ();
if (!Directory.Exists (uid.ToString ()))
Directory.CreateDirectory (uid.ToString ());
fileName = Path.Combine (uid.ToString (), fileName);
using (var stream = File.Create (fileName))
attachment.ContentObject.DecodeTo (stream);
saved.Add (attachment, fileName);
}
// replace the <img src=...> value with the local file name
//.........这里部分代码省略.........
示例9: OriginateReply
public OriginateReply(ICommand command, bool result, UniqueId sessionId)
: base(command, result, sessionId.ToString())
{
_sessionId = sessionId;
}
示例10: RemoveViewDefinition
public void RemoveViewDefinition(UniqueId id)
{
_rest.Resolve("id").Resolve(id.ToString()).Delete();
}
示例11: GetViewDefinition
public ViewDefinition GetViewDefinition(UniqueId id)
{
return _rest.Resolve("id").Resolve(id.ToString()).Get<ViewDefinition>();
}