Esempio n. 1
0
        //вывод тайла
        void ShowTile(int x, int y)
        {
            Graphics g = Graphics.FromImage(Img);

            for (int j = y * 16; j < y * 16 + 16; j++)
            {
                for (int i = x * 16; i < x * 16 + 16; i++)
                {
                    int   bright = (AttrLayer[i / 8, j / 8] >> 3) & 0x08;
                    Color ink    = ZX.GetColor((AttrLayer[i / 8, j / 8] & 0x07) + bright);
                    Color paper  = ZX.GetColor(((AttrLayer[i / 8, j / 8] >> 3) & 0x07) + bright);
                    Color c      = PixelLayer[i, j] == 0 ? paper : ink;
                    Brush b      = new SolidBrush(c);
                    g.FillRectangle(b, i * PixSize, j * PixSize, PixSize, PixSize);
                }
            }
            if (ShowGrid.Checked)
            {
                Pen p = new Pen(Color.Gray);
                p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                g.DrawLine(p, x * 16 * PixSize, y * 16 * PixSize, x * 16 * PixSize, (y + 1) * 16 * PixSize);
                g.DrawLine(p, x * 16 * PixSize, y * 16 * PixSize, (x + 1) * 16 * PixSize, y * 16 * PixSize);

                p           = new Pen(Color.LightGray);
                p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                g.DrawLine(p, (x * 16 + 8) * PixSize, y * 16 * PixSize, (x * 16 + 8) * PixSize, (y + 1) * 16 * PixSize);
                g.DrawLine(p, x * 16 * PixSize, (y * 16 + 8) * PixSize, (x + 1) * 16 * PixSize, (y * 16 + 8) * PixSize);
            }
        }
Esempio n. 2
0
        //反填
        public ZX FanNewsZX(int Id)
        {
            string sql = $"select * from NewsZX where Nzxid={Id}";
            var    dt  = DBHelper.ExecuteQuery(sql, System.Data.CommandType.Text);
            string str = JsonConvert.SerializeObject(dt);
            ZX     z   = JsonConvert.DeserializeObject <List <ZX> >(str).FirstOrDefault();

            return(z);
        }
Esempio n. 3
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ZX.BeginAnimation(OpacityProperty, new DoubleAnimation(0.3, 1, TimeSpan.FromSeconds(1))
            {
                AutoReverse = true
            });
            if (await Lemon_Updata.IsLemonNew(He.KMS))
            {
                new UpdataWindow().Show();
            }
            if (!Uuuhh.Lalala("www.mi.com"))
            {
                ZX.Background = MIN.Background;
            }
            else
            {
                ZX.Background = MAX.Background;
            }
            if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "UserImage.bmp"))
            {
                tx.Background = new ImageBrush(new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + "UserImage.bmp", UriKind.Absolute)));
            }
            DateTime tmCur = DateTime.Now;

            if (tmCur.Hour > 18 && tmCur.Hour < 24)
            {
                Toast.SetToastNotion("晚上好:", "欢迎回来" + Settings.Default.RobotName, "------早睡早起身体好").Show();
            }
            else if (tmCur.Hour >= 11 && tmCur.Hour < 12)
            {
                Toast.SetToastNotion("中午好:", "欢迎回来" + Settings.Default.RobotName, "------中午啦~吃饭饭了~~").Show();
            }
            else if (tmCur.Hour > 1 && tmCur.Hour < 5)
            {
                Toast.SetToastNotion("凌晨好:", "欢迎回来" + Settings.Default.RobotName, "-----不乖哦,还没有睡觉~").Show();
            }
            else if (tmCur.Hour > 6 && tmCur.Hour < 11)
            {
                Toast.SetToastNotion("早上好:", "欢迎回来" + Settings.Default.RobotName, "-----一日之计在于晨,早上是最宝贵的时间哦~").Show();
            }
            else if (tmCur.Hour > 13 && tmCur.Hour < 17)
            {
                Toast.SetToastNotion("下午好:", "欢迎回来" + Settings.Default.RobotName, "------祝你今天好运!").Show();
            }
            LemonWeather w = new LemonWeather(Settings.Default.WeatherInfo);

            Toast.SetToastNotion($"今日{w.WeatherName}天气", w.WeatherMessage, "-----来自柠檬天气Toast").Show();
        }
Esempio n. 4
0
        public override int GetHashCode()
        {
            int result = 17;

            result = 31 * result + XX.GetHashCode();
            result = 31 * result + XY.GetHashCode();
            result = 31 * result + XZ.GetHashCode();

            result = 31 * result + YX.GetHashCode();
            result = 31 * result + YY.GetHashCode();
            result = 31 * result + YZ.GetHashCode();

            result = 31 * result + ZX.GetHashCode();
            result = 31 * result + ZY.GetHashCode();
            result = 31 * result + ZZ.GetHashCode();
            return(result);
        }
Esempio n. 5
0
        public override int GetHashCode()
        {
            int h = 17;

            unchecked
            {
                h = h * 23 + XX.GetHashCode();
                h = h * 23 + XY.GetHashCode();
                h = h * 23 + XZ.GetHashCode();
                h = h * 23 + YX.GetHashCode();
                h = h * 23 + YY.GetHashCode();
                h = h * 23 + YZ.GetHashCode();
                h = h * 23 + ZX.GetHashCode();
                h = h * 23 + ZY.GetHashCode();
                h = h * 23 + ZZ.GetHashCode();
            }
            return(h);
        }
        Bitmap ScreenImg = new Bitmap(512, 384);       //изображение скрина с тайлами

        //захват тайлсета
        void CaptureTileset()
        {
            //чтение SCR в массив
            byte[]       scrfile = new byte[6912];
            BinaryReader reader  = new BinaryReader(File.Open(ImgName.Text, FileMode.Open));

            for (int i = 0; i < 6912; i++)
            {
                scrfile[i] = reader.ReadByte();
            }
            reader.Close();
            //нарезаем тайлы
            Graphics g = Graphics.FromImage(ScreenImg);

            for (int y = 0; y < 12; y++)
            {
                for (int x = 0; x < 16; x++)
                {
                    int n = x + y * 16;
                    ExtTiles[n] = new byte[37];
                    for (int j = 0; j < 16; j++)
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            int xscr   = x * 2 + i;
                            int yscr   = y * 16 + j;
                            int scradr = xscr + ((yscr << 2) & 0xe0) + ((yscr & 7) * 256) + (((yscr >> 3) & 0x18) * 256);
                            ExtTiles[n][i + j * 2] = scrfile[scradr];
                        }
                    }
                    for (int j = 0; j < 2; j++)
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            ExtTiles[n][32 + i + j * 2] = scrfile[6144 + (x * 2 + i) + (y * 2 + j) * 32];
                        }
                    }
                    ExtTilesImg[n] = new Bitmap(ZX.DrawTile(ExtTiles[n], 2));
                    g.DrawImage(ExtTilesImg[n], x * 32, y * 32);
                }
            }
            ScreenPicture.Image = ScreenImg;
        }
        //прорисовка спрайта 8x8
        public void DrawChar(Graphics g, int x, int y, byte[] ch, int master_attr)
        {
            if (ch[0] == 0)
            {
                return;
            }
            Brush ColorInk;
            Brush ColorPaper;
            Brush ColorPix;

            if (master_attr == 0)
            {
                ColorInk   = new SolidBrush(ZX.GetColor((ch[0] & 7) + ((ch[0] >> 3) & 8)));
                ColorPaper = new SolidBrush(ZX.GetColor(((ch[0] >> 3) & 15)));
            }
            else
            {
                ColorInk   = new SolidBrush(ZX.GetColor((master_attr & 7) + ((master_attr >> 3) & 8)));
                ColorPaper = new SolidBrush(ZX.GetColor(((master_attr >> 3) & 15)));
            }
            if ((ch[0] & 0x80) == 0)
            {
                for (int j = 0; j < 8; j++)
                {
                    for (int i = 0; i < 8; i++)
                    {
                        ColorPix = ((ch[j + 1] << i) & 128) == 0 ? ColorPaper : ColorInk;
                        g.FillRectangle(ColorPix, x * 16 + i * 2, y * 16 + j * 2, 2, 2);
                    }
                }
            }
            else
            {
                g.FillRectangle(ColorPaper, x * 16, y * 16, 16, 16);
            }
        }
Esempio n. 8
0
        public IHttpActionResult NewsAdd()
        {
            ZX  z       = new ZX();
            var file    = HttpContext.Current.Request.Files[0];
            var files   = HttpContext.Current.Request.Files[0];
            var zxlei   = HttpContext.Current.Request.Form["zxlei"];
            var zxtitle = HttpContext.Current.Request.Form["zxtitle"];
            var zxmiao  = HttpContext.Current.Request.Form["zxmiao"];
            var zxnei   = HttpContext.Current.Request.Form["zxnei"];
            var zxly    = HttpContext.Current.Request.Form["zxly"];
            var zxurl   = HttpContext.Current.Request.Form["zxurl"];

            z.Nzxlei   = zxlei;
            z.NzxTitle = zxtitle;
            z.Nzmiao   = zxmiao;
            z.Nznei    = zxnei;
            z.NzxLY    = zxly;
            z.Nzurl    = zxurl;
            if (file != null)
            {
                string xd = "/img/" + Guid.NewGuid().ToString() + Path.GetExtension(file.FileName);
                string jd = HttpContext.Current.Server.MapPath(xd);
                file.SaveAs(jd);
                z.Nzimg = xd;
            }
            if (files != null)
            {
                string xd = "/img/" + Guid.NewGuid().ToString() + Path.GetExtension(file.FileName);
                string jd = HttpContext.Current.Server.MapPath(xd);
                file.SaveAs(jd);
                z.NzShiPin = xd;
            }
            var list = dal.NewsZXAdd(z);

            return(Json(list));
        }
Esempio n. 9
0
        //修改新闻资讯
        public int NewsUpd(ZX z)
        {
            string sql = $"update NewsZX set Nzxlei='{z.Nzxlei}',NzxTitle='{z.NzxTitle}',Nzmiao='{z.Nzmiao}',Nzimg='{z.Nzimg}',NzShiPin='{z.NzShiPin}',Nznei='{z.Nznei}',NzxLY='{z.NzxLY}',Nzurl='{z.Nzurl}' where Nzxid={z.Nzxid}";

            return(DBHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text));
        }
Esempio n. 10
0
        //添加新闻资讯
        public int NewsZXAdd(ZX n)
        {
            string sql = $"insert into NewsZX(Nzxlei,NzxTitle,Nzmiao,Nzimg,NzShiPin,Nznei,NzxLY,Nzurl) values('{n.Nzxlei}','{n.NzxTitle}','{n.Nzmiao}','{n.Nzimg}','{n.NzShiPin}','{n.Nznei}','{n.NzxLY}','{n.Nzurl}')";

            return(DBHelper.ExecuteNonQuery(sql, System.Data.CommandType.Text));
        }
Esempio n. 11
0
        //вывод палитры
        void ShowPalette()
        {
            int b = 0;

            if (BrightCheck.Checked)
            {
                b = 8;
            }
            for (int i = 0; i < 8; i++)
            {
                Color c = ZX.GetColor((byte)(i + b));
                if (!ColorsCheck.Checked)
                {
                    c = Color.LightGray;
                }
                var p = PalettePanel.Controls["I" + i.ToString()];
                p.BackColor = c;
                if (i == Ink)
                {
                    p.Text = "V";
                }
                else
                {
                    p.Text = "";
                }
                if (i < 4 && ColorsCheck.Checked)
                {
                    p.ForeColor = Color.White;
                }
                else
                {
                    p.ForeColor = Color.Black;
                }
                p           = PalettePanel.Controls["P" + i.ToString()];
                p.BackColor = c;
                if (i == Paper)
                {
                    p.Text = "V";
                }
                else
                {
                    p.Text = "";
                }
                if (i < 4 && ColorsCheck.Checked)
                {
                    p.ForeColor = Color.White;
                }
                else
                {
                    p.ForeColor = Color.Black;
                }
            }
            if (!ColorsCheck.Checked)
            {
                AttrColor.BackColor = Color.LightGray;
                AttrColor.ForeColor = Color.Black;
            }
            else
            {
                AttrColor.BackColor = ZX.GetColor((byte)(Paper + b));
                AttrColor.ForeColor = ZX.GetColor((byte)(Ink + b));
            }
        }
 private void tb_Client_SelectionChanged(ZX.Controls.DotNetMagic.Controls.TabControl sender, ZX.Controls.DotNetMagic.Controls.TabPage oldPage, ZX.Controls.DotNetMagic.Controls.TabPage newPage)
 {
 }