当前位置: 首页>>代码示例>>C#>>正文


C# Interval.ToString方法代码示例

本文整理汇总了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());
        }
开发者ID:zyh329,项目名称:nbi,代码行数:7,代码来源:NumericComparer.cs

示例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
//.........这里部分代码省略.........
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:101,代码来源:TvdbHandler.cs

示例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;
 }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:6,代码来源:TvdbLinkCreator.cs

示例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());
 }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:7,代码来源:IntervalTest.cs

示例6: ToString_Infinite

 public void ToString_Infinite()
 {
     var value = new Interval(null, null);
     Assert.AreEqual("StartOfTime/EndOfTime", value.ToString());
 }
开发者ID:nicklbailey,项目名称:nodatime,代码行数:5,代码来源:IntervalTest.cs

示例7: String

        public void String()
        {
            IInterval<int> interval = new Interval<int>(5, 10);

            Assert.AreEqual("[5, 10]", interval.ToString());
        }
开发者ID:andipaetzold,项目名称:IntervalDictionary,代码行数:6,代码来源:IntervalTest.cs

示例8: ToStringReturnsExpectedResult

 public void ToStringReturnsExpectedResult(Interval<double> sut, string expected)
 {
     Assert.Equal(expected, sut.ToString());
 }
开发者ID:Georadix,项目名称:Georadix.NET,代码行数:4,代码来源:IntervalFixture.cs


注:本文中的Interval.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。