public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("PowerLines", out value)) PowerLines = (List<PowerMeasurement>) value;
     if (values.TryGetValue("CurrentPower", out value)) CurrentPower = value is Int64 ? (Int32)(Int64)value : (Int32)value;
 }
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("Value", out value)) @Value = (String) value;
     if (values.TryGetValue("OtherValue", out value)) @OtherValue = (String) value;
 }
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("LastAppliedEventId", out value)) @LastAppliedEventId = value is Int32 ? (Int32)value : (Int64)value;
     if (values.TryGetValue("Value", out value)) @Value = (Decimal) value;
 }
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("FirstName", out value)) @FirstName = (String) value;
     if (values.TryGetValue("LastName", out value)) @LastName = (String) value;
     if (values.TryGetValue("IsMarried", out value)) @IsMarried = (Boolean) value;
 }
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("Version", out value)) Version = (UInt64) value;
     if (values.TryGetValue("TransactionPreparations", out value)) TransactionPreparations = (Dictionary<Guid,TransactionPreparation>) value;
     if (values.TryGetValue("OwnerId", out value)) OwnerId = (Guid) value;
     if (values.TryGetValue("Balance", out value)) Balance = (Decimal) value;
 }
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("UncommitedEvents", out value)) UncommitedEvents = (List<Object>) value;
     if (values.TryGetValue("Version", out value)) Version = value is Int64 ? (Int32)(Int64)value : (Int32)value;
     if (values.TryGetValue("FirstName", out value)) FirstName = (String) value;
     if (values.TryGetValue("LastName", out value)) LastName = (String) value;
     if (values.TryGetValue("Gender", out value)) Gender = (GenderType) value;
 }
		void IExternalBlobConnectionProvider.Configure(System.Collections.Generic.IDictionary<string, string> settings)
		{
			string connStr;
			if (settings.TryGetValue(Environment.ConnectionStringNameProperty, out connStr))
			{
				ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings[connStr];
				if (connectionStringSettings == null)
					throw new HibernateException(string.Format("Could not find named connection string {0}", connStr));
				ConnectionString = connectionStringSettings.ConnectionString;
			}
			else if (settings.TryGetValue(Environment.ConnectionStringProperty, out connStr))
			{
				ConnectionString = connStr;
			}
		}
Example #8
0
        static int Run(string[] args)
        {
            if (args.Length == 0)
                throw new ApplicationException("Missing command.");

            var commands = new[]
            {
                new CommandNames(() => new SelectCommand(), Aliases("select", "sel")),
                new CommandNames(() => new ExplainCommand(), Aliases("explain", "describe", "desc")),
            }
            .SelectMany(e => e.Value.Select(v => new KeyValuePair<string, Func<ICommand>>(v, e.Key)))
            .ToDictionary(e => e.Key, e => e.Value);

            var name = args[0];

            Func<ICommand> command;
            if (!commands.TryGetValue(name, out command))
                throw new ApplicationException("Invalid command.");

            return command().Run(args.Skip(1).ToArray());
        }
Example #9
0
 private const ConfigType DEFAULT_CONFIG_TYPE = ConfigType.Locations;
Example #10
0
        private static void Main(string[] args)
        {
            ServicePointManager.DefaultConnectionLimit = int.MaxValue;
            ServicePointManager.Expect100Continue = false;
            ServicePointManager.UseNagleAlgorithm = false;

            var program = new Program();
            var commands = new[]
            {
                Tuple.Create<string, Action>("RunAsParallel", program.RunAsParallel),
                Tuple.Create<string, Action>("RunAsync", program.RunAsync),
                Tuple.Create<string, Action>("RunSingleThread", program.RunSingleThread),
                Tuple.Create<string, Action>("RunParallelForEach", program.RunParallelForEach)

            }.ToDictionary(tuple => tuple.Item1);

            var command = program.ParseOption(args);
            if(program._help)
                ShowHelp(program._optionSet, commands.Keys.ToArray());

            if (program._verbose > 1)
                OperationContext.GlobalRequestCompleted += (sender, args2) =>
                {
                    Console.WriteLine("Start:{0}, Elapsed:{1:F2}, {2}, {3}, {4}",
                        args2.RequestInformation.StartTime,
                        (args2.RequestInformation.EndTime - args2.RequestInformation.StartTime).TotalSeconds,
                        args2.Request.Method,
                        args2.Request.RequestUri,
                        args2.RequestInformation.HttpStatusCode);
                };

            Tuple<string, Action> action;
            if (commands.TryGetValue(command, out action))
            {
                action.Item2();
            }
            else
            {
                ShowHelp(program._optionSet, commands.Keys.ToArray());
            }
        }
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("MethodDescriptor", out value)) @MethodDescriptor = (MethodDescriptor) value;
 }
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("Version", out value)) Version = (UInt64) value;
     if (values.TryGetValue("Status", out value)) Status = (TransactionStatus) value;
     if (values.TryGetValue("TransferOutPreparationConfirmed", out value)) TransferOutPreparationConfirmed = (Boolean) value;
     if (values.TryGetValue("TransferInPreparationConfirmed", out value)) TransferInPreparationConfirmed = (Boolean) value;
     if (values.TryGetValue("TransferOutConfirmed", out value)) TransferOutConfirmed = (Boolean) value;
     if (values.TryGetValue("TransferInConfirmed", out value)) TransferInConfirmed = (Boolean) value;
     if (values.TryGetValue("AccountValidatedAt", out value)) AccountValidatedAt = (DateTime) value;
     if (values.TryGetValue("TransferOutPreparationConfirmedAt", out value)) TransferOutPreparationConfirmedAt = (DateTime) value;
     if (values.TryGetValue("TransferInPreparationConfirmedAt", out value)) TransferInPreparationConfirmedAt = (DateTime) value;
     if (values.TryGetValue("TransferOutConfirmedAt", out value)) TransferOutConfirmedAt = (DateTime) value;
     if (values.TryGetValue("TransferInConfirmedAt", out value)) TransferInConfirmedAt = (DateTime) value;
     if (values.TryGetValue("TransferCancelAt", out value)) TransferCancelAt = (DateTime) value;
     if (values.TryGetValue("TransferTransactionInfo", out value)) TransferTransactionInfo = (TransferTransactionInfo) value;
 }
Example #13
0
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("Exists", out value)) @Exists = (Boolean) value;
     if (values.TryGetValue("PositionX", out value)) @PositionX = (Single) value;
     if (values.TryGetValue("PositionY", out value)) @PositionY = (Single) value;
     if (values.TryGetValue("PositionZ", out value)) @PositionZ = (Single) value;
     if (values.TryGetValue("Orientation", out value)) @Orientation = (Single) value;
     if (values.TryGetValue("MapID", out value)) @MapID = (UInt32) value;
     if (values.TryGetValue("InstanceID", out value)) @InstanceID = (UInt32) value;
     if (values.TryGetValue("MyType", out value)) @MyType = (TypeID) value;
     if (values.TryGetValue("ObjType", out value)) @ObjType = (ObjectType) value;
     if (values.TryGetValue("UpdateFields", out value)) @UpdateFields = (UpdateField[]) value;
     if (values.TryGetValue("UpdateFlags", out value)) @UpdateFlags = (ObjectUpdateFlags) value;
     if (values.TryGetValue("unit_test", out value)) @unit_test = value is Int64 ? (Int32)(Int64)value : (Int32)value;
 }
Example #14
0
 private void NowPlayingPage_StateChanged(object sender, System.Collections.Generic.Dictionary<string, string> e)
 {
     Logger.Debug("State change");
     selfSetting = true;
     string val;
     if (!e.TryGetValue("repeat", out val)) val = "0";
     RepeatToggle.Active = val != "0";
     if (!e.TryGetValue("random", out val)) val = "0";
     ShuffleToggle.Active = val != "0";
     if (!e.TryGetValue("state", out val)) val = "stop";
     PlayButton.TooltipText = val == "play" ? "Pause" : "Play";
     PlayButton.Image=val=="play"?pauseImage:playImage;
     selfSetting = false;
 }
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("SolutionFullPath", out value)) @SolutionFullPath = (String) value;
     if (values.TryGetValue("SourceCode", out value)) @SourceCode = (String) value;
 }
Example #16
0
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("SessionKey", out value)) @SessionKey = (Byte[]) value;
     if (values.TryGetValue("Account", out value)) @Account = (IAccount) value;
 }
Example #17
0
 {
Example #18
0
		/// <summary>
		/// Looks for a key in the array of key/values of the parameter string.  If not found, return the specified default value
		/// </summary>
		/// <param name="items">The list to look in</param>
		/// <param name="key">The key to find</param>
		/// <param name="defValue">The default value to return if the key is not found</param>
		/// <returns>The value corresponding to the specified key, or the default value if not found.</returns>
		static internal string FindKey(System.Collections.Generic.SortedList<string, string> items, string key, string defValue)
		{
			string ret;

			if (items.TryGetValue(key, out ret)) return ret;

			return defValue;
		}
Example #19
0
        internal static string GetPWD(System.Data.Common.DbConnectionStringBuilder connectionStringBuilder)
        {
            object objDbName;
            string dbName = null;
            if (connectionStringBuilder.TryGetValue("Password", out objDbName))
                dbName = objDbName.ToString();
            else if (connectionStringBuilder.TryGetValue("PWD", out objDbName))
                dbName = objDbName.ToString();

            return dbName;
        }
Example #20
0
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("roomGrain", out value)) roomGrain = (IRoomGrain) value;
     if (values.TryGetValue("playerGuid", out value)) playerGuid = (Guid) value;
     if (values.TryGetValue("playerGrain", out value)) playerGrain = (IPlayerGrain) value;
     if (values.TryGetValue("npcInfo", out value)) npcInfo = (NPCInfo) value;
 }
Example #21
0
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("gameState", out value)) gameState = (Dictionary<String,Boolean>) value;
 }
Example #22
0
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("roomId", out value)) roomId = value is Int32 ? (Int32)value : (Int64)value;
     if (values.TryGetValue("name", out value)) name = (String) value;
     if (values.TryGetValue("players", out value)) players = (List<IPlayerGrain>) value;
     if (values.TryGetValue("monsters", out value)) monsters = (List<IMonsterGrain>) value;
     if (values.TryGetValue("things", out value)) things = (List<Thing>) value;
     if (values.TryGetValue("npcs", out value)) npcs = (List<INPCGrain>) value;
     if (values.TryGetValue("descriptors", out value)) descriptors = (List<Descriptor>) value;
     if (values.TryGetValue("directions", out value)) directions = (List<Direction>) value;
 }
Example #23
0
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("roomGrain", out value)) roomGrain = (IRoomGrain) value;
     if (values.TryGetValue("things", out value)) things = (List<Thing>) value;
     if (values.TryGetValue("roomGrains", out value)) roomGrains = (List<IRoomGrain>) value;
     if (values.TryGetValue("monsterGrains", out value)) monsterGrains = (List<IMonsterGrain>) value;
     if (values.TryGetValue("npcGrains", out value)) npcGrains = (List<INPCGrain>) value;
     if (values.TryGetValue("killed", out value)) killed = (Boolean) value;
     if (values.TryGetValue("myInfo", out value)) myInfo = (PlayerInfo) value;
     if (values.TryGetValue("playerHistory", out value)) playerHistory = (List<String>) value;
     if (values.TryGetValue("gameState", out value)) gameState = (IGameStateGrain) value;
     if (values.TryGetValue("version", out value)) version = value is Int64 ? (Int32)(Int64)value : (Int32)value;
     if (values.TryGetValue("stateChangeActions", out value)) stateChangeActions = (List<StateChangeAction>) value;
 }
Example #24
0
 internal static string GetDatabaseName(System.Data.Common.DbConnectionStringBuilder connectionStringBuilder)
 {
     object objDbName;
     string dbName = null;
     if (connectionStringBuilder.TryGetValue("USER ID", out objDbName))
         dbName = objDbName.ToString();
     else if (connectionStringBuilder.TryGetValue("UID", out objDbName))
         dbName = objDbName.ToString();
     return dbName;
 }
Example #25
0
        }

        #endregion Properties
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("Customer", out value)) @Customer = (Customer) value;
 }
Example #27
0
 public override void SetAll(System.Collections.Generic.IDictionary<string,object> values)
 {   
     object value;
     if (values == null) { InitStateFields(); return; }
     if (values.TryGetValue("unit_test", out value)) @unit_test = value is Int64 ? (Int32)(Int64)value : (Int32)value;
     if (values.TryGetValue("Exists", out value)) @Exists = (Boolean) value;
     if (values.TryGetValue("PositionX", out value)) @PositionX = (Single) value;
     if (values.TryGetValue("PositionY", out value)) @PositionY = (Single) value;
     if (values.TryGetValue("PositionZ", out value)) @PositionZ = (Single) value;
     if (values.TryGetValue("Orientation", out value)) @Orientation = (Single) value;
     if (values.TryGetValue("MapID", out value)) @MapID = (UInt32) value;
     if (values.TryGetValue("InstanceID", out value)) @InstanceID = (UInt32) value;
     if (values.TryGetValue("MyType", out value)) @MyType = (TypeID) value;
     if (values.TryGetValue("ObjType", out value)) @ObjType = (ObjectType) value;
     if (values.TryGetValue("UpdateFields", out value)) @UpdateFields = (UpdateField[]) value;
     if (values.TryGetValue("UpdateFlags", out value)) @UpdateFlags = (ObjectUpdateFlags) value;
     if (values.TryGetValue("Name", out value)) @Name = (String) value;
     if (values.TryGetValue("Account", out value)) @Account = (String) value;
     if (values.TryGetValue("Race", out value)) @Race = value is Int64 ? (Int32)(Int64)value : (Int32)value;
     if (values.TryGetValue("Class", out value)) @Class = value is Int64 ? (Int32)(Int64)value : (Int32)value;
     if (values.TryGetValue("Gender", out value)) @Gender = value is Int64 ? (Int32)(Int64)value : (Int32)value;
     if (values.TryGetValue("RealmID", out value)) @RealmID = (UInt32) value;
     if (values.TryGetValue("BindX", out value)) @BindX = (Single) value;
     if (values.TryGetValue("BindY", out value)) @BindY = (Single) value;
     if (values.TryGetValue("BindZ", out value)) @BindZ = (Single) value;
     if (values.TryGetValue("BindMap", out value)) @BindMap = (UInt32) value;
     if (values.TryGetValue("BindArea", out value)) @BindArea = (UInt32) value;
 }
		public void SetParameterValues(System.Collections.Generic.IDictionary<string, string> parameters)
		{
			string offset;
			if (parameters.TryGetValue("Offset", out offset))
			{
				Offset = TimeSpan.Parse(offset);
			}
		}
Example #29
0
        #endregion Properties

        #region Methods