Ejemplo n.º 1
0
		protected void AddArmyAttackVariant(AIVariantPackage variants, Context context, PlayerInfoCM player, AIOptions options, int restUnits)
		{
			List<IslandCM> enemyNeibourIslands = Library.Map.GetEnemyNeibourIslands(context.map, player.ID, true);
			float maxAttackVP = 0;
			IslandCM maxVPenemyIsland = null;
			for (int i = 0; i < enemyNeibourIslands.Count; ++i)
			{
				IslandCM enemyIsland = enemyNeibourIslands[i];
				float vp = Library.Map.GetIslandPriceVP(context.map, enemyIsland.ID, player.ID, options);
				if (vp > maxAttackVP)
				{
					maxAttackVP = vp;
					maxVPenemyIsland = enemyIsland;
				}
			}

			if (maxAttackVP > 0)
			{
				int needForce = Library.Map.GetForceNeedToCapture(context.map, maxVPenemyIsland.ID, options.coefficients.MinProbToAttackIsland);
				int needGold = Library.Common.CostOfArmy(needForce, context.turn.TurnActionCounter) + Constants.moveArmyCost;
				if (needForce <= restUnits && needGold <= player.Gold)
				{
					List<IslandCM> ourIslands = context.map.GetBridgetIslands(maxVPenemyIsland.ID, player.ID);
					int islandFromID = ourIslands.First().ID;

					AIArmyAttackVariant attackVariant = new AIArmyAttackVariant(islandFromID, maxVPenemyIsland.ID, needForce, needForce);
					attackVariant.offer = new VariantOffer(needGold, maxAttackVP);

					variants.AddVariant(attackVariant);
				}
			}
		}
Ejemplo n.º 2
0
    public void Run()
    {
        using (Context ctx = new Context())
        {
            Sort U = ctx.MkUninterpretedSort("U");
            Console.WriteLine(U);
            Expr a = ctx.MkConst("a", U);

            a = ctx.MkConst("a", U);
            Expr b = ctx.MkConst("b", U);
            Expr c = ctx.MkConst("c", U);

            IntExpr x = ctx.MkIntConst("x");
            IntExpr y = ctx.MkIntConst("y");

            Console.WriteLine(ctx.MkAnd(ctx.MkEq(a, b), ctx.MkEq(a, c)));
            Console.WriteLine(U == ctx.IntSort);

            Sort U2 = ctx.MkUninterpretedSort("U");
            Console.WriteLine(U == U2);

            U2 = ctx.MkUninterpretedSort("U2");
            Console.WriteLine(U == U2);
            Console.WriteLine(ctx.MkDistinct(a, b, c));

            FuncDecl f = ctx.MkFuncDecl("f", new Sort[] { U, U }, U);
            Console.WriteLine(ctx.MkEq(f[a,b], b));
        }
    }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            using (var context = new Context(1))
            {
                using (Socket
                        receiver = context.Socket(SocketType.PULL),
                        sender = context.Socket(SocketType.PUSH))
                {

                    receiver.Connect("tcp://localhost:5557");
                    sender.Connect("tcp://localhost:5558");

                    while (true)
                    {
                        string task = receiver.Recv(Encoding.Unicode);

                        Console.WriteLine("{0}.", task);

                        int sleepTime = Convert.ToInt32(task);
                        Thread.Sleep(sleepTime);

                        sender.Send("", Encoding.Unicode);
                    }

                }
            }
        }
Ejemplo n.º 4
0
        static void ExecTest(Context context, IMatch testToken)
        {
            var token = new CaptureGroup(testToken);

            if(token.Match(context))
            {
                WriteInfo("Match success.");
                WriteLine(context);

                while (token.MatchNext(context))
                {
                    WriteInfo("MatchNext success.");
                    WriteLine(context);
                }
                WriteError("MatchNext failed.");
                WriteLine(context);
            }
            else
            {
                WriteError("Match failed.");
                WriteLine(context);
            }

            if (context.offset != 0)
                WriteError("Warning: Context offset not reset to 0.");
        }
Ejemplo n.º 5
0
 private void StartListening()
 {
     context = new Context(1);
     socket = context.Socket(SocketType.PULL);
     socket.Connect("tcp://127.0.0.1:8400"); // Connect to 8400
     UpdateTextBox("Connected to 127.0.0.1:8400");
 }
        public PartialCountBolt(Context ctx)
        {
            this.ctx = ctx;

            // set input schemas
            Dictionary<string, List<Type>> inputSchema = new Dictionary<string, List<Type>>();
            inputSchema.Add(Constants.DEFAULT_STREAM_ID, new List<Type>() { typeof(string) });

            //Add the Tick tuple Stream in input streams - A tick tuple has only one field of type long
            inputSchema.Add(Constants.SYSTEM_TICK_STREAM_ID, new List<Type>() { typeof(long) });

            // set output schemas
            Dictionary<string, List<Type>> outputSchema = new Dictionary<string, List<Type>>();
            outputSchema.Add(Constants.DEFAULT_STREAM_ID, new List<Type>() { typeof(long) });

            // Declare input and output schemas
            this.ctx.DeclareComponentSchema(new ComponentStreamSchema(inputSchema, outputSchema));

            this.ctx.DeclareCustomizedDeserializer(new CustomizedInteropJSONDeserializer());

            if (Context.Config.pluginConf.ContainsKey(Constants.NONTRANSACTIONAL_ENABLE_ACK))
            {
                enableAck = (bool)(Context.Config.pluginConf[Constants.NONTRANSACTIONAL_ENABLE_ACK]);
            }

            partialCount = 0L;
            totalCount = 0L;
        }
Ejemplo n.º 7
0
    public void ensures_same_deterministic_order_when_getting_entities_after_DestroyAllEntities()
    {
        var context = new Context(1);

        const int numEntities = 10;
        for (int i = 0; i < numEntities; i++) {
            context.CreateEntity();
        }

        var order1 = new int[numEntities];
        var entities1 = context.GetEntities();
        for (int i = 0; i < numEntities; i++) {
            order1[i] = entities1[i].creationIndex;
        }

        context.DestroyAllEntities();
        context.ResetCreationIndex();

        for (int i = 0; i < numEntities; i++) {
            context.CreateEntity();
        }

        var order2 = new int[numEntities];
        var entities2 = context.GetEntities();
        for (int i = 0; i < numEntities; i++) {
            order2[i] = entities2[i].creationIndex;
        }

        for (int i = 0; i < numEntities; i++) {
            var index1 = order1[i];
            var index2 = order2[i];

            Assert.AreEqual(index1, index2);
        }
    }
Ejemplo n.º 8
0
    public void Run()
    {
        Dictionary<string, string> cfg = new Dictionary<string, string>() {
            { "AUTO_CONFIG", "true" } };

        using (Context ctx = new Context(cfg))
        {
            RealExpr x = ctx.MkRealConst("x");
            RealExpr y = ctx.MkRealConst("y");

            RatNum zero = ctx.MkReal(0);
            RatNum two = ctx.MkReal(2);

            Goal g = ctx.MkGoal();
            g.Assert(ctx.MkGt(x, zero));
            g.Assert(ctx.MkGt(y, zero));
            g.Assert(ctx.MkEq(x, ctx.MkAdd(y, two)));
            Console.WriteLine(g);

            Tactic t1 = ctx.MkTactic("simplify");
            Tactic t2 = ctx.MkTactic("solve-eqs");
            Tactic t = ctx.AndThen(t1, t2);

            Console.WriteLine(t[g]);
        }
    }
Ejemplo n.º 9
0
			public string ReadTemplateFile(Context context, string templateName)
			{
				string templatePath = (string) context[templateName];

				switch (templatePath)
				{
					case "product":
						return "Product: {{ product.title }} ";

					case "locale_variables":
						return "Locale: {{echo1}} {{echo2}}";

					case "variant":
						return "Variant: {{ variant.title }}";

					case "nested_template":
						return "{% include 'header' %} {% include 'body' %} {% include 'footer' %}";

					case "body":
						return "body {% include 'body_detail' %}";

					case "nested_product_template":
						return "Product: {{ nested_product_template.title }} {%include 'details'%} ";

					case "recursively_nested_template":
						return "-{% include 'recursively_nested_template' %}";

					case "pick_a_source":
						return "from TestFileSystem";

					default:
						return templatePath;
				}
			}
Ejemplo n.º 10
0
 public Buffer(Context context)
     : base(context)
 {
     Constructor = new BufferConstructor(context);
     SetPropertyValue("Buffer", Constructor, true);
     SetPropertyValue("SlowBuffer", Constructor, true);
 }
        /// <summary>
        /// Parse bytes in context into a FlaggedPropertyValueNode
        /// </summary>
        /// <param name="context">The value of Context</param>
        public override void Parse(Context context)
        {
            this.Flag = context.PropertyBytes[context.CurIndex++];
            switch (this.Flag)
            {
                // PropertyValue presents
                case 0:
                    break;

                // PropertyValue not presents
                case 1:
                    return;

                // Property error code
                case 0xA:

                    // If the Flag is 0x0A, the property type should be PtypErrorCode.
                    context.CurProperty.Type = PropertyType.PtypErrorCode;
                    break;

                // Not defined value
                default:
                    break;
            }
            
            base.Parse(context);
        }
Ejemplo n.º 12
0
        public void RequestPolicyWithBody()
        {
            // Assert
            var requestMessage = new HttpRequestMessage()
            {
                RequestUri = new Uri("http://example.org/foo"),
                Content = new StringContent("Hello World!")
            };

            var variables = new Dictionary<string, object>()
            {
                { "message-id","xxxyyy"}
            };

            var context = new Context(requestMessage: requestMessage, variables: variables);

            // Act
            string policyResult = SendRequestToEventHub(context);

            //Assert
            Assert.Equal("request:xxxyyy\n"
                                        + "GET /foo HTTP/1.1\r\n"
                                        + "Host: example.org\r\n"
                                        + "Content-Type: text/plain; charset=utf-8\r\n"
                                        + "Content-Length: 12\r\n"
                                        + "\r\n"
                                        + "Hello World!", policyResult);
        }
 public TransportadorasController()
 {
     context = new Context();
     var dataBaseInitializer = new DataBaseInitializer();
     dataBaseInitializer.InitializeDatabase(context);
     repositorioTransportadora = new Repository<Transportadora>(context);
 }
Ejemplo n.º 14
0
	void FillChecks (Context cr, int x, int y, int width, int height)
	{
		int CHECK_SIZE = 32;
		
		cr.Save ();
		Surface check = cr.Target.CreateSimilar (Content.Color, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
		
		// draw the check
		using (Context cr2 = new Context (check)) {
			cr2.Operator = Operator.Source;
			cr2.Color = new Color (0.4, 0.4, 0.4);
			cr2.Rectangle (0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
			cr2.Fill ();

			cr2.Color = new Color (0.7, 0.7, 0.7);
			cr2.Rectangle (x, y, CHECK_SIZE, CHECK_SIZE);
			cr2.Fill ();

			cr2.Rectangle (x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE);
			cr2.Fill ();
		}

		// Fill the whole surface with the check
		SurfacePattern check_pattern = new SurfacePattern (check);
		check_pattern.Extend = Extend.Repeat;
		cr.Source = check_pattern;
		cr.Rectangle (0, 0, width, height);
		cr.Fill ();

		check_pattern.Destroy ();
		check.Destroy ();
		cr.Restore ();
	}
Ejemplo n.º 15
0
		protected AIStateClient GetAIStateClient(Context context)
		{
			if (Shmipl.StatePath.IsSubState(context.State, Phase.Auction))
				return new AIStateClient_Auction();

			if (context.armyFight != null || context.navyFight != null)
				return new AIStateClient_Fight();

			if (context.State.StartsWith("Turn.PlaceMetro"))
				return new AIStateClient_PlaceMetro(context.State.Equals("Turn.PlaceMetroBuilding"));

			switch (context.turn.CurrentGod)
			{
				case God.Zeus:
					return new AIStateClient_Zeus();
				case God.Sophia:
					return new AIStateClient_Sophia();
				case God.Poseidon:
					return new AIStateClient_Poseidon();
				case God.Mars:
					return new AIStateClient_Mars();
				case God.Appolon:
					return new AIStateClient_Apollo();
			}

			throw new Exception("AI: unknown GetAIStateClient");
		}
	  /// <summary>
	  /// Executes the chart demo. </summary>
	  /// <param name="context"> the context </param>
	  /// <returns> the built intent </returns>
	  public override Intent execute(Context context)
	  {
		string[] titles = new string[] {"sin", "cos"};
		IList<double[]> x = new List<double[]>();
		IList<double[]> values = new List<double[]>();
		int step = 4;
		int count = 360 / step + 1;
		x.Add(new double[count]);
		x.Add(new double[count]);
		double[] sinValues = new double[count];
		double[] cosValues = new double[count];
		values.Add(sinValues);
		values.Add(cosValues);
		for (int i = 0; i < count; i++)
		{
		  int angle = i * step;
		  x[0][i] = angle;
		  x[1][i] = angle;
		  double rAngle = Math.toRadians(angle);
		  sinValues[i] = Math.Sin(rAngle);
		  cosValues[i] = Math.Cos(rAngle);
		}
		int[] colors = new int[] {Color.BLUE, Color.CYAN};
		PointStyle[] styles = new PointStyle[] {PointStyle.POINT, PointStyle.POINT};
		XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
		setChartSettings(renderer, "Trigonometric functions", "X (in degrees)", "Y", 0, 360, -1, 1, Color.GRAY, Color.LTGRAY);
		renderer.XLabels = 20;
		renderer.YLabels = 10;
		return ChartFactory.getLineChartIntent(context, buildDataset(titles, x, values), renderer);
	  }
Ejemplo n.º 17
0
 public Process(Context context)
     : base(context)
 {
     Constructor = new ProcessConstructor(context, "Process", new ProcessInstance(context.Events.EventEmitter.InstancePrototype, false));
     Instance = Constructor.Construct();
     Populate();
 }
Ejemplo n.º 18
0
        public void MyTestInitialize()
        {
            m_Index = 0;
            m_Name = "HSPDSCHRSCP";
            m_Case = new HSPDSCHRSCPCase();
            m_Context = new Context();

            tfMatrix = new TrueFalseMatrix(4, 4, 0.0, 200, 50, true);
            tdGroup = MockGroupAndCell.MockTDPredicGroup();
            cell = MockGroupAndCell.CreateTDCell();

            InitTerminal(tdGroup);

            LinkLossAssist.Init();
            IProjectManager projectMgr = ServiceHelper.Lookup<IProjectManager>(ProjectSingleton.CurrentProject.AppContext);
            string path = projectMgr.CurrentProjectLossPath;
            string absolutePath = ResultFilePath.CreateFilePath(path, tdGroup.Name, tdGroup.Region.Name, TDPredictionStudyType.Best_Server.ToString());
            string relativePath = ResultFilePath.CreateRelativePath(tdGroup.Name, tdGroup.Region.Name, TDPredictionStudyType.Best_Server.ToString());
            BestServerCellID = ValueMatrixAssist.GenerateByTrueFalseMatrix(tfMatrix, absolutePath, relativePath, ShortResultStruct.DefaultMax);
            BestServerCellID[0] = cell.ID;

            m_Context.Add(ContextKeys.CurrentCalcCell, cell);
            m_Context.Add(ContextKeys.Group, tdGroup);
            m_Context.Add(ContextKeys.TDBestServerCellID, BestServerCellID);
            m_Context.Add(ContextKeys.TFMatrix, tfMatrix);
            m_Context.Add(ContextKeys.CellList, InitCellList(cell));
            m_Context.Add(ContextKeys.ApplicationContext, ProjectSingleton.CurrentProject.AppContext);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Function to initialise the particle system. Has to be called before the first call to RenderFrame.
 /// </summary>
 /// <param name="settings">Particle system settings</param>
 /// <param name="context">Particle system context</param>
 public void Init(Context context, RenderHelper renderHelper)
 {
     Particles = new List<Particle>();
     Context = context;
     RenderHelper = renderHelper;
     Initialise();
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Renders a tokens representation (or interpolated lambda result)
        /// </summary>
        /// <param name="writer">The writer to write the token to</param>
        /// <param name="context">The context to discover values from</param>
        /// <param name="partials">The partial templates available to the token</param>
        /// <param name="originalTemplate">The original template</param>
        /// <returns>The rendered token result</returns>
        public string Render(Writer writer, Context context, IDictionary<string, string> partials, string originalTemplate)
        {
            var value = context.Lookup(Value);
            value = InterpolateLambdaValueIfPossible(value, writer, context, partials);

            return value?.ToString();
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 初始化Case
        /// </summary>
        /// <param name="context"></param>
        public void InitialCase(Context context)
        {

            GetDataFromContext(context);
            InitialData(m_Group, m_TFMatrix);
            context.Add(ContextKeys.GSMULServiceCIR, m_GSMULServiceCIR);
        }
Ejemplo n.º 22
0
 /******************************************/
 /******************************************/
 /// <summary>内部生成時、使用される</summary>
 /// <param name="Target">ターゲットユーザー</param>
 /// <param name="Host">生成元</param>
 /// <param name="Context">コンテキスト</param>
 internal UserPage(User.User Target, VideoService Host, Context Context)
 {
     target = Target;
     host = Host;
     context = Context;
     converter = new Serial.Converter(context);
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Decodes the specified instruction.
        /// </summary>
        /// <param name="ctx">The context.</param>
        /// <param name="decoder">The instruction decoder, which holds the code stream.</param>
        public override void Decode(Context ctx, IInstructionDecoder decoder)
        {
            // Decode base classes first
            base.Decode(ctx, decoder);

            Token token = decoder.DecodeTokenType();
            ITypeModule module = null;
            Mosa.Runtime.TypeSystem.Generic.CilGenericType genericType = decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType;
            if (genericType != null)
                module = (decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType).BaseGenericType.Module;
            else
                module = decoder.Method.Module;
            ctx.RuntimeField = module.GetField(token);

            if (ctx.RuntimeField.ContainsGenericParameter)
            {
                foreach (RuntimeField field in decoder.Method.DeclaringType.Fields)
                    if (field.Name == ctx.RuntimeField.Name)
                    {
                        ctx.RuntimeField = field;
                        break;
                    }

                Debug.Assert(!ctx.RuntimeField.ContainsGenericParameter);
            }

            SigType sigType = ctx.RuntimeField.SignatureType;
            ctx.Result = LoadInstruction.CreateResultOperand(decoder, Operand.StackTypeFromSigType(sigType), sigType);
        }
Ejemplo n.º 24
0
 public object Set(Context cx, object value)
 {
     if (xmlObject == null)
         throw ScriptRuntime.UndefWriteError (this, ToString (), value);
     xmlObject.PutXMLProperty (this, value);
     return value;
 }
Ejemplo n.º 25
0
        public void TestEncodeMessageWithAllFieldTypes()
        {
            var template = new MessageTemplate(
                "",
                new Field[]
                    {
                        new Scalar("1", FastType.String, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("2", FastType.ByteVector, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("3", FastType.Decimal, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("4", FastType.I32, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("5", FastType.String, Operator.Copy, ScalarValue.Undefined, false),
                        new Scalar("6", FastType.U32, Operator.Copy, ScalarValue.Undefined, false),
                    });

            var context = new Context();
            context.RegisterTemplate(113, template);

            var message = new Message(template);
            message.SetString(1, "H");
            message.SetByteVector(2, new[] {(byte) 0xFF});
            message.SetDecimal(3, 1.201);
            message.SetInteger(4, -1);
            message.SetString(5, "abc");
            message.SetInteger(6, 2);

            //               --PMAP-- --TID--- ---#1--- -------#2-------- ------------#3------------ ---#4--- ------------#5------------ ---#6---
            const string msgstr =
                "11111111 11110001 11001000 10000001 11111111 11111101 00001001 10110001 11111111 01100001 01100010 11100011 10000010";
            AssertEquals(msgstr, new FastEncoder(context).Encode(message));
        }
Ejemplo n.º 26
0
 public ContinueCodelet(double salience, Context context, IContinuation succ, IFailure fail)
     : base(context.Coderack, salience, 4 * 4, 5)
 {
     this.context = context;
     this.succ = succ;
     this.fail = fail;
 }
Ejemplo n.º 27
0
        private void InsertBlockProtectInstructions()
        {
            foreach (var handler in MethodCompiler.Method.ExceptionHandlers)
            {
                var tryBlock = BasicBlocks.GetByLabel(handler.TryStart);

                var tryHandler = BasicBlocks.GetByLabel(handler.HandlerStart);

                var context = new Context(InstructionSet, tryBlock);

                while (context.IsEmpty || context.Instruction == IRInstruction.TryStart)
                {
                    context.GotoNext();
                }

                context.AppendInstruction(IRInstruction.TryStart, tryHandler);

                context = new Context(InstructionSet, tryHandler);

                if (handler.HandlerType == ExceptionHandlerType.Exception)
                {
                    var exceptionObject = MethodCompiler.CreateVirtualRegister(handler.Type);

                    context.AppendInstruction(IRInstruction.ExceptionStart, exceptionObject);
                }
                else if (handler.HandlerType == ExceptionHandlerType.Finally)
                {
                    context.AppendInstruction(IRInstruction.FinallyStart);
                }
            }
        }
Ejemplo n.º 28
0
        public override System.Object ExecIdCall(IdFunctionObject f, Context cx, IScriptable scope, IScriptable thisObj, System.Object [] args)
        {
            if (!f.HasTag (XMLCTOR_TAG)) {
                return base.ExecIdCall (f, cx, scope, thisObj, args);
            }
            int id = f.MethodId;
            switch (id) {

                case Id_defaultSettings: {
                        lib.SetDefaultSettings ();
                        IScriptable obj = cx.NewObject (scope);
                        WriteSetting (obj);
                        return obj;
                    }

                case Id_settings: {
                        IScriptable obj = cx.NewObject (scope);
                        WriteSetting (obj);
                        return obj;
                    }

                case Id_setSettings: {
                        if (args.Length == 0 || args [0] == null || args [0] == Undefined.Value) {
                            lib.SetDefaultSettings ();
                        }
                        else if (args [0] is IScriptable) {
                            ReadSettings ((IScriptable)args [0]);
                        }
                        return Undefined.Value;
                    }
            }
            throw new System.ArgumentException (System.Convert.ToString (id));
        }
Ejemplo n.º 29
0
        public static void test_empty()
        {
            var context = new Context("abc");
            var empty = new Empty();

            ExecTest(context, empty);
        }
        protected override void Run()
        {
            Dictionary<Operand, int> list = new Dictionary<Operand, int>();

            foreach (var block in this.BasicBlocks)
            {
                for (var context = new Context(this.InstructionSet, block); !context.IsBlockEndInstruction; context.GotoNext())
                {
                    context.Marked = false;

                    if (context.Result == null)
                        continue;

                    int index = 0;

                    if (list.TryGetValue(context.Result, out index))
                    {
                        InstructionSet.Data[index].Marked = true;
                        context.Marked = true;
                    }
                    else
                    {
                        list.Add(context.Result, context.Index);
                    }
                }
            }
        }
Ejemplo n.º 31
0
 public void Apply(AccountOpened accountOpened)
 {
     Context.ActorOf(Account.Create(accountOpened.Number, accountOpened.InitialBalance), $"Account-{accountOpened.Number}");
 }
Ejemplo n.º 32
0
 public TwoFactorAuthenticationSignIn()
 {
     manager       = Context.GetOwinContext().GetUserManager <ApplicationUserManager>();
     signinManager = Context.GetOwinContext().GetUserManager <ApplicationSignInManager>();
 }
Ejemplo n.º 33
0
 public GrpcCopyContentTests()
     : base(() => new PassThroughFileSystem(TestGlobal.Logger), TestGlobal.Logger)
 {
     _context = new Context(Logger);
 }
Ejemplo n.º 34
0
 public static Bitmap WeatherIconToBitmap(Context context, String text, int textSize)
 {
     return(WeatherIconToBitmap(context, text, textSize, Color.White));
 }
 public CoreStackLayoutRenderer(Context ctx) : base(ctx)
 {
 }
Ejemplo n.º 36
0
        private void GotoLeaveTargetInstruction(InstructionNode node)
        {
            var ctx = new Context(node);

            // clear exception register
            // FIXME: This will need to be preserved for filtered exceptions; will need a flag to know this - maybe an upper bit of leaveTargetRegister
            ctx.SetInstruction(Select(exceptionRegister, IRInstruction.MoveInt32, IRInstruction.MoveInt64), exceptionRegister, nullOperand);

            var label            = node.Label;
            var exceptionContext = FindImmediateExceptionContext(label);

            // 1) currently within a try block with a finally handler --- call it.
            if (exceptionContext.ExceptionHandlerType == ExceptionHandlerType.Finally && exceptionContext.IsLabelWithinTry(node.Label))
            {
                var handlerBlock = BasicBlocks.GetByLabel(exceptionContext.HandlerStart);

                ctx.AppendInstruction(IRInstruction.Jmp, handlerBlock);

                return;
            }

            // 2) else, find the next finally handler (if any), check if it should be called, if so, call it
            var nextFinallyContext = FindNextEnclosingFinallyContext(exceptionContext);

            if (nextFinallyContext != null)
            {
                var handlerBlock = BasicBlocks.GetByLabel(nextFinallyContext.HandlerStart);

                var nextBlock = Split(ctx);

                // compare leaveTargetRegister > handlerBlock.End, then goto finally handler
                ctx.AppendInstruction(Select(IRInstruction.CompareIntBranch32, IRInstruction.CompareIntBranch64), ConditionCode.GreaterThan, null, CreateConstant(handlerBlock.Label), leaveTargetRegister, nextBlock.Block);                 // TODO: Constant should be 64bit
                ctx.AppendInstruction(IRInstruction.Jmp, handlerBlock);

                ctx = nextBlock;
            }

            // find all the available targets within the method from this node's location
            var targets = new List <BasicBlock>();

            // using the end of the protected as the location
            var location = exceptionContext.TryEnd;

            foreach (var targetBlock in leaveTargets)
            {
                var source = targetBlock.Item2;
                var target = targetBlock.Item1;

                // target must be after end of exception context
                if (target.Label <= location)
                {
                    continue;
                }

                // target must be found within try or handler
                if (exceptionContext.IsLabelWithinTry(source.Label) || exceptionContext.IsLabelWithinHandler(source.Label))
                {
                    targets.AddIfNew(target);
                }
            }

            if (targets.Count == 0)
            {
                // this is an unreachable location

                // clear this block --- should only have on instruction
                ctx.Empty();

                var currentBlock  = ctx.Block;
                var previousBlock = currentBlock.PreviousBlocks[0];

                var otherBranch = (previousBlock.NextBlocks[0] == currentBlock) ? previousBlock.NextBlocks[1] : previousBlock.NextBlocks[0];

                ReplaceBranchTargets(previousBlock, currentBlock, otherBranch);

                // the optimizer will remove the branch comparison

                return;
            }

            if (targets.Count == 1)
            {
                ctx.AppendInstruction(IRInstruction.Jmp, targets[0]);
                return;
            }
            else
            {
                var newBlocks = CreateNewBlockContexts(targets.Count - 1, node.Label);

                ctx.AppendInstruction(Select(IRInstruction.CompareIntBranch32, IRInstruction.CompareIntBranch64), ConditionCode.Equal, null, leaveTargetRegister, CreateConstant(targets[0].Label), targets[0]);                 // TODO: Constant should be 64bit
                ctx.AppendInstruction(IRInstruction.Jmp, newBlocks[0].Block);

                for (int b = 1; b < targets.Count - 2; b++)
                {
                    newBlocks[b - 1].AppendInstruction(Select(IRInstruction.CompareIntBranch32, IRInstruction.CompareIntBranch64), ConditionCode.Equal, null, leaveTargetRegister, CreateConstant(targets[b].Label), targets[b]);                     // TODO: Constant should be 64bit
                    newBlocks[b - 1].AppendInstruction(IRInstruction.Jmp, newBlocks[b + 1].Block);
                }

                newBlocks[targets.Count - 2].AppendInstruction(IRInstruction.Jmp, targets[targets.Count - 1]);
            }
        }
Ejemplo n.º 37
0
 public GroupedListViewAdapter(Context context, AListView realListView, ListView listView) : base(context, realListView, listView)
 {
 }
Ejemplo n.º 38
0
        public void Handle(QueryAccountBalance queryAccountBalance)
        {
            var account = Context.Child($"Account-{queryAccountBalance.Number}");

            account.Forward(new QueryBalance(queryAccountBalance.Number));
        }
Ejemplo n.º 39
0
 public List <OrderLine> GetAll()
 {
     return(Context.Set <OrderLine>().ToList());
 }
Ejemplo n.º 40
0
        private bool AccountDoesNotExist(int number)
        {
            var account = Context.Child($"Account-{number}");

            return(account == ActorRefs.Nobody);
        }
Ejemplo n.º 41
0
        public ActionResult ExchangeActivitySaveSet(ExchangeActivity exChangeModel)
        {
            int appId = Context.GetRequestInt("appId", 0);

            if (appId <= 0)
            {
                return(Json(new { isok = false, msg = "appId非法" }, JsonRequestBehavior.AllowGet));
            }
            if (dzaccount == null)
            {
                return(Json(new { isok = false, msg = "登录信息超时" }, JsonRequestBehavior.AllowGet));
            }
            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                return(Json(new { isok = false, msg = "小程序未授权" }, JsonRequestBehavior.AllowGet));
            }

            XcxTemplate xcxTemplate = XcxTemplateBLL.SingleModel.GetModel($"id={xcx.TId}");

            if (xcxTemplate == null)
            {
                return(Json(new { isok = false, msg = "找不到该小程序模板" }, JsonRequestBehavior.AllowGet));
            }



            if (exChangeModel.activityname.Length <= 0 || exChangeModel.activityname.Length > 100)
            {
                return(Json(new { isok = false, msg = "活动名称不能为空并且小于100字符" }, JsonRequestBehavior.AllowGet));
            }

            if (!Regex.IsMatch(exChangeModel.integral.ToString(), @"^\+?[0-9]*$"))
            {
                return(Json(new { isok = false, msg = "所需积分必须为整数" }, JsonRequestBehavior.AllowGet));
            }
            if (!Regex.IsMatch(exChangeModel.stock.ToString(), @"^\+?[0-9]*$"))
            {
                return(Json(new { isok = false, msg = "库存必须为正整数" }, JsonRequestBehavior.AllowGet));
            }
            if (!Regex.IsMatch(exChangeModel.perexgcount.ToString(), @"^\+?[1-9][0-9]*$"))
            {
                return(Json(new { isok = false, msg = "每人可兑换数量必须为正整数且大于0" }, JsonRequestBehavior.AllowGet));
            }

            if (!Regex.IsMatch(exChangeModel.freight.ToString(), @"^\+?[0-9]*$"))
            {
                return(Json(new { isok = false, msg = "运费不合法!" }, JsonRequestBehavior.AllowGet));
            }

            if (exChangeModel.exchangeway == 1)
            {
                //表示积分+金额兑换需要验证金额
                if (!Regex.IsMatch(exChangeModel.price.ToString(), @"^\+?[1-9][0-9]*$") || exChangeModel.price <= 0)
                {
                    return(Json(new { isok = false, msg = "金额不合法!" }, JsonRequestBehavior.AllowGet));
                }
            }

            //图片
            string activityimg = Context.GetRequest("activityimg", string.Empty);
            string imgs        = Context.GetRequest("imgs", string.Empty);

            bool result = false;

            string[] Imgs = imgs.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
            if (exChangeModel.id > 0)
            {
                //表示更新
                ExchangeActivity model = ExchangeActivityBLL.SingleModel.GetModel(exChangeModel.id);
                if (model == null)
                {
                    return(Json(new { isok = false, msg = "数据不存在!" }, JsonRequestBehavior.AllowGet));
                }
                exChangeModel.UpdateDate = DateTime.Now;

                result = ExchangeActivityBLL.SingleModel.Update(exChangeModel);
            }
            else
            {
                if (xcxTemplate.Type == (int)TmpType.小程序专业模板)
                {
                    FunctionList functionList = new FunctionList();
                    int          industr      = xcx.VersionId;
                    functionList = FunctionListBLL.SingleModel.GetModel($"TemplateType={xcxTemplate.Type} and VersionId={industr}");
                    if (functionList == null)
                    {
                        return(Json(new { isok = false, msg = $"功能权限未设置" }, JsonRequestBehavior.AllowGet));
                    }
                    OperationMgr operationMgr = new OperationMgr();
                    if (!string.IsNullOrEmpty(functionList.OperationMgr))
                    {
                        operationMgr = JsonConvert.DeserializeObject <OperationMgr>(functionList.OperationMgr);
                    }

                    if (operationMgr.Integral == 1)
                    {
                        return(Json(new { isok = false, msg = $"请先升级到更高版本才能开启此功能" }, JsonRequestBehavior.AllowGet));
                    }
                }


                //表示新增
                if (activityimg.Length <= 0)
                {
                    return(Json(new { isok = false, msg = "请上传活动图片!" }, JsonRequestBehavior.AllowGet));
                }

                if (Imgs.Length <= 0 || Imgs.Length > 5)
                {
                    return(Json(new { isok = false, msg = "轮播图至少一张最多5张!" }, JsonRequestBehavior.AllowGet));
                }
                exChangeModel.appId      = appId;
                exChangeModel.apptype    = xcxTemplate.Type;
                exChangeModel.AddTime    = DateTime.Now;
                exChangeModel.UpdateDate = DateTime.Now;
                int id = Convert.ToInt32(ExchangeActivityBLL.SingleModel.Add(exChangeModel));
                result           = id > 0;
                exChangeModel.id = id;
            }

            if (result)
            {
                if (!string.IsNullOrEmpty(activityimg))
                {
                    //添加店铺Logo
                    C_AttachmentBLL.SingleModel.Add(new C_Attachment
                    {
                        itemId     = exChangeModel.id,
                        createDate = DateTime.Now,
                        filepath   = activityimg,
                        itemType   = (int)AttachmentItemType.小程序积分活动图片,
                        thumbnail  = Utility.AliOss.AliOSSHelper.GetAliImgThumbKey(activityimg, 300, 300),
                        status     = 0
                    });
                }


                if (Imgs.Length > 0)
                {
                    foreach (string img in Imgs)
                    {
                        //判断上传图片是否以http开头,不然为破图-蔡华兴
                        if (!string.IsNullOrWhiteSpace(img) && img.IndexOf("http") == 0)
                        {
                            C_AttachmentBLL.SingleModel.Add(new C_Attachment
                            {
                                itemId     = exChangeModel.id,
                                createDate = DateTime.Now,
                                filepath   = img,
                                itemType   = (int)AttachmentItemType.小程序积分活动轮播图,
                                thumbnail  = img,
                                status     = 0
                            });
                        }
                    }
                }

                return(Json(new { isok = true, msg = "操作成功!", obj = exChangeModel.id }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { isok = true, msg = "操作失败!" }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Caplet prices calculated as a put on a zero coupon bond.
        /// </summary>
        /// <param name="model">The model to use to execute the calculation.</param>
        /// <param name="mat">
        /// Caplet maturity. This vector starts from zero and increases
        /// of step DeltaK each element till the last one.
        /// </param>
        /// <param name="fwd">Forward with the deltaK step.</param>
        /// <param name="rk">Strike vector (columns).</param>
        /// <param name="deltaK">Amount to use as increase factor.</param>
        /// <param name="tOss">The Maturities.</param>
        /// <returns>A <see cref="Matrix"/> with the caplet prices.</returns>
        public Matrix PGSMCaplets(SquaredGaussianModel model, Vector mat, Vector fwd, Vector rk, double deltaK, Vector tOss)
        {
            double s   = model.sigma1.fV();
            int    col = rk.Length;

            int NP = (int)(1 + tOss[tOss.Length - 1] * 252);

            double[] dates = new double[NP];
            double   step  = mat[mat.Length - 1] / (NP - 1);

            for (int z = 0; z < NP; z++)
            {
                dates[z] = step * z;
            }

            DateTime t0 = DateTime.Now;

            model.Setup(dates);
            DateTime t1 = DateTime.Now;

            Vector K       = 1.0 / (1 + rk * deltaK);
            double cCost   = model.C(deltaK);
            Vector sigma0s = Math.Pow(s, 2) * CtT(model, 0, mat);

            Matrix caplets = new Matrix(mat.Length - 1, rk.Length);
            Matrix caps    = new Matrix(tOss.Length, rk.Length);

            // Pre-calculate values.
            Vector logK = Vector.Log(K);

            // Parallel version.
            List <Task> tl = new List <Task>();

            Context context = new Context();

            context.Model    = model;
            context.Mat      = mat;
            context.Fwd      = fwd;
            context.RK       = rk;
            context.DeltaK   = deltaK;
            context.TOss     = tOss;
            context.K        = K;
            context.LogK     = logK;
            context.Caplets  = caplets;
            context.Sigma0s  = sigma0s;
            context.CCost    = cCost;
            context.RowStart = 0;
            context.RowEnd   = (mat.Length - 2) / 2;
            tl.Add(Task.Factory.StartNew(Context.CalculateRowP, context));

            context          = new Context();
            context.Model    = model;
            context.Mat      = mat;
            context.Fwd      = fwd;
            context.RK       = rk;
            context.DeltaK   = deltaK;
            context.TOss     = tOss;
            context.K        = K;
            context.LogK     = logK;
            context.Caplets  = caplets;
            context.Sigma0s  = sigma0s;
            context.CCost    = cCost;
            context.RowStart = (mat.Length - 2) / 2 + 1;
            context.RowEnd   = mat.Length - 2 - 1;
            tl.Add(Task.Factory.StartNew(Context.CalculateRowP, context));

            tsScheduler.WaitTaskList(tl);

            // Sequential version.

            /*
             * Context Context = new Context();
             * Context.Model = Model;
             * Context.Mat = Mat;
             * Context.Fwd = Fwd;
             * Context.RK = RK;
             * Context.DeltaK = DeltaK;
             * Context.TOss = TOss;
             * Context.K = K;
             * Context.LogK = LogK;
             * Context.Caplets = Caplets;
             * Context.Sigma0s = Sigma0s;
             * Context.CCost = CCost;
             *
             * for (int r = 0; r < Mat.Length - 2; r++)
             * Context.CalculateRow(r);
             */

            // Calculate the caps from the caplets.
            for (int r = 0; r < tOss.Length; r++)
            {
                for (int c = 0; c < rk.Length; c++)
                {
                    double current = 0;
                    for (int ci = 0; ci < (int)(tOss[r] / deltaK) - 1; ci++)
                    {
                        current += caplets[ci, c];
                    }
                    caps[r, c] = current;
                }
            }

            return(caps);
        }
Ejemplo n.º 43
0
 public void ShowToast(Context context, string status, MaskType maskType = MaskType.Black, TimeSpan?timeout = null, bool centered = true, Action clickCallback = null, Action cancelCallback = null, Action <Dialog> prepareDialogCallback = null, Action <Dialog> dialogShownCallback = null)
 {
     showStatus(context, false, status, maskType, timeout, clickCallback, centered, cancelCallback, prepareDialogCallback, dialogShownCallback);
 }
Ejemplo n.º 44
0
        public ActionResult SaveExchangePlayCardConfig(ExchangePlayCardConfig model)
        {
            result = new Return_Msg();
            int appId = Context.GetRequestInt("appId", 0);

            if (dzaccount == null)
            {
                result.Msg = "登录信息超时";
                return(Json(result));
            }

            XcxAppAccountRelation xcx = XcxAppAccountRelationBLL.SingleModel.GetModelByaccountidAndAppid(appId, dzaccount.Id.ToString());

            if (xcx == null)
            {
                result.Msg = "小程序未授权";
                return(Json(result));
            }


            XcxTemplate xcxTemplate = XcxTemplateBLL.SingleModel.GetModel($"id={xcx.TId}");

            if (xcxTemplate == null)
            {
                result.Msg = "找不到小程序模板";
                return(Json(result));
            }

            if (xcxTemplate.Type == (int)TmpType.小程序专业模板)
            {
                FunctionList functionList = new FunctionList();
                int          industr      = xcx.VersionId;
                functionList = FunctionListBLL.SingleModel.GetModel($"TemplateType={xcxTemplate.Type} and VersionId={industr}");
                if (functionList == null)
                {
                    result.Msg = "功能权限未设置";
                    return(Json(result));
                }

                OperationMgr operationMgr = new OperationMgr();
                if (!string.IsNullOrEmpty(functionList.OperationMgr))
                {
                    operationMgr = JsonConvert.DeserializeObject <OperationMgr>(functionList.OperationMgr);
                }

                if (operationMgr.Integral == 1)
                {
                    result.Msg = "请先升级到更高版本才能开启此功能";
                    return(Json(result));
                }
            }

            Store store = StoreBLL.SingleModel.GetModelByRid(appId);

            if (store == null)
            {
                result.Msg = $"店铺配置不存在";
                return(Json(result));
            }
            ExchangePlayCardConfig exchangePlayCardConfig = new ExchangePlayCardConfig();

            store.funJoinModel = JsonConvert.DeserializeObject <StoreConfigModel>(store.configJson) ?? new StoreConfigModel();//若为 null 则new一个新的配置
            if (store.funJoinModel != null)
            {
                store.funJoinModel.ExchangePlayCardConfig = JsonConvert.SerializeObject(model);
                store.configJson = JsonConvert.SerializeObject(store.funJoinModel);
            }

            if (StoreBLL.SingleModel.Update(store, "configJson"))
            {
                result.Msg = $"保存成功";
                return(Json(result));
            }
            else
            {
                result.Msg = $"保存失败";
                return(Json(result));
            }
        }
Ejemplo n.º 45
0
 public void ShowErrorWithStatus(Context context, string status, MaskType maskType = MaskType.Black, TimeSpan?timeout = null, Action clickCallback = null, Action cancelCallback = null, Action <Dialog> prepareDialogCallback = null, Action <Dialog> dialogShownCallback = null)
 {
     showImage(context, GetDrawable(context, Resource.Drawable.ic_errorstatus), status, maskType, timeout, clickCallback, cancelCallback, prepareDialogCallback, dialogShownCallback);
 }
Ejemplo n.º 46
0
 public void Dismiss(Context context = null)
 {
     DismissCurrent(context);
 }
Ejemplo n.º 47
0
        void showStatus(Context context, bool spinner, string status = null, MaskType maskType = MaskType.Black, TimeSpan?timeout = null, Action clickCallback = null, bool centered = true, Action cancelCallback = null, Action <Dialog> prepareDialogCallback = null, Action <Dialog> dialogShownCallback = null)
        {
            if (timeout == null)
            {
                timeout = TimeSpan.Zero;
            }

            if (CurrentDialog != null && statusObj == null)
            {
                DismissCurrent(context);
            }

            lock (dialogLock)
            {
                if (CurrentDialog == null)
                {
                    SetupDialog(context, maskType, cancelCallback, (a, d, m) => {
                        View view = LayoutInflater.From(context).Inflate(Resource.Layout.loading, null);

                        if (clickCallback != null)
                        {
                            view.Click += (sender, e) => clickCallback();
                        }

                        statusObj = new object();

                        statusText = view.FindViewById <TextView>(Resource.Id.textViewStatus);

                        if (!spinner)
                        {
                            view.FindViewById <ProgressBar>(Resource.Id.loadingProgressBar).Visibility = ViewStates.Gone;
                        }

                        if (maskType != MaskType.Black)
                        {
                            view.SetBackgroundResource(Resource.Drawable.roundedbgdark);
                        }

                        if (statusText != null)
                        {
                            statusText.Text       = status ?? "";
                            statusText.Visibility = string.IsNullOrEmpty(status) ? ViewStates.Gone : ViewStates.Visible;
                        }

                        if (!centered)
                        {
                            d.Window.SetGravity(GravityFlags.Bottom);
                            var p = d.Window.Attributes;

                            p.Y = DpToPx(context, 22);

                            d.Window.Attributes = p;
                        }

                        return(view);
                    }, prepareDialogCallback, dialogShownCallback);

                    RunTimeout(context, timeout);
                }
                else
                {
                    Application.SynchronizationContext.Send(state => {
                        if (statusText != null)
                        {
                            statusText.Text = status ?? "";
                        }
                    }, null);
                }
            }
        }
Ejemplo n.º 48
0
 public void ShowImage(Context context, Drawable drawable, string status = null, MaskType maskType = MaskType.Black, TimeSpan?timeout = null, Action clickCallback = null, Action cancelCallback = null, Action <Dialog> prepareDialogCallback = null, Action <Dialog> dialogShownCallback = null)
 {
     showImage(context, drawable, status, maskType, timeout, clickCallback, cancelCallback, prepareDialogCallback, dialogShownCallback);
 }
Ejemplo n.º 49
0
 /// <inheritdoc/>
 public override void ReportError(EvaluationErrors errors, ModuleLiteral environment, LineInfo location, Expression expression, Context context)
 {
     errors.ReportContractRequire(environment, expression, Message, location);
 }
Ejemplo n.º 50
0
        int DpToPx(Context context, int dp)
        {
            var displayMetrics = context.Resources.DisplayMetrics;

            return((int)TypedValue.ApplyDimension(ComplexUnitType.Dip, dp, displayMetrics));
        }
Ejemplo n.º 51
0
 /// <summary>
 /// Fixed:
 /// </summary>
 public SysLogModel(Context context)
 {
     Class  = context.Controller;
     Method = context.Action;
     WriteSysLog(context: context);
 }
Ejemplo n.º 52
0
 public EpisodiosService(Context context)
 {
     _context = context;
 }
Ejemplo n.º 53
0
 private void SetBySession(Context context)
 {
 }
Ejemplo n.º 54
0
 /// <summary>
 /// Allows visitor based dispatch for this instruction object.
 /// </summary>
 /// <param name="visitor">The visitor object.</param>
 /// <param name="context">The context.</param>
 public override void Visit (IX86Visitor visitor, Context context)
 {
     visitor.Dec (context);
 }
Ejemplo n.º 55
0
 private void OnConstructed(Context context)
 {
 }
Ejemplo n.º 56
0
        private void Set(Context context, DataRow dataRow, string tableAlias = null)
        {
            AccessStatus = Databases.AccessStatuses.Selected;
            foreach (DataColumn dataColumn in dataRow.Table.Columns)
            {
                var column = new ColumnNameInfo(dataColumn.ColumnName);
                if (column.TableAlias == tableAlias)
                {
                    switch (column.Name)
                    {
                    case "CreatedTime":
                        if (dataRow[column.ColumnName] != DBNull.Value)
                        {
                            CreatedTime      = new Time(context, dataRow, column.ColumnName);
                            SavedCreatedTime = CreatedTime.Value;
                        }
                        break;

                    case "SysLogId":
                        if (dataRow[column.ColumnName] != DBNull.Value)
                        {
                            SysLogId      = dataRow[column.ColumnName].ToLong();
                            SavedSysLogId = SysLogId;
                        }
                        break;

                    case "Ver":
                        Ver      = dataRow[column.ColumnName].ToInt();
                        SavedVer = Ver;
                        break;

                    case "SysLogType":
                        SysLogType      = (SysLogTypes)dataRow[column.ColumnName].ToInt();
                        SavedSysLogType = SysLogType.ToInt();
                        break;

                    case "OnAzure":
                        OnAzure      = dataRow[column.ColumnName].ToBool();
                        SavedOnAzure = OnAzure;
                        break;

                    case "MachineName":
                        MachineName      = dataRow[column.ColumnName].ToString();
                        SavedMachineName = MachineName;
                        break;

                    case "ServiceName":
                        ServiceName      = dataRow[column.ColumnName].ToString();
                        SavedServiceName = ServiceName;
                        break;

                    case "TenantName":
                        TenantName      = dataRow[column.ColumnName].ToString();
                        SavedTenantName = TenantName;
                        break;

                    case "Application":
                        Application      = dataRow[column.ColumnName].ToString();
                        SavedApplication = Application;
                        break;

                    case "Class":
                        Class      = dataRow[column.ColumnName].ToString();
                        SavedClass = Class;
                        break;

                    case "Method":
                        Method      = dataRow[column.ColumnName].ToString();
                        SavedMethod = Method;
                        break;

                    case "RequestData":
                        RequestData      = dataRow[column.ColumnName].ToString();
                        SavedRequestData = RequestData;
                        break;

                    case "HttpMethod":
                        HttpMethod      = dataRow[column.ColumnName].ToString();
                        SavedHttpMethod = HttpMethod;
                        break;

                    case "RequestSize":
                        RequestSize      = dataRow[column.ColumnName].ToInt();
                        SavedRequestSize = RequestSize;
                        break;

                    case "ResponseSize":
                        ResponseSize      = dataRow[column.ColumnName].ToInt();
                        SavedResponseSize = ResponseSize;
                        break;

                    case "Elapsed":
                        Elapsed      = dataRow[column.ColumnName].ToDouble();
                        SavedElapsed = Elapsed;
                        break;

                    case "ApplicationAge":
                        ApplicationAge      = dataRow[column.ColumnName].ToDouble();
                        SavedApplicationAge = ApplicationAge;
                        break;

                    case "ApplicationRequestInterval":
                        ApplicationRequestInterval      = dataRow[column.ColumnName].ToDouble();
                        SavedApplicationRequestInterval = ApplicationRequestInterval;
                        break;

                    case "SessionAge":
                        SessionAge      = dataRow[column.ColumnName].ToDouble();
                        SavedSessionAge = SessionAge;
                        break;

                    case "SessionRequestInterval":
                        SessionRequestInterval      = dataRow[column.ColumnName].ToDouble();
                        SavedSessionRequestInterval = SessionRequestInterval;
                        break;

                    case "WorkingSet64":
                        WorkingSet64      = dataRow[column.ColumnName].ToLong();
                        SavedWorkingSet64 = WorkingSet64;
                        break;

                    case "VirtualMemorySize64":
                        VirtualMemorySize64      = dataRow[column.ColumnName].ToLong();
                        SavedVirtualMemorySize64 = VirtualMemorySize64;
                        break;

                    case "ProcessId":
                        ProcessId      = dataRow[column.ColumnName].ToInt();
                        SavedProcessId = ProcessId;
                        break;

                    case "ProcessName":
                        ProcessName      = dataRow[column.ColumnName].ToString();
                        SavedProcessName = ProcessName;
                        break;

                    case "BasePriority":
                        BasePriority      = dataRow[column.ColumnName].ToInt();
                        SavedBasePriority = BasePriority;
                        break;

                    case "Url":
                        Url      = dataRow[column.ColumnName].ToString();
                        SavedUrl = Url;
                        break;

                    case "UrlReferer":
                        UrlReferer      = dataRow[column.ColumnName].ToString();
                        SavedUrlReferer = UrlReferer;
                        break;

                    case "UserHostName":
                        UserHostName      = dataRow[column.ColumnName].ToString();
                        SavedUserHostName = UserHostName;
                        break;

                    case "UserHostAddress":
                        UserHostAddress      = dataRow[column.ColumnName].ToString();
                        SavedUserHostAddress = UserHostAddress;
                        break;

                    case "UserLanguage":
                        UserLanguage      = dataRow[column.ColumnName].ToString();
                        SavedUserLanguage = UserLanguage;
                        break;

                    case "UserAgent":
                        UserAgent      = dataRow[column.ColumnName].ToString();
                        SavedUserAgent = UserAgent;
                        break;

                    case "SessionGuid":
                        SessionGuid      = dataRow[column.ColumnName].ToString();
                        SavedSessionGuid = SessionGuid;
                        break;

                    case "ErrMessage":
                        ErrMessage      = dataRow[column.ColumnName].ToString();
                        SavedErrMessage = ErrMessage;
                        break;

                    case "ErrStackTrace":
                        ErrStackTrace      = dataRow[column.ColumnName].ToString();
                        SavedErrStackTrace = ErrStackTrace;
                        break;

                    case "InDebug":
                        InDebug      = dataRow[column.ColumnName].ToBool();
                        SavedInDebug = InDebug;
                        break;

                    case "AssemblyVersion":
                        AssemblyVersion      = dataRow[column.ColumnName].ToString();
                        SavedAssemblyVersion = AssemblyVersion;
                        break;

                    case "Comments":
                        Comments      = dataRow[column.ColumnName].ToString().Deserialize <Comments>() ?? new Comments();
                        SavedComments = Comments.ToJson();
                        break;

                    case "Creator":
                        Creator      = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName));
                        SavedCreator = Creator.Id;
                        break;

                    case "Updator":
                        Updator      = SiteInfo.User(context: context, userId: dataRow.Int(column.ColumnName));
                        SavedUpdator = Updator.Id;
                        break;

                    case "UpdatedTime":
                        UpdatedTime      = new Time(context, dataRow, column.ColumnName); Timestamp = dataRow.Field <DateTime>(column.ColumnName).ToString("yyyy/M/d H:m:s.fff");
                        SavedUpdatedTime = UpdatedTime.Value;
                        break;

                    case "IsHistory":
                        VerType = dataRow.Bool(column.ColumnName)
                                ? Versions.VerTypes.History
                                : Versions.VerTypes.Latest; break;

                    default:
                        switch (Def.ExtendedColumnTypes.Get(column.Name))
                        {
                        case "Class":
                            Class(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToString());
                            SavedClass(
                                columnName: column.Name,
                                value: Class(columnName: column.Name));
                            break;

                        case "Num":
                            Num(
                                columnName: column.Name,
                                value: new Num(
                                    dataRow: dataRow,
                                    name: column.ColumnName));
                            SavedNum(
                                columnName: column.Name,
                                value: Num(columnName: column.Name).Value);
                            break;

                        case "Date":
                            Date(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToDateTime());
                            SavedDate(
                                columnName: column.Name,
                                value: Date(columnName: column.Name));
                            break;

                        case "Description":
                            Description(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToString());
                            SavedDescription(
                                columnName: column.Name,
                                value: Description(columnName: column.Name));
                            break;

                        case "Check":
                            Check(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToBool());
                            SavedCheck(
                                columnName: column.Name,
                                value: Check(columnName: column.Name));
                            break;

                        case "Attachments":
                            Attachments(
                                columnName: column.Name,
                                value: dataRow[column.ColumnName].ToString()
                                .Deserialize <Attachments>() ?? new Attachments());
                            SavedAttachments(
                                columnName: column.Name,
                                value: Attachments(columnName: column.Name).ToJson());
                            break;
                        }
                        break;
                    }
                }
            }
        }
Ejemplo n.º 57
0
 public override SizeRequest GetDesiredSize(int widthConstraint, int heightConstraint)
 {
     return(new SizeRequest(new Size(Context.ToPixels(40), Context.ToPixels(40))));
 }
Ejemplo n.º 58
0
 public void ClearSessions(Context context)
 {
 }
Ejemplo n.º 59
0
        private static void GetMultibootEAX(Context context, MethodCompiler methodCompiler)
        {
            var MultibootEAX = Operand.CreateUnmanagedSymbolPointer(Intel.CompilerStages.MultibootV1Stage.MultibootEAX, methodCompiler.TypeSystem);

            context.SetInstruction(IRInstruction.Load32, context.Result, MultibootEAX, methodCompiler.ConstantZero32);
        }
Ejemplo n.º 60
0
 private void OnConstructing(Context context)
 {
 }