示例#1
0
        public void CreateMethod()
        {
            // preparation
            var config = new Mock <IConfiguration>();

            config.Setup(_ => _["COSMOS_AUTO_GENERATE"]).Returns("true");
            var containerScripts = new Mock <Scripts>();
            var container        = new Mock <Container>();

            container.Setup(_ => _.Scripts).Returns(containerScripts.Object);
            var containerResponse = new Mock <ContainerResponse>();

            containerResponse.Setup(_ => _.Container).Returns(container.Object);
            var database = new Mock <Database>();

            database.Setup(_ => _.CreateContainerIfNotExistsAsync
                               (It.IsAny <ContainerProperties>(), It.IsAny <int?>(), It.IsAny <Microsoft.Azure.Cosmos.RequestOptions>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(containerResponse.Object);
            database.Setup(_ => _.GetContainer(It.IsAny <string>()))
            .Returns(container.Object);
            var databaseResponse = new Mock <DatabaseResponse>();

            databaseResponse.Setup(_ => _.Database).Returns(database.Object);
            databaseResponse.Setup(_ => _.StatusCode).Returns(System.Net.HttpStatusCode.OK);
            var client = new Mock <CosmosClient>();

            client.Setup(_ => _.CreateDatabaseIfNotExistsAsync
                             (It.IsAny <string>(), It.IsAny <int?>(), It.IsAny <Microsoft.Azure.Cosmos.RequestOptions>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(databaseResponse.Object);

            var logger = new LoggerMock <ICosmos>();
            // action
            var instance = new Cosmos(config.Object, client.Object, logger);
        }
 public override void UpdateAddress( Cosmos.Assembler.Assembler aAssembler, ref ulong aAddress )
 {
     if (SourceRef != null) {
         SourceValue = 0xFFFFFFFF;
     }
     base.UpdateAddress(aAssembler, ref aAddress);
 }
 protected void GivenThePublishedFundingVersionFeed(ICosmosDbFeedIterator <PublishedFundingVersion> feed)
 {
     Cosmos.Setup(_ => _.GetPublishedFundingVersions(TaskDetails.FundingStreamId,
                                                     TaskDetails.FundingPeriodId,
                                                     TaskDetails.TimeStamp))
     .Returns(feed);
 }
示例#4
0
    /* void Copy(Array sourceArray,			ebp + 0x1C
     *			 int sourceIndex,			ebp + 0x18
     *			 Array destinationArray,	ebp + 0x14
     *			 int destinationIndex,		ebp + 0x10
     *			 int length,				ebp + 0xC
     *			 bool reliable);			ebp + 0x8
     */
    public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
      new CPUx86.Push { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement = 0x1C };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceValue = 12, Size = 32 }; // pointer is at the element size
      new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true }; // element size
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EBX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x18 };
      new CPUx86.Multiply { DestinationReg = CPUx86.Registers.EBX };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 16 };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.ESI, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x1C };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.ESI, SourceReg = CPUx86.Registers.EAX }; // source ptr
      new CPUx86.Push { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement = 0x14 };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceValue = 12, Size = 32 }; // pointer is at element size
      new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x10 };
      new CPUx86.Multiply { DestinationReg = CPUx86.Registers.ECX };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 16 };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x14 };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EAX };

      // calculate byte count to copy
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x14 };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 12 };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0xC };
      new CPUx86.Multiply { DestinationReg = CPUx86.Registers.EDX };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.EAX, };
      new CPUx86.Movs { Size = 8, Prefixes = CPUx86.InstructionPrefixes.Repeat };
    }
    public void formcontent(string NO)
    {
        ArrayList list = new ArrayList();
        Transform data;

        currentdisplay = NO;
        for (int i = 0; i < Cosmos.Instance().worddata.Length; i++)
        {
            if (Cosmos.Instance().worddata[i].FileID == NO)
            {
                list.Add(Cosmos.Instance().worddata[i]);
            }
        }

        FileLinedatatype[] display = (FileLinedatatype[])list.ToArray(typeof(FileLinedatatype));
        //display element
        clearpool();
        for (int i = 0; i < display.Length; i++)
        {
            data = Instantiate(ContentPrefab, gameObject.transform);
            data.GetComponent <Text> ().text = display [i].Content;
            data.Find("SelectText").GetComponent <Text>().text = display [i].Content;
            data.GetComponent <Toggle> ().group            = gameObject.transform.GetComponent <ToggleGroup>();
            data.GetComponent <ContentTextScript>().LineID = display [i].FileID + "-" + display [i].LineID;
        }
    }
示例#6
0
文件: Ldflda.cs 项目: iSalva/Cosmos
        public static void DoExecute(Cosmos.Assembler.Assembler Assembler, MethodInfo aMethod, Type aDeclaringType, FieldInfo aField, bool aDerefValue, bool aDebugEnabled)
        {
            int xExtraOffset = 0;
            var xType = aMethod.MethodBase.DeclaringType;
            bool xNeedsGC = aDeclaringType.IsClass && !aDeclaringType.IsValueType;

            if (xNeedsGC)
            {
                xExtraOffset = 12;
            }

            var xActualOffset = aField.Offset + xExtraOffset;
            var xSize = aField.Size;
            DoNullReferenceCheck(Assembler, aDebugEnabled, 0);

            if (aDerefValue && aField.IsExternalValue)
            {
                new CPUx86.Mov
                {
                    DestinationReg = CPUx86.Registers.EAX,
                    SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true, SourceDisplacement = (int) xActualOffset
                };
                new CPUx86.Mov {DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceReg = CPUx86.Registers.EAX};
            }
            else
                new CPUx86.Add {DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceValue = (uint) (xActualOffset)};
        }
示例#7
0
 public override void WriteText(Cosmos.Assembler.Assembler aAssembler, System.IO.TextWriter aOutput)
 {
     switch (Condition)
     {
         case FloatConditionalMoveTestEnum.Below:
             aOutput.Write("fcmovb");
             break;
         case FloatConditionalMoveTestEnum.Equal:
             aOutput.Write("fcmove");
             break;
         case FloatConditionalMoveTestEnum.BelowOrEqual:
             aOutput.Write("fcmovbe");
             break;
         case FloatConditionalMoveTestEnum.Unordered:
             aOutput.Write("fcmovu");
             break;
         case FloatConditionalMoveTestEnum.NotBelow:
             aOutput.Write("fcmovnb");
             break;
         case FloatConditionalMoveTestEnum.NotEqual:
             aOutput.Write("fcmovne");
             break;
         case FloatConditionalMoveTestEnum.NotBelowOrEqual:
             aOutput.Write("fcmovnbe");
             break;
         case FloatConditionalMoveTestEnum.Ordered:
             aOutput.Write("fcmovnu");
             break;
     }
     aOutput.Write(" ");
     aOutput.Write("ST0");
     aOutput.Write(", ");
     aOutput.Write(this.GetSourceAsString());
 }
示例#8
0
        public static void Assemble(Cosmos.Assembler.Assembler aAssembler, OpType aOpType, uint aElementSize, bool debugEnabled)
        {
            XS.Comment("Arraytype: " + aOpType.StackPopTypes.Last().FullName);
            XS.Comment("Size: " + aElementSize);

            DoNullReferenceCheck(aAssembler, debugEnabled, 4);
            // calculate element offset into array memory (including header)
            XS.Pop(XSRegisters.EAX);
            XS.Set(XSRegisters.EDX, aElementSize);
            XS.Multiply(XSRegisters.EDX);
            XS.Add(XSRegisters.EAX, (uint)(ObjectImpl.FieldDataOffset + 4));

            // pop the array now
            XS.Pop(XSRegisters.EDX);
            // translate it to actual memory
            XS.Set(XSRegisters.EDX, XSRegisters.EDX, sourceIsIndirect: true);

            if (aOpType.StackPopTypes.Last().GetElementType().IsClass)
            {
                XS.Set(XSRegisters.EDX, XSRegisters.EDX, sourceIsIndirect: true);
            }

            XS.Add(XSRegisters.EDX, XSRegisters.EAX);
            XS.Push(XSRegisters.EDX);
        }
 public override void UpdateAddress( Cosmos.Assembler.Assembler aAssembler, ref ulong aAddresss )
 {
     if (DestinationRef != null) {
         DestinationValue = 0xFFFFFFFF;
     }
     base.UpdateAddress(aAssembler, ref aAddresss);
 }
示例#10
0
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
  new LiteralAssemblerCode("%ifdef DEBUGSTUB");
  new LiteralAssemblerCode("pushad");
  new LiteralAssemblerCode("Call DebugStub_TraceOn");
  new LiteralAssemblerCode("popad");
  new LiteralAssemblerCode("%endif");
 }
示例#11
0
 //LostFocus=="txtProduto_LostFocus"
 private void txtProduto_LostFocus(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(txtProduto.Text))
     {
         try
         {
             var dados = Cosmos.GetProdutoApi(txtProduto.Text);
             if (dados != null)
             {
                 var lista = dados?.Split('|');
                 if (lista.Length > 0)
                 {
                     txtProduto.Text = lista[1];
                     txtPreco.Text   = lista[0];
                     txtQtd.Focus();
                     imgFotoProduto.Source = new BitmapImage(new Uri(lista[2]));
                 }
             }
             else
             {
                 imgFotoProduto.Source = null;
             }
         }
         catch (Exception ex)
         {
             //sem dados da api
             imgFotoProduto.Source = null;
             Console.WriteLine(ex.ToString());
         }
     }
 }
 public override void UpdateAddress( Cosmos.Assembler.Assembler aAssembler, ref ulong aAddress )
 {
     if (ArgumentRef != null) {
         ArgumentValue = 0xFFFFFFFF;
     }
     base.UpdateAddress(aAssembler, ref aAddress);
 }
    public void globaltopicsettlement()
    {
        bool flag;

        for (int i = 0; i < Cosmos.Instance().Topiclist.Length; i++)
        {
            if (Cosmos.Instance().Topiclist[i].Depand.Length != 0)
            {
                flag = false;
                for (int j = 0; j < Cosmos.Instance().Topiclist[i].Depand.Length; j++)
                {
                    if (Cosmos.Instance().ActivatedConclusion.FindIndex(x => x.NO == Cosmos.Instance().Topiclist[i].Depand[j]) != -1)
                    {
                        flag = true;
                    }
                }
                if (flag && Cosmos.Instance().Topiclist[i].Discovered == false)
                {
                    Cosmos.Instance().Topiclist[i].Discovered = true;
                }
                Cosmos.Instance().Topiclist[i].Interactable = flag;
            }
        }
        updatealltopic();
    }
示例#14
0
        public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
        {
            // method signature: $this, object @object, IntPtr method
            var xAssembler = aAssembler;
            var xMethodInfo = (MethodInfo)aMethodInfo;
            XS.Comment("Save target ($this) to field");
            XS.Comment("-- ldarg 0");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
            XS.Comment("-- ldarg 1");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 1);
            XS.Comment("-- stfld _target");
            Stfld.DoExecute(xAssembler, xMethodInfo, "System.Object System.Delegate._target", xMethodInfo.MethodBase.DeclaringType, true, false);
            XS.Comment("Save method pointer to field");
            XS.Comment("-- ldarg 0");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
            XS.Comment("-- ldarg 2");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 2);
            XS.Comment("-- stfld _methodPtr");
            Stfld.DoExecute(xAssembler, xMethodInfo, "System.IntPtr System.Delegate._methodPtr", xMethodInfo.MethodBase.DeclaringType, true, false);
            XS.Comment("Saving ArgSize to field");
            uint xSize = 0;
            foreach (var xArg in xMethodInfo.MethodBase.DeclaringType.GetMethod("Invoke").GetParameters())
            {
                xSize += ILOp.Align(ILOp.SizeOfType(xArg.ParameterType), 4);
            }

            XS.Comment("-- ldarg 0");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
            XS.Comment("-- push argsize");
            XS.Push(xSize);
            XS.Comment("-- stfld ArgSize");
            Stfld.DoExecute(xAssembler, xMethodInfo, "$$ArgSize$$", xMethodInfo.MethodBase.DeclaringType, true, false);
        }
示例#15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>true if parsing had no errors</returns>
        public bool Parse()
        {
            if (AlreadyParsed)
            {
                return(ParsingWasSuccessfull);
            }

            //Sets default console if needed
            console ??= new DefaultConsole();

            var antlrInputStream = new AntlrInputStream(code);
            var lexer            = new CosmosLexer(antlrInputStream);
            var tokens           = new CommonTokenStream(lexer);
            var parser           = new Cosmos(tokens);

            ErrorListener = new ErrorListener(console);
            parser.RemoveErrorListeners();
            parser.AddErrorListener(ErrorListener);

            context = parser.programme();

            var result = !ErrorListener.HadError;

            AlreadyParsed         = true;
            ParsingWasSuccessfull = result;

            return(result);
        }
示例#16
0
        public static void Assemble(Cosmos.Assembler.Assembler aAssembler, OpType aOpType, uint aElementSize, bool debugEnabled)
        {
            new Comment("Arraytype: " + aOpType.StackPopTypes.Last().FullName);
            new Comment("Size: " + aElementSize);

            DoNullReferenceCheck(aAssembler, debugEnabled, 4);
            // calculate element offset into array memory (including header)
            new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceValue = aElementSize };
            new CPUx86.Multiply { DestinationReg = CPUx86.Registers.EDX };
            new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = (uint)(ObjectImpl.FieldDataOffset + 4) };

            // pop the array now
            new CPUx86.Pop { DestinationReg = CPUx86.Registers.EDX };
            // translate it to actual memory
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.RegistersEnum.EDX, SourceIsIndirect = true };

            if (aOpType.StackPopTypes.Last().GetElementType().IsClass)
            {
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.RegistersEnum.EDX, SourceIsIndirect = true };
            }

            new CPUx86.Add { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EAX };
            new CPUx86.Push { DestinationReg = CPUx86.Registers.EDX };
        }
示例#17
0
    //; Method 'System.UInt32  Cosmos.Kernel.Plugs.CPU.HasCPUIDSupport()'
    //; Locals:
    //; 	(0) 0	4	ebp - 04h (Type = System.UInt32)
    //; Arguments:
    //; 	(none)
    //; 	ReturnSize: 4
    public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
        /*XS.Pushfd();
        new CPUx86.Pop("eax");
        new CPUx86.Move("ecx", "eax");

        new CPUx86.Xor("eax", "200000h");
        new CPUx86.Push("eax");
        XS.Popfd();

        XS.Pushfd();
        new CPUx86.Pop("ebx");
        new CPUx86.Xor("eax", "ebx");
        new CPUx86.And("eax", "200000h");
        new CPUx86.JumpIfZero(".not");

        new CPUx86.Move("eax", "1");
        new CPUx86.Jump(".return");

        new CPUAll.Label(".not");
        new CPUx86.Xor("eax", "eax");

        new CPUAll.Label(".return");
        new CPUx86.Push("ecx");
        XS.Popfd();

        new CPUx86.Push("eax");*/
      XS.Push(0);
    }
示例#18
0
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     // $this   ebp+8
     new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 8 };
     new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.EAX, SourceIsIndirect = true };
     new Push { DestinationIsIndirect = true, DestinationReg = Registers.EAX, DestinationDisplacement = 8 };
 }
示例#19
0
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x08 };
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
     new CPUx86.IN { DestinationReg = CPUx86.Registers.AX };
     new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
 }
    public void displaytopic(string topicID)
    {
        Transform data;
        string    content;

        clearpool();
        gameObject.transform.Find("TitleTopicBar/Text").GetComponent <Text>().text = Cosmos.Instance().searchtopic(topicID);
        int target = -1;

        for (int i = 0; i < Cosmos.Instance().Topiclist.Length; i++)
        {
            if (Cosmos.Instance().Topiclist [i].NO == topicID)
            {
                target = i;
            }
        }
        if (target != -1 && Cosmos.Instance().Topiclist [target].Evidence.Count != 0)
        {
            for (int i = 0; i < Cosmos.Instance().Topiclist [target].Evidence.Count; i++)
            {
                data    = Instantiate(evidenceprefab, gameObject.transform.Find("EvidencePool/LayoutController"));
                content = Cosmos.Instance().searchline(Cosmos.Instance().Topiclist [target].Evidence [i].eviID);
                data.GetComponent <EvidenceTextScript> ().LineID = Cosmos.Instance().Topiclist [target].Evidence [i].eviID;
                data.GetComponent <Text> ().text = content;
                data.Find("SelectText").GetComponent <Text> ().text = content;
                data.GetComponent <Toggle> ().group = data.parent.GetComponent <ToggleGroup>();
            }
        }
    }
    public void deletebuttonevent()
    {
        Transform layout = gameObject.transform.Find("EvidencePool/LayoutController");
        int       target = -1;

        if (currentselect != null)
        {
            for (int i = 0; i < Cosmos.Instance().Topiclist.Length; i++)
            {
                if (Cosmos.Instance().Topiclist [i].NO == currenttopic)
                {
                    target = Cosmos.Instance().Topiclist [i].Evidence.FindIndex(x => x.eviID == currentselect);
                    if (Cosmos.Instance().Topiclist [i].Evidence [target].Activated == true)
                    {
                        print("Error:Current Evidence Acitvated");
                        return;
                    }
                    Cosmos.Instance().Topiclist[i].Evidence.RemoveAt(target);
                }
                //destory the prefab
                for (int j = 0; j < layout.childCount; j++)
                {
                    if (layout.GetChild(j).GetComponent <Toggle> ().isOn)
                    {
                        Destroy(layout.GetChild(j).gameObject);
                    }
                }
            }
        }
    }
示例#22
0
文件: Ldfld.cs 项目: iSalva/Cosmos
        public static void DoExecute(Cosmos.Assembler.Assembler Assembler, Type aDeclaringType, string xFieldId, bool aDerefExternalField, bool debugEnabled) {
          var xOffset = GetFieldOffset(aDeclaringType, xFieldId);
          var xFields = GetFieldsInfo(aDeclaringType, false);
          var xFieldInfo = (from item in xFields
                            where item.Id == xFieldId
                            select item).Single();
          new Comment("Field = '" + xFieldId + "'");

            DoNullReferenceCheck(Assembler, debugEnabled, 0);

          new CPUx86.Pop { DestinationReg = CPUx86.Registers.ECX };

#if DOTNETCOMPATIBLE
			// pushed size is always 4 or 8
			var xSize = ILOp.Align(xFieldInfo.Size, 4);
#else
			var xSize = xFieldInfo.Size;
#endif

          new CPUx86.Add { DestinationReg = CPUx86.Registers.ECX, SourceValue = (uint)(xOffset) };

          if( xFieldInfo.IsExternalValue && aDerefExternalField)
          {
              new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true };
          }

          for (int i = 1; i <= (xSize / 4); i++) {
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true, SourceDisplacement = (int)(xSize - (i * 4)) };
            new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
          }
          switch (xSize % 4) {
            case 1: {
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.AL, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true };
                new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
                break;
              }
            case 2: {
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.AX, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true };
                new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
                break;
              }

            case 3: //For Release
                    {
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true };
                new CPUx86.ShiftRight { DestinationReg = CPUx86.Registers.EAX, SourceValue = 8 };
                new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
                break;
              }
            case 0: {
                      break;
                    }
            default:
              throw new Exception(string.Format("Remainder size {0:D} {1:D} not supported!", xFieldInfo.FieldType.ToString(), xSize));
          }
        }
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     var xAsm = (Assembler.Assembler)aAssembler;
     var xMethodInfo = (MethodInfo)aMethodInfo;
     var xDelegate = typeof(Delegate);
     var xMethod = xDelegate.GetMethod("GetInvokeMethod", BindingFlags.NonPublic | BindingFlags.Instance);
     XS.Push(ILOp.GetMethodLabel(xMethod));
 }
示例#24
0
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     new LiteralAssemblerCode("%ifdef DEBUGSTUB");
       new LiteralAssemblerCode("push dword [EBP + 8]");
       new LiteralAssemblerCode("Call DebugStub_SendComplexNumber");
       new LiteralAssemblerCode("add ESP, 4");
       new LiteralAssemblerCode("%endif");
 }
 public static Cosmos Instance()
 {
     if (instance == null)
     {
         instance = new Cosmos();
     }
     return(instance);
 }
示例#26
0
文件: CPUImpl.cs 项目: nwiede/Cosmos
			public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
				new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceRef = CPUAll.ElementReference.New("MultiBootInfo_Memory_High"), SourceIsIndirect = true };
				new CPUx86.Xor { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EDX };
				new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceValue = 1024 };
				new CPUx86.Divide { DestinationReg = CPUx86.Registers.ECX };
				new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 1 };
				new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
			}
示例#27
0
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
   XS.Mov(XSRegisters.EAX, CPUAll.ElementReference.New("MultiBootInfo_Memory_High"), sourceIsIndirect: true);
   XS.Xor(XSRegisters.EDX, XSRegisters.CPUx86.Registers.EDX);
   XS.Mov(XSRegisters.ECX, 1024);
   XS.Divide(XSRegisters.ECX);
   XS.Add(XSRegisters.EAX, 1);
   XS.Push(XSRegisters.EAX);
 }
 public override bool IsComplete( Cosmos.Assembler.Assembler aAssembler )
 {
     if (ArgumentRef != null) {
         ulong xAddress;
         return base.IsComplete(aAssembler) && ArgumentRef.Resolve(aAssembler, out xAddress);
     }
     return base.IsComplete(aAssembler);
 }
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     var xAsm = (Assembler)aAssembler;
     var xMethodInfo = (MethodInfo)aMethodInfo;
     var xDelegate = typeof(Delegate);
     var xMethod = xDelegate.GetMethod("GetInvokeMethod", BindingFlags.NonPublic | BindingFlags.Instance);
     new CPUx86.Push { DestinationRef = Cosmos.Assembler.ElementReference.New(ILOp.GetMethodLabel(xMethod)) };
 }
示例#30
0
 private void Form1_Load(object sender, EventArgs e)
 {
     hostXobj = Cosmos.GetXobjFromControl(this);
     if (hostXobj != null)
     {
         hostXobj.OnCloudMessageReceived += HostXobj_OnCloudMessageReceived;
     }
 }
示例#31
0
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x08 };
     //TODO: Do we need to clear rest of EAX first?
     //    MTW: technically not, as in other places, it _should_ be working with AL too..
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
     new CPUx86.IN { DestinationReg = CPUx86.Registers.AL };
     new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
 }
示例#32
0
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     //TODO: This is a lot of work to write to a single port.
     // We need to have some kind of inline ASM option that can
     // emit a single out instruction
     XS.Set(XSRegisters.EDX, XSRegisters.EBP, sourceDisplacement: 0x0C);
     XS.Set(XSRegisters.EAX, XSRegisters.EBP, sourceDisplacement: 0x08);
     XS.WriteToPortDX(XSRegisters.AL);
 }
示例#33
0
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     //TODO: This is a lot of work to write to a single port.
     // We need to have some kind of inline ASM option that can
     // emit a single out instruction
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceDisplacement = 0x0C, SourceIsIndirect = true };
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EBP, SourceDisplacement = 0x08, SourceIsIndirect = true };
     new CPUx86.Out { DestinationReg = CPUx86.Registers.AL };
 }
示例#34
0
 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     XS.Set(XSRegisters.EAX, "MultiBootInfo_Memory_High", sourceIsIndirect: true);
     XS.Xor(XSRegisters.EDX, XSRegisters.EDX);
     XS.Set(XSRegisters.ECX, 1024);
     XS.Divide(XSRegisters.ECX);
     XS.Add(XSRegisters.EAX, 1);
     XS.Push(XSRegisters.EAX);
 }
示例#35
0
 public override void WriteText( Cosmos.Assembler.Assembler aAssembler, System.IO.TextWriter aOutput )
 {
     aOutput.Write(mMnemonic);
     String destination = this.GetDestinationAsString();
     if (!(DestinationEmpty && destination.Equals("")))
     {
         aOutput.Write(" ");
         aOutput.Write(destination);
     }
 }
示例#36
0
 //public override byte[] GetData(Assembler aAssembler) {
 public override void WriteData( Cosmos.Assembler.Assembler aAssembler, System.IO.Stream aOutput )
 {
     aOutput.WriteByte(0xEA);
     ulong xAddress = 0;
     if (DestinationRef != null && DestinationRef.Resolve(aAssembler, out xAddress)) {
         xAddress = (ulong)(((long)xAddress) + DestinationRef.Offset);
     }
     aOutput.Write(BitConverter.GetBytes((uint)(xAddress)), 0, 4);
     aOutput.Write(BitConverter.GetBytes(Segment), 0, 2);
 }
 public override void WriteText(Cosmos.Assembler.Assembler aAssembler, System.IO.TextWriter aOutput)
 {
     aOutput.Write(mMnemonic);
     aOutput.Write(" ");
     aOutput.Write(this.GetDestinationAsString());
     aOutput.Write(", ");
     aOutput.Write(this.GetSourceAsString());
     aOutput.Write(", ");
     aOutput.Write(this.pseudoOpcode);
 }
示例#38
0
        public static void naAPI()
        {
            Cosmos sirius_security = new Cosmos(); //still an cosmos object

            sirius_security.GetACL("weak");        //location input is hdfs style not windows based >> ex. C:\\ result is located at C:\COSMOS\SIRIUS_PERMISSION.txt
            //sirius_security.SetUserACL("/weak", "---", "clock", false);
            sirius_security.SetUserACL("/sans", "r--", "dayana", true);
            //sirius_security.SetOthersACL("/weak/hi.txt", "---", false);
            //sirius_security.SetGroupACL("/weak/hi.txt", "---", "",false);
        }
示例#39
0
文件: MathImpl.cs 项目: iSalva/Cosmos
			public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
			{
				new CPUx86.x87.FloatLoad { DestinationReg = CPUx86.Registers.EBP, Size = 64, DestinationIsIndirect = true, DestinationDisplacement = 8 };
				new CPUx86.x87.FloatSqrt{ };
				// reservate 8 byte for returntype double on stack
				new CPUx86.Sub { DestinationReg = CPUx86.Registers.ESP, SourceValue = 8 };
				// write double value to this reservation
				new CPUx86.x87.FloatStoreAndPop { DestinationReg = CPUx86.Registers.ESP, Size = 64, DestinationIsIndirect = true };
				// after this is the result popped
			}
示例#40
0
 void pushdata()
 {
     for (int i = 0; i < Cosmos.Instance().Topiclist.Length; i++)
     {
         if (Cosmos.Instance().Topiclist [i].NO == topicID)
         {
             Cosmos.Instance().Topiclist[i] = topic;
             break;
         }
     }
 }
        public override void WriteText( Cosmos.Assembler.Assembler aAssembler, System.IO.TextWriter aOutput )
{
            aOutput.Write(mMnemonic);
            aOutput.Write(" ");
            aOutput.Write(SizeToString(Size));
            if (!DestinationEmpty)
            {
                aOutput.Write(" ");
                aOutput.Write(this.GetDestinationAsString());
            }
        }
示例#42
0
 public void pulldata()
 {
     for (int i = 0; i < Cosmos.Instance().Topiclist.Length; i++)
     {
         if (Cosmos.Instance().Topiclist [i].NO == topicID)
         {
             topic = Cosmos.Instance().Topiclist [i];
             break;
         }
     }
 }
示例#43
0
文件: Ldelema.cs 项目: iSalva/Cosmos
 public static void Assemble(Cosmos.Assembler.Assembler aAssembler, uint aElementSize, bool debugEnabled)
 {
     DoNullReferenceCheck(aAssembler, debugEnabled, 4);
     new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceValue = aElementSize };
     new CPUx86.Multiply { DestinationReg = CPUx86.Registers.EDX };
     new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = ( uint )( ObjectImpl.FieldDataOffset + 4 ) };
     new CPUx86.Pop { DestinationReg = CPUx86.Registers.EDX };
     new CPUx86.Add { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EAX };
     new CPUx86.Push { DestinationReg = CPUx86.Registers.EDX };
 }
        protected override async Task <PublishedProviderVersion> GetPreviousPublishedProviderVersion(string providerId,
                                                                                                     PublishedFundingUndoTaskContext taskContext,
                                                                                                     PublishedProviderStatus?status = null)
        {
            LogInformation($"Querying latest earlier published provider version for '{taskContext.Parameters}'");

            UndoTaskDetails taskDetails = taskContext.PublishedProviderVersionDetails;

            return(await Cosmos.GetLatestEarlierPublishedProviderVersionFromVersion(taskDetails.FundingStreamId,
                                                                                    taskDetails.FundingPeriodId,
                                                                                    taskDetails.Version,
                                                                                    providerId,
                                                                                    status));
        }
示例#45
0
 private void button4_Click(object sender, EventArgs e)
 {
     string xml = "<content1>" +
                  "<layout>" +
                  "<grid style=\"43\">" +
                  "<grid id='tangramtabctrl_Page2' objid=\"nucleus\" caption='Page 1'></grid>" +
                  "<grid id='test1' caption='Page 2'></grid>" +
                  "<grid id='test2' caption='Page 3'></grid>" +
                  "<grid id='test3' caption='Page 4'></grid>" +
                  "</grid>" +
                  "</layout>" +
                  "</content1>";
     Xobj grid = Cosmos.Observe(treeView1, "test", xml);
 }
示例#46
0
        protected override async Task <PublishedFundingVersion> GetPreviousPublishedFundingVersion(PublishedFundingVersion currentVersion,
                                                                                                   PublishedFundingUndoTaskContext taskContext)
        {
            LogInformation($"Querying latest earlier published funding version for '{taskContext.Parameters}'");

            UndoTaskDetails details = taskContext.PublishedFundingVersionDetails;

            return(await Cosmos.GetLatestEarlierPublishedFundingVersionFromVersion(details.FundingStreamId,
                                                                                   details.FundingPeriodId,
                                                                                   details.Version,
                                                                                   currentVersion.OrganisationGroupTypeIdentifier,
                                                                                   currentVersion.OrganisationGroupIdentifierValue,
                                                                                   currentVersion.GroupingReason));
        }
示例#47
0
    public void displaytopic()
    {
        clearpool();
        Transform data;

        for (int i = 0; i < Cosmos.Instance().Topiclist.Length; i++)
        {
            if (Cosmos.Instance().Topiclist [i].Discovered == true)
            {
                data = Instantiate(topicprefab, gameObject.transform);
                data.Find("Text").GetComponent <Text> ().text = Cosmos.Instance().Topiclist [i].Name;
                data.GetComponent <TopicBarScript> ().topicID = Cosmos.Instance().Topiclist [i].NO;
            }
        }
    }
示例#48
0
 bool searchcondition(string id)
 {
     for (int i = 0; i < topic.Evidence.Count; i++)
     {
         if (topic.Evidence[i].eviID == id && topic.Evidence[i].Activated)
         {
             return(true);
         }
     }
     if (Cosmos.Instance().ActivatedConclusion.FindIndex(x => x.NO == id) != -1)
     {
         return(true);
     }
     return(false);
 }
 public void UpdateActiveConclusion()
 {
     Cosmos.Instance().ActivatedConclusion.Clear();
     for (int i = 0; i < Cosmos.Instance().Topiclist.Length; i++)
     {
         for (int j = 0; j < Cosmos.Instance().Topiclist[i].Conclusion.Count; j++)
         {
             if (Cosmos.Instance().Topiclist[i].Conclusion[j].Interactable && Cosmos.Instance().Topiclist[i].Conclusion[j].Activated)
             {
                 Cosmos.Instance().ActivatedConclusion.Add(Cosmos.Instance().Topiclist[i].Conclusion[j]);
             }
         }
     }
     print(Cosmos.Instance().ActivatedConclusion.Count);
 }
    public void addevi(string topicID, string eviID)
    {
        Evidencetype evi = new Evidencetype();

        for (int i = 0; i < Cosmos.Instance().Topiclist.Length; i++)
        {
            if (Cosmos.Instance().Topiclist [i].NO == topicID)
            {
                if (Cosmos.Instance().Topiclist [i].Evidence.FindIndex(x => x.eviID == eviID) == -1)
                {
                    evi.eviID     = eviID;
                    evi.Activated = false;
                    Cosmos.Instance().Topiclist[i].Evidence.Add(evi);
                }
                displaytopic(topicID);
                return;
            }
        }
    }
示例#51
0
        public static bool OnReleaseWork_Cosmos(Cosmos __instance, ref UseSkill skill)
        {
            CreatureFeelingState currentFeelingState = skill.GetCurrentFeelingState();

            if (currentFeelingState == CreatureFeelingState.NORM)
            {
                __instance.model.SubQliphothCounter();
            }
            else if (currentFeelingState == CreatureFeelingState.BAD)
            {
                __instance.model.SubQliphothCounter();
                __instance.model.SubQliphothCounter();
            }

            if (skill.agent.fortitudeLevel >= 3)
            {
                __instance.model.SubQliphothCounter();
            }
            return(true);
        }
示例#52
0
        private void button1_Click(object sender, EventArgs e)
        {
            string xml = "<content1>" +
                         "<layout>" +
                         "<grid style=\"13\">" +
                         "<grid id='tangramtabctrl_Page2 www' objid=\"nucleus\" caption='Page 1'></grid>" +
                         "<grid id='test1' caption='Page 2 eee'></grid>" +
                         "<grid id='test2' caption='Page 3'></grid>" +
                         "<grid id='test3' caption='Page 4'></grid>" +
                         "</grid>" +
                         "</layout>" +
                         "</content1>";
            Xobj node = Cosmos.Observe(listView1, "test", xml);

            if (node != null)
            {
                node.OnTabChange += Node_OnTabChange;
            }
            Cosmos.CreateBrowser((IntPtr)1, "host:sunny2.html|host:WebPage/newweb.html");
        }
示例#53
0
        public static void test_h_functions()
        {
            //register file
            Cosmos hydra_storage = new Cosmos();

            //hydra_storage.RegisterFile("C:\\Users\\sirius\\Desktop\\nyeh");//PASSED 12:26 PM
            //hydra_storage.RegisterFile("C:\\thign.txt"); //PASSED 12:26 PM
            hydra_storage.GetFile("hi3.txt"); //PASSED 13:55 ; need to be specific filename
            //hydra_storage.EditFile("xxx.txt"); //gets file from hdfs then you edit at editfiles folder
            //Console.WriteLine("ni hao");
            //    string[] searchfiles = hydra_storage.SearchFile("thign");
            //    int counter = 0;
            //    while ((searchfiles[counter]) != null){
            //        Console.WriteLine(searchfiles[counter]);
            //        counter++;
            //    }
            //int milliseconds = 2000;
            //Thread.Sleep(milliseconds);
            //hydra_storage.DeleteFile("thign"); //NEED TO BE SPECIFIC (IE FILE EXTENSION) IF TWO FILES HAVE SAME NAME :O)
            //hydra_storage.SaveFile();
        }
示例#54
0
    public void SearchWord(string word)
    {
        //GameObject data;
        ArrayList list = new ArrayList();
        Transform data;

        //illegal input fliter
        if (word.Length == 0)
        {
            return;
        }
        //clear searchpool if needed
        clearpool();
        //setup display array
        for (int i = 0; i < Cosmos.Instance().document.Length; i++)
        {
            if (Cosmos.Instance().document [i].Name.IndexOf(word) != -1 && Cosmos.Instance().document[i].Stored == "0")
            {
                list.Add(Cosmos.Instance().document [i]);
            }
        }
        Filedatatype[] display = (Filedatatype[])list.ToArray(typeof(Filedatatype));
        //if no result
        if (display.Length == 0)
        {
            print("no result!");
            return;
        }
        //display element
        for (int i = 0; i < display.Length; i++)
        {
            data = Instantiate(databar, gameObject.transform);
            //change the text
            data.Find("Name").GetComponent <Text>().text        = display [i].Name;
            data.Find("Description").GetComponent <Text>().text = display [i].Description;
            data.GetComponent <DataBar> ().NO    = display [i].NO;
            data.GetComponent <DataBar> ().title = display [i].Name;
        }
    }
示例#55
0
        public void GetContainerProperties()
        {
            // preparation
            var config = new Mock <IConfiguration>();

            config.Setup(_ => _["COSMOS_AUTO_GENERATE"]).Returns("true");
            var container         = new Mock <Container>();
            var containerResponse = new Mock <ContainerResponse>();
            var database          = new Mock <Database>();

            database.Setup(_ => _.CreateContainerIfNotExistsAsync
                               (It.IsAny <ContainerProperties>(), It.IsAny <int?>(), It.IsAny <Microsoft.Azure.Cosmos.RequestOptions>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(containerResponse.Object);
            database.Setup(_ => _.GetContainer(It.IsAny <string>()))
            .Returns(container.Object);
            var databaseResponse = new Mock <DatabaseResponse>();

            databaseResponse.Setup(_ => _.Database).Returns(database.Object);
            databaseResponse.Setup(_ => _.StatusCode).Returns(System.Net.HttpStatusCode.OK);
            var client = new Mock <CosmosClient>();

            client.Setup(_ => _.CreateDatabaseIfNotExistsAsync
                             (It.IsAny <string>(), It.IsAny <int?>(), It.IsAny <Microsoft.Azure.Cosmos.RequestOptions>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(databaseResponse.Object);
            client.Setup(_ => _.GetDatabase(It.IsAny <string>()))
            .Returns(database.Object);

            var logger   = new LoggerMock <ICosmos>();
            var instance = new Cosmos(config.Object, client.Object, logger);

            // action
            Assert.IsNotNull(instance.Diagnosis);
            Assert.IsNotNull(instance.Notification);
            Assert.IsNotNull(instance.Sequence);
            Assert.IsNotNull(instance.TemporaryExposureKey);
            Assert.IsNotNull(instance.TemporaryExposureKeyExport);
            Assert.IsNotNull(instance.User);
        }
示例#56
0
    public void updateevi()
    {
        Transform temp;

        evilist.Clear();
        for (int i = 0; i < evipanel.childCount; i++)
        {
            Destroy(evipanel.GetChild(i).gameObject);
        }

        if (topic.Evidence.Count == 0)
        {
            //if no evidence
        }
        else
        {
            for (int i = 0; i < topic.Evidence.Count; i++)
            {
                temp = Instantiate(EvidenceText, evipanel);
                temp.GetComponent <Text> ().text = Cosmos.Instance().searchline(topic.Evidence [i].eviID);
                temp.Find("Text").GetComponent <Text> ().text = temp.GetComponent <Text> ().text;
                if (topic.Evidence [i].Activated)
                {
                    temp.GetComponent <Toggle> ().isOn = true;
                }
                temp.name = i.ToString();
                temp.SetSiblingIndex(i);
                evilist.Add(temp);
            }
            foreach (Transform item in evilist)
            {
                item.GetComponent <Toggle> ().onValueChanged.AddListener(ifselect => { eviclickhandler(item, ifselect); });
            }
        }
        gameObject.transform.Find("EvidenceNum").GetComponent <Text>().text = topic.Evidence.Count.ToString();
    }
示例#57
0
    // Token: 0x0600079A RID: 1946 RVA: 0x000A38C4 File Offset: 0x000A1AC4
    private Gameplay CreateGameplay(GameplayKind gp)
    {
        Gameplay result = null;

        switch (gp)
        {
        case GameplayKind.Origin:
            result = new Origin();
            break;

        case GameplayKind.Update:
            result = new UpdateController(this);
            break;

        case GameplayKind.Battle:
            result = new BattleController();
            break;

        case GameplayKind.War:
            result = new WarManager();
            break;

        case GameplayKind.CHAOS:
            result = new CHAOS();
            break;

        case GameplayKind.Front:
            result = new Front();
            break;

        case GameplayKind.Cosmos:
            result = new Cosmos();
            break;
        }
        return(result);
    }
示例#58
0
 public List <User> GetUsers()
 {
     return(Cosmos.GetDocuments <User>(UserCollection, x => true));
 }
 protected override ICosmosDbFeedIterator <PublishedFundingVersion> GetPublishedFundingVersionsFeed(UndoTaskDetails details)
 => Cosmos.GetPublishedFundingVersionsFromVersion(details.FundingStreamId,
                                                  details.FundingPeriodId,
                                                  details.Version);
示例#60
0
 public SPService(Cosmos cosmos)
 {
     _cosmosClient = cosmos.Client;
 }