///<inheritdoc/>
        public override int GetHashCode()
        {
            int hash = 17;

            // Overflow is fine, just wrap
            unchecked
            {
                hash = (hash * 29) + PaintScheme.GetHashCode();
                hash = (hash * 29) + Mobility.GetHashCode();
                hash = (hash * 29) + Mission.GetHashCode();
                hash = (hash * 29) + Damage.GetHashCode();
                hash = (hash * 29) + Smoke.GetHashCode();
                hash = (hash * 29) + TrailingEffects.GetHashCode();
                hash = (hash * 29) + Lights.GetHashCode();
                hash = (hash * 29) + Flaming.GetHashCode();
                hash = (hash * 29) + Antenna.GetHashCode();
                hash = (hash * 29) + CamouflageType.GetHashCode();
                hash = (hash * 29) + Concealed.GetHashCode();
                hash = (hash * 29) + FrozenStatus.GetHashCode();
                hash = (hash * 29) + PowerPlantStatus.GetHashCode();
                hash = (hash * 29) + State.GetHashCode();
                hash = (hash * 29) + Tent.GetHashCode();
                hash = (hash * 29) + BlackoutLights.GetHashCode();
                hash = (hash * 29) + InteriorLights.GetHashCode();
            }

            return(hash);
        }
Ejemplo n.º 2
0
        void RunningState(GameTime gameTime)
        {
            if (_walkingPhysics.movingDirection != Vector2.Zero)
            {
                if (!_instantiatedSmoke)
                {
                    for (int i = 0; i < 8; ++i)
                    {
                        var pos = new Vector2(
                            _player.collisionBox.middle.X - _walkingPhysics.movingDirection.X * 4 + (float)GameManager.random.NextDouble() * 3 - 1.5f,
                            _player.collisionBox.bottom - 1 + (float)GameManager.random.NextDouble() * 3 - 1.5f);
                        var s = new Smoke(pos);
                        s.SetRadius(1, 1.5f);
                        ParticleManager.AddParticle(s);
                    }

                    _instantiatedSmoke = true;
                }

                _player.timeDecrease *= 1.25f;
            }
            else
            {
                _instantiatedSmoke = false;
            }
        }
Ejemplo n.º 3
0
 void OnDisable()
 {
     smoke = Smoke.Instantiate(smoke);
     smoke.GetComponent <Smoke>().frame = 0;
     smoke.transform.position           = transform.position;
     smoke.GetComponent <Smoke>().Type  = 1;
 }
Ejemplo n.º 4
0
    /*
     * Generates an Enum member, creating the Enum if necessary.
     */
    public void DefineMember(Smoke.Method* meth)
    {
        if ((meth->flags & (uint) Smoke.MethodFlags.mf_enum) == 0)
            return;

        string typeName = ByteArrayManager.GetString(data.Smoke->types[meth->ret].name);
        if (typeName == "long") // unnamed enum
            return;

        CodeTypeDeclaration enumType;
        if (!data.EnumTypeMap.TryGetValue(typeName, out enumType))
        {
            enumType = DefineEnum(typeName);
        }
        CodeMemberField member = new CodeMemberField();
        member.Name = ByteArrayManager.GetString(data.Smoke->methodNames[meth->name]);
        long value = GetEnumValue(data.Smoke, meth);

        if (value > int.MaxValue && enumType.BaseTypes.Count == 0)
        {
            // make the enum derive from 'long' if necessary
            enumType.BaseTypes.Add(new CodeTypeReference(typeof(long)));
        }

        member.InitExpression = new CodePrimitiveExpression(value);
        if (PostEnumMemberHook != null)
        {
            PostEnumMemberHook(data.Smoke, meth, member, enumType);
        }
        enumType.Members.Add(member);
    }
Ejemplo n.º 5
0
        public void ExampleTest3()
        {
            string testDirectory = Path.Combine(this.TestContext.DataDirectory, @"Examples\ExampleTest3");

            // Build the MSI that will be run against Smoke. Pass the -sval argument to delay validation until Smoke is run
            string msi = Builder.BuildPackage(testDirectory, "product.wxs", Path.Combine(this.TestContext.TestDirectory, "product.msi"), null, "-sval");

            // Create a new Smoke object
            Smoke smoke = new Smoke();

            smoke.DatabaseFiles.Add(msi);
            smoke.CubFiles.Add(Path.Combine(this.TestContext.DataDirectory, @"Examples\ExampleTest3\test.cub"));

            // Define the expected ICE error
            WixMessage LGHT1076 = new WixMessage(1076, "ICE1000: Component 'ExtraICE.0.ProductComponent' installs into directory 'TARGETDIR', which will get installed into the volume with the most free space unless explicitly set.", WixMessage.MessageTypeEnum.Warning);

            smoke.ExpectedWixMessages.Add(LGHT1076);

            // Run Smoke and keep a reference to the Result object that is returned by the Run() method
            Result result = smoke.Run();

            // Use the Result object to verify the exit code
            // Note: checking for an exit code of 0 is done implicitly in the Run() method but
            // this is just for demonstration purposes.
            Assert.True(0 == result.ExitCode, "Actual exit code did not match expected exit code");
        }
        ///<inheritdoc/>
        public override int GetHashCode()
        {
            int hash = 17;

            // Overflow is fine, just wrap
            unchecked
            {
                hash = (hash * 29) + PaintScheme.GetHashCode();
                hash = (hash * 29) + Propulsion.GetHashCode();
                hash = (hash * 29) + Damage.GetHashCode();
                hash = (hash * 29) + Smoke.GetHashCode();
                hash = (hash * 29) + TrailingEffects.GetHashCode();
                hash = (hash * 29) + Canopy.GetHashCode();
                hash = (hash * 29) + LandingLights.GetHashCode();
                hash = (hash * 29) + NavigationLights.GetHashCode();
                hash = (hash * 29) + AntiCollisionLights.GetHashCode();
                hash = (hash * 29) + Flaming.GetHashCode();
                hash = (hash * 29) + Afterburner.GetHashCode();
                hash = (hash * 29) + FrozenStatus.GetHashCode();
                hash = (hash * 29) + PowerPlantStatus.GetHashCode();
                hash = (hash * 29) + State.GetHashCode();
                hash = (hash * 29) + FormationLights.GetHashCode();
                hash = (hash * 29) + SpotLights.GetHashCode();
                hash = (hash * 29) + InteriorLights.GetHashCode();
            }

            return(hash);
        }
Ejemplo n.º 7
0
        protected F9S1Base(string craftDirectory, DVector2 position, DVector2 velocity, double propellantMass, string texturePath, double finOffset = -16.3)
            : base(craftDirectory, position, velocity, 0, propellantMass, texturePath)
        {
            _gridFins = new[]
            {
                new GridFin(this, new DVector2(1.3, finOffset), true),
                new GridFin(this, new DVector2(-1.3, finOffset), false)
            };

            _landingLegs = new[]
            {
                new LandingLeg(this, new DVector2(0.94, 21), true),
                new LandingLeg(this, new DVector2(-0.94, 21), false)
            };

            string sootTexturePath = texturePath.Replace(".png", "Soot.png");

            string fullSootPath = Path.Combine("Textures/Spacecrafts", sootTexturePath);

            if (!File.Exists(fullSootPath))
            {
                throw new FileNotFoundException("Could not find texture!", fullSootPath);
            }

            // Initialized 'soot' texture and allocate the drawing buffer
            _sootTexture   = new Bitmap(fullSootPath);
            _drawingBuffer = new Bitmap(_sootTexture.Width, _sootTexture.Height);

            _engineSmoke = new Smoke(1000, Color.FromArgb(100, 100, 100, 100));
        }
Ejemplo n.º 8
0
 private void Input_ButtonsChanged(object sender, StardewModdingAPI.Events.ButtonsChangedEventArgs e)
 {
     if (Context.IsWorldReady)
     {
         if (e.Released.Contains(SButton.MouseRight))
         {
             if (Game1.player.ActiveObject?.Name == "Airstrike Flare")
             {
                 if (!Game1.player.currentLocation.IsOutdoors)
                 {
                     Game1.addHUDMessage(new HUDMessage($"You need to be outside to call an airstrike!", HUDMessage.error_type));
                     return;
                 }
                 else
                 {
                     if (Game1.player.Items[Game1.player.Items.IndexOf(Game1.player.ActiveObject)].Stack > 1)
                     {
                         Game1.player.Items[Game1.player.Items.IndexOf(Game1.player.ActiveObject)].Stack -= 1;
                     }
                     else
                     {
                         Game1.player.Items.Remove(Game1.player.ActiveObject);
                     }
                     Smoke smoke = new Smoke(e.Cursor.Tile, Game1.player.currentLocation);
                 }
             }
         }
     }
 }
Ejemplo n.º 9
0
    /// <summary>
    /// Aliohjelma "tuhoaa" pelaajan poistamalla tältä kontrollit, vaihtamalla tekstuurin ja asettamalla efektit.
    /// </summary>
    /// <param name="pelaaja">pelaaja</param>
    private void TuhoaPelaaja(PhysicsObject pelaaja)
    {
        pelaaja.IgnoresExplosions = true;
        if (pelaajaOnTuhoutunut == false)
        {
            Explosion rajahdys = new Explosion(50);
            rajahdys.Position = pelaaja.Position;
            Add(rajahdys);
            pelaajanTuhoutumiset++;
        }
        pelaajaOnTuhoutunut = true;
        pelaaja.Image       = pelaajanKuvaRikki;
        LopetaNappainkomennot();

        Smoke savu = new Smoke();

        savu.Position = pelaaja.Position;
        Add(savu, 3);
        savu.Tag = "savu";
        FollowerBrain aivo = new FollowerBrain(pelaaja);

        savu.Brain         = aivo;
        aivo.Speed         = 10;
        pelaaja.Destroyed += savu.Destroy;
        Timer.SingleShot(3, LuoTuhoteksti);
    }
Ejemplo n.º 10
0
    private void ActivateItem(string playerTag)
    {
        Debug.Log("Item Activated");
        switch (ItemType)
        {
        case Type.Mushroom:
            mushroomScript.Affect(playerTag);
            break;

        case Type.Banana:
            Banana.BananaHit(playerTag);
            GameObject.Find("MiniGameA").GetComponent <ItemMiniGame>().ResetPositions(playerTag);
            break;

        case Type.Mirror:
            mirrorScript.ActivateMirror(playerTag);
            break;

        case Type.Smoke:
            Smoke.SmokeInpact(transform.parent.transform.position.x);
            break;

        default:
            break;
        }
        Destroy(this.gameObject);
    }
Ejemplo n.º 11
0
    private Crosshair cs;// = new Crosshair();

    public MyGame() : base(1920, 1080, false)
    {
        gd          = new GunDude();
        gm          = new GameManager();
        border      = new Border();
        background  = new Background();
        smoke       = new Smoke();
        lights      = new Lights();
        cs          = new Crosshair();
        hud         = new HUD();
        player      = new Player();
        builder     = new WaveBuilder();
        topBuilder  = new TopWaveBuilder();
        startScreen = new StartScreen();
        gameOver    = new GameOver();


        gameObjs.Add(border);
        gameObjs.Add(background);
        gameObjs.Add(smoke);
        gameObjs.Add(lights);
        gameObjs.Add(cs);
        gameObjs.Add(hud);
        gameObjs.Add(player);
        gameObjs.Add(gd);

        builder.WaveSpawner();
        topBuilder.WaveSpawner();
    }
Ejemplo n.º 12
0
 public void AddSmoke()
 {
     if (smokes.Count < MaxParticles)
     {
         smoke = new Smoke(rand, startPosition);
         smokes.Add(smoke);
     }
 }
Ejemplo n.º 13
0
 public void MakeSmoke(Texture2D smoke)
 {
     if (particle.Count < Maxparticle)
     {
         Smoke newsmoke = new Smoke(smoke, rand);
         particle.Add(newsmoke);
     }
 }
Ejemplo n.º 14
0
        public ActionResult DeleteConfirmed(int id)
        {
            Smoke smoke = db.Smokes.Find(id);

            db.Smokes.Remove(smoke);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 15
0
 public House(Color color, Nationality nationality, Pet pet, Drink drink, Smoke smoke)
 {
     Color       = color;
     Nationality = nationality;
     Pet         = pet;
     Drink       = drink;
     Smoke       = smoke;
 }
Ejemplo n.º 16
0
 private void Start()
 {
     anim = GetComponentInChildren <Animator>();
     //I use the camera bouds here so its easier to scale the lvl,but I dont like too much this this solution
     CameraFollow.CameraBounds bounds = Camera.main.gameObject.GetComponent <CameraFollow>().Boundaries;
     rightLimit = bounds.right - moveLimitOffset;
     leftLimit  = bounds.left + moveLimitOffset;
     smoke      = Instantiate(smokePrefab, transform).GetComponent <Smoke>();
 }
Ejemplo n.º 17
0
    public virtual void PowerNetworkUpdate()
    {
        ElectricityFunctions.WorkOutActualNumbers(wireConnect);
        if (MaximumInstantBreakCurrent != 0 && CanOverCurrent)
        {
            if (MaximumInstantBreakCurrent < wireConnect.Data.CurrentInWire)
            {
                QueueForDemolition(this);
                return;
            }
            if (MaximumBreakdownCurrent < wireConnect.Data.CurrentInWire)
            {
                if (CheckDestruction)
                {
                    if (wireConnect.RelatedLine != null)
                    {
                        foreach (var CB in wireConnect.RelatedLine.Covering)
                        {
                            CB.gameObject.GetComponent <CableInheritance>()?.Smoke.Stop();
                        }
                    }
                    QueueForDemolition(this);
                    return;
                }
                else
                {
                    if (wireConnect.RelatedLine != null)
                    {
                        foreach (var CB in wireConnect.RelatedLine.Covering)
                        {
                            CB.gameObject.GetComponent <CableInheritance>()?.Smoke.Play();
                        }
                    }
                    Smoke.Play();
                    StartCoroutine(WaitForDemolition());
                    return;
                }
            }
            if (CheckDestruction)
            {
                CheckDestruction = false;
                if (wireConnect.RelatedLine != null)
                {
                    foreach (var CB in wireConnect.RelatedLine.Covering)
                    {
                        CB.gameObject.GetComponent <CableInheritance>()?.Smoke.Stop();
                    }
                }
                Smoke.Stop();
            }

            if (IsSparking())
            {
                Sparks.Stop();
            }
        }
    }
Ejemplo n.º 18
0
 public void GenerateSmoke(Color startColor, Color endColor, int width, int height, int amount)
 {
     for (int s = 0; s < amount; s++)
     {
         Vector2 pos = position + new Vector2(Main.random.Next(0, width), Main.random.Next(0, height));
         Vector2 vel = new Vector2(Main.random.Next(-2, 2) / 20.5f, -0.03f);
         Smoke.NewSmokeParticle(pos, vel, startColor, endColor, 30, 90);
     }
 }
Ejemplo n.º 19
0
    private void SpawnSmok()
    {
        Smoke smokeClone = (Smoke)Instantiate(smokePrefab, transform.position, transform.rotation);
        float smokeSize  = 0.15f;

        smokeClone.transform.localScale = new Vector3(smokeSize, smokeSize, 0);
        smokeClone.transform.SetParent(badParent.transform);
        smokeClone.transform.localPosition = new Vector3(UnityEngine.Random.Range(-5f, 5f), badParent.transform.position.y, 0f);
        smokeClone.GetComponent <Rigidbody2D>().velocity = new Vector2(UnityEngine.Random.Range(-0, 0), UnityEngine.Random.Range(-5, -1));
    }
Ejemplo n.º 20
0
        public override Entity Create(Main main)
        {
            Entity entity = new Entity(main, "Smoke");
            Smoke  smoke  = new Smoke();

            smoke.Velocity.Value = speed * Vector3.Normalize(new Vector3(((float)random.NextDouble() - 0.5f) * 2.0f, (float)random.NextDouble(), ((float)random.NextDouble() - 0.5f) * 2.0f));
            entity.Add("Smoke", smoke);

            return(entity);
        }
Ejemplo n.º 21
0
 public ActionResult Edit([Bind(Include = "SmokeID,Name,Price,Description")] Smoke smoke)
 {
     if (ModelState.IsValid)
     {
         db.Entry(smoke).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(smoke));
 }
Ejemplo n.º 22
0
 public SolutionRow(int houseNumber, HouseColour houseColor,
                    Drink drink, Nationality nationality, Smoke smoke, Pet pet)
 {
     HouseNumber = houseNumber;
     HouseColour = houseColor;
     Drink       = drink;
     Nationality = nationality;
     Smoke       = smoke;
     Pet         = pet;
 }
Ejemplo n.º 23
0
    public GeneratorData(Smoke* smoke, string defaultNamespace, List<string> imports, List<Assembly> references,
	                     CodeCompileUnit unit, string destination, string docs)
    {
        Destination = destination;
        Docs = docs;
        Smoke = smoke;
        string argNamesFile = GetArgNamesFile(Smoke);
        if (File.Exists(argNamesFile))
        {
            foreach (string[] strings in File.ReadAllLines(argNamesFile).Select(line => line.Split(';')))
            {
                ArgumentNames[strings[0]] = strings[1].Split(',');
            }
        }
        CompileUnit = unit;
        Imports = imports;

        References = references;
        DefaultNamespace = new CodeNamespace(defaultNamespace);
        this.AddUsings(DefaultNamespace);

        foreach (Assembly assembly in References)
        {
            smokeClassAttribute = assembly.GetType("QtCore.SmokeClass", false);
            if (smokeClassAttribute != null)
            {
                smokeClassGetSignature = smokeClassAttribute.GetProperty("Signature").GetGetMethod();
                break;
            }
        }
        foreach (Assembly assembly in References)
        {
            foreach (Type type in assembly.GetTypes())
            {
                object[] attributes = type.GetCustomAttributes(smokeClassAttribute, false);
                if (attributes.Length != 0)
                {
                    string smokeClassName = (string) smokeClassGetSignature.Invoke(attributes[0], null);
                    Type t;
                    if (ReferencedTypeMap.TryGetValue(smokeClassName, out t) && t.IsInterface)
                    {
                        continue;
                    }
                    ReferencedTypeMap[smokeClassName] = type;
                }
                else
                {
                    ReferencedTypeMap[type.Name] = type;
                }
            }
        }

        CompileUnit.Namespaces.Add(DefaultNamespace);
        NamespaceMap[defaultNamespace] = DefaultNamespace;
    }
Ejemplo n.º 24
0
 void Start()
 {
     if (instance != null && instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
     }
 }
Ejemplo n.º 25
0
        private void GenerateClouds()
        {
            int   smokeType = 0;
            int   smokesize = 2;
            Smoke smoke1    = new Smoke(SmokeScreen.Normal, core.cam.screenCenter, smokesize, smokeType);

            smokes.Add(smoke1);
            for (int i = 1; i < 2; i++)
            {
                smoke1 = new Smoke(SmokeScreen.Normal, new Vector2(core.cam.screenCenter.X + 2048 * i, core.cam.screenCenter.Y), smokesize, smokeType);
                smokes.Add(smoke1);
                smoke1 = new Smoke(SmokeScreen.Normal, new Vector2(core.cam.screenCenter.X - 2048 * i, core.cam.screenCenter.Y), smokesize, smokeType);
                smokes.Add(smoke1);
                smoke1 = new Smoke(SmokeScreen.Normal, new Vector2(core.cam.screenCenter.X, core.cam.screenCenter.Y + 2048 * i), smokesize, smokeType);
                smokes.Add(smoke1);
                smoke1 = new Smoke(SmokeScreen.Normal, new Vector2(core.cam.screenCenter.X, core.cam.screenCenter.Y - 2048 * i), smokesize, smokeType);
                smokes.Add(smoke1);
                for (int y = 1; y < 2; y++)
                {
                    smoke1 = new Smoke(SmokeScreen.Normal, new Vector2(core.cam.screenCenter.X - 2048 * smokesize * i, core.cam.screenCenter.Y + 2048 * y), smokesize, smokeType);
                    smokes.Add(smoke1);
                    smoke1 = new Smoke(SmokeScreen.Normal, new Vector2(core.cam.screenCenter.X + 2048 * smokesize * i, core.cam.screenCenter.Y - 2048 * y), smokesize, smokeType);
                    smokes.Add(smoke1);
                    smoke1 = new Smoke(SmokeScreen.Normal, new Vector2(core.cam.screenCenter.X - 2048 * smokesize * i, core.cam.screenCenter.Y - 2048 * y), smokesize, smokeType);
                    smokes.Add(smoke1);
                    smoke1 = new Smoke(SmokeScreen.Normal, new Vector2(core.cam.screenCenter.X + 2048 * smokesize * i, core.cam.screenCenter.Y + 2048 * y), smokesize, smokeType);
                    smokes.Add(smoke1);
                }
            }
            smoke1 = new Smoke(SmokeScreen.Fon, core.cam.screenCenter, smokesize, smokeType);
            smokes.Add(smoke1);
            for (int i = 1; i < 2; i++)
            {
                smoke1 = new Smoke(SmokeScreen.Fon, new Vector2(core.cam.screenCenter.X + 2048 * i, core.cam.screenCenter.Y), smokesize, smokeType);
                smokes.Add(smoke1);
                smoke1 = new Smoke(SmokeScreen.Fon, new Vector2(core.cam.screenCenter.X - 2048 * i, core.cam.screenCenter.Y), smokesize, smokeType);
                smokes.Add(smoke1);
                smoke1 = new Smoke(SmokeScreen.Fon, new Vector2(core.cam.screenCenter.X, core.cam.screenCenter.Y + 2048 * i), smokesize, smokeType);
                smokes.Add(smoke1);
                smoke1 = new Smoke(SmokeScreen.Fon, new Vector2(core.cam.screenCenter.X, core.cam.screenCenter.Y - 2048 * i), smokesize, smokeType);
                smokes.Add(smoke1);
                for (int y = 1; y < 2; y++)
                {
                    smoke1 = new Smoke(SmokeScreen.Fon, new Vector2(core.cam.screenCenter.X - 2048 * smokesize * i, core.cam.screenCenter.Y + 2048 * y), smokesize, smokeType);
                    smokes.Add(smoke1);
                    smoke1 = new Smoke(SmokeScreen.Fon, new Vector2(core.cam.screenCenter.X + 2048 * smokesize * i, core.cam.screenCenter.Y - 2048 * y), smokesize, smokeType);
                    smokes.Add(smoke1);
                    smoke1 = new Smoke(SmokeScreen.Fon, new Vector2(core.cam.screenCenter.X - 2048 * smokesize * i, core.cam.screenCenter.Y - 2048 * y), smokesize, smokeType);
                    smokes.Add(smoke1);
                    smoke1 = new Smoke(SmokeScreen.Fon, new Vector2(core.cam.screenCenter.X + 2048 * smokesize * i, core.cam.screenCenter.Y + 2048 * y), smokesize, smokeType);
                    smokes.Add(smoke1);
                }
            }
        }
Ejemplo n.º 26
0
 public void Hide()
 {
     //Hide and reconfigure
     smoke = Smoke.Instantiate(smoke);
     smoke.GetComponent <Smoke>().frame = 0;
     smoke.transform.position           = transform.position;
     smoke.GetComponent <Smoke>().Type  = 3;
     render.sprite = (Sprites[0]);
     frame         = 0;
     Frame         = 0;
 }
Ejemplo n.º 27
0
        public ActionResult Create([Bind(Include = "SmokeID,Name,Price,Description")] Smoke smoke)
        {
            if (ModelState.IsValid)
            {
                db.Smokes.Add(smoke);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(smoke));
        }
        public SmokeSimulation()
        {
            smoke = new List<Smoke>(amontOfSmoke);
            random = new Random();

            for(int i = 0; i < smoke.Capacity; i++)
            {
                Smoke s = new Smoke();
                s.GenerateNewCloudStats(random);
                smoke.Add(s);
            }
        }
        private void PlayerEntryAnimation()
        {
            animationTimer++;
            float flightStopCoord = 160f;

            if (animationTimer % 2 == 0)
            {
                Main.player.AddAfterImage(0.8f, Main.player.position);
            }

            if (animationTimer == 1)
            {
                Main.player.canMove    = false;
                Main.player.position.Y = 260f;
            }
            if (animationTimer >= 120 && Main.player.position.Y > flightStopCoord)
            {
                Main.player.position.Y -= animationTimer / 32f;
            }

            if (Main.player.position.Y <= flightStopCoord)
            {
                Main.player.canMove = true;
                for (int s = 0; s < 60; s++)
                {
                    Vector2 position = Main.player.position;
                    float   angle    = s * (360f / 60f);
                    Vector2 velocity = new Vector2(0.6f, 0.6f) * new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
                    Smoke.NewSmokeParticle(position + new Vector2(Main.player.hitbox.Width / 2f, Main.player.hitbox.Height / 2f), velocity, Color.LightBlue, Color.White, 30, 60);
                }
            }

            if (Main.player.canMove)
            {
                secondaryAnimationTimer++;
                if (secondaryAnimationTimer % 5 == 0)
                {
                    if (PlayerUI.uiAlpha == 0f)
                    {
                        PlayerUI.uiAlpha = 1f;
                    }
                    else if (PlayerUI.uiAlpha == 1f)
                    {
                        PlayerUI.uiAlpha = 0f;
                    }
                }
                if (secondaryAnimationTimer >= 25)
                {
                    PlayerUI.uiAlpha = 1f;
                    EndAnimation(PlayerEntry);
                }
            }
        }
Ejemplo n.º 30
0
    public void Defeat()
    {
        Smoke s = _m.placement[placement];

        s.creation  = false;
        s.character = this.gameObject;
        s.gameObject.SetActive(true);
        s.Load();

        //TODO: WHAT HAPPENS ON DEFEAT
        _m.leave_timer += 2F;
    }
Ejemplo n.º 31
0
    public void Victory()
    {
        Smoke s = _m.placement[placement];

        s.creation  = false;
        s.character = this.gameObject;
        s.gameObject.SetActive(true);
        s.Load();

        //TODO: WHAT HAPPENS ON VICTORY
        _m.SupporterIn();
    }
Ejemplo n.º 32
0
        // POST: odata/Smokes
        public IHttpActionResult Post(Smoke smoke)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Smokes.Add(smoke);
            db.SaveChanges();

            return(Created(smoke));
        }
Ejemplo n.º 33
0
        public Explosion(Vector2 position) : base(position)
        {
            for (int i = 0; i < particleNumber; i += 1)
            {
                var smoke = new Smoke(transform.position + new Vector2(GameManager.random.Next(6) - 3, GameManager.random.Next(6) - 3));
                smoke.SetColor(Misc.util.Choose <byte>(7, 9));
                ParticleManager.AddParticle(smoke);
            }

            done = true;

            GameManager.pico8.Audio.Sfx(2);
        }
Ejemplo n.º 34
0
    public override void LaunchProjectile()
    {
        float distToPlayer = Vector2.Distance(this.transform.position, player.position);

        if (shoot == true && distToPlayer < 15)
        {
            StartCoroutine(Delay());
            GameObject projectileObject = Instantiate(Fumee, spawn + Vector3.up * 0.5f, Quaternion.identity);
            Smoke      projectile       = projectileObject.GetComponent <Smoke>();
            projectile.Launch(Vector2.up, 0);
            AudioManager.Instance.Playsound(sound, 0.2f);
        }
    }
Ejemplo n.º 35
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Color.GetHashCode();
         hashCode = (hashCode * 397) ^ Nationality.GetHashCode();
         hashCode = (hashCode * 397) ^ Pet.GetHashCode();
         hashCode = (hashCode * 397) ^ Drink.GetHashCode();
         hashCode = (hashCode * 397) ^ Smoke.GetHashCode();
         hashCode = (hashCode * 397) ^ Position.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 36
0
        public void ExampleTest1()
        {
            string testDirectory = Environment.ExpandEnvironmentVariables(@"%WIX%\examples\test\extraice.0");

            // Build the MSI that will be run against Smoke.
            // Pass the -sval argument so that light does not fail due to ICE violations - it will be up to Smoke to catch them.
            string outputDirectory = Builder.BuildPackage(testDirectory, "product.wxs", "product.msi", false, null, "-sval");
            string databaseFile = Path.Combine(outputDirectory, "product.msi");

            // Run Smoke
            Smoke smoke = new Smoke(testDirectory);
            smoke.DatabaseFiles.Add(databaseFile);
            smoke.CubFiles.Add(@"%WIX%\examples\data\test.cub");
            smoke.ExpectedWixWarnings.Add(1076);
            smoke.ExpectedOutputStrings.Add("ICE1000");

            Result smokeResult = smoke.Run();
        }
Ejemplo n.º 37
0
    public static unsafe Stack<KeyValuePair<Smoke.ModuleIndex, string>> GetAbstractMethods(Smoke* smoke, short classId)
    {
        Dictionary<Smoke.ModuleIndex, string> methods =
            new Dictionary<Smoke.ModuleIndex, string>(SmokeMethodEqualityComparer.AbstractRespectingComparer);
        SmokeMethodEqualityComparer defaultComparer = SmokeMethodEqualityComparer.DefaultEqualityComparer;

        smoke->FindAllMethods(classId, methods, true);
        var abstractMethods = new Stack<KeyValuePair<Smoke.ModuleIndex, string>>();

        foreach (KeyValuePair<Smoke.ModuleIndex, string> pair in methods)
        {
            Smoke.Method* meth = pair.Key.smoke->methods + pair.Key.index;
            if ((meth->flags & (ushort) Smoke.MethodFlags.mf_purevirtual) == 0)
            {
                // only compare pure-virtuals
                continue;
            }
            abstractMethods.Push(pair);

            foreach (KeyValuePair<Smoke.ModuleIndex, string> other in methods)
            {
                // Break if we encounter our original Index. Anything after this one will be further up in the
                // hierarchy and thus can't override anything.
                if (pair.Key == other.Key)
                    break;

                Smoke.Method* otherMeth = other.Key.smoke->methods + other.Key.index;
                if (defaultComparer.Equals(pair.Key, other.Key))
                {
                    if ((otherMeth->flags & (ushort) Smoke.MethodFlags.mf_purevirtual) == 0)
                    {
                        // overriden with implementation
                        abstractMethods.Pop();
                    }
                    break;
                }
            }
        }

        return abstractMethods;
    }
Ejemplo n.º 38
0
        public void ExampleTest3()
        {
            string testDirectory = Path.Combine(this.TestContext.DataDirectory, @"Examples\ExampleTest3");

            // Build the MSI that will be run against Smoke. Pass the -sval argument to delay validation until Smoke is run
            string msi = Builder.BuildPackage(testDirectory, "product.wxs", Path.Combine(this.TestContext.TestDirectory, "product.msi"), null, "-sval");

            // Create a new Smoke object
            Smoke smoke = new Smoke();
            smoke.DatabaseFiles.Add(msi);
            smoke.CubFiles.Add(Path.Combine(this.TestContext.DataDirectory, @"Examples\ExampleTest3\test.cub"));

            // Define the expected ICE error
            WixMessage LGHT1076 = new WixMessage(1076, "ICE1000: Component 'ExtraICE.0.ProductComponent' installs into directory 'TARGETDIR', which will get installed into the volume with the most free space unless explicitly set.", WixMessage.MessageTypeEnum.Warning);
            smoke.ExpectedWixMessages.Add(LGHT1076);

            // Run Smoke and keep a reference to the Result object that is returned by the Run() method
            Result result = smoke.Run();

            // Use the Result object to verify the exit code
            // Note: checking for an exit code of 0 is done implicitly in the Run() method but
            // this is just for demonstration purposes.
            Assert.True(0 == result.ExitCode, "Actual exit code did not match expected exit code");
        }
Ejemplo n.º 39
0
 public static unsafe bool IsQObject(Smoke.Class* klass)
 {
     return IsDerivedFrom(ByteArrayManager.GetString(klass->className), "QObject");
 }
Ejemplo n.º 40
0
 public static unsafe extern bool GetModuleIndexFromClassName(byte* name, ref Smoke* smoke, ref short index);
Ejemplo n.º 41
0
 public static unsafe bool IsClassAbstract(Smoke* smoke, short classId)
 {
     return GetAbstractMethods(smoke, classId).Count > 0;
 }
Ejemplo n.º 42
0
 private static extern bool GetProperties(Smoke* smoke, short classId, AddProperty addProp);
Ejemplo n.º 43
0
 public CodeMemberMethod GenerateMethod(Smoke* smoke, short idx, string mungedName)
 {
     return GenerateMethod(smoke, smoke->methods + idx, mungedName, null);
 }
Ejemplo n.º 44
0
 // scale 10% of the screeen size
 public float ScaleObject(Smoke smokeScale)
 {
     scale = sizeofthefield / smokeScale.smokey.Width;
     return scale;
 }
Ejemplo n.º 45
0
 private CodeParameterDeclarationExpression GetArgument(Smoke* smoke, short* typeIndex, IList<string> methodArgs, IEnumerable args, ref int count)
 {
     bool isRef;
     CodeTypeReference argType = translator.CppToCSharp(smoke->types + *typeIndex, type, out isRef);
     string argName = this.GetArgName(smoke, typeIndex, methodArgs, ref count, isRef, argType);
     if (!argName.Contains(" = "))
     {
         RemoveDefaultValuesFromPreviousArgs(args);
     }
     CodeParameterDeclarationExpression arg = new CodeParameterDeclarationExpression(argType, argName);
     if (isRef)
     {
         arg.Direction = FieldDirection.Ref;
     }
     return arg;
 }
Ejemplo n.º 46
0
 private void PostEnumMemberHook(Smoke* smoke, Smoke.Method* smokeMethod, CodeMemberField cmm, CodeTypeDeclaration type)
 {
     CodeTypeDeclaration parentType = this.memberDocumentation.Keys.FirstOrDefault(t => t.Name == (string) type.UserData["parent"]);
     if (parentType != null)
     {
         IList<string> docs = this.memberDocumentation[parentType];
         string typeName = Regex.Escape(parentType.Name) + "::" + Regex.Escape(type.Name);
         if (type.Comments.Count == 0)
         {
             for (int i = 0; i < docs.Count; i++)
             {
                 const string enumDoc = @"enum {0}(\s*flags {1}::\w+\s+)?(?<docsStart>.*?)(\n){{3}}";
                 Match matchEnum = Regex.Match(docs[i], string.Format(enumDoc, typeName, parentType.Name), RegexOptions.Singleline);
                 if (matchEnum.Success)
                 {
                     string doc = (matchEnum.Groups["docsStart"].Value + matchEnum.Groups["docsEnd1"].Value).Trim();
                     doc = Regex.Replace(doc,
                                         @"(The \S+ type is a typedef for QFlags<\S+>\. It stores an OR combination of \S+ values\.)",
                                         string.Empty);
                     doc = Regex.Replace(doc,
                                         @"ConstantValue(Description)?.*?(((\n){2})|$)",
                                         string.Empty, RegexOptions.Singleline).Trim();
                     if (!string.IsNullOrEmpty(doc))
                     {
                         Util.FormatComment(doc, type, i > 0);
                         break;
                     }
                 }
             }
         }
         string memberName = Regex.Escape(parentType.Name) + "::" +
                             Regex.Escape(ByteArrayManager.GetString(smoke->methodNames[smokeMethod->name]));
         const string memberDoc = @"enum {0}.*{1}\t[^\t\n]+\t(?<docs>.*?)(&\w+;)?(\n)";
         for (int i = 0; i < docs.Count; i++)
         {
             Match match = Regex.Match(docs[i], string.Format(memberDoc, typeName, memberName), RegexOptions.Singleline);
             if (match.Success)
             {
                 string doc = match.Groups["docs"].Value.Trim();
                 if (!string.IsNullOrEmpty(doc))
                 {
                     Util.FormatComment(char.ToUpper(doc[0]) + doc.Substring(1), cmm, i > 0);
                     break;
                 }
             }
         }
     }
 }
Ejemplo n.º 47
0
 private void PostMethodBodyHooks(Smoke* smoke, Smoke.Method* smokeMethod, CodeMemberMethod cmm, CodeTypeDeclaration type)
 {
     this.CommentMember(smoke, smokeMethod, cmm, type);
     GenerateEvent(cmm, cmm.Name, type, true);
 }
Ejemplo n.º 48
0
 static extern void GetSignals(Smoke* smoke, void* klass, AddSignal addSignalFn);
Ejemplo n.º 49
0
 private void CommentMember(Smoke* smoke, Smoke.Method* smokeMethod, CodeTypeMember cmm, CodeTypeDeclaration type)
 {
     if (this.memberDocumentation.ContainsKey(type))
     {
         IList<string> docs = this.memberDocumentation[type];
         string typeName = Regex.Escape(type.Name);
         string signature = smoke->GetMethodSignature(smokeMethod);
         StringBuilder signatureRegex = new StringBuilder();
         Match matchSignature = Regex.Match(signature, @"(?<name>[^\(]+)\((?<args>.*)\)");
         string methodName = Regex.Escape(matchSignature.Groups["name"].Value);
         signatureRegex.Append(methodName);
         signatureRegex.Append(@"\s*\(\s*");
         string[] argTypes = matchSignature.Groups["args"].Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
         const string separator = @",\s*";
         foreach (string argType in argTypes)
         {
             StringBuilder typeBuilder = new StringBuilder(Regex.Escape(argType));
             typeBuilder.Replace(@"\*", @"\s*\*").Replace(@"&", @"\s*&").Replace(type.Name + "::", string.Empty);
             signatureRegex.Append(Translator.MatchFunctionPointer(typeBuilder.ToString()).Success
                                       ? @"[^,]+"
                                       : (typeBuilder + @"\s+\w+(\s*=\s*\w+)?"));
             signatureRegex.Append(separator);
         }
         if (argTypes.Length > 0)
         {
             signatureRegex.Remove(signatureRegex.Length - separator.Length, separator.Length);
         }
         signatureRegex.Append(@"\s*\)\s*");
         string memberDoc = @"{0}( |(::)){1}( const)?( \[(\w+\s*)+\])?\n\W*(?<docs>.*?)(\n\s*){{1,2}}((&?\S* --)|((\n\s*){{2}}))";
         for (int i = 0; i < docs.Count; i++)
         {
             Match match = Regex.Match(docs[i], string.Format(memberDoc, typeName, signatureRegex), RegexOptions.Singleline);
             if (match.Success)
             {
                 Util.FormatComment(match.Groups["docs"].Value, cmm, i > 0);
                 break;
             }
             memberDoc = @"{0}( |(::)){1}\s*\([^\n]*\)( const)?( \[(\w+\s*)+\])?\n\W*(?<docs>.*?)(\n\s*){{1,2}}((&?\S* --)|((\n\s*){{2}}))";
             match = Regex.Match(docs[i], string.Format(memberDoc, typeName, methodName), RegexOptions.Singleline);
             if (match.Success)
             {
                 Util.FormatComment(match.Groups["docs"].Value, cmm, i > 0);
                 break;
             }
         }
     }
 }
Ejemplo n.º 50
0
 public void SupportingMethodsHook(Smoke* smoke, Smoke.Method* method, CodeMemberMethod cmm, CodeTypeDeclaration type)
 {
     if (type.Name == "QObject" && cmm is CodeConstructor)
     {
         cmm.Statements.Add(new CodeSnippetStatement(QObjectDummyCtorCode));
     }
 }
Ejemplo n.º 51
0
    public void PreMembersHook(Smoke* smoke, Smoke.Class* klass, CodeTypeDeclaration type)
    {
        if (type.Name == "QObject")
        {
            // Add 'Qt' base class
            type.BaseTypes.Add(new CodeTypeReference("Qt"));

            // add the Q_EMIT field
            CodeMemberField Q_EMIT = new CodeMemberField(typeof(object), "Q_EMIT");
            Q_EMIT.Attributes = MemberAttributes.Family;
            Q_EMIT.InitExpression = new CodePrimitiveExpression(null);
            type.Members.Add(Q_EMIT);
        }
    }
Ejemplo n.º 52
0
    private void GenerateInheritedMethods(Smoke.Class* klass, MethodsGenerator methgen, AttributeGenerator attrgen,
	                                      List<Smoke.ModuleIndex> alreadyImplemented)
    {
        // Contains inherited methods that have to be implemented by the current class.
        // We use our custom comparer, so we don't end up with the same method multiple times.
        IDictionary<Smoke.ModuleIndex, string> implementMethods =
            new Dictionary<Smoke.ModuleIndex, string>(SmokeMethodEqualityComparer.DefaultEqualityComparer);

        bool firstParent = true;
        for (short* parent = data.Smoke->inheritanceList + klass->parents; *parent > 0; parent++)
        {
            if (firstParent)
            {
                // we're only interested in parents implemented as interfaces
                firstParent = false;
                continue;
            }
            // collect all methods (+ inherited ones) and add them to the implementMethods Dictionary
            data.Smoke->FindAllMethods(*parent, implementMethods, true);
        }

        foreach (KeyValuePair<Smoke.ModuleIndex, string> pair in implementMethods)
        {
            Smoke.Method* meth = pair.Key.smoke->methods + pair.Key.index;
            Smoke.Class* ifaceKlass = pair.Key.smoke->classes + meth->classId;

            if ((meth->flags & (ushort) Smoke.MethodFlags.mf_enum) > 0
                || (meth->flags & (ushort) Smoke.MethodFlags.mf_ctor) > 0
                || (meth->flags & (ushort) Smoke.MethodFlags.mf_copyctor) > 0
                || (meth->flags & (ushort) Smoke.MethodFlags.mf_dtor) > 0
                || (meth->flags & (ushort) Smoke.MethodFlags.mf_static) > 0
                || (meth->flags & (ushort) Smoke.MethodFlags.mf_internal) > 0)
            {
                // no need to check for properties here - QObjects don't support multiple inheritance anyway
                continue;
            }
            if (alreadyImplemented.Contains(pair.Key, SmokeMethodEqualityComparer.DefaultEqualityComparer))
            {
                continue;
            }
            if ((meth->flags & (ushort) Smoke.MethodFlags.mf_attribute) > 0)
            {
                attrgen.ScheduleAttributeAccessor(pair.Key.smoke, meth);
                continue;
            }

            CodeTypeReference type = translator.CppToCSharp(ByteArrayManager.GetString(ifaceKlass->className));
            methgen.GenerateMethod(pair.Key.smoke, meth, pair.Value, type);
        }
    }
Ejemplo n.º 53
0
 public CodeMemberMethod GenerateBasicMethodDefinition(Smoke* smoke, Smoke.Method* method)
 {
     string cppSignature = smoke->GetMethodSignature(method);
     return this.GenerateBasicMethodDefinition(smoke, method, cppSignature, null);
 }
Ejemplo n.º 54
0
    public void PostMembersHook(Smoke* smoke, Smoke.Class* klass, CodeTypeDeclaration type)
    {
        if (Util.IsQObject(klass))
        {
            CodeMemberProperty emit = new CodeMemberProperty();
            emit.Name = "Emit";
            emit.Attributes = MemberAttributes.Family | MemberAttributes.New | MemberAttributes.Final;
            emit.HasGet = true;
            emit.HasSet = false;

            string signalsIfaceName = "I" + type.Name + "Signals";
            CodeTypeReference returnType = new CodeTypeReference(signalsIfaceName);
            emit.Type = returnType;

            emit.GetStatements.Add(new CodeMethodReturnStatement(new CodeCastExpression(
                returnType,
                new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "Q_EMIT")
            )));

            type.Members.Add(emit);

            string className = ByteArrayManager.GetString(klass->className);
            int colon = className.LastIndexOf("::", StringComparison.Ordinal);
            string prefix = (colon != -1) ? className.Substring(0, colon) : string.Empty;

            IList typeCollection = Data.GetTypeCollection(prefix);
            CodeTypeDeclaration ifaceDecl = new CodeTypeDeclaration(signalsIfaceName);
            ifaceDecl.IsInterface = true;

            if (className != "QObject")
            {
                string parentClassName = ByteArrayManager.GetString(smoke->classes[smoke->inheritanceList[klass->parents]].className);
                colon = parentClassName.LastIndexOf("::", StringComparison.Ordinal);
                prefix = (colon != -1) ? parentClassName.Substring(0, colon) : string.Empty;
                if (colon != -1)
                {
                    parentClassName = parentClassName.Substring(colon + 2);
                }

                string parentInterface = (prefix != string.Empty) ? prefix.Replace("::", ".") + "." : string.Empty;
                parentInterface += "I" + parentClassName + "Signals";

                ifaceDecl.BaseTypes.Add(new CodeTypeReference(parentInterface));
            }
            Dictionary<CodeSnippetTypeMember, CodeMemberMethod> signalEvents = new Dictionary<CodeSnippetTypeMember, CodeMemberMethod>();
            GetSignals(smoke, klass, delegate(string signature, string name, string typeName, IntPtr metaMethod)
            {
                CodeMemberMethod signal = new CodeMemberMethod();
                signal.Attributes = MemberAttributes.Abstract;

                // capitalize the first letter
                StringBuilder builder = new StringBuilder(name);
                builder[0] = char.ToUpper(builder[0]);
                string tmp = builder.ToString();

                signal.Name = tmp;
                bool isRef;
                try
                {
                    if (typeName == string.Empty)
                        signal.ReturnType = new CodeTypeReference(typeof(void));
                    else
                        signal.ReturnType = Translator.CppToCSharp(typeName, out isRef);
                }
                catch (NotSupportedException)
                {
                    Debug.Print("  |--Won't wrap signal {0}::{1}", className, signature);
                    return;
                }

                CodeAttributeDeclaration attr = new CodeAttributeDeclaration("Q_SIGNAL",
                    new CodeAttributeArgument(new CodePrimitiveExpression(signature)));
                signal.CustomAttributes.Add(attr);

                int argNum = 1;
                StringBuilder fullNameBuilder = new StringBuilder("Slot");
                GetMetaMethodParameters(metaMethod, delegate(string paramType, string paramName)
                {
                    if (paramName == string.Empty)
                    {
                        paramName = "arg" + argNum.ToString();
                    }
                    argNum++;

                    CodeParameterDeclarationExpression param;
                    try
                    {
                        short id = smoke->IDType(paramType);
                        CodeTypeReference paramTypeRef;
                        if (id > 0)
                        {
                            paramTypeRef = Translator.CppToCSharp(smoke->types + id, out isRef);
                        }
                        else
                        {
                            if (!paramType.Contains("::"))
                            {
                                id = smoke->IDType(className + "::" + paramType);
                                if (id > 0)
                                {
                                    paramTypeRef = Translator.CppToCSharp(smoke->types + id, out isRef);
                                }
                                else
                                {
                                    paramTypeRef = Translator.CppToCSharp(paramType, out isRef);
                                }
                            }
                            else
                            {
                                paramTypeRef = Translator.CppToCSharp(paramType, out isRef);
                            }
                        }
                        param = new CodeParameterDeclarationExpression(paramTypeRef, paramName);
                    }
                    catch (NotSupportedException)
                    {
                        Debug.Print("  |--Won't wrap signal {0}::{1}", className, signature);
                        return;
                    }
                    if (isRef)
                    {
                        param.Direction = FieldDirection.Ref;
                    }
                    signal.Parameters.Add(param);
                    if (argNum == 2)
                    {
                        fullNameBuilder.Append('<');
                    }
                    fullNameBuilder.Append(param.Type.BaseType);
                    fullNameBuilder.Append(',');
                });
                if (fullNameBuilder[fullNameBuilder.Length - 1] == ',')
                {
                    fullNameBuilder[fullNameBuilder.Length - 1] = '>';
                }
                ifaceDecl.Members.Add(signal);
                CodeSnippetTypeMember signalEvent = new CodeSnippetTypeMember();
                signalEvent.Name = signal.Name;
                CodeSnippetTypeMember existing = signalEvents.Keys.FirstOrDefault(m => m.Name == signal.Name);
                if (existing != null)
                {
                    CodeSnippetTypeMember signalEventToUse;
                    CodeMemberMethod signalToUse;
                    if (signal.Parameters.Count == 0)
                    {
                        signalEventToUse = existing;
                        signalToUse = signalEvents[existing];
                    }
                    else
                    {
                        signalEventToUse = signalEvent;
                        signalToUse = signal;
                    }
                    string suffix = signalToUse.Parameters.Cast<CodeParameterDeclarationExpression>().Last().Name;
                    if (suffix.StartsWith("arg") && suffix.Length > 3 && char.IsDigit(suffix[3]))
                    {
                        string lastType = signalToUse.Parameters.Cast<CodeParameterDeclarationExpression>().Last().Type.BaseType;
                        suffix = lastType.Substring(lastType.LastIndexOf('.') + 1);
                    }
                    else
                    {
                        StringBuilder lastParamBuilder = new StringBuilder(suffix);
                        lastParamBuilder[0] = char.ToUpper(lastParamBuilder[0]);
                        suffix = lastParamBuilder.ToString();
                    }
                    signalEventToUse.Text = signalEventToUse.Text.Replace(signalEventToUse.Name, signalEventToUse.Name += suffix);
                }
                signalEvent.Text = string.Format(@"
        public event {0} {1}
        {{
            add
            {{
                QObject.Connect(this, Qt.SIGNAL(""{2}""), (QObject) value.Target, Qt.SLOT(value.Method.Name + ""{3}""));
            }}
            remove
            {{
                QObject.Disconnect(this, Qt.SIGNAL(""{2}""), (QObject) value.Target, Qt.SLOT(value.Method.Name + ""{3}""));
            }}
        }}", fullNameBuilder, signalEvent.Name, signature, signature.Substring(signature.IndexOf('(')));
                signalEvents.Add(signalEvent, signal);
            });

            typeCollection.Add(ifaceDecl);
            foreach (KeyValuePair<CodeSnippetTypeMember, CodeMemberMethod> signalEvent in signalEvents)
            {
                CodeSnippetTypeMember implementation = signalEvent.Key;
                CodeCommentStatementCollection comments = new CodeCommentStatementCollection();
                foreach (CodeTypeMember current in from CodeTypeMember member in type.Members
                                                   where member.Name == implementation.Name
                                                   select member)
                {
                    if (comments.Count == 0)
                    {
                        comments.AddRange(current.Comments);
                    }
                    current.Name = "On" + current.Name;
                }
                signalEvent.Value.Comments.AddRange(comments);
                signalEvent.Key.Comments.AddRange(comments);
                type.Members.Add(signalEvent.Key);
            }
        }
    }
Ejemplo n.º 55
0
    public static bool MethodOverrides(Smoke* smoke, Smoke.Method* method, out MemberAttributes access, out bool foundInInterface)
    {
        access = MemberAttributes.Public;
        foundInInterface = false;

        if (smoke->inheritanceList[smoke->classes[method->classId].parents] == 0)
        {
            return false;
        }

        long id = method - smoke->methods;
        Smoke.ModuleIndex methodModuleIndex = new Smoke.ModuleIndex(smoke, (short) id);

        Smoke.Method* firstMethod = (Smoke.Method*) IntPtr.Zero;
        short* firstParent = smoke->inheritanceList + smoke->classes[method->classId].parents;

        for (short* parent = firstParent; *parent > 0; parent++)
        {
            if (firstMethod != (Smoke.Method*) IntPtr.Zero && !foundInInterface)
            {
                // already found a method in the first parent class
                break;
            }

            // Do this with linq... there's probably room for optimization here.
            // Select virtual and pure virtual methods from superclasses.
            var inheritedVirtuals = from key in smoke->FindAllMethods(*parent, true).Keys
                                    where ((key.smoke->methods[key.index].flags & (ushort) Smoke.MethodFlags.mf_virtual) > 0
                                           ||
                                           (key.smoke->methods[key.index].flags & (ushort) Smoke.MethodFlags.mf_purevirtual) > 0)
                                    select key;

            foreach (Smoke.ModuleIndex mi in inheritedVirtuals)
            {
                Smoke.Method* meth = mi.smoke->methods + mi.index;

                if (SmokeMethodEqualityComparer.DefaultEqualityComparer.Equals(methodModuleIndex, mi))
                {
                    if ((meth->flags & (uint) Smoke.MethodFlags.mf_protected) > 0)
                    {
                        access = MemberAttributes.Family;
                    }
                    else
                    {
                        access = MemberAttributes.Public;
                    }

                    // don't return here - we need the access of the method in the topmost superclass
                    firstMethod = meth;
                    if (parent != firstParent)
                    {
                        foundInInterface = true;
                    }
                }
            }
        }

        // we need to have a method that's not in a interface to mark it as overriden
        bool ret = firstMethod != (Smoke.Method*) IntPtr.Zero && !foundInInterface;

        // we need to have a public method in one of the interfaces for this to be set
        foundInInterface = firstMethod != (Smoke.Method*) IntPtr.Zero && foundInInterface && access == MemberAttributes.Public;

        return ret;
    }
Ejemplo n.º 56
0
    private void DefineWrapperClassFieldsAndMethods(Smoke.Class* smokeClass, CodeTypeDeclaration type)
    {
        // define the dummy constructor
        if (smokeClass->size > 0)
        {
            CodeConstructor dummyCtor = new CodeConstructor();
            dummyCtor.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(Type)), "dummy"));
            if (data.Smoke->inheritanceList[smokeClass->parents] > 0)
            {
                dummyCtor.BaseConstructorArgs.Add(new CodeSnippetExpression("(System.Type) null"));
            }
            dummyCtor.Attributes = MemberAttributes.Family;
            if (SupportingMethodsHooks != null)
            {
                SupportingMethodsHooks(data.Smoke, (Smoke.Method*) 0, dummyCtor, type);
            }
            type.Members.Add(dummyCtor);
        }

        CodeMemberField staticInterceptor = new CodeMemberField("SmokeInvocation", "staticInterceptor");
        staticInterceptor.Attributes = MemberAttributes.Static;
        CodeObjectCreateExpression initExpression = new CodeObjectCreateExpression("SmokeInvocation");
        initExpression.Parameters.Add(new CodeTypeOfExpression(type.Name));
        initExpression.Parameters.Add(new CodePrimitiveExpression(null));
        staticInterceptor.InitExpression = initExpression;
        type.Members.Add(staticInterceptor);

        if (smokeClass->size == 0)
            return;

        // we only need this for real classes
        CodeMemberMethod createProxy = new CodeMemberMethod();
        createProxy.Name = "CreateProxy";
        createProxy.Attributes = MemberAttributes.Public;
        if (data.Smoke->inheritanceList[smokeClass->parents] != 0)
        {
            createProxy.Attributes |= MemberAttributes.Override;
        }
        createProxy.Statements.Add(new CodeAssignStatement(
                                       new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "interceptor"),
                                       // left hand side
                                       new CodeObjectCreateExpression("SmokeInvocation", new CodeTypeOfExpression(type.Name),
                                                                      new CodeThisReferenceExpression()) // right hand side
                                       ));
        type.Members.Add(createProxy);

        if (data.Smoke->inheritanceList[smokeClass->parents] != 0)
            return;
        // The following fields are only necessary for classes without superclasses.

        CodeMemberField interceptor = new CodeMemberField("SmokeInvocation", "interceptor");
        interceptor.Attributes = MemberAttributes.Family;
        type.Members.Add(interceptor);
        CodeMemberField smokeObject = new CodeMemberField(typeof(IntPtr), "smokeObject");
        type.Members.Add(smokeObject);
        type.BaseTypes.Add(new CodeTypeReference("ISmokeObject"));
        CodeMemberProperty propertySmokeObject = new CodeMemberProperty();
        propertySmokeObject.Name = "SmokeObject";
        propertySmokeObject.Type = new CodeTypeReference(typeof(IntPtr));
        propertySmokeObject.Attributes = MemberAttributes.Public;
        CodeFieldReferenceExpression smokeObjectReference = new CodeFieldReferenceExpression(
            new CodeThisReferenceExpression(), smokeObject.Name);
        propertySmokeObject.GetStatements.Add(new CodeMethodReturnStatement(smokeObjectReference));
        propertySmokeObject.SetStatements.Add(new CodeAssignStatement(smokeObjectReference,
                                                                      new CodePropertySetValueReferenceExpression()));
        type.Members.Add(propertySmokeObject);
    }
Ejemplo n.º 57
0
 private string[] GetMethodArgs(Smoke* smoke, Smoke.Method* method)
 {
     if (method->numArgs == 0)
     {
         return new string[0];
     }
     string className = ByteArrayManager.GetString(smoke->classes[method->classId].className);
     className = className.Substring(className.LastIndexOf(":") + 1);
     StringBuilder keyBuilder =
         new StringBuilder(className + "," + ByteArrayManager.GetString(smoke->methodNames[method->name]));
     for (short* typeIndex = smoke->argumentList + method->args; *typeIndex > 0; typeIndex++)
     {
         keyBuilder.Append(',');
         keyBuilder.Append(*typeIndex);
     }
     string key = keyBuilder.ToString();
     if (data.ArgumentNames.ContainsKey(key))
     {
         return data.ArgumentNames[key];
     }
     string argNamesFile = data.GetArgNamesFile(smoke);
     if (File.Exists(argNamesFile))
     {
         foreach (string[] strings in File.ReadAllLines(argNamesFile).Select(line => line.Split(';')))
         {
             data.ArgumentNames[strings[0]] = strings[1].Split(',');
         }
         return data.ArgumentNames[key];
     }
     return null;
 }
Ejemplo n.º 58
0
    public CodeMemberMethod GenerateMethod(Smoke* smoke, Smoke.Method* method, string mungedName, CodeTypeReference iface)
    {
        string cppSignature = smoke->GetMethodSignature(method);
        CodeMemberMethod cmm = GenerateBasicMethodDefinition(smoke, method, cppSignature, iface);
        if (cmm == null)
        {
            return null;
        }

        // put the method into the correct type
        CodeTypeDeclaration containingType = type;
        if (cmm.Name.StartsWith("operator") || cmm.Name.StartsWith("explicit "))
        {
            if (!data.CSharpTypeMap.TryGetValue(cmm.Parameters[0].Type.GetStringRepresentation(), out containingType))
            {
                if (cmm.Parameters.Count < 2 ||
                    !data.CSharpTypeMap.TryGetValue(cmm.Parameters[1].Type.GetStringRepresentation(), out containingType))
                {
                    Debug.Print("  |--Can't find containing type for {0} - skipping", cppSignature);
                }
                return null;
            }
        }

        // already implemented?
        if (containingType.HasMethod(cmm))
        {
            if (iface == null || (method->flags & (uint) Smoke.MethodFlags.mf_protected) > 0)
            {
                // protected methods are not available in interfaces
                Debug.Print("  |--Skipping already implemented method {0}", cppSignature);
                return null;
            }
            else
            {
                cmm.PrivateImplementationType = iface;
            }
        }

        if (PreMethodBodyHooks != null)
        {
            PreMethodBodyHooks(smoke, method, cmm, containingType);
        }

        // do we have pass-by-ref parameters?
        bool generateInvokeForRefParams = cmm.Parameters.Cast<CodeParameterDeclarationExpression>().Any(expr => expr.Direction == FieldDirection.Ref);

        // generate the SmokeMethod attribute
        CodeAttributeDeclaration attr = new CodeAttributeDeclaration("SmokeMethod",
                                                                     new CodeAttributeArgument(
                                                                     	new CodePrimitiveExpression(cppSignature)));
        cmm.CustomAttributes.Add(attr);

        // choose the correct 'interceptor'
        CodeMethodInvokeExpression invoke;
        if ((cmm.Attributes & MemberAttributes.Static) == MemberAttributes.Static)
        {
            invoke = new CodeMethodInvokeExpression(SmokeSupport.staticInterceptor_Invoke);
        }
        else
        {
            invoke = new CodeMethodInvokeExpression(SmokeSupport.interceptor_Invoke);
        }

        // first pass the munged name, then the C++ signature
        invoke.Parameters.Add(new CodePrimitiveExpression(mungedName));
        invoke.Parameters.Add(new CodePrimitiveExpression(cppSignature));

        // retrieve the return type
        CodeTypeReference returnType;
        if ((method->flags & (uint) Smoke.MethodFlags.mf_dtor) > 0)
        {
            // destructor
            returnType = new CodeTypeReference(typeof(void));
        }
        else if (cmm.Name.StartsWith("explicit operator "))
        {
            // strip 'explicit operator' from the name to get the return type
            returnType = new CodeTypeReference(cmm.Name.Substring(18));
        }
        else
        {
            returnType = cmm.ReturnType;
        }

        // add the return type
        invoke.Parameters.Add(new CodeTypeOfExpression(returnType));
        invoke.Parameters.Add(new CodePrimitiveExpression(generateInvokeForRefParams));
        invoke.Parameters.Add(new CodeVariableReferenceExpression("smokeArgs"));

        ProcessEqualityOperators(cmm);

        CodeArrayCreateExpression argsInitializer = new CodeArrayCreateExpression(typeof(object[]));

        // add the parameters
        foreach (CodeParameterDeclarationExpression param in cmm.Parameters)
        {
            argsInitializer.Initializers.Add(new CodeTypeOfExpression(param.Type));
            string argReference = param.Name;
            int indexOfSpace = argReference.IndexOf(' ');
            if (indexOfSpace > 0)
            {
                argReference = argReference.Substring(0, indexOfSpace);
            }
            argsInitializer.Initializers.Add(new CodeArgumentReferenceExpression(argReference));
        }

        CodeStatement argsStatement = new CodeVariableDeclarationStatement(typeof(object[]), "smokeArgs", argsInitializer);
        cmm.Statements.Add(argsStatement);

        // we have to call "CreateProxy()" in constructors
        if (cmm is CodeConstructor)
        {
            cmm.Statements.Add(
                new CodeExpressionStatement(new CodeMethodInvokeExpression(new CodeThisReferenceExpression(), "CreateProxy")));
        }

        // add the method call statement
        CodeStatement statement;

        if (!generateInvokeForRefParams)
        {
            if (method->ret > 0 && (method->flags & (uint) Smoke.MethodFlags.mf_ctor) == 0)
            {
                statement = new CodeMethodReturnStatement(new CodeCastExpression(returnType, invoke));
            }
            else
            {
                statement = new CodeExpressionStatement(invoke);
            }
            cmm.Statements.Add(statement);
        }
        else
        {
            if (method->ret > 0 && (method->flags & (uint) Smoke.MethodFlags.mf_ctor) == 0)
            {
                statement = new CodeVariableDeclarationStatement(returnType, "smokeRetval",
                                                                 new CodeCastExpression(returnType, invoke));
                cmm.Statements.Add(statement);
            }
            else
            {
                statement = new CodeExpressionStatement(invoke);
                cmm.Statements.Add(statement);
            }

            int i = 0;
            foreach (CodeParameterDeclarationExpression param in cmm.Parameters)
            {
                ++i;
                if (param.Direction != FieldDirection.Ref)
                {
                    continue;
                }
                cmm.Statements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression(param.Name),
                                                           new CodeCastExpression(param.Type.BaseType,
                                                                                  new CodeArrayIndexerExpression(
                                                                                  	new CodeVariableReferenceExpression("smokeArgs"),
                                                                                  	new CodePrimitiveExpression(i*2 - 1)
                                                                                  	)
                                                           	)
                                   	));
            }

            if (method->ret > 0 && (method->flags & (uint) Smoke.MethodFlags.mf_ctor) == 0)
            {
                cmm.Statements.Add(new CodeMethodReturnStatement(new CodeVariableReferenceExpression("smokeRetval")));
            }
        }
        containingType.Members.Add(cmm);

        if ((method->flags & (uint) Smoke.MethodFlags.mf_dtor) != 0)
        {
            containingType.BaseTypes.Add(new CodeTypeReference(typeof(IDisposable)));
            CodeMemberMethod dispose = new CodeMemberMethod();
            dispose.Name = "Dispose";
            dispose.Attributes = MemberAttributes.Public | MemberAttributes.New | MemberAttributes.Final;
            dispose.Statements.AddRange(cmm.Statements);
            dispose.Statements.Add(new CodeExpressionStatement(new CodeMethodInvokeExpression(
                                                               	new CodeTypeReferenceExpression("GC"), "SuppressFinalize",
                                                               	new CodeThisReferenceExpression()
                                                               	)));
            containingType.Members.Add(dispose);
        }
        return cmm;
    }
Ejemplo n.º 59
0
    public CodeMemberMethod GenerateBasicMethodDefinition(Smoke* smoke, Smoke.Method* method, string cppSignature,
	                                                      CodeTypeReference iface)
    {
        // do we actually want that method?
        string className = ByteArrayManager.GetString(smokeClass->className);
        string completeSignature = className + "::" + cppSignature;
        if (translator.ExcludedMethods.Any(regex => regex.IsMatch(completeSignature)))
        {
            return null;
        }

        CodeParameterDeclarationExpressionCollection args = new CodeParameterDeclarationExpressionCollection();
        int count = 1;
        bool isRef;

        // make instance operators static and bring the arguments in the correct order
        string methName = ByteArrayManager.GetString(smoke->methodNames[method->name]);
        bool isOperator = false;
        string explicitConversionType = null;
        if (methName.StartsWith("operator"))
        {
            string op = methName.Substring(8);
            if (unsupportedOperators.Contains(op))
            {
                // not supported
                Debug.Print("  |--Won't wrap method {0}::{1}", className, cppSignature);
                return null;
            }

            if (op == "<<")
            {
                methName = "Write";
            }
            else if (op == ">>")
            {
                methName = "Read";
            }

            // binary/unary operator
            if (binaryOperators.Contains(op) || unaryOperators.Contains(op))
            {
                // instance operator
                if (smoke->classes[method->classId].size > 0)
                {
                    if (op == "*" && method->numArgs == 0 || (op == "++" || op == "--") && method->numArgs == 1)
                    {
                        // dereference operator and postfix in-/decrement operator are not supported
                        Debug.Print("  |--Won't wrap method {0}::{1}", className, cppSignature);
                        return null;
                    }

                    try
                    {
                        CodeParameterDeclarationExpression exp =
                            new CodeParameterDeclarationExpression(translator.CppToCSharp(className, type, out isRef), "one");
                        args.Add(exp);
                    }
                    catch (NotSupportedException)
                    {
                        Debug.Print("  |--Won't wrap method {0}::{1}", className, cppSignature);
                        return null;
                    }
                }
                else
                {
                    // global operator
                    if (op == "*" && method->numArgs == 0 || (op == "++" || op == "--") && method->numArgs == 2)
                    {
                        // dereference operator and postfix in-/decrement operator are not supported
                        Debug.Print("  |--Won't wrap method {0}::{1}", className, cppSignature);
                        return null;
                    }
                }
                isOperator = true;
            }
            else if (op[0] == ' ')
            {
                // conversion operator
                explicitConversionType = op.Substring(1);
                if (explicitConversionType.Contains("QVariant"))
                {
                    return null;
                }
                try
                {
                    explicitConversionType = translator.CppToCSharp(explicitConversionType, type, out isRef).GetStringRepresentation();
                    if (smoke->classes[method->classId].size > 0)
                    {
                        CodeParameterDeclarationExpression exp =
                            new CodeParameterDeclarationExpression(translator.CppToCSharp(className, type, out isRef), "value");
                        args.Add(exp);
                    }
                }
                catch (NotSupportedException)
                {
                    Debug.Print("  |--Won't wrap method {0}::{1}", className, cppSignature);
                    return null;
                }
                isOperator = true;
            }
        }

        // translate return type
        CodeTypeReference returnType;
        try
        {
            returnType = translator.CppToCSharp(smoke->types + method->ret, type, out isRef);
        }
        catch (NotSupportedException)
        {
            Debug.Print("  |--Won't wrap method {0}::{1}", className, cppSignature);
            return null;
        }

        CodeMemberMethod cmm;
        if ((method->flags & (uint) Smoke.MethodFlags.mf_ctor) > 0)
        {
            cmm = new CodeConstructor();
            cmm.Attributes = 0; // initialize to 0 so we can do |=
            ((CodeConstructor) cmm).ChainedConstructorArgs.Add(new CodeSnippetExpression("(System.Type) null"));
        }
        else
        {
            cmm = new CodeMemberMethod();
            cmm.Attributes = 0; // initialize to 0 so we can do |=

            string csName = methName;
            if (!isOperator && methName != "finalize")
            {
                // capitalize the first letter
                StringBuilder builder = new StringBuilder(csName);
                builder[0] = char.ToUpper(builder[0]);
                string tmp = builder.ToString();

                // If the new name clashes with a name of a type declaration, keep the lower-case name.
                var typesWithSameName = from member in data.GetAccessibleMembers(smokeClass)
                                        where member.Type == MemberTypes.NestedType && member.Name == tmp
                                        select member;

                var propertiesWithSameName = (from member in data.GetAccessibleMembers(smokeClass)
                                              where member.Type == MemberTypes.Property && member.Name == tmp
                                              select member).ToList();

                if (iface != null && propertiesWithSameName.Count() == 1 &&
                    (method->flags & (uint) Smoke.MethodFlags.mf_protected) == 0 &&
                    (method->flags & (uint) Smoke.MethodFlags.mf_virtual) == 0)
                {
                    cmm.PrivateImplementationType = iface;
                    csName = tmp;
                }
                else
                {
                    if (propertiesWithSameName.Any())
                    {
                        if ((method->flags & (uint) Smoke.MethodFlags.mf_virtual) == 0)
                        {
                            Debug.Print(
                                "  |--Conflicting names: method/(type or property): {0} in class {1} - keeping original method name", tmp,
                                className);
                        }
                        else
                        {
                            csName = tmp;
                        }
                    }
                    else if (typesWithSameName.Any())
                    {
                        Debug.Print("  |--Conflicting names: method/classname: {0} in class {1} - keeping original method name", tmp,
                                    className);
                    }
                    else
                    {
                        csName = tmp;
                    }
                }
            }

            if (explicitConversionType != null)
            {
                cmm.Name = "explicit operator " + explicitConversionType;
                cmm.ReturnType = new CodeTypeReference(" ");
            }
            else
            {
                cmm.Name = csName;
                cmm.ReturnType = returnType;
            }
        }

        // translate arguments
        string[] methodArgs = this.GetMethodArgs(smoke, method);
        for (short* typeIndex = smoke->argumentList + method->args; *typeIndex > 0; typeIndex++)
        {
            try
            {
                args.Add(this.GetArgument(smoke, typeIndex, methodArgs, args, ref count));
            }
            catch (NotSupportedException)
            {
                Debug.Print("  |--Won't wrap method {0}::{1}", className, cppSignature);
                return null;
            }
        }
        this.RemovePreviousOverload(args, cmm.Name);

        // for destructors we already have this stuff set
        if ((method->flags & (uint) Smoke.MethodFlags.mf_dtor) == 0)
        {
            // set access
            if ((method->flags & (uint) Smoke.MethodFlags.mf_protected) > 0)
            {
                cmm.Attributes |= MemberAttributes.Family;
            }
            else
            {
                cmm.Attributes |= MemberAttributes.Public;
            }

            if (isOperator)
            {
                cmm.Attributes |= MemberAttributes.Final | MemberAttributes.Static;
            }
            else if (cmm.Name == "ToString" && args.Count == 0 && cmm.ReturnType.BaseType == "System.String")
            {
                cmm.Attributes = MemberAttributes.Public | MemberAttributes.Override;
            }
            else
            {
                if ((method->flags & (uint) Smoke.MethodFlags.mf_static) > 0)
                {
                    cmm.Attributes |= MemberAttributes.Static;
                }
                else
                {
                    // virtual/final
                    MemberAttributes access;
                    bool foundInInterface;
                    bool isOverride = MethodOverrides(smoke, method, out access, out foundInInterface);

                    // methods that have to be implemented from interfaces can't override anything
                    if (iface == null && isOverride)
                    {
                        cmm.Attributes = access | MemberAttributes.Override;
                    }
                    else if (foundInInterface)
                    {
                        cmm.Attributes = access;
                    }

                    if ((method->flags & (uint) Smoke.MethodFlags.mf_purevirtual) > 0)
                    {
                        if (!m_internalImplementation)
                        {
                            cmm.Attributes = (cmm.Attributes & ~MemberAttributes.ScopeMask) | MemberAttributes.Abstract;

                            // The code generator doesn't like MemberAttributes.Abstract | MemberAttributes.Override being set.
                            if (isOverride && !type.IsInterface)
                            {
                                cmm.ReturnType.BaseType = "override " + cmm.ReturnType.BaseType == "System.Void"
                                                          	? "void"
                                                          	: cmm.ReturnType.BaseType;
                            }
                        }
                        else
                        {
                            cmm.Attributes |= MemberAttributes.Override;
                        }
                    }

                    if ((method->flags & (uint) Smoke.MethodFlags.mf_virtual) == 0 &&
                        (method->flags & (uint) Smoke.MethodFlags.mf_purevirtual) == 0 &&
                        !isOverride)
                    {
                        cmm.Attributes |= MemberAttributes.Final | MemberAttributes.New;
                    }
                }
            }
        }
        else
        {
            // hack, so we don't have to use CodeSnippetTypeMember to generator the destructor
            cmm.ReturnType = new CodeTypeReference(" ");
        }

        // add the parameters
        foreach (CodeParameterDeclarationExpression exp in args)
        {
            cmm.Parameters.Add(exp);
        }
        this.DocumentMemberFromInterface(iface, cmm);
        this.DistributeMethod(cmm);
        if (PostMethodDefinitionHooks != null)
        {
            PostMethodDefinitionHooks(smoke, method, cmm, this.type);
        }
        this.CorrectParameterNames(cmm);
        return cmm;
    }
Ejemplo n.º 60
0
 private void SetPropertyModifiers(Smoke.Method* method, CodeTypeMember cmp)
 {
     MemberAttributes access = 0;
     bool foundInInterface;
     bool? isOverride = null;
     if ((cmp.Attributes & MemberAttributes.Override) == MemberAttributes.Override)
     {
         isOverride = MethodsGenerator.MethodOverrides(this.data.Smoke, method, out access, out foundInInterface);
         if (!isOverride.Value)
         {
             cmp.Attributes &= ~MemberAttributes.Override;
         }
     }
     if ((method->flags & (uint) Smoke.MethodFlags.mf_virtual) == (int) Smoke.MethodFlags.mf_virtual)
     {
         if (!isOverride.HasValue)
         {
             isOverride = MethodsGenerator.MethodOverrides(this.data.Smoke, method, out access, out foundInInterface);
         }
         if (isOverride.Value)
         {
             cmp.Attributes = access | MemberAttributes.Override;
         }
         else
         {
             cmp.Attributes &= ~MemberAttributes.Final;
         }
     }
     else
     {
         if ((method->flags & (uint) Smoke.MethodFlags.mf_purevirtual) == (int) Smoke.MethodFlags.mf_purevirtual)
         {
             cmp.Attributes |= MemberAttributes.Abstract;
         }
     }
 }