public RandomStatic(XmlElement xmlInfo)
 {
     try
     {
         try
         {
             this.m_TileID = XmlConvert.ToInt16(xmlInfo.GetAttribute("TileID"));
         }
         catch (Exception ex)
         {
             ProjectData.SetProjectError(ex);
             this.m_TileID = ShortType.FromString("&H" + xmlInfo.GetAttribute("TileID"));
             ProjectData.ClearProjectError();
         }
         this.m_XMod   = XmlConvert.ToInt16(xmlInfo.GetAttribute("X"));
         this.m_YMod   = XmlConvert.ToInt16(xmlInfo.GetAttribute("Y"));
         this.m_ZMod   = XmlConvert.ToInt16(xmlInfo.GetAttribute("Z"));
         this.m_HueMod = XmlConvert.ToInt16(xmlInfo.GetAttribute("Hue"));
     }
     catch (Exception ex)
     {
         ProjectData.SetProjectError(ex);
         int num = (int)Interaction.MsgBox((object)string.Format("Error\r\n{0}", (object)xmlInfo.OuterXml), MsgBoxStyle.OKOnly, (object)null);
         ProjectData.ClearProjectError();
     }
 }
Esempio n. 2
0
        private void ToolBar1_ButtonClick(object sender, EventArgs e)
        {
            ToolStripButton button = sender as ToolStripButton;

            if (button == null)
            {
                return;
            }

            RandomStaticCollection selectedItem = (RandomStaticCollection)this.ListBox1.SelectedItem;

            if (selectedItem != null)
            {
                object tag = button.Tag;
                if (ObjectType.ObjTst(tag, "Add", false) == 0)
                {
                    selectedItem.Add(new RandomStatic(ShortType.FromString(this.TileID.Text), Convert.ToInt16(this.Xaxis.Value), Convert.ToInt16(this.Yaxis.Value), Convert.ToInt16(this.Zaxis.Value), ShortType.FromString(this.HueID.Text)));
                    selectedItem.Display(this.ListBox2);
                    this.Panel3.Refresh();
                }
                else if (ObjectType.ObjTst(tag, "Delete", false) == 0)
                {
                    selectedItem.Remove((RandomStatic)this.ListBox2.SelectedItem);
                    selectedItem.Display(this.ListBox2);
                    this.Panel3.Refresh();
                }
            }
        }
Esempio n. 3
0
 public RandomStatic(XmlElement xmlInfo)
 {
     try
     {
         try
         {
             this.m_TileID = (ushort)XmlConvert.ToInt16(xmlInfo.GetAttribute("TileID"));
         }
         catch (Exception expr_22)
         {
             ProjectData.SetProjectError(expr_22);
             this.m_TileID = (ushort)ShortType.FromString("&H" + xmlInfo.GetAttribute("TileID"));
             ProjectData.ClearProjectError();
         }
         this.m_XMod   = (ushort)XmlConvert.ToInt16(xmlInfo.GetAttribute("X"));
         this.m_YMod   = (ushort)XmlConvert.ToInt16(xmlInfo.GetAttribute("Y"));
         this.m_ZMod   = (ushort)XmlConvert.ToInt16(xmlInfo.GetAttribute("Z"));
         this.m_HueMod = (ushort)XmlConvert.ToInt16(xmlInfo.GetAttribute("Hue"));
     }
     catch (Exception expr_AC)
     {
         ProjectData.SetProjectError(expr_AC);
         Interaction.MsgBox(string.Format("Error\r\n{0}", xmlInfo.OuterXml), MsgBoxStyle.OkOnly, null);
         ProjectData.ClearProjectError();
     }
 }
Esempio n. 4
0
    private List <ShortItem> LoadShortcutKeyFromFile(string savePath, ShortType sType)
    {
        if (!File.Exists(savePath))
        {
            return(null);
        }
        List <ShortItem> itemList = new List <ShortItem> ();
        XmlDocument      xml      = new XmlDocument();

        xml.Load(savePath);
        XmlNodeList xnlList = xml.SelectSingleNode("KeyData").ChildNodes;
        string      tn = "", sn = "", blongto = "";

        for (int i = 0; i < xnlList.Count; i++)
        {
            XmlElement xel = xnlList [i] as XmlElement;
            if (xel.GetAttribute("id") == (i + 1).ToString())
            {
                ShortItem itemRes = new ShortItem();
                foreach (XmlNode item in xel.ChildNodes)
                {
                    if (item.Name.Equals("Path"))
                    {
                        tn = item.InnerText;
                    }
                    if (item.Name.Equals("ShortKeyName"))
                    {
                        sn = item.InnerText;
                    }
                    if (item.Name.Equals("BlongTo"))
                    {
                        blongto = item.InnerText;
                    }
                }

                if (blongto.Equals(sType.ToString()))
                {
                    itemRes.SetData(tn, sn, sType);
                    if (!string.IsNullOrEmpty(sn) && sn.Length >= 2)
                    {
                        if (sn.Contains(ShortKeyCode.Command))
                        {
                            itemRes.AIDCommand = true;
                        }
                        if (sn.Contains(ShortKeyCode.Shift))
                        {
                            itemRes.AIDShift = true;
                        }
                        if (sn.Contains(ShortKeyCode.Control))
                        {
                            itemRes.AIDCtrl = true;
                        }
                    }
                    itemList.Add(itemRes);
                }
            }
        }
        return(itemList);
    }
Esempio n. 5
0
        /// <summary>
        /// Returns the scalar type for the strings, decimals, uris, etc...
        /// </summary>
        /// <param name="type"></param>
        /// <param name="scalarType"></param>
        /// <returns></returns>
        public static bool TryGetBuiltInScalarType(
            Type type,
            [NotNullWhen(true)] out ScalarType?scalarType
            )
        {
            if (type == typeof(string))
            {
                scalarType = new StringType();
            }
            else if (type == typeof(decimal))
            {
                scalarType = new DecimalType();
            }
            else if (type == typeof(int))
            {
                scalarType = new IntType();
            }
            else if (type == typeof(bool))
            {
                scalarType = new BooleanType();
            }
            else if (type == typeof(float))
            {
                scalarType = new FloatType();
            }
            else if (type == typeof(Guid))
            {
                scalarType = new UuidType();
            }
            else if (type == typeof(DateTime))
            {
                scalarType = new DateTimeType();
            }
            else if (type == typeof(byte))
            {
                scalarType = new ByteType();
            }
            else if (type == typeof(Uri))
            {
                scalarType = new UrlType();
            }
            else if (type == typeof(long))
            {
                scalarType = new LongType();
            }
            else if (type == typeof(short))
            {
                scalarType = new ShortType();
            }
            else
            {
                scalarType = null;
            }

            return(scalarType is object);
        }
Esempio n. 6
0
 public void SetData(string path, string shortkey, ShortType shortType = ShortType.Extension)
 {
     m_Path     = path;
     m_ShortKey = shortkey;
     m_BlongTo  = shortType;
     if (!string.IsNullOrEmpty(shortkey))
     {
         UpdateKeySelectIndex(shortkey[shortkey.Length - 1].ToString());
     }
 }
Esempio n. 7
0
 private void ShowItemList(ShortType sType, bool isSystem = false)
 {
     //show
     if (m_ShortKeyDict[sType] != null && m_ShortKeyDict[sType].Count > 0)
     {
         for (int i = 0; i < m_ShortKeyDict[sType].Count; i++)
         {
             GUILayout.Space(5);
             ShowItem(m_ShortKeyDict[sType][i], m_ShortKeyDict[sType], isSystem);
             GUILayout.Space(5);
         }
     }
 }
Esempio n. 8
0
 public MapTile(XmlElement xmlInfo)
 {
     try
     {
         this.m_TileID = XmlConvert.ToInt16(xmlInfo.GetAttribute("TileID"));
     }
     catch (Exception expr_21)
     {
         ProjectData.SetProjectError(expr_21);
         this.m_TileID = ShortType.FromString("&H" + xmlInfo.GetAttribute("TileID"));
         ProjectData.ClearProjectError();
     }
     this.m_AltID = XmlConvert.ToInt16(xmlInfo.GetAttribute("AltIDMod"));
 }
Esempio n. 9
0
 void OnGUI()
 {
     //绘制标题
     GUILayout.Space(10);
     GUI.skin.label.fontSize  = 24;
     GUI.skin.label.alignment = TextAnchor.MiddleCenter;
     GUILayout.Label("Shortcut Style");
     GUI.skin.label.fontSize = 12;
     GUILayout.Space(10);
     isOldFirst = EditorGUILayout.Toggle("Old Version First", isOldFirst);
     //Show
     ShowList();
     //button
     EditorGUILayout.BeginHorizontal();
     m_SType = (ShortType)EditorGUILayout.EnumPopup(m_SType);
     if (GUILayout.Button("add"))
     {
         ski = new ShortItem("Editor1/Editor2/Editor3", "", m_SType);
         Debug.LogFormat("add {0} {1} {2} {3} ", ski.Path, ski.ShortKey, ski.MenuItemName, ski.FuncName);
         if (m_ShortKeyDict[m_SType] == null)
         {
             m_ShortKeyDict[m_SType] = new List <ShortItem>();
         }
         m_ShortKeyDict[m_SType].Add(ski);
     }
     if (GUILayout.Button("save"))
     {
         mSkiList.Clear();
         mSkiList = new List <ShortItem>();
         foreach (ShortType st in m_ShortKeyDict.Keys)
         {
             if (st != ShortType.Extension)
             {
                 mSkiList.AddRange(m_ShortKeyDict[st]);
             }
         }
         SaveShortcutKey2File(ShortcutSystemSavePath, mSkiList);
         SaveShortcutKey2EditorCode(ShortcutSystemPath, mSkiList);
         //save to script
         SaveShortcutKey2File(ShortcutSavePath, m_ShortKeyDict[ShortType.Extension]);
         SaveShortcutKey2EditorCode(ShortcutPath, m_ShortKeyDict[ShortType.Extension]);
     }
     EditorGUILayout.EndHorizontal();
     GUILayout.Space(10);
 }
 private void BuscarCliente()
 {
     this.Cursor = Cursors.WaitCursor;
     Catalogo.cCliente cCliente = new Catalogo.cCliente(2, this._Cliente);
     if (((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader).Read())
     {
         this.lblNombre.Text  = StringType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[1]);
         this.lblCliente.Text = StringType.FromInteger(this._Cliente);
         ((ComboBase)this.cboZonaEconomica).PosicionaCombo((int)ShortType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[2]));
         ((ComboBase)this.cboRuta).PosicionaCombo((int)ShortType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[3]));
         ((TextBox)this.txtClientePortatil).Text = "";
         this.lblNombrePortatil.Text             = "";
         if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[4])))
         {
             ((TextBox)this.txtClientePortatil).Text = StringType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[4]);
             this.lblNombrePortatil.Text             = StringType.FromObject(((SqlDataReader)((Catalogo.ConsultaBase)cCliente).drReader)[5]);
         }
     }
     this.Cursor = Cursors.Default;
 }
        /*
         * private void StaticToolBar_ButtonClick(object sender, EventArgs e)
         * {
         *  ToolStripButton button = sender as ToolStripButton;
         *  if (button == null)
         *  {
         *      return;
         *  }
         *
         *  object tag = button.Tag;
         *  if (ObjectType.ObjTst(tag, (object)"Add", false) == 0)
         *  {
         *      if (StringType.StrCmp(this.Static_TileID.Text, string.Empty, false) == 0)
         *          return;
         *      this.iTransition.AddStaticTile(ShortType.FromString(this.Static_TileID.Text), Convert.ToInt16(this.Static_AltIDMod.Value));
         *      this.iTransition.GetStaticTiles.Display(this.StaticTileList);
         *  }
         *  else if (ObjectType.ObjTst(tag, (object)"Delete", false) == 0)
         *  {
         *      Transition.StaticTile iStaticTile = (Transition.StaticTile)this.StaticTileList.SelectedItem;
         *      if (iStaticTile == null)
         *          return;
         *      this.StaticImage.Image = (Image)null;
         *      this.iTransition.RemoveStaticTile(iStaticTile);
         *      this.iTransition.GetStaticTiles.Display(this.StaticTileList);
         *  }
         *  else if (ObjectType.ObjTst(tag, (object)"Select", false) == 0)
         *  {
         *      StaticZoom staticZoom = new StaticZoom();
         *      staticZoom.Tag = (object)this.StaticItems;
         *      staticZoom.Show();
         *  }
         * }
         */
        #endregion

        private void ToolBarButton14_Click(object sender, EventArgs e)
        {
            ToolStripButton button = sender as ToolStripButton;

            if (button == null)
            {
                return;
            }

            object tag = button.Tag;

            if (ObjectType.ObjTst(tag, (object)"Add", false) == 0)
            {
                if (StringType.StrCmp(this.Static_TileID.Text, string.Empty, false) == 0)
                {
                    return;
                }
                this.iTransition.AddStaticTile(ShortType.FromString(this.Static_TileID.Text), Convert.ToInt16(this.Static_AltIDMod.Value));
                this.iTransition.GetStaticTiles.Display(this.StaticTileList);
            }
        }
Esempio n. 12
0
        public static String Oct(Object Number)
        {
            if (Number == null)
            {
                throw new ArgumentNullException("Number");
            }
            switch (ObjectType.GetTypeCode(Number))
            {
            case TypeCode.Byte:
                return(Oct(ByteType.FromObject(Number)));

            case TypeCode.Int16:
                return(Oct(ShortType.FromObject(Number)));

            case TypeCode.Boolean:
            case TypeCode.Char:
            case TypeCode.SByte:
            case TypeCode.UInt16:
            case TypeCode.Int32:
                return(Oct(IntegerType.FromObject(Number)));

            case TypeCode.Int64:
                return(Oct(LongType.FromObject(Number)));

            case TypeCode.UInt32:
            case TypeCode.UInt64:
            case TypeCode.Single:
            case TypeCode.Double:
            case TypeCode.Decimal:
                return(Oct(LongType.FromObject(Number)));

            case TypeCode.String:
                return(Oct(LongType.FromString
                               (StringType.FromObject(Number))));
            }
            throw new ArgumentException(S._("VB_InvalidNumber"), "Number");
        }
        public StaticTileCollection Get_StaticTile(TreeNodeCollection iTreeNode)
        {
            IEnumerator          enumerator           = null;
            StaticTileCollection staticTileCollection = new StaticTileCollection();

            staticTileCollection.Clear();
            try
            {
                enumerator = iTreeNode.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    TreeNode current = (TreeNode)enumerator.Current;
                    staticTileCollection.Add(new Transition.StaticTile(ShortType.FromObject(current.Tag), 0));
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    ((IDisposable)enumerator).Dispose();
                }
            }
            return(staticTileCollection);
        }
Esempio n. 14
0
 public void FromString_ThrowsOverflowException(string value)
 {
     Assert.Throws <OverflowException>(() => ShortType.FromString(value));
 }
Esempio n. 15
0
 public void FromString_ThrowsInvalidCastException(string value)
 {
     Assert.Throws <InvalidCastException>(() => ShortType.FromString(value));
 }
Esempio n. 16
0
 public void FromString(string value, short expected)
 {
     Assert.Equal(expected, ShortType.FromString(value));
 }
Esempio n. 17
0
 public void FromObject_ThrowsOverflowException(object value)
 {
     Assert.Throws <OverflowException>(() => ShortType.FromObject(value));
 }
Esempio n. 18
0
 public void FromObject_ThrowsInvalidCastException(object value)
 {
     Assert.Throws <InvalidCastException>(() => ShortType.FromObject(value));
 }
Esempio n. 19
0
 public void FromObject(object value, short expected)
 {
     Assert.Equal(expected, ShortType.FromObject(value));
 }
        private void Panel2_Paint(object sender, PaintEventArgs e)
        {
            string   name = null;
            string   str  = null;
            Point    point;
            Graphics graphics = e.Graphics;

            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(5, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(197, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 29));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 221));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 79));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(78, 102));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(124, 102));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(55, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(147, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(78, 148));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(124, 148));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 171));
            if (!this.ViewTiles)
            {
                if (this.iMapOuterTopLeft.GetNodeCount(true) > 0)
                {
                    Bitmap land = Art.GetLand(IntegerType.FromObject(this.iMapOuterTopLeft.Nodes[0].Tag));
                    point = new Point(101, 29);
                    graphics.DrawImage(land, point);
                }
                if (this.iMapInnerTopLeft.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap = Art.GetLand(IntegerType.FromObject(this.iMapInnerTopLeft.Nodes[0].Tag));
                    point = new Point(101, 79);
                    graphics.DrawImage(bitmap, point);
                }
                if (this.iMapInnerTop.GetNodeCount(true) > 0)
                {
                    Bitmap land1 = Art.GetLand(IntegerType.FromObject(this.iMapInnerTop.Nodes[0].Tag));
                    point = new Point(124, 102);
                    graphics.DrawImage(land1, point);
                }
                if (this.iMapInnerTopRight.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap1 = Art.GetLand(IntegerType.FromObject(this.iMapInnerTopRight.Nodes[0].Tag));
                    point = new Point(147, 125);
                    graphics.DrawImage(bitmap1, point);
                }
                if (this.iMapOuterTopRight.GetNodeCount(true) > 0)
                {
                    Bitmap land2 = Art.GetLand(IntegerType.FromObject(this.iMapOuterTopRight.Nodes[0].Tag));
                    point = new Point(197, 125);
                    graphics.DrawImage(land2, point);
                }
                if (this.iMapInnerLeft.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap2 = Art.GetLand(IntegerType.FromObject(this.iMapInnerLeft.Nodes[0].Tag));
                    point = new Point(78, 102);
                    graphics.DrawImage(bitmap2, point);
                }
                if (this.iMapInnerRight.GetNodeCount(true) > 0)
                {
                    Bitmap land3 = Art.GetLand(IntegerType.FromObject(this.iMapInnerRight.Nodes[0].Tag));
                    point = new Point(124, 148);
                    graphics.DrawImage(land3, point);
                }
                if (this.iMapOuterBottomLeft.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap3 = Art.GetLand(IntegerType.FromObject(this.iMapOuterBottomLeft.Nodes[0].Tag));
                    point = new Point(5, 125);
                    graphics.DrawImage(bitmap3, point);
                }
                if (this.iMapInnerBottomLeft.GetNodeCount(true) > 0)
                {
                    Bitmap land4 = Art.GetLand(IntegerType.FromObject(this.iMapInnerBottomLeft.Nodes[0].Tag));
                    point = new Point(55, 125);
                    graphics.DrawImage(land4, point);
                }
                if (this.iMapInnerBottom.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap4 = Art.GetLand(IntegerType.FromObject(this.iMapInnerBottom.Nodes[0].Tag));
                    point = new Point(78, 148);
                    graphics.DrawImage(bitmap4, point);
                }
                if (this.iMapInnerBottomRight.GetNodeCount(true) > 0)
                {
                    Bitmap land5 = Art.GetLand(IntegerType.FromObject(this.iMapInnerBottomRight.Nodes[0].Tag));
                    point = new Point(101, 171);
                    graphics.DrawImage(land5, point);
                }
                if (this.iMapOuterBottomRight.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap5 = Art.GetLand(IntegerType.FromObject(this.iMapOuterBottomRight.Nodes[0].Tag));
                    point = new Point(101, 221);
                    graphics.DrawImage(bitmap5, point);
                }
            }
            else
            {
                if (this.iStaticOuterTopLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticOuterTopLeft.Nodes[0].Tag), 101, 29, e);
                }
                if (this.iStaticInnerTopLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerTopLeft.Nodes[0].Tag), 101, 79, e);
                }
                if (this.iStaticInnerTop.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerTop.Nodes[0].Tag), 124, 102, e);
                }
                if (this.iStaticInnerTopRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerTopRight.Nodes[0].Tag), 147, 125, e);
                }
                if (this.iStaticOuterTopRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticOuterTopRight.Nodes[0].Tag), 197, 125, e);
                }
                if (this.iStaticInnerLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerLeft.Nodes[0].Tag), 78, 102, e);
                }
                if (this.iStaticInnerRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerRight.Nodes[0].Tag), 124, 148, e);
                }
                if (this.iStaticOuterBottomLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticOuterBottomLeft.Nodes[0].Tag), 5, 125, e);
                }
                if (this.iStaticInnerBottomLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerBottomLeft.Nodes[0].Tag), 55, 125, e);
                }
                if (this.iStaticInnerBottom.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerBottom.Nodes[0].Tag), 78, 148, e);
                }
                if (this.iStaticInnerBottomRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerBottomRight.Nodes[0].Tag), 101, 171, e);
                }
                if (this.iStaticOuterBottomRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticOuterBottomRight.Nodes[0].Tag), 101, 221, e);
                }
            }
            Pen pen = new Pen(Color.Red);

            if (this.iMapOuterTopLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 29));
            }
            if (this.iMapInnerTopLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 79));
            }
            if (this.iMapInnerTop.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(124, 102));
            }
            if (this.iMapInnerTopRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(147, 125));
            }
            if (this.iMapOuterTopRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(197, 125));
            }
            if (this.iMapInnerLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(78, 102));
            }
            if (this.iMapInnerRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(124, 148));
            }
            if (this.iMapOuterBottomLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(5, 125));
            }
            if (this.iMapInnerBottomLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(55, 125));
            }
            if (this.iMapInnerBottom.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(78, 148));
            }
            if (this.iMapInnerBottomRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 171));
            }
            if (this.iMapOuterBottomRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 221));
            }
            pen = new Pen(Color.Magenta);
            if (this.iStaticOuterTopLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 29));
            }
            if (this.iStaticInnerTopLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 79));
            }
            if (this.iStaticInnerTop.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(124, 102));
            }
            if (this.iStaticInnerTopRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(147, 125));
            }
            if (this.iStaticOuterTopRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(197, 125));
            }
            if (this.iStaticInnerLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(78, 102));
            }
            if (this.iStaticInnerRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(124, 148));
            }
            if (this.iStaticOuterBottomLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(5, 125));
            }
            if (this.iStaticInnerBottomLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(55, 125));
            }
            if (this.iStaticInnerBottom.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(78, 148));
            }
            if (this.iStaticInnerBottomRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 171));
            }
            if (this.iStaticOuterBottomRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 221));
            }
            ClsTerrain selectedItem = (ClsTerrain)this.Select_Group_A.SelectedItem;

            if (selectedItem != null)
            {
                Bitmap land6 = Art.GetLand(selectedItem.TileID);
                point = new Point(5, 242);
                graphics.DrawImage(land6, point);
                Bitmap bitmap6 = Art.GetLand(selectedItem.TileID);
                point = new Point(101, 125);
                graphics.DrawImage(bitmap6, point);
                name = selectedItem.Name;
            }
            selectedItem = (ClsTerrain)this.Select_Group_B.SelectedItem;
            if (selectedItem != null)
            {
                Bitmap land7 = Art.GetLand(selectedItem.TileID);
                point = new Point(55, 242);
                graphics.DrawImage(land7, point);
                str = selectedItem.Name;
            }
            this.TextBox1.Text = string.Format("{0} To {1}", name, str);
            graphics           = null;
        }
Esempio n. 21
0
 public void FromString_NotSupported(string value, short expected)
 {
     Assert.Throws <InvalidCastException>(() => ShortType.FromString(value));
 }
Esempio n. 22
0
 public ShortItem(string path, string shortkey, ShortType shortType = ShortType.Extension)
 {
     SetData(path, shortkey, shortType);
 }
Esempio n. 23
0
        // Inner version of "Print" and "Write".
        private static void Print(File file, Object[] Output,
                                  CultureInfo culture, bool print)
        {
            NumberFormatInfo nfi = culture.NumberFormat;

            if (Output == null)
            {
                return;
            }
            bool first = true;

            foreach (Object obj in Output)
            {
                if (!first && !print)
                {
                    file.Write(",");
                }
                else
                {
                    first = false;
                }
                if (obj == null)
                {
                    if (!print)
                    {
                        file.Write("#NULL#");
                    }
                    continue;
                }
                if (obj is TabInfo)
                {
                    file.Tab((TabInfo)obj);
                    continue;
                }
                else if (obj is SpcInfo)
                {
                    file.Space((SpcInfo)obj);
                    continue;
                }
                else if (obj is char[])
                {
                    file.Write(new String((char[])obj));
                    continue;
                }
                else if (obj is ErrObject)
                {
                    if (print)
                    {
                        file.Write(String.Format("Error {0}",
                                                 ((ErrObject)obj).Number));
                    }
                    else
                    {
                        file.Write(String.Format("#ERROR {0}#",
                                                 ((ErrObject)obj).Number));
                    }
                    continue;
                }
                switch (ObjectType.GetTypeCode(obj))
                {
                case TypeCode.DBNull:
                {
                    if (print)
                    {
                        file.Write("Null");
                    }
                    else
                    {
                        file.Write("#NULL#");
                    }
                }
                break;

                case TypeCode.Boolean:
                {
                    bool b = BooleanType.FromObject(obj);
                    if (print)
                    {
                        file.Write(b.ToString(culture));
                    }
                    else if (b)
                    {
                        file.Write("#TRUE#");
                    }
                    else
                    {
                        file.Write("#FALSE#");
                    }
                }
                break;

                case TypeCode.Byte:
                {
                    byte by = ByteType.FromObject(obj);
                    file.Write(by.ToString(nfi));
                }
                break;

                case TypeCode.Int16:
                {
                    short s = ShortType.FromObject(obj);
                    file.Write(s.ToString(nfi));
                }
                break;

                case TypeCode.Int32:
                {
                    int i = IntegerType.FromObject(obj);
                    file.Write(i.ToString(nfi));
                }
                break;

                case TypeCode.Int64:
                {
                    long l = LongType.FromObject(obj);
                    file.Write(l.ToString(nfi));
                }
                break;

                case TypeCode.Single:
                {
                    float f = SingleType.FromObject(obj, nfi);
                    file.Write(f.ToString(nfi));
                }
                break;

                case TypeCode.Double:
                {
                    double d = DoubleType.FromObject(obj, nfi);
                    file.Write(d.ToString(nfi));
                }
                break;

                case TypeCode.Decimal:
                {
                    Decimal dc = DecimalType.FromObject(obj, nfi);
                    file.Write(dc.ToString(nfi));
                }
                break;

                case TypeCode.DateTime:
                {
                    DateTime dt = DateType.FromObject(obj);
                    if (print)
                    {
                        file.Write(StringType.FromDate(dt) + " ");
                    }
                    else
                    {
                        String format;
                        long   dayTicks = dt.Ticks % TimeSpan.TicksPerDay;
                        if (dt.Ticks == dayTicks)
                        {
                            format = "T";
                        }
                        else if (dayTicks == 0)
                        {
                            format = "d";
                        }
                        else
                        {
                            format = "F";
                        }
                        file.Write(dt.ToString
                                       (format, culture.DateTimeFormat));
                    }
                }
                break;

                case TypeCode.String:
                {
                    file.Write(StringType.FromObject(obj));
                }
                break;

                default:
                {
                    Utils.ThrowException(5);                                            // ArgumentException.
                }
                break;
                }
            }
        }
Esempio n. 24
0
 public void FromObject_NotSupported(object value, short expected)
 {
     Assert.Throws <InvalidCastException>(() => ShortType.FromObject(value));
 }
        private void Panel2_Paint(object sender, PaintEventArgs e)
        {
            string   name = null;
            string   str  = null;
            Point    point;
            Graphics graphics = e.Graphics;

            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(5, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(197, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 29));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 221));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 79));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(78, 102));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(124, 102));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(55, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(147, 125));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(78, 148));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(124, 148));
            graphics.DrawPolygon(new Pen(Color.Blue), this.GetPoints(101, 171));
            if (!this.ViewTiles)
            {
                if (this.iMapOuterTopLeft.GetNodeCount(true) > 0)
                {
                    Bitmap land = Art.GetLand(IntegerType.FromObject(this.iMapOuterTopLeft.Nodes[0].Tag));
                    point = new Point(101, 29);
                    graphics.DrawImage(land, point);
                }
                if (this.iMapInnerTopLeft.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap = Art.GetLand(IntegerType.FromObject(this.iMapInnerTopLeft.Nodes[0].Tag));
                    point = new Point(101, 79);
                    graphics.DrawImage(bitmap, point);
                }
                if (this.iMapInnerTop.GetNodeCount(true) > 0)
                {
                    Bitmap land1 = Art.GetLand(IntegerType.FromObject(this.iMapInnerTop.Nodes[0].Tag));
                    point = new Point(124, 102);
                    graphics.DrawImage(land1, point);
                }
                if (this.iMapInnerTopRight.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap1 = Art.GetLand(IntegerType.FromObject(this.iMapInnerTopRight.Nodes[0].Tag));
                    point = new Point(147, 125);
                    graphics.DrawImage(bitmap1, point);
                }
                if (this.iMapOuterTopRight.GetNodeCount(true) > 0)
                {
                    Bitmap land2 = Art.GetLand(IntegerType.FromObject(this.iMapOuterTopRight.Nodes[0].Tag));
                    point = new Point(197, 125);
                    graphics.DrawImage(land2, point);
                }
                if (this.iMapInnerLeft.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap2 = Art.GetLand(IntegerType.FromObject(this.iMapInnerLeft.Nodes[0].Tag));
                    point = new Point(78, 102);
                    graphics.DrawImage(bitmap2, point);
                }
                if (this.iMapInnerRight.GetNodeCount(true) > 0)
                {
                    Bitmap land3 = Art.GetLand(IntegerType.FromObject(this.iMapInnerRight.Nodes[0].Tag));
                    point = new Point(124, 148);
                    graphics.DrawImage(land3, point);
                }
                if (this.iMapOuterBottomLeft.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap3 = Art.GetLand(IntegerType.FromObject(this.iMapOuterBottomLeft.Nodes[0].Tag));
                    point = new Point(5, 125);
                    graphics.DrawImage(bitmap3, point);
                }
                if (this.iMapInnerBottomLeft.GetNodeCount(true) > 0)
                {
                    Bitmap land4 = Art.GetLand(IntegerType.FromObject(this.iMapInnerBottomLeft.Nodes[0].Tag));
                    point = new Point(55, 125);
                    graphics.DrawImage(land4, point);
                }
                if (this.iMapInnerBottom.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap4 = Art.GetLand(IntegerType.FromObject(this.iMapInnerBottom.Nodes[0].Tag));
                    point = new Point(78, 148);
                    graphics.DrawImage(bitmap4, point);
                }
                if (this.iMapInnerBottomRight.GetNodeCount(true) > 0)
                {
                    Bitmap land5 = Art.GetLand(IntegerType.FromObject(this.iMapInnerBottomRight.Nodes[0].Tag));
                    point = new Point(101, 171);
                    graphics.DrawImage(land5, point);
                }
                if (this.iMapOuterBottomRight.GetNodeCount(true) > 0)
                {
                    Bitmap bitmap5 = Art.GetLand(IntegerType.FromObject(this.iMapOuterBottomRight.Nodes[0].Tag));
                    point = new Point(101, 221);
                    graphics.DrawImage(bitmap5, point);
                }
            }
            else
            {
                if (this.iStaticOuterTopLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticOuterTopLeft.Nodes[0].Tag), 101, 29, e);
                }
                if (this.iStaticInnerTopLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerTopLeft.Nodes[0].Tag), 101, 79, e);
                }
                if (this.iStaticInnerTop.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerTop.Nodes[0].Tag), 124, 102, e);
                }
                if (this.iStaticInnerTopRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerTopRight.Nodes[0].Tag), 147, 125, e);
                }
                if (this.iStaticOuterTopRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticOuterTopRight.Nodes[0].Tag), 197, 125, e);
                }
                if (this.iStaticInnerLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerLeft.Nodes[0].Tag), 78, 102, e);
                }
                if (this.iStaticInnerRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerRight.Nodes[0].Tag), 124, 148, e);
                }
                if (this.iStaticOuterBottomLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticOuterBottomLeft.Nodes[0].Tag), 5, 125, e);
                }
                if (this.iStaticInnerBottomLeft.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerBottomLeft.Nodes[0].Tag), 55, 125, e);
                }
                if (this.iStaticInnerBottom.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerBottom.Nodes[0].Tag), 78, 148, e);
                }
                if (this.iStaticInnerBottomRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticInnerBottomRight.Nodes[0].Tag), 101, 171, e);
                }
                if (this.iStaticOuterBottomRight.GetNodeCount(true) > 0)
                {
                    this.DrawStatic(ShortType.FromObject(this.iStaticOuterBottomRight.Nodes[0].Tag), 101, 221, e);
                }
            }
            Pen pen = new Pen(Color.Red);

            if (this.iMapOuterTopLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 29));
            }
            if (this.iMapInnerTopLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 79));
            }
            if (this.iMapInnerTop.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(124, 102));
            }
            if (this.iMapInnerTopRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(147, 125));
            }
            if (this.iMapOuterTopRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(197, 125));
            }
            if (this.iMapInnerLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(78, 102));
            }
            if (this.iMapInnerRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(124, 148));
            }
            if (this.iMapOuterBottomLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(5, 125));
            }
            if (this.iMapInnerBottomLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(55, 125));
            }
            if (this.iMapInnerBottom.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(78, 148));
            }
            if (this.iMapInnerBottomRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 171));
            }
            if (this.iMapOuterBottomRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 221));
            }
            pen = new Pen(Color.Magenta);
            if (this.iStaticOuterTopLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 29));
            }
            if (this.iStaticInnerTopLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 79));
            }
            if (this.iStaticInnerTop.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(124, 102));
            }
            if (this.iStaticInnerTopRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(147, 125));
            }
            if (this.iStaticOuterTopRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(197, 125));
            }
            if (this.iStaticInnerLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(78, 102));
            }
            if (this.iStaticInnerRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(124, 148));
            }
            if (this.iStaticOuterBottomLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(5, 125));
            }
            if (this.iStaticInnerBottomLeft.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(55, 125));
            }
            if (this.iStaticInnerBottom.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(78, 148));
            }
            if (this.iStaticInnerBottomRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 171));
            }
            if (this.iStaticOuterBottomRight.IsSelected)
            {
                graphics.DrawPolygon(pen, this.GetPoints(101, 221));
            }
            ClsTerrain selectedItem = (ClsTerrain)this.Select_Group_A.SelectedItem;

            if (selectedItem != null)
            {
                Bitmap land6 = Art.GetLand(selectedItem.TileID);
                point = new Point(5, 242);
                graphics.DrawImage(land6, point);
                Bitmap bitmap6 = Art.GetLand(selectedItem.TileID);
                point = new Point(101, 125);
                graphics.DrawImage(bitmap6, point);
                name = selectedItem.Name;
            }
            selectedItem = (ClsTerrain)this.Select_Group_B.SelectedItem;
            if (selectedItem != null)
            {
                Bitmap land7 = Art.GetLand(selectedItem.TileID);
                point = new Point(55, 242);
                graphics.DrawImage(land7, point);
                str = selectedItem.Name;
            }

            #region Label Formatting

            //Edit The '↔' To Change How You Want Your Labels To Look
            //Original 'To' Was The Transition Keyword For The Labels
            //This Keyword Was Changed To Arrows To Show The Back And Forth Between Transitions
            this.TextBox1.Text = string.Format("{0} ↔ {1}", name, str);

            #endregion

            graphics = null;

            #endregion
        }