Inheritance: Color
Beispiel #1
0
        public AbcMethod Exit()
        {
            var instance = _generator.Corlib.Environment.Instance;

            return(instance.DefineMethod(
                       Sig.@static("exit_impl", AvmTypeCode.Void, AvmTypeCode.Int32, "exitCode"),
                       code =>
            {
                var isFlash = IsFlashPlayer();
                code.Getlex(isFlash);
                code.Call(isFlash);
                var ifNotFlash = code.IfFalse();

                var ns = Abc.DefinePackage("avmplus");
                var mn = Abc.DefineQName(ns, "System");
                code.Getlex(mn);
                mn = Abc.DefineQName(ns, "exit");
                code.GetLocal(1);                                 //exitCode
                code.Call(mn, 1);
                code.ReturnVoid();

                ifNotFlash.BranchTarget = code.Label();

                ns = Abc.DefinePackage("flash.System");
                mn = Abc.DefineQName(ns, "System");
                code.Getlex(mn);
                mn = Abc.DefineQName(ns, "exit");
                code.GetLocal(1);                                 //exitCode
                code.Add(InstructionCode.Coerce_u);               //???
                code.Call(mn, 1);
                code.ReturnVoid();
            }));
        }
Beispiel #2
0
        public void Run()
        {
            try
            {
                Stream filestream = File.OpenRead(Filename);

                // SWC file: extract 'library.swf' file
                if (Filename.EndsWith(".swc", StringComparison.OrdinalIgnoreCase))
                {
                    ZipFile zfile = new ZipFile(filestream);
                    foreach (ZipEntry entry in zfile)
                    {
                        if (entry.Name.EndsWith(".swf", StringComparison.OrdinalIgnoreCase))
                        {
                            ExploreSWF(new MemoryStream(UnzipFile(zfile, entry)));
                        }
                        else if (entry.Name.EndsWith(".xml", StringComparison.OrdinalIgnoreCase)
                            && entry.Name.StartsWith("docs/"))
                        {
                            Docs[entry.Name] = UnzipFile(zfile, entry);
                        }
                        else if (entry.Name == "catalog.xml")
                        {
                            Catalog = UnzipFile(zfile, entry);
                        }
                    }
                    zfile.Close();
                    filestream.Close();
                }
                else
                {
                    byte[] data = new byte[filestream.Length];
                    filestream.Read(data, 0, (int)filestream.Length);
                    filestream.Close();
                    Stream dataStream = new MemoryStream(data);

                    // raw ABC bytecode
                    if (Filename.EndsWith(".abc", StringComparison.OrdinalIgnoreCase))
                    {
                        BinaryReader br = new BinaryReader(dataStream);
                        Abc abc = new Abc(br);
                        ExploreABC(abc);
                    }
                    // regular SWF
                    else if (Filename.EndsWith(".swf", StringComparison.OrdinalIgnoreCase))
                    {
                        ExploreSWF(dataStream);
                    }
                    else Errors.Add("Error: Not a supported filetype");
                }
            }
            catch (FileNotFoundException)
            {
                Errors.Add("Error: File not found");
            }
            catch (Exception ex)
            {
                Errors.Add("Error: " + ex.Message);
            }
        }
Beispiel #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < 10000; i++)
     {
         Abc x = new Abc();
     }
 }
 public void x(Abc abc)
 {
     if (abc is IM)
     {
         ((IM)abc).m();
     }
 }
Beispiel #5
0
        public Abc BuildFromRow(DataRow row)
        {
            var returnRecord = Abc.BuildAbcFromRow(row);

            returnRecord = this.BuildExtraFromRow <Abc>(returnRecord, row);
            return(returnRecord);
        }
        private void buttonFindCycle_Click(object sender, EventArgs e)
        {
            if (Hset.List == null)
            {
                return;
            }
            Abc shift1 = -Hset.List.GetLast().Data[2].AbcShift,
                shift2 = -Hset.List.Data[1].AbcShift;

            numericUpDownA1.Value = shift1.A;
            numericUpDownB1.Value = shift1.B;
            numericUpDownC1.Value = shift1.C;
            numericUpDownA2.Value = shift2.A;
            numericUpDownB2.Value = shift2.B;
            numericUpDownC2.Value = shift2.C;
            var mh = FindEquation(shift1, shift2);

            if (mh == null)
            {
                MessageBox.Show(this, string.Join("\r\n", new[] {
                    @"Не знайдено жодного рівняння",
                    @"з такими зміщеннями",
                    @"параметрів a, b, c."
                }), @"Не знайдено", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            buttonAdd_Click(buttonAdd, null);
        }
        private void ExploreABC(Abc abc)
        {
            Abcs.Add(abc);

            foreach (Traits trait in abc.instances)
            {
                string name = trait.ToString();
                Classes.Add(new DeclEntry(name));
            }
            foreach (Traits trait in abc.scripts)
            {
                foreach (MemberInfo member in trait.members)
                {
                    if (member.kind != TraitMember.Class)
                    {
                        if (member is MethodInfo)
                        {
                            Classes.Add(new DeclEntry(member.name + "()"));
                        }
                        else if (member is SlotInfo)
                        {
                            if (member.kind == TraitMember.Const)
                            {
                                Classes.Add(new DeclEntry(member.name + "#"));
                            }
                            else
                            {
                                Classes.Add(new DeclEntry(member.name + "$"));
                            }
                        }
                    }
                }
            }
        }
		public void LoadAllStartingWithShouldNotLoadDeletedDocs()
		{
			using (var store = NewRemoteDocumentStore())
			{
				var doc1 = new Abc()
				{
					Id = "abc/1",
				};
				var doc2 = new Xyz()
				{
					Id = "xyz/1"
				};


				using (var session = store.OpenSession())
				{
					session.Store(doc1);
					session.Store(doc2);
					session.SaveChanges();
				}

				using (var session = store.OpenSession())
				{
					// commenting out this call passes the test
					var testClasses = session.Advanced.Lazily.LoadStartingWith<Abc>("abc/");
					var test2Classes = session.Query<Xyz>().Customize(x => x.WaitForNonStaleResults())
					                          .Lazily().Value.ToList();

					Assert.Equal(1, testClasses.Value.Count());
					Assert.Equal(1, test2Classes.Count());
				}
			}
		}
Beispiel #9
0
        public AbcTrait DefineSlot(object name, object type, bool isStatic)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            var traitName = Abc.DefineName(name);

            var traits = isStatic ? Class.Traits : Traits;
            var trait  = traits.Find(traitName, AbcTraitKind.Slot);

            if (trait != null)
            {
                return(trait);
            }

            var typeName = Abc.DefineTypeNameSafe(type);

            trait = AbcTrait.CreateSlot(typeName, traitName);
            traits.Add(trait);

            return(trait);
        }
Beispiel #10
0
        private AbcMultiname BuildReturnType(object returnType, AbcMethod method)
        {
            if (returnType == null)
            {
                return(Abc.DefineTypeName(AvmTypeCode.Void));
            }

            var generator = Abc.Generator;

            var source = returnType as IMethod;

            if (source != null)
            {
                return(generator.MethodBuilder.BuildReturnType(method, source));
            }

            var type = returnType as IType;

            if (type != null)
            {
                return(generator.TypeBuilder.BuildReturnType(type));
            }

            return(Abc.DefineTypeNameSafe(returnType));
        }
Beispiel #11
0
        private object ImportType(IType type)
        {
            var tag = type.Data;

            if (tag == null)
            {
                return(null);
            }

            var instance = tag as AbcInstance;

            if (instance != null)
            {
                BuildBaseTypes(type);
                return(Abc.ImportInstance(instance));
            }

            var data = tag as ITypeData;

            if (data != null)
            {
                return(data.Import(Abc));
            }

            //TODO: avoid direct usage of AbcMultiname as tag for types, wrap to ITypeAgent impl always
            var name = tag as AbcMultiname;

            if (name != null)
            {
                return(Abc.ImportConst(name));
            }

            return(null);
        }
Beispiel #12
0
        public void LoadAllStartingWithShouldNotLoadDeletedDocs()
        {
            using (var store = GetDocumentStore())
            {
                var doc1 = new Abc
                {
                    Id = "abc/1",
                };
                var doc2 = new Xyz
                {
                    Id = "xyz/1"
                };

                using (var session = store.OpenSession())
                {
                    session.Store(doc1);
                    session.Store(doc2);
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    // commenting out this call passes the test
                    var testClasses  = session.Advanced.Lazily.LoadStartingWith <Abc>("abc/");
                    var test2Classes = session.Query <Xyz>().Customize(x => x.WaitForNonStaleResults())
                                       .Lazily().Value.ToList();

                    Assert.Equal(1, testClasses.Value.Count());
                    Assert.Equal(1, test2Classes.Count());
                }
            }
        }
Beispiel #13
0
        public static void Local()
        {
            var anonymousType = new { property = true };

            Assert.AreEqual(Name.Of(anonymousType), "anonymousType");
            // ldloc.0
            // call string [Name.Of]Name::Of(object)

            Nullable <Single> nullableType = 42.0f;

            Assert.AreEqual(Name.Of(nullableType), "nullableType");
            // ldloc.1
            // box [mscorlib]System.Nullable`1<float32>
            // call string [Name.Of]Name::Of(object)

            Boolean systemValueType = true;

            Assert.AreEqual(Name.Of(systemValueType), "systemValueType");
            // ldloc.2
            // box bool
            // call string [Name.Of]Name::Of(object)

            String systemReferenceType = "foo";

            Assert.AreEqual(Name.Of(systemReferenceType), "systemReferenceType");
            // ldloc.3
            // call string [Name.Of]Name::Of(object)

            Abc valueType = new Abc();

            valueType.GetHashCode();
            Assert.AreEqual(Name.Of(valueType), "valueType");
            // ldloc.s valueType
            // box AssemblyToProcess.Abc
            // call string [Name.Of]Name::Of(object)

            Def referenceType = new Def();

            Assert.AreEqual(Name.Of(referenceType), "referenceType");
            // ldloc.s referenceType
            // call string [Name.Of]Name::Of(object)

            Func <Int32> valueTypeDelegate = () => 1337;

            Assert.AreEqual(Name.Of(valueTypeDelegate), "valueTypeDelegate");
            // ldloc.s valueTypeDelegate
            // call string [Name.Of]Name::Of<int32>(class [mscorlib]System.Func`1<!!0>)

            Func <Object> referenceTypeDelegate = () => new Object();

            Assert.AreEqual(Name.Of(referenceTypeDelegate), "referenceTypeDelegate");
            // ldloc.s referenceTypeDelegate
            // call string [Name.Of]Name::Of<object>(class [mscorlib]System.Func`1<!!0>)

            Action referenceTypeDelegate2 = () => { };

            Assert.AreEqual(Name.Of(referenceTypeDelegate2), "referenceTypeDelegate2");
            // ldloc.s referenceTypeDelegate2
            // call string [Name.Of]Name::Of(object)
        }
Beispiel #14
0
        void DefinePrototype(AvmTypeCode type, AbcMethod sig)
        {
            var srcmethod = sig.Method;

            if (srcmethod == null)
            {
                return;
            }

            string key = GetKey(type, srcmethod.Name);
            var    val = _prototypes[key] as object[];

            if (val == null)
            {
                return;
            }

            var m = val[1] as AbcMethod;

            if (m != null)
            {
                return;
            }

            var coder = val[0] as AbcCoder;

            m = Abc.DefineMethod(Sig.@from(sig), coder);

            _generator.NewApi.SetProtoFunction(type, sig.TraitName, m);

            val[0] = m;
        }
Beispiel #15
0
        //Defines qname for AbcInstance for given type
        private AbcMultiname DefineInstanceName(IType type)
        {
            string ns   = type.GetTypeNamespace(_generator.RootNamespace);
            string name = type.NestedName;

            return(Abc.DefineName(QName.Package(ns, name)));
        }
Beispiel #16
0
        static void Main(string[] args)
        {
            Num c = new Num(5);
            Abc a = new Abc();

            Console.ReadKey();
        }
 public ActionResult UploadOneAbc(Abc abc, Cba cba)
 {
     this.uploadedObject = new List <object> {
         abc, cba
     };
     this.nullsInInputs = abc.a == null || abc.b == null || abc.c == null || cba.a == null || cba.b == null || cba.c == null;
     return(new EmptyResult());
 }
Beispiel #18
0
        public static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("SwfOp <file.swf>: list all library symbols of the SWF");
                return;
            }
            string filename = args[args.Length - 1];

            operation = (args.Length > 1) ? args[0] : "-list";

            // read SWF
            try
            {
                Stream filestream = File.OpenRead(filename);

                // SWC file: extract 'library.swf' file
                if (filename.EndsWith(".swc", StringComparison.OrdinalIgnoreCase))
                {
                    ZipFile zfile = new ZipFile(filestream);
                    foreach (ZipEntry entry in zfile)
                    {
                        if (entry.Name.EndsWith(".swf", StringComparison.OrdinalIgnoreCase))
                        {
                            ExploreSWF(new MemoryStream(UnzipFile(zfile, entry)));
                        }
                        else if (entry.Name.EndsWith(".xml", StringComparison.OrdinalIgnoreCase) &&
                                 entry.Name.StartsWith("docs/"))
                        {
                            string docSrc = Encoding.UTF8.GetString(UnzipFile(zfile, entry));
                        }
                    }
                    zfile.Close();
                    filestream.Close();
                }
                else if (filename.EndsWith(".abc", StringComparison.OrdinalIgnoreCase))
                {
                    byte[] data = new byte[filestream.Length];
                    filestream.Read(data, 0, (int)filestream.Length);
                    BinaryReader br  = new BinaryReader(new MemoryStream(data));
                    Abc          abc = new Abc(br);
                }
                // regular SWF
                else
                {
                    ExploreSWF(new BufferedStream(filestream));
                }
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("-- SwfOp Error: File not found");
            }
            catch (Exception ex)
            {
                Console.WriteLine("-- SwfOp Error: " + ex.Message);
            }
            Console.ReadLine();
        }
Beispiel #19
0
        protected override void DecompileBody(byte[] data)
        {
            SwfStream stream = data;

            Flags   = (DoAbcTagFlags)stream.ReadInt();
            Name    = stream.ReadString();
            AbcData = new Abc();
            AbcData.Decompile(stream.ReadToEnd());
        }
Beispiel #20
0
        public Form1()
        {
            InitializeComponent();

            for (int i = 0; i < 10000; i++)
            {
                Abc a = new Abc();
            }
        }
Beispiel #21
0
    public void Start()
    {
        var primeList          = new PrimeList();
        var primeDecomposition = new PrimeDecomposition(primeList);
        var radical            = new Radical(primeDecomposition);

        _abc = new Abc(radical);
        Calc();
    }
Beispiel #22
0
        private void numericUpDownAbc_ValueChanged(object sender, EventArgs e)
        {
            int a = (int)numericUpDownA.Value,
                b = (int)numericUpDownB.Value,
                c = (int)numericUpDownC.Value;

            ShiftAbc = new Abc(a, b, c);
            InitMono();
        }
Beispiel #23
0
        static void Main(string[] args)
        {
            Abc fc = new Abc();
            Efg sc = new Efg();

            fc.Func();
            sc.Func();
            Console.ReadKey();
        }
Beispiel #24
0
 public JsonResult UpDownloadOneAbc(Abc abc)
 {
     this.uploadedObject = abc;
     this.nullsInInputs  = abc.a == null || abc.b == null || abc.c == null;
     return(Json(new Abc()
     {
         a = abc.a, b = abc.b, c = abc.c
     }));
 }
Beispiel #25
0
 public AbcMultiname BuildMemberType(IType type)
 {
     Build(type);
     if (type.Data == null)
     {
         throw new InvalidOperationException(string.Format("Type {0} is not defined", type.FullName));
     }
     return(Abc.GetTypeName(type, true));
 }
Beispiel #26
0
        public Abc Insert(Abc record)
        {
            DataRow row = this.dataSet.ttblabc.NewttblabcRow();

            this.UpdateToRow(ref row, record);
            this.ExtraUpdateToRow(ref row, record);
            this.dataSet.ttblabc.AddttblabcRow((pdsabcDataSet.ttblabcRow)row);
            this.SaveChanges();
            return(this.dataSet.ttblabc.Rows.Count > 0 ? this.BuildFromRow(this.dataSet.ttblabc.Rows[0]) : null);
        }
Beispiel #27
0
 private AbcMethod DefineString_GetTypeId()
 {
     return(Abc.DefineMethod(
                Sig.@global(AvmTypeCode.Int32),
                code =>
     {
         code.PushTypeId(SystemTypes.String);
         code.ReturnValue();
     }));
 }
Beispiel #28
0
        public static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("SwfOp <file.swf>: list all library symbols of the SWF");
                return;
            }
            string filename = args[args.Length-1];
            operation = (args.Length > 1) ? args[0] : "-list";
            
            // read SWF
            try
            {
                Stream filestream = File.OpenRead(filename);

                // SWC file: extract 'library.swf' file
                if (filename.EndsWith(".swc", StringComparison.OrdinalIgnoreCase))
                {
                    ZipFile zfile = new ZipFile(filestream);
                    foreach(ZipEntry entry in zfile)
                    {
                        if (entry.Name.EndsWith(".swf", StringComparison.OrdinalIgnoreCase))
                        {
                            ExploreSWF(new MemoryStream(UnzipFile(zfile, entry)));
                        }
                        else if (entry.Name.EndsWith(".xml", StringComparison.OrdinalIgnoreCase)
                            && entry.Name.StartsWith("docs/"))
                        {
                            string docSrc = Encoding.UTF8.GetString(UnzipFile(zfile, entry));
                        }
                    }
                    zfile.Close();
                    filestream.Close();
                }
                else if (filename.EndsWith(".abc", StringComparison.OrdinalIgnoreCase))
                {
                    byte[] data = new byte[filestream.Length];
                    filestream.Read(data, 0, (int)filestream.Length);
                    BinaryReader br = new BinaryReader(new MemoryStream(data));
                    Abc abc = new Abc(br);
                }
                // regular SWF
                else ExploreSWF(new BufferedStream(filestream));
            }
            catch(FileNotFoundException)
            {
                Console.WriteLine("-- SwfOp Error: File not found");
            }
            catch(Exception ex)
            {
                Console.WriteLine("-- SwfOp Error: "+ex.Message);
            }
            Console.ReadLine();
        }
Beispiel #29
0
 static void Main(string[] args)
 {
     /*Person one = new Person();
      * Console.WriteLine(one.name);
      * Console.WriteLine(one.age);
      * Console.WriteLine("and he is");
      * Person.Walking();
      * Console.ReadKey();*/
     Abc.ToDo();
     Console.ReadKey();
 }
Beispiel #30
0
        public Abc GetByRowId(string rowId, string fldList)
        {
            var row = this.GetRowByRowId(rowId, fldList);
            Abc abc = null;

            if (row != null)
            {
                abc = this.BuildFromRow(row);
            }
            return(abc);
        }
Beispiel #31
0
    //		Default = 0,
    //		IgnoreCase = 1,
    //		DeclaredOnly = 2,
    //		Instance = 4,
    //		Static = 8,
    //		Public = 16,
    //		NonPublic = 32,
    //		FlattenHierarchy = 64,
    //		InvokeMethod = 256,
    //		CreateInstance = 512,
    //		GetField = 1024,
    //		SetField = 2048,
    //		GetProperty = 4096,
    //		SetProperty = 8192,
    //		PutDispProperty = 16384,
    //		PutRefDispProperty = 32768,
    //		ExactBinding = 65536,
    //		SuppressChangeType = 131072,
    //		OptionalParamBinding = 262144,
    //		IgnoreReturn = 16777216

    void Start()
    {
        StopwatchWrap stopwatchWrap = new StopwatchWrap();


        Abc a = new Abc();

        System.Type t  = System.Type.GetType("Abc");
        MethodInfo  mm = t.GetMethod("Moon");

        MethodInfo[] methodInfo = t.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
        //methodInfo[0].
        object [] aaaa = mm.GetCustomAttributes(true);

        System.Type TExposeble = System.Type.GetType("Exposeble");

        MethodInfo[] TExposebleMethodInfo = TExposeble.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
        //MethodInfo []methodInfoTExposeble = TExposeble.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);

        string valueString = "";

        int value = 0;

        for (int i = 0; i < 1000; ++i)
        {
            //valueString = Exposeble.Ex.Moon().ToString();
            if (ExposebleMethod.GetString("Exposeble/get_Ex/Moon", ref valueString))
            {
                //Debug.Log("Success valueString  => " + valueString);
            }
//			if(ExposebleMethod.GetInt("Exposeble/get_Ex/Moon", ref value))
//			{
//				//Debug.Log("Success =>" + value);
//			}
//			else
//			{
//				//Debug.Log("Fail@@@");
//			}
        }


        this.gameObject.AddComponent <TestCoponent>();
        stopwatchWrap.Start();

        TestCoponent ttt    = gameObject.GetComponent <TestCoponent>();
        double       second = stopwatchWrap.Stop();
        string       vavv   = value.ToString();

        //System.Threading.Thread.Sleep(1234);


        Debug.Log("Second => " + second.ToString());
        Debug.Log("Per Second => " + stopwatchWrap.ToStringFrame);
    }
Beispiel #32
0
 public JsonResult UpDownloadOneCbaFromAbc(Abc abc, Cba cba)
 {
     this.uploadedObject = new List <object> {
         abc, cba
     };
     this.nullsInInputs = abc.a == null || abc.b == null || abc.c == null || cba.a == null || cba.b == null || cba.c == null;
     return(Json(new Cba()
     {
         a = abc.a, b = abc.b, c = abc.c
     }));
 }
Beispiel #33
0
 public Abc AddChildIfNotExist(Abc child)
 {
     if (child == null)
     {
         return(this);
     }
     if (!HasChild(child.Id))
     {
         Child.Add(child);
     }
     return(this);
 }
Beispiel #34
0
 public AbcTag(byte[] data, int offset, bool namedTag): base(data)
 {
     MemoryStream m = new MemoryStream(_data);
     BinaryReader br = new BinaryReader(m);
     br.BaseStream.Position += offset;
     if (namedTag)
     {
         br.ReadUInt32();
         ReadName(br);
     }
     try
     {
         _abc = new Abc(br);
         //_abc.parseMethodBodies(_data);
     }
     catch (Exception ex)
     {
         Console.WriteLine("-- Error: ABC parser exception [" + ex.Message + "]");
     }
 }
Beispiel #35
0
        public static string dumpMethod(Abc abc, MethodInfo m, string indent, string attr)
        {
            StringBuilder sb = new StringBuilder();

            if (m.metadata != null)
            {
                foreach (MetaData md in m.metadata)
                    sb.Append(indent).AppendLine(md.ToString());
            }

            sb.Append(indent);
            formatMethod(m, sb);
            if (m.code != null && m.code.Length > 0)
            {
                sb.AppendLine(indent + "{");

                if ((m.flags & MethodFlags.NeedActivation) > 0)
                {
                    sb.AppendLine(indent + TAB + "// NEED ACTIVATION ???");
                    //m.activation.dump(abc, indent+TAB, "");
                }

                dumpCode(abc, m, indent + TAB, sb);

                sb.AppendLine(indent + "}\n");
            }
            return sb.ToString();
        }
	public Test()
	{
		Abc = new Abc(); // Mono 4.0.3 compiler fails here
			// error CS0118: `Abc' is a `type' but a `variable' was expected
	}
 private void ExploreABC(Abc abc)
 {
     Abcs.Add(abc);
     
     foreach (Traits trait in abc.instances)
     {
         string name = trait.ToString();
         Classes.Add(new DeclEntry(name));
     }
     foreach (Traits trait in abc.scripts)
     {
         foreach (MemberInfo member in trait.members)
         {
             if (member.kind != TraitMember.Class)
             {
                 if (member is MethodInfo) Classes.Add(new DeclEntry(member.name + "()"));
                 else if (member is SlotInfo)
                 {
                     if (member.kind == TraitMember.Const) Classes.Add(new DeclEntry(member.name + "#"));
                     else Classes.Add(new DeclEntry(member.name + "$"));
                 }
             }
         }
     }
 }
Beispiel #38
0
        private void ExploreABC(Abc abc)
        {
            Abcs.Add(abc);

            foreach (Traits trait in abc.instances)
            {
                string name = trait.ToString();
                if (!Classes.Contains(name)) Classes.Add(name + frameInfo);
            }
        }
Beispiel #39
0
	public Foo ()
	{
		Abc a = new Abc ();
	}
Beispiel #40
0
        private static void dumpCode(Abc abc, MethodInfo m, string indent, StringBuilder sb)
        {
            MemoryStream ms = new MemoryStream(m.code);
            BinaryReader br = new BinaryReader(ms);

            //long totalSize = 0;
            //long[] opSizes = new long[256];
            string[] stack = new string[m.max_stack];
            LabelInfo labels = new LabelInfo();
            long len = m.code.Length;
            while (br.BaseStream.Position < len)
            {
                long start = br.BaseStream.Position;
                string s = indent + start;
                while (s.Length < 12) s += ' ';
                int opcode = br.ReadByte();

                if (opcode == (int)Op.label || labels.ContainsKey(br.BaseStream.Position - 1))
                {
                    sb.AppendLine(indent)
                        .AppendLine(indent + labels.labelFor(br.BaseStream.Position - 1) + ": ");
                }

                s += opNames[opcode];
                s += opNames[opcode].Length < 8 ? TAB + TAB : TAB;

                switch ((Op)opcode)
                {
                    case Op.debugfile:
                    case Op.pushstring:
                        s += '"' + abc.strings[Abc.readU32(br)].ToString().Replace("\n", "\\n").Replace("\t", "\\t") + '"';
                        break;
                    case Op.pushnamespace:
                        s += abc.namespaces[Abc.readU32(br)];
                        break;
                    case Op.pushint:
                        int i = (int)abc.ints[Abc.readU32(br)];
                        s += i;// + "\t// 0x" + i.ToString(16);
                        break;
                    case Op.pushuint:
                        uint u = (uint)abc.uints[Abc.readU32(br)];
                        s += u;// + "\t// 0x" + u.ToString(16);
                        break;
                    case Op.pushdouble:
                        s += abc.doubles[Abc.readU32(br)];
                        break;
                    case Op.getsuper:
                    case Op.setsuper:
                    case Op.getproperty:
                    case Op.initproperty:
                    case Op.setproperty:
                    case Op.getlex:
                    case Op.findpropstrict:
                    case Op.findproperty:
                    case Op.finddef:
                    case Op.deleteproperty:
                    case Op.istype:
                    case Op.coerce:
                    case Op.astype:
                    case Op.getdescendants:
                        s += abc.names[Abc.readU32(br)];
                        break;
                    case Op.constructprop:
                    case Op.callproperty:
                    case Op.callproplex:
                    case Op.callsuper:
                    case Op.callsupervoid:
                    case Op.callpropvoid:
                        s += abc.names[Abc.readU32(br)];
                        s += " (" + Abc.readU32(br) + ")";
                        break;
                    case Op.newfunction:
                        {
                            var method_id = Abc.readU32(br);
                            s += abc.methods[method_id];
                            abc.methods[method_id].anon = true;
                            break;
                        }
                    case Op.callstatic:
                        s += abc.methods[Abc.readU32(br)];
                        s += " (" + Abc.readU32(br) + ")";
                        break;
                    case Op.newclass:
                        s += abc.instances[Abc.readU32(br)];
                        break;
                    case Op.lookupswitch:
                        var pos = br.BaseStream.Position - 1;
                        var target = pos + readS24(br);
                        var maxindex = Abc.readU32(br);
                        s += "default:" + labels.labelFor(target); // target + "("+(target-pos)+")"
                        s += " maxcase:" + maxindex;
                        for (int j = 0; j <= maxindex; j++)
                        {
                            target = pos + readS24(br);
                            s += " " + labels.labelFor(target); // target + "("+(target-pos)+")"
                        }
                        break;
                    case Op.jump:
                    case Op.iftrue:
                    case Op.iffalse:
                    case Op.ifeq:
                    case Op.ifne:
                    case Op.ifge:
                    case Op.ifnge:
                    case Op.ifgt:
                    case Op.ifngt:
                    case Op.ifle:
                    case Op.ifnle:
                    case Op.iflt:
                    case Op.ifnlt:
                    case Op.ifstricteq:
                    case Op.ifstrictne:
                        int offset = readS24(br);
                        target = br.BaseStream.Position + offset;
                        //s += target + " ("+offset+")"
                        s += labels.labelFor(target);
                        if (!labels.ContainsKey(br.BaseStream.Position))
                            s += "\n";
                        break;
                    case Op.inclocal:
                    case Op.declocal:
                    case Op.inclocal_i:
                    case Op.declocal_i:
                    case Op.getlocal:
                    case Op.kill:
                    case Op.setlocal:
                    case Op.debugline:
                    case Op.getglobalslot:
                    case Op.getslot:
                    case Op.setglobalslot:
                    case Op.setslot:
                    case Op.pushshort:
                    case Op.newcatch:
                        s += Abc.readU32(br);
                        break;
                    case Op.debug:
                        s += br.ReadByte();
                        s += " " + Abc.readU32(br);
                        s += " " + br.ReadByte();
                        s += " " + Abc.readU32(br);
                        break;
                    case Op.newobject:
                        s += "{" + Abc.readU32(br) + "}";
                        break;
                    case Op.newarray:
                        s += "[" + Abc.readU32(br) + "]";
                        break;
                    case Op.call:
                    case Op.construct:
                    case Op.constructsuper:
                    case Op.applytype:
                        s += "(" + Abc.readU32(br) + ")";
                        break;
                    case Op.pushbyte:
                    case Op.getscopeobject:
                        s += br.ReadSByte();
                        break;
                    case Op.hasnext2:
                        s += Abc.readU32(br) + " " + Abc.readU32(br);
                        break;
                    default:
                        /*if (opNames[opcode] == ("0x"+opcode.toString(16).toUpperCase()))
                            s += " UNKNOWN OPCODE"*/
                        break;
                }
                long size = br.BaseStream.Position - start;
                //totalSize += size;
                //opSizes[opcode] = opSizes[opcode] + size;
                sb.AppendLine(s);
            }
        }
Beispiel #41
0
    //        Default = 0,
    //        IgnoreCase = 1,
    //        DeclaredOnly = 2,
    //        Instance = 4,
    //        Static = 8,
    //        Public = 16,
    //        NonPublic = 32,
    //        FlattenHierarchy = 64,
    //        InvokeMethod = 256,
    //        CreateInstance = 512,
    //        GetField = 1024,
    //        SetField = 2048,
    //        GetProperty = 4096,
    //        SetProperty = 8192,
    //        PutDispProperty = 16384,
    //        PutRefDispProperty = 32768,
    //        ExactBinding = 65536,
    //        SuppressChangeType = 131072,
    //        OptionalParamBinding = 262144,
    //        IgnoreReturn = 16777216
    void Start()
    {
        StopwatchWrap stopwatchWrap = new StopwatchWrap();

        Abc a = new Abc();
        System.Type t = System.Type.GetType("Abc");
        MethodInfo mm = t.GetMethod("Moon");
        MethodInfo[] methodInfo = t.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
        //methodInfo[0].
        object [] aaaa = mm.GetCustomAttributes(true);

        System.Type TExposeble = System.Type.GetType("Exposeble");

        MethodInfo[] TExposebleMethodInfo = TExposeble.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
        //MethodInfo []methodInfoTExposeble = TExposeble.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);

        string valueString = "";

        int value = 0;

        for(int i = 0; i < 1000; ++i)
        {
            //valueString = Exposeble.Ex.Moon().ToString();
            if(ExposebleMethod.GetString("Exposeble/get_Ex/Moon", ref valueString))
            {
                //Debug.Log("Success valueString  => " + valueString);
            }
        //			if(ExposebleMethod.GetInt("Exposeble/get_Ex/Moon", ref value))
        //			{
        //				//Debug.Log("Success =>" + value);
        //			}
        //			else
        //			{
        //				//Debug.Log("Fail@@@");
        //			}
        }

        this.gameObject.AddComponent<TestCoponent>();
        stopwatchWrap.Start();

        TestCoponent ttt = gameObject.GetComponent<TestCoponent>();
        double second = stopwatchWrap.Stop();
        string vavv = value.ToString();

        //System.Threading.Thread.Sleep(1234);

        Debug.Log("Second => " + second.ToString());
        Debug.Log("Per Second => " + stopwatchWrap.ToStringFrame);
    }