Example #1
1
        static bool Files(IList<string> unparsed)
        {
            if (unparsed.Count > 2)
            {
                Console.Error.WriteLine("Too many arguments for [files]: {0}", String.Join(", ", unparsed.Select(s => String.Format("'{0}'", s))));
                Console.Error.WriteLine("Usage: vmc files <appname> <path>");
                return false;
            }
            if (unparsed.Count < 1)
            {
                Console.Error.WriteLine("Not enough arguments for [files]: {0}", String.Join(", ", unparsed.Select(s => String.Format("'{0}'", s))));
                Console.Error.WriteLine("Usage: vmc files <appname> <path (optional)>");
                return false;
            }

            string appname = unparsed[0];
            string path = string.Empty;
            if (unparsed.Count == 2)
                path = unparsed[1];

            IVcapClient vc = new VcapClient();
            byte[] output = vc.FilesSimple(appname, path, 0);
            if (false == output.IsNullOrEmpty())
            {
                Stream stdout = Console.OpenStandardOutput();
                stdout.Write(output, 0, output.Length);
                stdout.Flush();
            }
            return true;
        }
Example #2
1
        /// <summary>
        /// Converts a timestamp  specified in seconds/nanoseconds to a string.
        /// </summary>
        /// <remarks>
        /// If the value is a normalized duration in the range described in <c>field_mask.proto</c>,
        /// <paramref name="diagnosticOnly"/> is ignored. Otherwise, if the parameter is <c>true</c>,
        /// a JSON object with a warning is returned; if it is <c>false</c>, an <see cref="InvalidOperationException"/> is thrown.
        /// </remarks>
        /// <param name="paths">Paths in the field mask</param>
        /// <param name="diagnosticOnly">Determines the handling of non-normalized values</param>
        /// <exception cref="InvalidOperationException">The represented field mask is invalid, and <paramref name="diagnosticOnly"/> is <c>false</c>.</exception>
        internal static string ToJson(IList<string> paths, bool diagnosticOnly)
        {
            var firstInvalid = paths.FirstOrDefault(p => !ValidatePath(p));
            if (firstInvalid == null)
            {
                var writer = new StringWriter();
#if DOTNET35
                var query = paths.Select(JsonFormatter.ToJsonName);
                JsonFormatter.WriteString(writer, string.Join(",", query.ToArray()));
#else
                JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToJsonName)));
#endif
                return writer.ToString();
            }
            else
            {
                if (diagnosticOnly)
                {
                    var writer = new StringWriter();
                    writer.Write("{ \"@warning\": \"Invalid FieldMask\", \"paths\": ");
                    JsonFormatter.Default.WriteList(writer, (IList)paths);
                    writer.Write(" }");
                    return writer.ToString();
                }
                else
                {
                    throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {firstInvalid}");
                }
            }
        }
      public async Task<IssuesCollectionStatistics> Calculate(IList<JiraIssue> issues)
      {
         if(issues == null || issues.Any() == false)
            return null;

         return await Task.Factory.StartNew(() =>
         {
            return new IssuesCollectionStatistics
            {
               IssuesCount = issues.Count(),
               ResolvedIssuesCount = issues.Where(i => i.Resolved.HasValue).Count(),
               UnresolvedIssuesCount = issues.Where(i => i.Resolved.HasValue == false).Count(),

               AverageResolutionTimeHours = issues
                                               .Where(i => i.Resolved.HasValue)
                                               .Select(i => (i.Resolved.Value - i.Created).TotalHours).Average(),
               MaxResolutionTimeHours = issues
                                               .Where(i => i.Resolved.HasValue)
                                               .Select(i => (i.Resolved.Value - i.Created).TotalHours).Max(),

               TotalStorypoints = issues.Sum(i => i.StoryPoints),
               AverageStorypointsPerTask = issues.Average(i => i.StoryPoints),

               AverageSubtasksCount = issues.Average(i => i.Subtasks),

               EpicsInvolved = issues.Select(i => i.EpicLink).Distinct().Count(),

               DistinctReporters = issues.Select(i => i.Reporter).Distinct().Count()
            };
         });
      }
        public OperationResult CopyOrMoveContentFromSelf(IList<FarFile> files, string destination, bool isMove)
        {
            OnDeviceOperation doc = null;

            if (_fs.CurrentLevel == EFileSystemLevel.OnDevice)
            {
                var playLists = files.Select(p => (Playlist)p.Data);

                if (IsSilentOperation() ||
                    CommonDialog.ForCopyPlayListsToPath(playLists, ref destination, isMove) == 0)
                {
                    doc = new CopyContentFromSelfOperation(
                        _fs.CurrentDevice, playLists, destination, isMove);

                }
            }
            else if (_fs.CurrentLevel == EFileSystemLevel.OnPlayList)
            {
                var tracks = files.Select(p => (Track)p.Data);

                if (IsSilentOperation() ||
                    CommonDialog.ForCopyTracksToPath(tracks, ref destination, isMove) == 0)
                {
                    doc = new CopyContentFromSelfOperation(
                         _fs.CurrentDevice, tracks, destination, isMove, IsInternalOperation() || IsSilentOperation());
                }
            }

            return execOperation(doc, files);
        }
Example #5
1
        /// <summary>
        /// Create a styles.xml file
        /// </summary>
        /// <param name="styles"></param>
        /// <returns></returns>
        internal static XmlFile CreateStyleXml(IList<XlsxCellStyle> styles)
        {
            var uniqueBorders = styles.Select(s => s.Border).Where(s => s != CellBorder.None).Distinct().ToList();
            uniqueBorders.Insert(0, CellBorder.None);

            var numberFormats = styles.Select(s => s.Format).Distinct().ToList();
            var uniqueFonts = styles.Select(s => s.Font).Distinct().ToList();
            uniqueFonts.Insert(0, new XlsxFont());

            var file = new XmlFile
            {
                ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
                Path = "xl/styles.xml"
            };

            var doc = new XDocument(new XElement(Namespaces.workbook + "styleSheet", new XAttribute("xmlns", Namespaces.workbook)));

            StyleAddNumFmtsElement(doc, numberFormats);
            StyleAddFontsElement(doc, uniqueFonts);
            StyleAddFillsElement(doc);
            StyleAddBordersElement(doc, uniqueBorders);
            StyleAddCellStyleXfsElement(doc);
            StyleAddCellXfsElement(doc, styles, uniqueBorders, numberFormats, uniqueFonts);

            file.Content = doc;

            return file;
        }
Example #6
1
        /// <summary>
        ///     获取百度地图静态图片
        /// </summary>
        /// <param name="lng">中心点经度</param>
        /// <param name="lat">中心点维度</param>
        /// <param name="scale">
        ///     返回图片大小会根据此标志调整。取值范围为1或2:
        ///     1表示返回的图片大小为size= width * height;
        ///     2表示返回图片为(width*2)*(height *2),且zoom加1
        ///     注:如果zoom为最大级别,则返回图片为(width*2)*(height*2),zoom不变。
        /// </param>
        /// <param name="zoom">地图级别。高清图范围[3, 18];低清图范围[3,19]</param>
        /// <param name="markersList">标记列表,如果为null则不输出标记</param>
        /// <param name="width">图片宽度。取值范围:(0, 1024]。</param>
        /// <param name="height">图片高度。取值范围:(0, 1024]。</param>
        /// <returns></returns>
        public static string GetBaiduStaticMap(double lng, double lat, int scale, int zoom,
            IList<BaiduMarkers> markersList, int width = 400, int height = 300)
        {
            var url = new StringBuilder();
            url.Append("http://api.map.baidu.com/staticimage?");

            url.AppendFormat("center={0},{1}", lng, lat);
            url.AppendFormat("&width={0}", width);
            url.AppendFormat("&height={0}", height);
            url.AppendFormat("&scale={0}", scale);
            url.AppendFormat("&zoom={0}", zoom);

            if (markersList != null && markersList.Count > 0)
            {
                url.AppendFormat("&markers={0}",
                    string.Join("|",
                        markersList.Select(z => string.Format("{0},{1}", z.Longitude, z.Latitude)).ToArray()));
                url.AppendFormat("&markerStyles={0}",
                    string.Join("|",
                        markersList.Select(z => string.Format("{0},{1},{2}", z.Size.ToString(), z.Label, z.Color))
                            .ToArray()));
            }

            return url.ToString();
        }
        public void AugmentCompletionSession(ICompletionSession session, IList<CompletionSet> completionSets)
        {
            if (IsHtmlFile && completionSets.Any())
            {
                var bottomSpan = completionSets.First().ApplicableTo;
                if (!JScriptEditorUtil.IsInJScriptLanguageBlock(_lbm, bottomSpan.GetStartPoint(bottomSpan.TextBuffer.CurrentSnapshot)))
                {
                    // This is an HTML statement completion session, so do nothing
                    return;
                }
            }

            // TODO: Reflect over the ShimCompletionSet to see where the Description value comes from
            //       as setting the property does not actually change the value.
            var newCompletionSets = completionSets
                .Select(cs => cs == null ? cs : new ScriptCompletionSet(
                    cs.Moniker,
                    cs.DisplayName,
                    cs.ApplicableTo,
                    cs.Completions
                        .Select(c => c == null ? c : new Completion(
                            c.DisplayText,
                            c.InsertionText,
                            DocCommentHelper.ProcessParaTags(c.Description),
                            c.IconSource,
                            c.IconAutomationText))
                        .ToList(),
                    cs.CompletionBuilders))
                .ToList();
            
            completionSets.Clear();

            newCompletionSets.ForEach(cs => completionSets.Add(cs));
        }
 public DesignTimeCompilationException(IList<DiagnosticMessage> compileResponseErrors)
     : base(string.Join(Environment.NewLine, compileResponseErrors.Select(e => e.FormattedMessage)))
 {
     CompilationFailures = compileResponseErrors.GroupBy(g => g.SourceFilePath, StringComparer.OrdinalIgnoreCase)
                                                .Select(g => new CompilationFailure(g.Key, g))
                                                .ToArray();
 }
Example #9
1
 public static void GetLocationSelectedListItem(IList<Location> locations, out MultiSelectList allLocation, out List<SelectListItem> selectListItems)
 {
     var multiSelectList = new MultiSelectList(locations, "LocationId", "Province", locations);
     allLocation = multiSelectList;
     selectListItems =
         locations.Select(o => new SelectListItem { Text = o.Province, Value = o.Province }).ToList();
 }
Example #10
0
        public static void TestConstructorArgumentsNullCombinations(Type testedType, Type[] typeArguments, IList<Func<object>> arguments)
        {
            if (testedType.IsGenericType)
            {
                testedType = testedType.MakeGenericType(typeArguments);
            }

            var argumentTypes = arguments.Select(argument => argument.Method.ReturnType).ToArray();
            var constructor = testedType.GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, argumentTypes, null);

            if (constructor == null)
            {
                throw new ArgumentException("Constructor could not be found");
            }

            for (int i = 0; i < arguments.Count; i++)
            {
                object[] args = arguments.Select(a => a()).ToArray();
                args[i] = null;

                Assert.That(() =>
                {
                    try
                    {
                        constructor.Invoke(args);
                    }
                    catch (TargetInvocationException exception)
                    {
                        throw exception.InnerException;
                    }
                }, Throws.TypeOf<ArgumentNullException>());
            }
        }
        /// <summary>
        ///     Extracts the specified number of evaluation unit samples from each navigator/maze species for subsuquent clustering
        ///     analysis.
        /// </summary>
        /// <param name="experimentId">The experiment that was executed.</param>
        /// <param name="run">The run number of the given experiment.</param>
        /// <param name="batch">The batch number of the given run.</param>
        /// <param name="allEvaluationUnits">All evaluation during the given experiment/run/batch.</param>
        /// <param name="sampleSize">The sample size to extract from each navigator/maze species.</param>
        /// <returns>The specified number of evaluation unit samples from each navigator/maze species.</returns>
        public static IList<MazeNavigatorEvaluationUnit> ExtractEvaluationUnitSamplesFromSpecies(int experimentId,
            int run,
            int batch, IList<MazeNavigatorEvaluationUnit> allEvaluationUnits, int sampleSize)
        {
            List<MazeNavigatorEvaluationUnit> evalUnitSamples = new List<MazeNavigatorEvaluationUnit>();

            // Extract all maze and navigator genome IDs
            var allMazeGenomeIds = allEvaluationUnits.Select(eu => eu.MazeId).Distinct().ToList();
            var allNavigatorGenomeIds = allEvaluationUnits.Select(eu => eu.AgentId).Distinct().ToList();

            // Get the species to which the mazes and navigators are assigned
            var mazeSpecieGenomesGroups = ExperimentDataHandler.GetSpecieAssignmentsForMazeGenomeIds(experimentId, run,
                batch, allMazeGenomeIds);
            var navigatorSpecieGenomesGroups =
                ExperimentDataHandler.GetSpecieAssignmentsForNavigatorGenomeIds(experimentId, run, batch,
                    RunPhase.Primary, allNavigatorGenomeIds);

            // Extract a sample of mazes and navigators for each of their respective species
            var sampleMazeIds = ExtractGenomeIdSample(mazeSpecieGenomesGroups, sampleSize);
            var sampleNavigatorIds = ExtractGenomeIdSample(navigatorSpecieGenomesGroups, sampleSize);

            // Collect maze and navigator samples
            CollectEvaluationSamples(sampleMazeIds, allEvaluationUnits, evalUnitSamples, true);
            CollectEvaluationSamples(sampleNavigatorIds, allEvaluationUnits, evalUnitSamples, true);

            return evalUnitSamples;
        }
 public TaskMessages(RemoteTask task, string taskMatchStyle, IList<TaskMessage> taskMessages)
 {
     this.task = task;
     this.taskMatchStyle = taskMatchStyle;
     messages = taskMessages.Select(tm => tm.Message).ToList();
     serverActions = taskMessages.Select(tm => tm.ServerAction).ToList();
 }
        public IList<string> GetDayActivity(IList<string> zoo, string killer)
        {
            if (!zoo.Contains(killer))
            {
                return new List<string>();
            }

            var herring = new List<string>(GameResources.Herrings);
            var goodTraits = new List<string>(GameResources.GoodTraits);
            var badTraits = new List<string>(GameResources.BadTraits);
            herring.Shuffle();
            goodTraits.Shuffle();
            badTraits.Shuffle();

            // good and bad traits
            int badIndex = 0;
            int goodIndex = 0;
            var clues = zoo.Select(x =>
                                {
                                    double chance = x == killer ? ChanceBadKillerTrait : ChanceBadFodderTrait;
                                    string trait = Extensions.RandomGenerator.Next(0, 999)/1000.0 < chance
                                        ? badTraits[badIndex++]
                                        : goodTraits[goodIndex++];
                                    return String.Format(trait, x);
                                }).ToList();

            // herrings
            int herringIndex = 0;
            clues.AddRange(zoo.Select(x => String.Format(herring[herringIndex++], x)));

            clues.Shuffle();

            return clues;
        }
Example #14
0
        public Volume(IList<Point> points)
        {
            var rangeX = new Range(points.Select(p => p.X));
            var rangeY = new Range(points.Select(p => p.Y));
            var rangeZ = new Range(points.Select(p => p.Z));

            this.location = new Point(rangeX.Min, rangeY.Min, rangeZ.Min);
            this.width = rangeX.Interval;
            this.height = rangeY.Interval;
            this.depth = rangeZ.Interval;
        }
 private IList<RoomState> GetRoomsStates(IList<Room> rooms, DateTime date)
 {
     var roomsIds = rooms.Select(r => r.Id).ToList();
     var furnitureItems = furnitureReader.Get(roomsIds, date);
     return rooms.Select(room => new RoomState
     {
         RoomId = room.Id,
         Date = room.CreateDate,
         RoomName = room.Name,
         FurnitureItems = furnitureItems.Where(f => f.RoomId == room.Id).ToList()
     }).ToList();
 }
        public List<TaskExecutionResult> ExecuteTasks(IList<IExecutableTask> list)
        {
            _taskStatusUpdater.BeginExecution(list);
            List<LuceneAction> luceneActions =
                list.Select(task => task as ILuceneIndexTask)
                    .SelectMany(task => task.GetActions())
                    .Distinct(LuceneActionComparison.Comparer)
                    .ToList();

            LuceneActionExecutor.PerformActions(_indexService, luceneActions);
            List<TaskExecutionResult> results = list.Select(TaskExecutionResult.Successful).ToList();
            _taskStatusUpdater.CompleteExecution(results);
            return results;
        }
        public List<TaskExecutionResult> ExecuteTasks(IList<IExecutableTask> list)
        {
            _taskStatusUpdater.BeginExecution(list);
            List<UniversalSearchIndexData> data =
                list.Select(task => task as IUniversalSearchIndexTask)
                    .Select(task => task.UniversalSearchIndexData)
                    .Distinct(UniversalSearchIndexData.Comparer)
                    .ToList();

            UniversalSearchActionExecutor.PerformActions(_universalSearchIndexManager, _searchConverter, data);
            List<TaskExecutionResult> results = list.Select(TaskExecutionResult.Successful).ToList();
            _taskStatusUpdater.CompleteExecution(results);
            return results;
        }
        private double CalculateNormalisedMean(IList<double> scores)
        {
            if(scores.Count == 0)
            {
                return 0;
            }

            //http://en.wikipedia.org/wiki/Weighted_mean
            return
                scores.Select(
                    (s, i) => (s * CalculateScoreWeight(i, _predictorParameters.PreviousGameMultiplier))).Sum()
                              /
                              scores.Select(
                                  (_, i) => CalculateScoreWeight(i, _predictorParameters.PreviousGameMultiplier)).Sum();
        }
Example #19
0
 public static CalibrationCurve LinearFit(IList<WeightedPoint> points)
 {
     CalibrationCurve calibrationCurve = new CalibrationCurve().ChangePointCount(points.Count);
     try
     {
         double[] values = WeightedRegression.Weighted(points.Select(p => new Tuple<double[], double>(new[] {p.X}, p.Y)),
             points.Select(p => p.Weight).ToArray(), true);
         calibrationCurve = calibrationCurve.ChangeSlope(values[1]).ChangeIntercept(values[0]);
     }
     catch (Exception ex)
     {
         calibrationCurve = calibrationCurve.ChangeErrorMessage(ex.Message);
     }
     return calibrationCurve;
 }
Example #20
0
        public IEnumerable<StudentIdName> GetStudents(IList<Student> students)
        {
            var result = students.Select(s => new StudentIdName
            {
                Id = s.Id,
                Name = s.Name
            });

            return result;

            var result1 = students.Select(s => new { Id = s.Id, Name = s.Name});
            var result2 = students.Select(s => new { Id = s.Id, Age = s.Age });
            var result3 = students.Select(s => new { Id = s.Id, Class = GetClass(s.Id) });
            // ......
        }
Example #21
0
        public static void Do(string strToFindInCommandLine, string strToFindInCommandLine2, IList<string> filename, bool giveFocus = true)
        {
            int procID = 0;

            string wmiQuery = "select ProcessId, CommandLine from Win32_Process";
            ManagementObjectSearcher search = new ManagementObjectSearcher(wmiQuery);
            ManagementObjectCollection processList = search.Get();

            foreach (ManagementObject process in processList) {
                if (process["CommandLine"] != null) {
                    var cmdLine = process["CommandLine"].ToString();
                    if (cmdLine.Contains(strToFindInCommandLine) && cmdLine.Contains(strToFindInCommandLine2)) {
                        procID = Convert.ToInt32(process["ProcessId"]);
                    }
                }
            }

            if (procID != 0) {
                IntPtr winHandle = FindWindow.GetProcessWindow(procID);
                MmdDrop.DropFile(winHandle, filename.Select(x => new MmdDropFile(x)).ToList());

                if (giveFocus)
                    SetForegroundWindow(winHandle);
            }
        }
        /// <summary>
        /// Adds and activates new set of fees
        /// </summary>
        /// <param name="classTermFees">A list of fees (i.e jss - sss)</param>
        /// <param name="username">The user performing this action, for audit trail.</param>
        /// <returns>A list of ids of the newly added fees and the ones deactivated </returns>
        public ActivatedAndDeactivatedId AddClassTermFees(IList<ClassTermFee> classTermFees, string username)
        {
            var currentFees = GetCurrentFees();

            var deActivatedIds = DeactivateFeesAndGetIds(currentFees);

            // Add fees and return ids
            try
            {
                var activatedIds = classTermFees.Select(x => _classTermFees.Add(x).Id).ToList();

                var activatedAndDeactivatedId = new ActivatedAndDeactivatedId
                {
                    DeActivatedIds = deActivatedIds,
                    ActivatedIds = activatedIds
                };

                // Update School
                UpdateSchool(classTermFees);

                _auditTrailRepository.Log($"School fees created by {username}", AuditActionEnum.Created);

                _log.Info("Fees added");

                return activatedAndDeactivatedId;

            }
            catch (Exception ex)
            {
                _log.Error("Error", ex);
                return null;
            }
        }
        public void OnTestingOfMutantStarting(string mutantDestination, IList<string> mutantFilePaths)
        {
            string src = _projectPath.Join("chromedriver.exe").Path;

            string dest = Path.Combine(mutantDestination, "chromedriver.exe");
            if (!File.Exists(dest))
            {
                File.Copy(src, dest, true);
            }

            foreach (var p in mutantFilePaths.Select(path=>new FilePathAbsolute(path)))
            {
                var mutdest = _projectPath.Join("bin");//.Join(p.FileName).Path;
             /*   if(File.Exists(mutdest.Join(p.FileName).Path))
                {
                    File.Move(mutdest.Join(p.FileName).Path, mutdest.Join(p.FileNameWithoutExtension).Join(".dlltmp").Path);
                }*/

                File.Copy(p.Path, mutdest.Join(p.FileName).Path, true);
            }


            Process.Start(cmdPath);

        }
Example #24
0
		internal static IList<ITypeReference> ToTypeReference(IList<IType> typeArguments)
		{
			if (typeArguments == null)
				return null;
			else
				return typeArguments.Select(t => t.ToTypeReference()).ToArray();
		}
Example #25
0
        public ClassAnalyzer(IList<IExtractor> extractors)
        {
            Ensure.NotNullOrEmpty(extractors);

            _extractors = extractors;
            _heuristics = _extractors.Select(x => x.Heuristic).ToList();
        }
			public static StringBuilder SetComplexTypes(List<string> strlist, IList<int> intlist, Dictionary<string, int> map,
				string[] strarray, int[] intarray)
			{
				StringBuilder sb = new StringBuilder();

				sb.Append(string.Join(",", strlist.ToArray()));

				sb.Append("|");

				sb.Append(string.Join(",", intlist.Select(i => i.ToString()).ToArray()));

				sb.Append("|");

				sb.Append(string.Join(",", map.Keys.OrderBy(x => x).Select(i => i.ToString()).ToArray()));

				sb.Append("|");

				sb.Append(string.Join(",", map.Values.OrderBy(x => x).Select(i => i.ToString()).ToArray()));

				sb.Append("|");

				sb.Append(string.Join(",", strarray));

				sb.Append("|");

				sb.Append(string.Join(",", intarray.Select(i => i.ToString()).ToArray()));

				return sb;
			}
Example #27
0
        private static IDictionary<string, int> PrefillAuthors(IList<boeken> books, AuthorRepository authorsRepo, UnitOfWork unitOfWork)
        {
            var allAuthorsInOldDb = books.Select(_ => _.auteurs.Trim()).Distinct().ToList();
            var newAuthors = authorsRepo.All.ToList();
            var result =  new Dictionary<string, int>();
            Console.WriteLine("Found {0} authors in old db", allAuthorsInOldDb.Count());
            foreach(var a in allAuthorsInOldDb)
            {
                var candidate = newAuthors.FirstOrDefault(_ => _.Name.ToLower() == a.ToLower());

                if (candidate == null)
                {
                    candidate = new Author()
                    {
                        State = State.Added,
                        Name = a
                    };

                    authorsRepo.InsertOrUpdate(candidate);                    
                    unitOfWork.Save();
                    newAuthors.Add(candidate);
                }
                result[a.ToLower()] = candidate.Id;                
            }
            

            return result;
        }
Example #28
0
        public IList<Order> StoreAll(Customer customer, IList<Order> orders)
        {
            foreach (var order in orders)
            {
                if (order.Id == default(Guid))
                {
                    order.Id = Guid.NewGuid();
                }
                order.UserId = customer.Id;
                if (!customer.Orders.Contains(order.Id))
                {
                    customer.Orders.Add(order.Id);
                }

                foreach (var x in order.Lines)
                    _redisClient
                        .IncrementItemInSortedSet(RedisKeys.BestSellingItems,
                            (string) x.Item, (long) x.Quantity);

            }
            var orderIds = orders.Select(o => o.Id.ToString()).ToList();
            using (var transaction = _redisClient.CreateTransaction())
            {
                transaction.QueueCommand(c => c.Store(customer));
                transaction.QueueCommand(c => c.StoreAll(orders));
                transaction.QueueCommand(c => c.AddRangeToSet(RedisKeys
                    .GetCustomerOrdersReferenceKey(customer.Id),
                    orderIds));
                transaction.Commit();
            }

            return orders;
        }
        private static IEnumerable<FileInfo> FindPatches(IList<string> inputPaths)
        {
            if (inputPaths.Count == 0)
                inputPaths.Add(".");

            // make all path's rooted
            IEnumerable<string> rootedPaths = inputPaths.Select(p =>
                                                                Path.IsPathRooted(p) ? p : Path.Combine(_baseDir, p)
                );

            foreach (string path in rootedPaths)
            {
                bool isDir = Directory.Exists(path);
                bool isFile = File.Exists(path);

                if (!(isDir || isFile))
                    throw new Exception("Could not find file or directory: " + path);

                if (isDir)
                {
                    var dir = new DirectoryInfo(path);
                    foreach (FileInfo file in dir.GetFiles("*.patch"))
                    {
                        if (!file.Name.StartsWith("svn-"))
                            yield return file;
                    }
                }
                else
                {
                    yield return new FileInfo(path);
                }
            }

            yield break;
        }
		public static IMethodOrProperty FindOverload(IList<IMethodOrProperty> list,
		                                             IReturnType[] arguments,
		                                             bool allowAdditionalArguments,
		                                             bool substituteInferredTypes,
		                                             out bool acceptableMatch)
		{
			OverloadResolution or = new OverloadResolution();
			or.candidates = list.Select(m => new Candidate(m)).ToList();
			or.arguments = arguments;
			or.allowAdditionalArguments = allowAdditionalArguments;
			
			if (or.candidates.Count == 0)
				throw new ArgumentException("at least one candidate is required");
			
			MemberLookupHelper.Log("OverloadResolution");
			MemberLookupHelper.Log("  arguments = ", arguments);
			
			or.ConstructExpandedForms();
			or.InferTypeArguments();
			or.CheckApplicability();
			
			Candidate result = or.FindBestCandidate();
			MemberLookupHelper.Log("Overload resolution finished. Winning candidate = " + result);
			acceptableMatch = result.Status == CandidateStatus.Success;
			if (substituteInferredTypes)
				return result.Method;
			else
				return result.OriginalMethod;
		}