static void Main(string[] args)
        {
            NetworkCredential credential = new NetworkCredential("username", "password");
            Service           service    = new Service("https://myserver3/ews/Exchange.asmx", credential);

            try
            {
                ItemShape        itemShape  = new ItemShape(ShapeType.Id);
                FindItemResponse inboxItems = service.FindItem(StandardFolder.Inbox, itemShape);
                for (int i = 0; i < inboxItems.Items.Count; i++)
                {
                    Independentsoft.Msg.Message msgFile = service.GetMessageFile(inboxItems.Items[i].ItemId);
                    msgFile.Save("c:\\test\\message" + i + ".msg", true);
                }
            }
            catch (ServiceRequestException ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                Console.WriteLine("Error: " + ex.XmlMessage);
                Console.Read();
            }
            catch (WebException ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                Console.Read();
            }
        }
Example #2
0
    public override void Load(XmlNode xnode)
    {
        type = LocalType.Get(xnode.Name);

        texture = new Texture();
        name = MyXml.GetString(xnode, "name");
        variations = MyXml.GetInt(xnode, "variations", 1);
        maxHP = MyXml.GetInt(xnode, "hp");
        damage = MyXml.GetInt(xnode, "damage");
        attack = MyXml.GetInt(xnode, "attack");
        defence = MyXml.GetInt(xnode, "defence");
        armor = MyXml.GetInt(xnode, "armor");
        movementTime = MyXml.GetFloat(xnode, "movementTime");
        attackTime = MyXml.GetFloat(xnode, "attackTime");
        isWalkable = MyXml.GetBool(xnode, "walkable");
        isFlat = MyXml.GetBool(xnode, "flat");

        if (xnode.Name == "Thing") isWalkable = true;

        string s = MyXml.GetString(xnode, "type");
        if (s != "") creatureType = CreatureType.Get(s);

        s = MyXml.GetString(xnode, "corpse");
        if (creatureType != null && (creatureType.name == "Animal" || creatureType.name == "Sentient")) s = "Blood";
        if (s != "") corpse = Get(s);

        s = MyXml.GetString(xnode, "onDeath");
        if (creatureType != null && creatureType.name == "Animal") s = "Large Chunk of Meat";
        if (s != "") onDeath = ItemShape.Get(s);

        for (xnode = xnode.FirstChild; xnode != null; xnode = xnode.NextSibling)
            abilities.Add(BigBase.Instance.abilities.Get(MyXml.GetString(xnode, "name")));
    }
        static MessageItemRowNotificationHandler()
        {
            Shape[] shapes = new Shape[]
            {
                ItemShape.CreateShape(),
                    MessageShape.CreateShape(),
                    TaskShape.CreateShape()
            };
            ResponseShape responseShape = WellKnownShapes.ResponseShapes[WellKnownShapeName.MailListItem];

            MessageItemRowNotificationHandler.defaultSubscriptionProperties           = RowNotificationHandler.GetPropertyDefinitionsForResponseShape(shapes, responseShape, new PropertyDefinition[0]);
            MessageItemRowNotificationHandler.normalizedSubjectPropertyDefinition     = WellKnownProperties.NormalizedSubject.ToPropertyDefinition();
            MessageItemRowNotificationHandler.lastVerbExecutedPropertyDefinition      = WellKnownProperties.LastVerbExecuted.ToPropertyDefinition();
            MessageItemRowNotificationHandler.lastVerbExecutionTimePropertyDefinition = WellKnownProperties.LastVerbExecutionTime.ToPropertyDefinition();
        }
Example #4
0
    bool AllItensFromShape(ItemShape shape)
    {
        if (PowerUpItemList.Count == 0)
        {
            return(false);
        }
        bool allItensAreEqual = true;

        foreach (GameObject item in PowerUpItemList)
        {
            if (!item.GetComponent <itemController> ().m_itemShape.Equals(shape))
            {
                allItensAreEqual = false;
            }
        }
        return(allItensAreEqual);
    }
        private static PropertyDefinition[] GetSubscriptionProperties(IFeaturesManager featuresManager)
        {
            string            text = WellKnownShapeName.MailListItem.ToString();
            ItemResponseShape itemResponseShape = new ItemResponseShape();

            itemResponseShape.BaseShape = ShapeEnum.IdOnly;
            ItemResponseShape responseShape = Global.ResponseShapeResolver.GetResponseShape <ItemResponseShape>(text, itemResponseShape, featuresManager);

            if (responseShape == null)
            {
                ExTraceGlobals.NotificationsCallTracer.TraceError <string>((long)text.GetHashCode(), "[MessageItemRowNotificationHandler.GetSubscriptionProperties] Unable to resolve shapeName: {0} with features manager", text);
                return(MessageItemRowNotificationHandler.defaultSubscriptionProperties);
            }
            Shape[] shapes = new Shape[]
            {
                ItemShape.CreateShape(),
                    MessageShape.CreateShape(),
                    TaskShape.CreateShape()
            };
            return(RowNotificationHandler.GetPropertyDefinitionsForResponseShape(shapes, responseShape, new PropertyDefinition[0]));
        }
Example #6
0
        private IEnumerable <Point> GetLine(Point linePos, ItemShape shape)
        {
            var pos = new List <Point>();

            if (shape == ItemShape.HLine)
            {
                for (int x = 0; x < BoardWidth; x++)
                {
                    pos.Add(new Point(x, linePos.Y));
                }
            }
            else if (shape == ItemShape.VLine)
            {
                for (int y = 0; y < BoardHeight; y++)
                {
                    pos.Add(new Point(linePos.X, y));
                }
            }

            return(pos);
        }
Example #7
0
        private ItemPos CalcBonusSpawn(Point src, Point dest, Point[] line)
        {
            if (line.Length == 5)
            {
                Point targetPos = TargetBonusPos(src, dest, line);

                int color = Items[targetPos.X, targetPos.Y].Color;
                return(new ItemPos(targetPos, new Item(color, ItemShape.Bomb)));
            }

            if (line.Length == 4)
            {
                Point targetPos = TargetBonusPos(src, dest, line);

                int       color    = Items[targetPos.X, targetPos.Y].Color;
                bool      vertical = (line[0].X == line[1].X);
                ItemShape shape    = vertical ? ItemShape.VLine : ItemShape.HLine;

                return(new ItemPos(targetPos, new Item(color, shape)));
            }

            return(null);
        }
Example #8
0
 public bool Contains(ItemShape shape)
 {
     return Items.Where(i => i.data == shape).Count() > 0;
 }
Example #9
0
 public void Add(ItemShape shape, int number)
 {
     for (int i = 0; i < number; i++) Add(shape);
 }
Example #10
0
    public void Add(ItemShape shape)
    {
        if (shape.isStackable)
        {
            var query = from i in data where i.Value != null && i.Value.data.name == shape.name select i.Key;
            if (query.Count() > 0)
            {
                data[query.First()].numberOfStacks++;
                return;
            }
        }

        data[(from pair in data where pair.Value == null select pair.Key).First()] = new Item(shape);
    }
Example #11
0
        public static GameObject Create(ItemShape shape, ItemMaterial itemMaterial, float width, float height)
        {
            Mesh       objMesh, objEffectMesh;
            ItemEffect effect;

            if (itemMaterial == ItemMaterial.Ice)
            {
                effect = ItemEffect.Ice;
            }
            else
            {
                effect = ItemEffect.Solid;
            }

            switch (shape)
            {
            case ItemShape.Circle:
                objMesh       = createCircleMesh(width / 2, itemMaterial);
                objEffectMesh = createCircleEffectMesh(width / 2, effect);
                break;

            case ItemShape.Rectangle:
                objMesh       = createRectangleMesh(width, height, itemMaterial);
                objEffectMesh = createRectangleEffectMesh(width, height, effect);
                break;

            case ItemShape.Triangle:
                objMesh       = createTriangleMesh(width, height, itemMaterial);
                objEffectMesh = createTriangleEffectMesh(width, height, effect);
                break;

            default:
                objMesh       = createTriangleMesh(width, height, itemMaterial);
                objEffectMesh = createTriangleEffectMesh(width, height, effect);
                break;
            }

            //create the object
            GameObject obj = new GameObject();

            obj.AddComponent <MeshRenderer>();
            obj.AddComponent <MeshFilter>().mesh   = objMesh;
            obj.GetComponent <Renderer>().material = itemMaterials[(int)itemMaterial];

            //create the object effect
            GameObject objEffect = new GameObject();

            objEffect.AddComponent <MeshRenderer>();
            objEffect.AddComponent <MeshFilter>().mesh   = objEffectMesh;
            objEffect.GetComponent <Renderer>().material = atlas1Material;

            //setup the object and the object effect in the scene
            obj.name       = "Item: " + shape + " " + frontLayerIndex;
            objEffect.name = shape + " Effect " + frontLayerIndex;

            objEffect.transform.parent = obj.transform;
            obj.layer = 0;

            //bring the effect in front of the object, bring the object to front
            Vector3 pos = objEffect.transform.localPosition;

            objEffect.transform.localPosition = new Vector3(pos.x, pos.y, -layerSpacing / 2);
            BringToFront(obj);

            //add the object properties
            ItemProperties itemProperties = obj.AddComponent <ItemProperties>();

            itemProperties.shape    = shape;
            itemProperties.material = itemMaterial;
            itemProperties.width    = width;
            itemProperties.height   = height;

            setPhysics(obj);

            return(obj);
        }
Example #12
0
 public Item(int color, ItemShape shape, int score = 20)
 {
     Color = color;
     Shape = shape;
     Score = score;
 }
Example #13
0
File: Item.cs Project: mxgmn/GENW
 public Item(ItemShape shape)
     : this(shape, 1)
 {
 }
Example #14
0
File: Item.cs Project: mxgmn/GENW
 public Item(ItemShape shape, int n)
 {
     data = shape;
     numberOfStacks = n;
     cooldown = 0;
 }
Example #15
0
        public IAction[] CheatBonus(ItemShape bonus)
        {
            var rnd = new Random();

            bool vertical;

            switch (bonus)
            {
            case ItemShape.HLine:
                vertical = false;
                break;

            case ItemShape.VLine:
                vertical = true;
                break;

            default:
                vertical = rnd.Next(2) == 0;
                break;
            }
            ItemShape shape = rnd.Next(2) == 0
                ? ItemShape.Ball
                : ItemShape.Cube;
            int color = rnd.Next(shape == ItemShape.Ball ? 3 : 2) + 1;
            int x     = vertical
                ? rnd.Next(BoardWidth)
                : rnd.Next(BoardWidth - 3);
            int y = vertical
                ? rnd.Next(BoardHeight - 3)
                : rnd.Next(BoardHeight);

            Point[] place = PointsFrom(x, y, vertical, 3);
            // Needs to avoid NullReferenceException while destroy old bonuses
            var            destroyedBy = new Dictionary <ItemPos, ItemPos[]>();
            List <ItemPos> oldBonuses  = place
                                         .Select(p => new ItemPos(p, Items[p.X, p.Y]))
                                         .Where(ip => ip.Item.IsBombShape || ip.Item.IsLineShape)
                                         .ToList();

            oldBonuses.ForEach(b => destroyedBy[b] = new ItemPos[0]);
            //
            var dAct = new DestroyAction
            {
                MatchDestroyedPos = place
                                    .Select(p => new ItemPos(p, Items[p.X, p.Y]))
                                    .ToArray(),
                SpawnBonuses = new ItemPos[0],
                DestroyedBy  = destroyedBy,
            };

            Items[place[0].X, place[0].Y] = new Item(color, shape);
            Items[place[1].X, place[1].Y] = new Item(color, bonus);
            Items[place[2].X, place[2].Y] = new Item(color, shape);

            var spAct = new SpawnAction
            {
                Positions = place
                            .Select(p => new ItemPos(p, Items[p.X, p.Y]))
                            .ToArray(),
            };

            return(new IAction[] { dAct, spAct });
        }
Example #16
0
 public void Remove(ItemShape shape)
 {
     Remove((from pair in data where pair.Value.data == shape select pair.Key).First());
 }
Example #17
0
 private bool HasRoomFor(ItemShape itemShape)
 {
     int totalHands = (from i in Items select i.data.hands).Sum() + itemShape.hands;
     bool armorAlreadyEquipped = (from i in Items where i.data.isArmor select i).Count() > 0 && itemShape.isArmor;
     return totalHands <= 2 && !armorAlreadyEquipped;
 }
Example #18
0
 public ItemAbility(Ability a, ItemShape s)
 {
     itemShape = s;
     name = a.name;
     targetType = a.targetType;
     range = a.range;
     cost = a.cost;
     castTime = a.castTime;
     cooldownTime = a.cooldownTime;
 }