本文整理汇总了C#中Interval.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Interval.ToString方法的具体用法?C# Interval.ToString怎么用?C# Interval.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interval
的用法示例。
在下文中一共展示了Interval.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareDecimals
protected ComparerResult CompareDecimals(Interval interval, decimal actual)
{
if (interval.Contains(actual))
return ComparerResult.Equality;
return new ComparerResult(interval.ToString());
}
示例2: PrintOverlappedIntervals
private static void PrintOverlappedIntervals(ICollection<Interval<int>> intervals, Interval<int> intervalInQuestion)
{
Console.WriteLine("\nIntervals that overlap with " + intervalInQuestion.ToString());
foreach(var i in intervals)
{
Console.WriteLine(i.ToString());
}
}
开发者ID:nadiahristova,项目名称:Data-Structures-Algorithms-and-Complexity,代码行数:8,代码来源:PlayWithIntervalTree.cs
示例3: MakeUpdate
/// <summary>
/// Make the update
/// </summary>
/// <param name="interval">interval of update</param>
/// <param name="zipped">zipped downloading yes/no</param>
/// <param name="reloadOldContent"> </param>
/// <returns>true if successful, false otherwise</returns>
private bool MakeUpdate(Interval interval, bool zipped, bool reloadOldContent)
{
Log.Info("Started update (" + interval + ")");
Stopwatch watch = new Stopwatch();
watch.Start();
DateTime startUpdate = DateTime.Now;
if (UpdateProgressed != null)
{//update has started, we're downloading the updated content from tvdb
UpdateProgressed(new UpdateProgressEventArgs(UpdateProgressEventArgs.UpdateStage.Downloading,
"Downloading " + (zipped ? " zipped " : " unzipped") +
" updated content (" + interval.ToString() + ")",
0, 0));
}
//update all flagged series
List<TvdbSeries> updateSeries;
List<TvdbEpisode> updateEpisodes;
List<TvdbBanner> updateBanners;
List<int> updatedSeriesIds = new List<int>();
List<int> updatedEpisodeIds = new List<int>();
List<int> updatedBannerIds = new List<int>();
DateTime updateTime = _downloader.DownloadUpdate(out updateSeries, out updateEpisodes, out updateBanners, interval, zipped);
List<int> cachedSeries = _cacheProvider.GetCachedSeries();
//list of all series that have been loaded from cache
//and need to be saved to cache at the end of the update
Dictionary<int, TvdbSeries> seriesToSave = new Dictionary<int, TvdbSeries>();
if (UpdateProgressed != null)
{//update has started, we're downloading the updated content from tvdb
UpdateProgressed(new UpdateProgressEventArgs(UpdateProgressEventArgs.UpdateStage.SeriesUpdate,
"Begin updating series",
0, 25));
}
int countUpdatedSeries = updateSeries.Count;
int countSeriesDone = 0;
int lastProgress = 0;//send progress event at least every 1 percent
String updateText = "Updating series";
if (reloadOldContent)
{
//if the last time an item (series or episode) was updated is longer ago than the timespan
//we downloaded updates for, it's neccessary to completely reload the object to ensure that
//the data is up to date.
DateTime lastupdated = GetLastUpdate();
TimeSpan span = new TimeSpan();
switch (interval)
{
case Interval.Day:
span = span.Add(new TimeSpan(1, 0, 0, 0));
break;
case Interval.Week:
span = span.Add(new TimeSpan(7, 0, 0, 0));
break;
case Interval.Month:
span = span.Add(new TimeSpan(30, 0, 0, 0));
break;
}
if (lastupdated < DateTime.Now - span)
{//the last update of the cache is longer ago than the timespan we make the update for
List<int> allSeriesIds = _cacheProvider.GetCachedSeries();
foreach (int s in allSeriesIds)
{
//TvdbSeries series = _cacheProvider.LoadSeriesFromCache(s);
TvdbSeries series = seriesToSave.ContainsKey(s) ? seriesToSave[s] : _cacheProvider.LoadSeriesFromCache(s);
//ForceReload(series, false);
if (series.LastUpdated > DateTime.Now - span)
{
//the series object is up to date, but some episodes might not be
foreach (TvdbEpisode e in series.Episodes)
{
if (e.LastUpdated < DateTime.Now - span)
{
if (TvDbUtils.FindEpisodeInList(e.Id, updateEpisodes) == null)
{//The episode is not in the updates.xml file
TvdbEpisode newEp = new TvdbEpisode();
newEp.Id = e.Id;
newEp.LastUpdated = DateTime.Now;
updateEpisodes.Add(newEp);
}
if (!seriesToSave.ContainsKey(series.Id)) seriesToSave.Add(series.Id, series);
}
}
}
else
//.........这里部分代码省略.........
示例4: CreateUpdateLink
internal static String CreateUpdateLink(string apiKey, Interval interval, bool zipped)
{
String link = String.Format("{0}/api/{1}/updates/updates_{2}{3}", BASE_SERVER, apiKey,
interval.ToString().ToLowerInvariant(), (zipped ? ".zip" : ".xml"));
return link;
}
示例5: ToStringUsesExtendedIsoFormat
public void ToStringUsesExtendedIsoFormat()
{
var start = new LocalDateTime(2013, 4, 12, 17, 53, 23, 123, 4567).InUtc().ToInstant();
var end = new LocalDateTime(2013, 10, 12, 17, 1, 2, 120).InUtc().ToInstant();
var value = new Interval(start, end);
Assert.AreEqual("2013-04-12T17:53:23.1234567Z/2013-10-12T17:01:02.12Z", value.ToString());
}
示例6: ToString_Infinite
public void ToString_Infinite()
{
var value = new Interval(null, null);
Assert.AreEqual("StartOfTime/EndOfTime", value.ToString());
}
示例7: String
public void String()
{
IInterval<int> interval = new Interval<int>(5, 10);
Assert.AreEqual("[5, 10]", interval.ToString());
}
示例8: ToStringReturnsExpectedResult
public void ToStringReturnsExpectedResult(Interval<double> sut, string expected)
{
Assert.Equal(expected, sut.ToString());
}