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


C# Dictionary.Concat方法代码示例

本文整理汇总了C#中System.Collections.Dictionary.Concat方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.Concat方法的具体用法?C# Dictionary.Concat怎么用?C# Dictionary.Concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Dictionary的用法示例。


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

示例1: GetMergedMap

 public Dictionary<string, object> GetMergedMap()
 {
     Dictionary<string, object> finalPurchase = new Dictionary<string, object>();
     IEnumerator<KeyValuePair<Part, Dictionary<string, object>>> enumerator = purchase.GetEnumerator ();
     while(enumerator.MoveNext())
     {
         Logger.Log(enumerator.Current.ToString());
         finalPurchase = finalPurchase.Concat(enumerator.Current.Value)
             .ToDictionary (d => d.Key, d => d.Value);
     //					.GroupBy(d => d.Key)
     //					.ToDictionary (d => d.Key, d => d.First().Value);
     }
     return finalPurchase;
 }
开发者ID:xsolla,项目名称:xsolla-unity-sdk,代码行数:14,代码来源:ActivePurchase.cs

示例2: GenerateAssembly

        static Dictionary<Type, uint> s_Type_caseIDtypeIDMap; // Type => (typeID | (caseID << 16))

        #endif

        #if GENERATE_DEBUGGING_ASSEMBLY

        static void GenerateAssembly(Type[] types, Dictionary<Type, TypeData> typeMap)
        {
            Dictionary<Type, TypeData> _map = GenerateTypeData(types);
            Dictionary<Type, TypeData> map = typeMap.Concat(_map).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

            var nonStaticTypes = map.Where(kvp => kvp.Value.IsDynamic).Select(kvp => kvp.Key);

            var ab = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("NetSerializerDebug"), AssemblyBuilderAccess.RunAndSave);
            var modb = ab.DefineDynamicModule("NetSerializerDebug.dll");
            var tb = modb.DefineType("NetSerializer", TypeAttributes.Public);

            /* generate stubs */
            foreach (var type in nonStaticTypes)
            {
                var mb = SerializerCodegen.GenerateStaticSerializerStub(tb, type);
                map[type].WriterMethodInfo = mb;
                map[type].WriterILGen = mb.GetILGenerator();
            }

            foreach (var type in nonStaticTypes)
            {
                var dm = DeserializerCodegen.GenerateStaticDeserializerStub(tb, type);
                map[type].ReaderMethodInfo = dm;
                map[type].ReaderILGen = dm.GetILGenerator();
            }

            #if GENERATE_SWITCH
            var serializerSwitchMethod = tb.DefineMethod("SerializerSwitch", MethodAttributes.Public | MethodAttributes.Static, null, new Type[] { typeof(Stream), typeof(object), typeof(ObjectList) });
            serializerSwitchMethod.DefineParameter(1, ParameterAttributes.None, "stream");
            serializerSwitchMethod.DefineParameter(2, ParameterAttributes.None, "value");
            serializerSwitchMethod.DefineParameter(3, ParameterAttributes.None, "objList");
            var serializerSwitchMethodInfo = serializerSwitchMethod;

            var deserializerSwitchMethod = tb.DefineMethod("DeserializerSwitch", MethodAttributes.Public | MethodAttributes.Static, null, new Type[] { typeof(Stream), typeof(object).MakeByRefType(), typeof(ObjectList) });
            deserializerSwitchMethod.DefineParameter(1, ParameterAttributes.None, "stream");
            deserializerSwitchMethod.DefineParameter(2, ParameterAttributes.Out, "value");
            deserializerSwitchMethod.DefineParameter(3, ParameterAttributes.None, "objList");
            var deserializerSwitchMethodInfo = deserializerSwitchMethod;

            var ctx = new CodeGenContext(map, serializerSwitchMethodInfo, deserializerSwitchMethodInfo);
            #else
            var ctx = new CodeGenContext(map);
            #endif

            /* generate bodies */
            foreach (var type in nonStaticTypes)
            {
                SerializerCodegen.GenerateSerializerBody(ctx, type, map[type].WriterILGen);
                DeserializerCodegen.GenerateDeserializerBody(ctx, type, map[type].ReaderILGen);
            }

            #if GENERATE_SWITCH
            var ilGen = serializerSwitchMethod.GetILGenerator();
            SerializerCodegen.GenerateSerializerSwitch(ctx, ilGen, map);

            ilGen = deserializerSwitchMethod.GetILGenerator();
            DeserializerCodegen.GenerateDeserializerSwitch(ctx, ilGen, map);
            #else
            foreach (var kvp in map)
            {
                GetSerializationInvoker(tb, kvp.Value.WriterMethodInfo, kvp.Key, (int)kvp.Value.TypeID);
                GetDeserializationInvoker(tb, kvp.Value.ReaderMethodInfo, kvp.Key, (int)kvp.Value.TypeID);
            }
            #endif
            tb.CreateType();
            ab.Save("NetSerializerDebug.dll");
            SerializationID.userID = SerializationID.userIDstart;
        }
开发者ID:smalinin,项目名称:netserializer,代码行数:74,代码来源:Main.cs

示例3: SafeExploreProps

        private IEnumerable<Pair<String, Object>> SafeExploreProps(Object obj)
        {
            var scope = BindingFlags.Instance;
            if ((Explore & Explore.Private) != 0) scope |= BindingFlags.NonPublic;
            if ((Explore & Explore.Public) != 0) scope |= BindingFlags.Public;

            var outFields = new Dictionary<String, Object>();
            foreach (var f in obj.GetType().GetExplorableFields(scope))
            {
                if (AcceptFieldCriterion(obj, f))
                {
                    outFields.Add(f.Name.NormalizeFieldName(), SafeGet(() => f.GetValue(obj)));
                }
            }

            var outProps = new Dictionary<String, Object>();
            var props = obj.GetType().GetExplorableProperties(scope);
            foreach (var p in props)
            {
                var sameCase = p.Name;
                var camelCase = Char.ToLower(p.Name[0]) + p.Name.Substring(1);
                var _camelCase = "_" + camelCase;
                var m_undercase = "m" + _camelCase;

                Object sfval = null, cfval = null, ufval = null, mufval = null;
                var dupeName = outFields.TryGetValue(sameCase, out sfval);
                dupeName |= outFields.TryGetValue(camelCase, out cfval);
                dupeName |= outFields.TryGetValue(_camelCase, out ufval);
                dupeName |= outFields.TryGetValue(m_undercase, out mufval);

                // todo. not 100% correct since it doesn't take into account diff names avail at once
                var fval = sfval ?? cfval ?? ufval ?? mufval;
                var pval = SafeGet(() => p.GetValue(obj, null));

                if (dupeName)
                {
                    if (fval == null || pval == null)
                    {
                        if (fval == null && pval == null)
                        {
                            outFields.Remove(sameCase);
                            outFields.Remove(camelCase);
                            outFields.Remove(_camelCase);
                            outFields.Remove(m_undercase);
                        }
                    }
                    else
                    {
                        var ftype = fval.GetType();
                        var ptype = pval.GetType();

                        if (!(ftype.IsClass ^ ptype.IsClass))
                        {
                            if (ftype.IsClass && ptype.IsClass)
                            {
                                if (ReferenceEquals(fval, pval))
                                {
                                    outFields.Remove(sameCase);
                                    outFields.Remove(camelCase);
                                    outFields.Remove(_camelCase);
                                    outFields.Remove(m_undercase);
                                }
                            }
                            else
                            {
                                if (Equals(fval, pval))
                                {
                                    outFields.Remove(sameCase);
                                    outFields.Remove(camelCase);
                                    outFields.Remove(_camelCase);
                                    outFields.Remove(m_undercase);
                                }
                            }
                        }
                    }
                }

                if (AcceptPropCriterion(obj, p))
                {
                    outProps.Add(p.Name, pval);
                }
            }

            return outFields.Concat(outProps).Select(kvp => new Pair<String, Object>(kvp.Key, kvp.Value));
        }
开发者ID:xeno-by,项目名称:relinq,代码行数:85,代码来源:SimpleExplorer.cs

示例4: GenerateDynamic

        static Dictionary<Type, TypeData> GenerateDynamic(Type[] types, Dictionary<Type, TypeData> typeMap)
        {
            Dictionary<Type, TypeData> _map = GenerateTypeData(types);
            Dictionary<Type, TypeData> map = typeMap.Concat(_map).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

            var nonStaticTypes = map.Where(kvp => kvp.Value.IsDynamic).Select(kvp => kvp.Key);

            /* generate stubs */
            foreach (var type in nonStaticTypes)
            {
                var s_dm = SerializerCodegen.GenerateDynamicSerializerStub(type);
                var typeData = map[type];
                typeData.WriterMethodInfo = s_dm;
                typeData.WriterILGen = s_dm.GetILGenerator();

                var d_dm = DeserializerCodegen.GenerateDynamicDeserializerStub(type);
                typeData.ReaderMethodInfo = d_dm;
                typeData.ReaderILGen = d_dm.GetILGenerator();
            }

            #if GENERATE_SWITCH
            var serializerSwitchMethod = new DynamicMethod("SerializerSwitch", null,
                new Type[] { typeof(Stream), typeof(object), typeof(ObjectList) },
                typeof(Serializer), true);
            serializerSwitchMethod.DefineParameter(1, ParameterAttributes.None, "stream");
            serializerSwitchMethod.DefineParameter(2, ParameterAttributes.None, "value");
            serializerSwitchMethod.DefineParameter(3, ParameterAttributes.None, "objList");
            var serializerSwitchMethodInfo = serializerSwitchMethod;

            var deserializerSwitchMethod = new DynamicMethod("DeserializerSwitch", null,
                new Type[] { typeof(Stream), typeof(object).MakeByRefType(), typeof(ObjectList) },
                typeof(Serializer), true);
            deserializerSwitchMethod.DefineParameter(1, ParameterAttributes.None, "stream");
            deserializerSwitchMethod.DefineParameter(2, ParameterAttributes.Out, "value");
            deserializerSwitchMethod.DefineParameter(3, ParameterAttributes.Out, "objList");
            var deserializerSwitchMethodInfo = deserializerSwitchMethod;

            var ctx = new CodeGenContext(map, serializerSwitchMethodInfo, deserializerSwitchMethodInfo);
            #else
            var ctx = new CodeGenContext(map);
            #endif

            /* generate bodies */
            foreach (var type in nonStaticTypes)
            {
                SerializerCodegen.GenerateSerializerBody(ctx, type, map[type].WriterILGen);
                DeserializerCodegen.GenerateDeserializerBody(ctx, type, map[type].ReaderILGen);
            }

            #if GENERATE_SWITCH
            var ilGen = serializerSwitchMethod.GetILGenerator();
            SerializerCodegen.GenerateSerializerSwitch(ctx, ilGen, map);
            s_serializerSwitch = (SerializerSwitch)serializerSwitchMethod.CreateDelegate(typeof(SerializerSwitch));

            ilGen = deserializerSwitchMethod.GetILGenerator();
            DeserializerCodegen.GenerateDeserializerSwitch(ctx, ilGen, map);
            s_deserializerSwitch = (DeserializerSwitch)deserializerSwitchMethod.CreateDelegate(typeof(DeserializerSwitch));
            #else
            foreach (var kvp in map)
            {
                kvp.Value.serializer = GetSerializationInvoker(null, kvp.Value.WriterMethodInfo, kvp.Key, (int)kvp.Value.TypeID);
                kvp.Value.deserializer = GetDeserializationInvoker(null, kvp.Value.ReaderMethodInfo, kvp.Key, (int)kvp.Value.TypeID);
            }
            #endif

            return map;
        }
开发者ID:smalinin,项目名称:netserializer,代码行数:67,代码来源:Main.cs

示例5: CompareSameMatch


//.........这里部分代码省略.........
                                            }
                                        }
                                    }
                                }
                                this._listSameMatch.Add(matchDTO);
                            }
                        }
                    }
                    System.DateTime now = System.DateTime.Now;
                    System.TimeSpan timeSpan;

                    System.DateTime now2 = System.DateTime.Now;
                    timeSpan = now2 - now;
                    double totalMilliseconds = timeSpan.TotalMilliseconds;
                    BarItem arg_648_0 = this.lblSbobetTotalMatch;
                    int count = sMatchs.Count;
                    arg_648_0.Caption = count.ToString();
                    BarItem arg_663_0 = this.lblIbetTotalMatch;
                    count = iMatchs.Count;
                    arg_663_0.Caption = count.ToString();
                    this.lblSameMatch.Caption = "Total Same Match: " + this._listSameMatch.Count;
                    this.lblLastUpdate.Caption = System.DateTime.Now.ToString();
                    #endregion
                }
                else if (scantype == ScanningType.ibet || scantype == ScanningType.ibetVSibet)
                {                    
                    Dictionary<string, IbetMatch> iMatchs1 = new Dictionary<string, IbetMatch>();
                    Dictionary<string, IbetMatch> iMatchs0 = new Dictionary<string, IbetMatch>();
                    if (checkEdit5.Checked)//live
                        iMatchs0 = this._ibetEngine.ibetAgent.parser.LdicMatches[0];
                    if (checkEdit6.Checked)//non live
                        iMatchs1 = this._ibetEngine.ibetAgent.parser.LdicMatches[1];

                    this._ibetMatchs = iMatchs1.Concat(iMatchs0).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.First().Value);
                    lock (this._ibetMatchs)
                    {
                        foreach (KeyValuePair<string, IbetMatch> iM in _ibetMatchs)
                        {
                            #region SAMEWORD_PREPARE_MATCHLIST
                            MatchDTO matchDTO = new MatchDTO();
                            matchDTO.ID = iM.Value.MatchId;
                            matchDTO.AwayTeamName = iM.Value.Away;
                            matchDTO.HomeTeamName = iM.Value.Home;
                            //matchDTO.KickOffTime = iM.Value.KickOffTime;
                            string formatString = "yyyyMMddHHmm";
                            //string sample = "201006112219";
                            DateTime dt = DateTime.ParseExact(iM.Value.KickOffTime, formatString, null);
                            matchDTO.KickOffTime = dt.ToString("dd/MM HH:mm");
                            DateTime ct = DateTime.Parse(this._ibetEngine.ibetAgent.CT);
                            TimeSpan ts = dt.Subtract(ct);//kick off time - current time
                            double tic = ts.TotalSeconds;
                            if (tic <= 300 && tic > 0)
                            {
                                matchDTO.KickOffTime += " - " + ts.Minutes.ToString() + " mins to start";
                            }
                            else if (tic < 0)
                            {
                                matchDTO.KickOffTime += " !Live";
                            }

                            matchDTO.Minute = iM.Value.Minute;
                            matchDTO.HomeScore = iM.Value.ScoreH.ToString();
                            matchDTO.AwayScore = iM.Value.ScoreA.ToString();

                            if (iM.Value.Period == 0)
                                matchDTO.IsHalfTime = true;
开发者ID:nikersch,项目名称:BuonComIbetSbobet3In1Bet,代码行数:67,代码来源:TerminalFormIBETSBO.cs

示例6: Process

        /// <summary>
        /// Process is used to return a JSON object containing a variety of information about the host system
        /// which is running the WaveBox server
        /// </summary>
        public void Process(UriWrapper uri, IHttpProcessor processor, User user)
        {
            try
            {
                // Allocate an array of various statistics about the running process
                IDictionary<string, object> status = new Dictionary<string, object>();

                // Gather data about WaveBox process
                global::System.Diagnostics.Process proc = global::System.Diagnostics.Process.GetCurrentProcess();

                // Get current UNIX time
                long unixTime = DateTime.UtcNow.ToUnixTime();

                // Get current query log ID
                long queryLogId = Injection.Kernel.Get<IDatabase>().LastQueryLogId;

                // Get process ID
                status["pid"] = proc.Id;
                // Get uptime of WaveBox instance
                status["uptime"] = unixTime - WaveBoxService.StartTime.ToUnixTime();
                // Get last update time in UNIX format for status
                status["updated"] = unixTime;
                // Get hostname of machine
                status["hostname"] = System.Environment.MachineName;
                // Get WaveBox version
                status["version"] = WaveBoxService.BuildVersion;
                // Get build date
                status["buildDate"] = WaveBoxService.BuildDate.ToString("MMMM dd, yyyy");
                // Get host platform
                status["platform"] = WaveBoxService.OS.ToDescription();
                // Get current CPU usage
                status["cpuPercent"] = CpuUsage();
                // Get current memory usage in MB
                status["memoryMb"] = (float)proc.WorkingSet64 / 1024f / 1024f;
                // Get peak memory usage in MB
                status["peakMemoryMb"] = (float)proc.PeakWorkingSet64 / 1024f / 1024f;
                // Get list of media types WaveBox can index and serve (removing "Unknown")
                status["mediaTypes"] = Enum.GetNames(typeof(FileType)).Where(x => x != "Unknown").ToList();
                // Get list of transcoders available
                status["transcoders"] = Enum.GetNames(typeof(TranscodeType)).ToList();
                // Get list of services
                status["services"] = ServiceManager.GetServices();
                // Get last query log ID
                status["lastQueryLogId"] = queryLogId;

                // Call for extended status, which uses some database intensive calls
                if (uri.Parameters.ContainsKey("extended"))
                {
                    if (uri.Parameters["extended"].IsTrue())
                    {
                        // Check if any destructive queries have been performed since the last cache
                        if ((statusCache.LastQueryId == null) || (queryLogId > statusCache.LastQueryId))
                        {
                            // Update to the latest query log ID
                            statusCache.LastQueryId = queryLogId;

                            logger.IfInfo("Gathering extended status metrics from database");

                            // Get count of artists
                            statusCache.Cache["artistCount"] = Injection.Kernel.Get<IArtistRepository>().CountArtists();
                            // Get count of album artists
                            statusCache.Cache["albumArtistCount"] = Injection.Kernel.Get<IAlbumArtistRepository>().CountAlbumArtists();
                            // Get count of albums
                            statusCache.Cache["albumCount"] = Injection.Kernel.Get<IAlbumRepository>().CountAlbums();
                            // Get count of songs
                            statusCache.Cache["songCount"] = Injection.Kernel.Get<ISongRepository>().CountSongs();
                            // Get count of videos
                            statusCache.Cache["videoCount"] = Injection.Kernel.Get<IVideoRepository>().CountVideos();
                            // Get total file size of songs (bytes)
                            statusCache.Cache["songFileSize"] = Injection.Kernel.Get<ISongRepository>().TotalSongSize();
                            // Get total file size of videos (bytes)
                            statusCache.Cache["videoFileSize"] = Injection.Kernel.Get<IVideoRepository>().TotalVideoSize();
                            // Get total song duration
                            statusCache.Cache["songDuration"] = Injection.Kernel.Get<ISongRepository>().TotalSongDuration();
                            // Get total video duration
                            statusCache.Cache["videoDuration"] = Injection.Kernel.Get<IVideoRepository>().TotalVideoDuration();

                            logger.IfInfo("Metric gathering complete, cached results!");
                        }

                        // Append cached status dictionary to status
                        status = status.Concat(statusCache.Cache).ToDictionary(x => x.Key, x => x.Value);
                    }
                }

                // Return all status
                processor.WriteJson(new StatusResponse(null, status));
                return;
            }
            catch (Exception e)
            {
                logger.Error(e);
            }

            // Return error
            processor.WriteJson(new StatusResponse("Could not retrieve server status", null));
//.........这里部分代码省略.........
开发者ID:einsteinx2,项目名称:WaveBox,代码行数:101,代码来源:StatusApiHandler.cs

示例7: Generate


//.........这里部分代码省略.........
                else merchantsDict.Add(key, dict[key]); 
            }

            if (piratesDict.Keys.Count == 0) return;

            //This dictionary of pirates is the one we'll use to save intercept courses.
            Dictionary<T_Move, T_Reveal> piratesWithInterceptCourse = new Dictionary<T_Move, T_Reveal>();

            //Set each pirate on the shortest intercept course to a newly revealed or existing merchant.
            foreach (T_Move pirateMove in piratesDict.Keys) {
                Vec2D pirateLocation = new Vec2D(GetLocation(pirateMove, piratesDict[pirateMove]));

                //=========Check newly revealed merchants created in this item to find closest ===========================//
                double timeToIntercept = 1000000000000000;
                Vec2D closestInterceptPoint = null;
                T_Move closestNewMerchant = null;

                foreach (T_Move merchantMove in merchantsDict.Keys)
                {
                    double merchantSpeed = merchantMove.Throttle * GetMaxSpeed(merchantMove);
                    Vec2D merchantStart = new Vec2D(GetLocation(merchantMove, merchantsDict[merchantMove]));
                    Vec2D merchantDestination = new Vec2D((LocationValue)merchantMove.Location.Item);
                    Vec2D interceptPoint = GetInterceptPoint(merchantStart, merchantDestination, merchantSpeed, pirateLocation, GetMaxSpeed(pirateMove));
                    double merchantTimeToIntercept = merchantStart.ScalerDistanceTo(interceptPoint) / merchantSpeed;
                    if (merchantTimeToIntercept < timeToIntercept)
                    {
                        closestNewMerchant = merchantMove;
                        closestInterceptPoint = interceptPoint;
                        timeToIntercept = merchantTimeToIntercept;
                    }
                }            

                //============Check merchants already revealed, see if one is closer ========================
                //TODO: make sure any merchants we will move in this round are not being compared
                DDDAdapter.SeamateObject closestRevealedMerchant = null;
             
                foreach (DDDAdapter.SeamateObject vessel in revealedSeaVessels)
                {
                    //Compare all the existing merchants' positions to see if they are closer.

                    //if (vessel.ID == closestNewMerchant.ID) continue;

                    if (vessel.Owner == "Merchant DM")
                    {
                        double merchantSpeed = vessel.Throttle * vessel.MaximumSpeed;
                        Vec2D merchantStart = new Vec2D(vessel.Location);
                        Vec2D merchantDestination = new Vec2D(vessel.DestinationLocation);
                        Vec2D interceptPoint = GetInterceptPoint(merchantStart, merchantDestination, merchantSpeed, pirateLocation, GetMaxSpeed(pirateMove));

                        double merchantTimeToIntercept = merchantStart.ScalerDistanceTo(interceptPoint) / merchantSpeed;
                        if (merchantTimeToIntercept < timeToIntercept)
                        {
                            closestNewMerchant = null;
                            closestRevealedMerchant = vessel;
                            closestInterceptPoint = interceptPoint;
                            timeToIntercept = merchantTimeToIntercept;
                        }
                    }
                    else continue; //ignore pirates or fleet ships
                }


                if (closestInterceptPoint == null)
                {
                    return;
                }
                //Make a new move for the pirate, containing the pirate's intercept course.
                T_Move moveWithInterceptCourse = new T_Move();
                moveWithInterceptCourse.ID = pirateMove.ID;
                moveWithInterceptCourse.Throttle = 1.0;
                moveWithInterceptCourse.Location = new T_Location();
                moveWithInterceptCourse.Location.Item = closestInterceptPoint.ToLocationValue();



                
                //Set the pirate and merchant's "Intent" relating to the intercept in their SimObjects
                if (closestNewMerchant != null)
                {
                    ddd.UpdateObjectAttribute(closestNewMerchant.ID, "Intent", "Being intercepted:" + pirateMove.ID + ":" + timeToIntercept, "AGENT");   //Merchant
                    ddd.UpdateObjectAttribute(pirateMove.ID, "Intent", "Intercepting:" + closestNewMerchant.ID + ":" + timeToIntercept, "AGENT");  //Pirate
                }
                else if (closestRevealedMerchant != null)
                {
                    ddd.UpdateObjectAttribute(closestRevealedMerchant.ID, "Intent", "Being intercepted:" + pirateMove.ID + ":" + timeToIntercept, "AGENT");   //Merchant
                    ddd.UpdateObjectAttribute(pirateMove.ID, "Intent", "Intercepting:" + closestRevealedMerchant.ID + ":" + timeToIntercept, "AGENT");  //Pirate
                }
                else
                    Console.Error.WriteLine("Fix intercept generator");
                 
             
                //Add the pirate's updated move and reveal to pirate dictionary.
                piratesWithInterceptCourse[moveWithInterceptCourse] = piratesDict[pirateMove];

            }

            //Add altered pirates back to merchants, and reset the action array.
            currentItem.Action = GetActionsFromDictionary(merchantsDict.Concat(piratesWithInterceptCourse).ToDictionary(kvp => kvp.Key, kvp => kvp.Value));

        }
开发者ID:wshanshan,项目名称:DDD,代码行数:101,代码来源:InterceptGenerator.cs

示例8: ReadDataFromRouteData

        private void ReadDataFromRouteData()
        {
            if (RouteData.Values["clientId"].GetType() == typeof(System.Int32))
            {
                clientId = (int)RouteData.Values["clientId"];
            }
            else
            {
                clientId = int.Parse((string)RouteData.Values["clientId"]);
            }

            if (RouteData.Values["portalId"].GetType() == typeof(System.Int32))
            {
                portalId = (int)RouteData.Values["portalId"];
            }
            else
            {
                portalId = int.Parse((string)RouteData.Values["portalId"]);
            }
            _portal = Session.GetPortalSessions().GetPortalSession(portalId, clientId).Portal;
            _user = HttpContext.Session.GetUser(portalId);
            SolutionFinderModule SFModule = (SolutionFinderModule)_portal.Configuration.SolutionFinderModule;
            if (SFModule == null)
            {
                KBCustomException kbCustExp = KBCustomException.ProcessException(null, KBOp.LoadSolutionFinderPage, KBErrorHandler.GetMethodName(), GeneralResources.SolutionFinderModuleNotFoundError, LogEnabled.False);
                throw kbCustExp;
            }

            //Assign portal and user object to artilceManger
            this._solFinderManager.Portal = _portal;
            this._solFinderManager.User = HttpContext.Session.GetUser(portalId);
            //Assign portal and user object to artilceManger
            this._articleManager.Portal = _portal;
            this._articleManager.User = HttpContext.Session.GetUser(portalId);
            //resource object
            ViewData["CommonViewModel"] = Utilities.CreateCommonViewModel(clientId, portalId, this._portal.PortalType, this._portal.Configuration, "solutionFinder");
            headerVM = ((CommonViewModel)ViewData["CommonViewModel"]).HeaderViewModel;
            Resources = Session.Resource(portalId, clientId, "solutionFinder", _portal.Language.Name);
            ResourcesArticle = Session.Resource(portalId, clientId, "ARTICLE", _portal.Language.Name);
            Resources = Resources.Concat(ResourcesArticle).ToDictionary(x => x.Key, x => x.Value);
            CommonResources = Session.Resource(portalId, clientId, "common", _portal.Language.Name);
            //get Module name and create navigation
            homeText = Utilities.getModuleText(headerVM, "home");
            SFText = Utilities.getModuleText(headerVM, "solutionFinder");
        }
开发者ID:rageshpayyan,项目名称:responsiveportal,代码行数:45,代码来源:SolutionFinderController.cs


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