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


C# IRun类代码示例

本文整理汇总了C#中IRun的典型用法代码示例。如果您正苦于以下问题:C# IRun类的具体用法?C# IRun怎么用?C# IRun使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IRun类属于命名空间,在下文中一共展示了IRun类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SubmitRun

        public virtual bool SubmitRun(
            IRun run,
            string username, string password, 
            Func<Image> screenShotFunction = null,
            bool attachSplits = false,
            TimingMethod method = TimingMethod.RealTime,
            string gameId = "", string categoryId = "",
            string version = "", string comment = "",
            string video = "",
            params string[] additionalParams)
        {
            try
            {
                if (attachSplits)
                    comment += " " + SplitsIO.Instance.Share(run, screenShotFunction);
                if (gameId == string.Empty)
                    gameId = GetGameIdByName(run.GameName);
                if (categoryId == string.Empty)
                    categoryId = GetCategoryIdByName(gameId, run.CategoryName);
                var json = ASUP.SubmitRun(run, username, password, gameId, categoryId, version, comment, video, additionalParams);
                return json.result == "success";
            }
            catch (Exception e)
            {
                Log.Error(e);

                return false;
            }
        }
开发者ID:xarrez,项目名称:LiveSplit,代码行数:29,代码来源:ASUPRunUploadPlatform.cs

示例2: Save

        public void Save(IRun run, Stream stream)
        {
            var regularTimeFormatter = new RegularTimeFormatter(TimeAccuracy.Hundredths);
            var shortTimeFormatter = new ShortTimeFormatter();

            var writer = new StreamWriter(stream);

            if (!string.IsNullOrEmpty(run.GameName))
            {
                writer.Write(Escape(run.GameName));

                if (!string.IsNullOrEmpty(run.CategoryName))
                    writer.Write(" - ");
            }

            writer.Write(Escape(run.CategoryName));
            writer.Write(',');
            writer.WriteLine(Escape(run.AttemptCount.ToString()));

            foreach (var segment in run)
            {
                writer.Write(Escape(segment.Name));
                writer.Write(',');
                writer.Write(Escape(regularTimeFormatter.Format(segment.PersonalBestSplitTime.RealTime)));
                writer.Write(',');
                writer.WriteLine(Escape(shortTimeFormatter.Format(segment.BestSegmentTime.RealTime)));
            }

            writer.Flush();
        }
开发者ID:PrototypeAlpha,项目名称:LiveSplit,代码行数:30,代码来源:SplitterZRunSaver.cs

示例3: ParseAttemptHistory

 private static void ParseAttemptHistory(Version version, XmlElement parent, IRun run)
 {
     if (version >= new Version(1, 5, 0))
     {
         var attemptHistory = parent["AttemptHistory"];
         foreach (var attemptNode in attemptHistory.GetElementsByTagName("Attempt"))
         {
             var attempt = Attempt.ParseXml(attemptNode as XmlElement);
             run.AttemptHistory.Add(attempt);
         }
     }
     else if (version >= new Version(1, 4, 1))
     {
         var runHistory = parent["RunHistory"];
         foreach (var runHistoryNode in runHistory.GetElementsByTagName("Time"))
         {
             var indexedTime = IndexedTimeHelper.ParseXml(runHistoryNode as XmlElement);
             var attempt = new Attempt(indexedTime.Index, indexedTime.Time, null, null);
             run.AttemptHistory.Add(attempt);
         }
     }
     else
     {
         var runHistory = parent["RunHistory"];
         foreach (var runHistoryNode in runHistory.GetElementsByTagName("Time"))
         {
             var indexedTime = IndexedTimeHelper.ParseXmlOld(runHistoryNode as XmlElement);
             var attempt = new Attempt(indexedTime.Index, indexedTime.Time, null, null);
             run.AttemptHistory.Add(attempt);
         }
     }
 }
开发者ID:Glurmo,项目名称:LiveSplit,代码行数:32,代码来源:XMLRunFactory.cs

示例4: return

 /// <summary>
 /// Gets or sets the RunVertex associated with the given IRun
 /// </summary>
 /// <param name="key">
 /// The IRun whose value to get or set.
 /// </param>
 public RunVertex this[IRun key]
 {
     get
     {
         return (RunVertex) this.Dictionary[key];
     }
 }
开发者ID:timonela,项目名称:mb-unit,代码行数:13,代码来源:RunVertexDictionary.cs

示例5: FailedLoadingRunInvoker

 public FailedLoadingRunInvoker(IRun generator, Exception exception)
     : base(generator)
 {
     if (exception == null)
         throw new ArgumentNullException("exception");
     this.exception = exception;
 }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:7,代码来源:FailedLoadingRunInvoker.cs

示例6: ChocolateyService

 public ChocolateyService(IRun powerShell, ISourceService sourceService)
 {
     _powershell = new RunSync();
     _sourceService = sourceService;
     _powershell.OutputChanged += OutPutChangedHandler;
     _powershell.RunFinished += RunFinishedHandler;
 }
开发者ID:Buildstarted,项目名称:chocolatey-Explorer,代码行数:7,代码来源:ChocolateyService.cs

示例7: ChocolateyService

 public ChocolateyService(IRunSync powerShell, ISourceService sourceService)
 {
     _powershell = powerShell;
     _sourceService = sourceService;
     _powershell.OutputChanged += InvokeOutputChanged;
     _powershell.RunFinished += OnRunFinished;
 }
开发者ID:jamescurran,项目名称:chocolatey-Explorer,代码行数:7,代码来源:ChocolateyService.cs

示例8: MethodFailedLoadingRunInvoker

 public MethodFailedLoadingRunInvoker(IRun generator, Exception exception, MethodInfo method)
     :base(generator,exception)
 {
     if (method == null)
         throw new ArgumentNullException("method");
     this.method = method;
 }
开发者ID:timonela,项目名称:mb-unit,代码行数:7,代码来源:MethodFailedLoadingRunInvoker.cs

示例9: PopulatePredictions

 private static void PopulatePredictions(IRun run, TimeSpan? currentTime, int segmentIndex, IList<TimeSpan?> predictions, bool simpleCalculation, bool useCurrentRun, TimingMethod method)
 {
     if (currentTime != null)
     {
         PopulatePrediction(predictions, currentTime + run[segmentIndex].BestSegmentTime[method], segmentIndex + 1);
         if (!simpleCalculation)
         {
             foreach (var nullSegment in run[segmentIndex].SegmentHistory.Where(x => !x.Value[method].HasValue))
             {
                 Time segmentTime;
                 if (segmentIndex == 0 
                     || !run[segmentIndex - 1].SegmentHistory.TryGetValue(nullSegment.Key, out segmentTime)
                     || segmentTime[method] != null)
                 {
                     var prediction = TrackBranch(run, currentTime, segmentIndex + 1, nullSegment.Key, method);
                     PopulatePrediction(predictions, prediction.Time[method], prediction.Index);
                 }
             }
         }
         if (useCurrentRun)
         {
             var currentRunPrediction = TrackCurrentRun(run, currentTime, segmentIndex, method);
             PopulatePrediction(predictions, currentRunPrediction.Time[method], currentRunPrediction.Index);
         }
         var personalBestRunPrediction = TrackPersonalBestRun(run, currentTime, segmentIndex, method);
         PopulatePrediction(predictions, personalBestRunPrediction.Time[method], personalBestRunPrediction.Index);
     }
 }
开发者ID:Rezura,项目名称:LiveSplit,代码行数:28,代码来源:SumOfBest.cs

示例10: ImportAsComparison

        public string ImportAsComparison(IRun run, Form form = null)
        {
            var splitDialog = new OpenFileDialog();

            var result = splitDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                var filePath = splitDialog.FileName;

                using (var stream = File.OpenRead(filePath))
                {
                    var runFactory = new StandardFormatsRunFactory();
                    var comparisonGeneratorsFactory = new StandardComparisonGeneratorsFactory();

                    runFactory.Stream = stream;
                    runFactory.FilePath = filePath;

                    var imported = runFactory.Create(comparisonGeneratorsFactory);

                    var comparisonName = Path.GetFileNameWithoutExtension(splitDialog.FileName);
                    result = InputBox.Show(form, "Enter Comparison Name", "Name:", ref comparisonName);
                    if (result != DialogResult.Cancel)
                        return run.AddComparisonWithNameInput(imported, comparisonName, form);
                }
            }
            return null;
        }
开发者ID:xarrez,项目名称:LiveSplit,代码行数:27,代码来源:FileRunImporter.cs

示例11: PackageVersionService

 public PackageVersionService(IRunAsync powershell, ISourceService sourceService)
 {
     _powershellAsync = powershell;
     _sourceService = sourceService;
     _powershellAsync.OutputChanged += VersionHandler;
     _powershellAsync.RunFinished += RunFinished;
 }
开发者ID:jamescurran,项目名称:chocolatey-Explorer,代码行数:7,代码来源:PackageVersionService.cs

示例12: PopulatePredictions

 private static void PopulatePredictions(IRun run, TimeSpan? currentTime, int segmentIndex, IList<TimeSpan?> predictions, bool simpleCalculation, bool useCurrentRun, TimingMethod method)
 {
     if (currentTime != null)
     {
         PopulatePrediction(predictions, currentTime + run[segmentIndex].BestSegmentTime[method], segmentIndex + 1);
         if (!simpleCalculation)
         {
             foreach (var nullSegment in run[segmentIndex].SegmentHistory.Where(x => !x.Time[method].HasValue))
             {
                 var segmentTime = segmentIndex > 0 ? run[segmentIndex - 1].SegmentHistory.FirstOrDefault(x => x.Index == nullSegment.Index) : null;
                 if (segmentTime == null || segmentTime.Time[method] != null)
                 {
                     var prediction = SumOfSegmentsHelper.TrackBranch(run, currentTime, segmentIndex + 1, nullSegment.Index, method);
                     PopulatePrediction(predictions, prediction.Time[method], prediction.Index);
                 }
             }
         }
         if (useCurrentRun)
         {
             var currentRunPrediction = SumOfSegmentsHelper.TrackCurrentRun(run, currentTime, segmentIndex, method);
             PopulatePrediction(predictions, currentRunPrediction.Time[method], currentRunPrediction.Index);
         }
         var personalBestRunPrediction = SumOfSegmentsHelper.TrackPersonalBestRun(run, currentTime, segmentIndex, method);
         PopulatePrediction(predictions, personalBestRunPrediction.Time[method], personalBestRunPrediction.Index);
     }
 }
开发者ID:kugelrund,项目名称:LiveSplit,代码行数:26,代码来源:SumOfBest.cs

示例13: PopulatePredictions

 private static void PopulatePredictions(IRun run, TimeSpan? currentTime, int segmentIndex, IList<TimeSpan?> predictions, bool useCurrentRun, TimingMethod method)
 {
     if (currentTime != null)
     {
         PopulatePrediction(predictions, currentTime + run[segmentIndex].BestSegmentTime[method], segmentIndex + 1);
         foreach (var segment in run[segmentIndex].SegmentHistory)
         {
             Time segmentTime;
             if (segmentIndex == 0 
                 || !run[segmentIndex - 1].SegmentHistory.TryGetValue(segment.Key, out segmentTime) 
                 || segmentTime[method] != null)
             {
                 var prediction = SumOfSegmentsHelper.TrackBranch(run, currentTime, segmentIndex, segment.Key, method);
                 PopulatePrediction(predictions, prediction.Time[method], prediction.Index);
             }
         }
         if (useCurrentRun)
         {
             var currentRunPrediction = SumOfSegmentsHelper.TrackCurrentRun(run, currentTime, segmentIndex, method);
             PopulatePrediction(predictions, currentRunPrediction.Time[method], currentRunPrediction.Index);
         }
         var personalBestRunPrediction = SumOfSegmentsHelper.TrackPersonalBestRun(run, currentTime, segmentIndex, method);
         PopulatePrediction(predictions, personalBestRunPrediction.Time[method], personalBestRunPrediction.Index);
     }
 }
开发者ID:Glurmo,项目名称:LiveSplit,代码行数:25,代码来源:SumOfWorst.cs

示例14: PackageService

 public PackageService(IRun powershell, ISourceService sourceService)
 {
     _powershellAsync = new RunAsync();
     _sourceService = sourceService;
     _powershellAsync.OutputChanged += OutputChanged;
     _powershellAsync.RunFinished += RunFinished;
 }
开发者ID:jamesmanning,项目名称:chocolatey-Explorer,代码行数:7,代码来源:PackageService.cs

示例15: AvailablePackagesService

 public AvailablePackagesService(IRunAsync powershell, ISourceService sourceService)
 {
     _lines = new List<string>();
     _sourceService = sourceService;
     _powershellAsync = powershell;
     _powershellAsync.OutputChanged += OutputChanged;
     _powershellAsync.RunFinished += RunFinished;
 }
开发者ID:jamescurran,项目名称:chocolatey-Explorer,代码行数:8,代码来源:AvailablePackagesService.cs


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