Exemplo n.º 1
0
 private void SetCustomPadding(ExtEntry entry)
 {
     if (entry.Padding != default(Thickness))
     {
         Control.SetPadding((int)entry.Padding.Left, (int)entry.Padding.Top, (int)entry.Padding.Right, (int)entry.Padding.Bottom);
     }
 }
        public static bool HeleusCoinValidator(StatusView statusView, ExtEntry edit, string newText, string oldText)
        {
            if (decimal.TryParse(newText, System.Globalization.NumberStyles.AllowDecimalPoint, null, out var p))
            {
                try
                {
                    var h = Currency.ToHel(p);
                    if (h < 0)
                    {
                        edit.Text = oldText;
                        goto err;
                    }

                    return(h > 0);
                }
                catch { }
            }

            if (!newText.IsNullOrEmpty())
            {
                edit.Text = oldText;
            }

err:
            return(false);
        }
Exemplo n.º 3
0
        void AddExtension(string extName, int version)
        {
            ExtEntry ext = FindExtension(extName.Trim());

            if (ext == null)
            {
                return;
            }
            ext.ClientExtVersion = (byte)version;

            if (ext.ExtName == CpeExt.CustomBlocks)
            {
                if (version == 1)
                {
                    Send(Packet.CustomBlockSupportLevel(1));
                }
                hasCustomBlocks = true;
            }
            else if (ext.ExtName == CpeExt.ChangeModel)
            {
                hasChangeModel = true;
            }
            else if (ext.ExtName == CpeExt.FullCP437)
            {
                hasCP437 = true;
            }
            else if (ext.ExtName == CpeExt.ExtPlayerList)
            {
                hasExtList = true;
            }
            else if (ext.ExtName == CpeExt.BlockDefinitions)
            {
                hasBlockDefs = true;
            }
            else if (ext.ExtName == CpeExt.TextColors)
            {
                hasTextColors = true;
                for (int i = 0; i < Colors.List.Length; i++)
                {
                    if (!Colors.List[i].IsModified())
                    {
                        continue;
                    }
                    Send(Packet.SetTextColor(Colors.List[i]));
                }
            }
            else if (ext.ExtName == CpeExt.ExtEntityPositions)
            {
                hasExtPositions = true;
            }
            else if (ext.ExtName == CpeExt.TwoWayPing)
            {
                hasTwoWayPing = true;
            }
            else if (ext.ExtName == CpeExt.BulkBlockUpdate)
            {
                hasBulkBlockUpdate = true;
            }
        }
Exemplo n.º 4
0
        public bool HasExtension(string extName)
        {
            if (!extension)
            {
                return(false);
            }

            return(ExtEntry.FindAll(cpe => cpe.name == extName) != null);
        }
Exemplo n.º 5
0
        public bool Supports(string extName, int version = 1)
        {
            if (!hasCpe)
            {
                return(false);
            }
            ExtEntry ext = FindExtension(extName);

            return(ext != null && ext.ClientExtVersion == version);
        }
Exemplo n.º 6
0
 private void SetEntryBorder(ExtEntry entry)
 {
     if (entry.HasBorder && !string.IsNullOrEmpty(entry.BorderColor))
     {
         var gd = new GradientDrawable();
         gd.SetColor(Android.Graphics.Color.White);
         gd.SetCornerRadius(10);
         gd.SetStroke(2, Android.Graphics.Color.ParseColor(entry.BorderColor));
         Control.Background = gd;
     }
     else
     {
         Control.SetBackgroundColor(Color.Transparent.ToAndroid());
     }
 }
Exemplo n.º 7
0
        private StyleGroupInfo ProcessGroup(ExtEntry entry)
        {
            var k = entry.Key;
            var dn = entry.Element("display");

            var configs = entry.Children.Select(c =>
                    new StyleItemConfig
                    {
                        Type = c.Key,
                        DisplayName = c.Element("display") ?? c.Key,
                        FontName = c.Element("font"),
                        FontSize = c.Element<Int32>("size", 0),
                        ForeColor = c.Element<KnownColor?>("fore"),
                        BackColor = c.Element<KnownColor?>("back"),
                        Bold = c.Element<Boolean?>("bold"),
                        Italic = c.Element<Boolean?>("italic"),
                        Underline = c.Element<Boolean?>("underline")
                    }
                );

            return new StyleGroupInfo(k, dn, configs);
        }
Exemplo n.º 8
0
        private StyleGroupInfo ProcessGroup(ExtEntry entry)
        {
            var k  = entry.Key;
            var dn = entry.Element("display");

            var configs = entry.Children.Select(c =>
                                                new StyleItemConfig
            {
                Type        = c.Key,
                DisplayName = c.Element("display") ?? c.Key,
                FontName    = c.Element("font"),
                FontSize    = c.Element <Int32>("size", 0),
                ForeColor   = c.Element <KnownColor?>("fore"),
                BackColor   = c.Element <KnownColor?>("back"),
                Bold        = c.Element <Boolean?>("bold"),
                Italic      = c.Element <Boolean?>("italic"),
                Underline   = c.Element <Boolean?>("underline")
            }
                                                );

            return(new StyleGroupInfo(k, dn, configs));
        }
 public static bool HeleusPasswordValidator(StatusView statusView, ExtEntry edit, string newText, string oldText)
 {
     return(WalletApp.IsValidPassword(newText));
 }