Commit 4dba01be authored by 花桃白音's avatar 花桃白音

Color cards in listbox by LFStates

parent 860fc2f3
No preview for this file type
......@@ -54,7 +54,6 @@ namespace cardvisa
Brush myBrush = Brushes.Black;
SolidBrush mySBrush = new SolidBrush(Color.White);
Rectangle myRect = new Rectangle(0,0,0,0);
int lockobj = 0;
List<string> filelist = new List<string> { "0禁止.jpg", "1限制.jpg", "2准限.jpg", "3通过.png", "4回退.jpg" };
public List<string> zipcdblist { get; set; } = new List<string>();
public int cardindex = 0;
......@@ -346,6 +345,7 @@ namespace cardvisa
richTextBox1.ForeColor = ftc;
listBox1.BackColor = bgc;
listBox1.ForeColor = ftc;
mySBrush.Color = bgc;
BackColor = ColorTranslator.FromHtml("#333333");
}
else
......@@ -360,6 +360,7 @@ namespace cardvisa
richTextBox1.ForeColor = Color.Black;
listBox1.BackColor = Color.White;
listBox1.ForeColor = Color.Black;
mySBrush.Color = Color.White;
BackColor = DefaultBackColor;
}
/*
......@@ -435,7 +436,7 @@ namespace cardvisa
var code = cardd.id;
var cti = new CardTypeInfo(cardd.type);
bool otbug = settings.packDIY ? (cardd.ot != 4) : false;
bool lostcheck = (cardd.alias == 0 && cti.IsNeedScript());
bool lostcheck = (cardd.alias == 0 && cti.IsNeedScript()) && settings.checkfiles;
if (lostcheck || otbug)//非同名卡
{
string parentpath = Path.GetDirectoryName(pathName);
......@@ -752,22 +753,27 @@ namespace cardvisa
using (StreamWriter sw = new StreamWriter(path, false, (new UTF8Encoding(false)))) { sw.Write(""); }
}
else
{
readLFList(path);
}
}
public void readLFList(string path)
{
string[] strsets = File.ReadAllLines(path);
string reg = "(?<id>\\d{1,10})\\s(?<lf>\\d).*(?<=[-]{2})(?<name>.*)";
foreach (var str in strsets)
{
Match mt = Regex.Match(str,reg);
Match mt = Regex.Match(str, reg);
if (mt.Success)
{
long cid = long.Parse(mt.Groups["id"].Value);
if (cdbh.cmds.ContainsKey(cid)) {
if (cdbh.cmds.ContainsKey(cid))
{
cdbh.cmds[cid].LFState = (LFStates)Enum.Parse(typeof(LFStates), mt.Groups["lf"].Value);
}
}
}
}
}
public void LflistPackOut(string txtFilePath)
{
List<string> list = new List<string> { "#forbidden", "#limit", "#semi limit", "#Passed", "#Returned" };
......@@ -968,43 +974,37 @@ namespace cardvisa
private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index < 0) return;
if (lockobj == 1) return;
if (button7.Text == "开灯")
{
myBrush = Brushes.White;
mySBrush.Color = Color.Black;
}
myRect.X = e.Bounds.X;
myRect.Y = e.Bounds.Y;
myRect.Width = e.Bounds.Width;
myRect.Height = e.Bounds.Height;
myRect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
e.Graphics.FillRectangle(mySBrush,myRect);//罪魁祸首
/*
if (cdbh.cmds.Count > 0)
{
var id = e.Index > 0 ? (e.Index < 20 ? e.Index : 19) : 2;
sqldata sqd = cdbh.cmds[GetCardFromListID(id)];
switch (sqd.LFState)
var id = e.Index > 0 ? (e.Index < 20 ? e.Index : 20) : 1;
switch ((e.Index == 21 || e.Index == 0)? cdbh.cmds[GetCardFromListID(id)].LFState : LFStates.other)
{
case LFStates.死刑:
case LFStates.Forbidden:
myBrush = Brushes.Red;
break;
case LFStates.Limited:
myBrush = Brushes.Orange;
break;
case LFStates.SubLimited:
myBrush = Brushes.Blue;
myBrush = Brushes.ForestGreen;
break;
default:
myBrush = button7.Text == "关灯" ? Brushes.Black : Brushes.White;
break;
}
}*/
}
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
{
e.Graphics.FillRectangle(new SolidBrush(Color.LightBlue),myRect);//罪魁祸首
}
e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), listBox1.Font, myBrush,myRect, StringFormat.GenericDefault);
e.Graphics.DrawString(listBox1.Items[e.Index].ToString(), listBox1.Font, myBrush, myRect, StringFormat.GenericDefault);
e.DrawFocusRectangle();
}
private void listBox1_SelectedValueChanged(object sender, EventArgs e)
......@@ -1443,7 +1443,8 @@ namespace cardvisa
Limited = 1,
SubLimited = 2,
UnLimited = 3,
死刑 = 4
死刑 = 4,
other = 5
}
public class CommonHandler
{
......@@ -1538,6 +1539,7 @@ namespace cardvisa
public string ygopath { get; set; } = "";
public bool pathcheck { get; set; } = false;
public bool packDIY { get; set; } = true;
public bool checkfiles { get; set; } = false;
public List<string> regs { get; set; }
}
public class sqldata
......
This diff is collapsed.
This diff is collapsed.
{"ygopath":"E:\\MyCardLibrary\\ygopro\\ygopro.exe","pathcheck":false,"packDIY":true,"regs":null}
\ No newline at end of file
{"ygopath":"D:\\MyCardLibrary\\ygopro\\ygopro.exe","pathcheck":false,"packDIY":true,"regs":null,"checkfiles": false}
\ No newline at end of file
6eed85acb0b2cbb3d5797a801f4b74efa08f41cf
82ee7007c2ed7a5765c90a144ea7ebd66d6b4faf830bf39b7baeaf603aeb3916
......@@ -55,3 +55,5 @@ E:\project\visa\cardvisa\cardvisa\obj\Debug\cardvisa.PicViewer.resources
C:\Users\Administrator\source\repos\cardvisa\cardvisa\obj\Debug\cardvisa.PicViewer.resources
E:\project\visa\cardvisa\cardvisa\obj\Debug\cardvisa.PuzzleGame.resources
E:\project\visa\cardvisa\cardvisa\obj\Debug\cardvisa.MyListBox.resources
C:\Users\Administrator\source\repos\cardvisa\cardvisa\obj\Debug\cardvisa.MyListBox.resources
C:\Users\Administrator\source\repos\cardvisa\cardvisa\obj\Debug\cardvisa.PuzzleGame.resources
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment