コード例 #1
0
 private void MakeSessionFromRawParams()
 {
     foreach (var sessionName in rawParams.Keys)
     {
         var sessSetts = rawParams[sessionName];
         var sessKey   = new SessionSettingsKey();
         if (sessSetts.ContainsKey("TargetCompID"))
         {
             sessKey.targetCompID = sessSetts["TargetCompID"];
         }
         if (sessSetts.ContainsKey("SenderCompID"))
         {
             sessKey.senderCompID = sessSetts["SenderCompID"];
         }
         sessionParams.Add(sessionName == "DEFAULT"
             ? new SessionSettingsKey() : sessKey, sessSetts);
     }
 }
コード例 #2
0
        public string GetSessionParam(string targetID, string senderID, string paramName,
                                      string defaultValue)
        {
            var defaultSets = sessionParams[new SessionSettingsKey()]; // default params
            Dictionary <string, string> sets = null;
            var fullKey = new SessionSettingsKey {
                senderCompID = senderID, targetCompID = targetID
            };
            var senderKey = new SessionSettingsKey {
                senderCompID = senderID
            };
            var targetKey = new SessionSettingsKey {
                targetCompID = targetID
            };

            if (sessionParams.ContainsKey(fullKey))
            {
                sets = sessionParams[fullKey];
            }
            else
            if (sessionParams.ContainsKey(senderKey))
            {
                sets = sessionParams[senderKey];
            }
            else
            if (sessionParams.ContainsKey(targetKey))
            {
                sets = sessionParams[targetKey];
            }
            if (sets != null)
            {
                if (sets.ContainsKey(paramName))
                {
                    return(sets[paramName]);
                }
            }
            if (defaultSets.ContainsKey(paramName))
            {
                return(defaultSets[paramName]);
            }
            return(defaultValue);
        }