Exemple #1
0
        private void listTables_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index >= 0)
            {
                e.DrawBackground();
                e.DrawFocusRectangle();

                ConflictInfo con = (sender as ListBox).Items[e.Index] as ConflictInfo;
                if (con != null && con.ConflictType != ConflictType.NONE)
                {
                    if (con.ConflictType == ConflictType.TABLE)
                    {
                        e.Graphics.DrawString("与文件 " + Path.GetFileName(con.ConflictFile) + " 冲突目录 " + con.Table, e.Font, Brushes.Red, e.Bounds, StringFormat.GenericDefault);
                    }
                    else if (con.ConflictType == ConflictType.KEY)
                    {
                        e.Graphics.DrawString("与文件 " + Path.GetFileName(con.ConflictFile) + " 重复词条 " + string.Join(" | ", con.FieldValue), e.Font, Brushes.Orange, e.Bounds, StringFormat.GenericDefault);
                    }
                }
                else if (con != null)
                {
                    e.Graphics.DrawString("该目录正常", e.Font, Brushes.Green, e.Bounds, StringFormat.GenericDefault);
                }
                else if ((sender as ListBox).Items[e.Index] != null)
                {
                    e.Graphics.DrawString((sender as ListBox).Items[e.Index].ToString(), e.Font, Brushes.Black, e.Bounds, StringFormat.GenericDefault);
                }
            }
        }
Exemple #2
0
 private void 打开文件夹ToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (listTables.SelectedIndex >= 0)
     {
         ConflictInfo mod = listTables.Items[listTables.SelectedIndex] as ConflictInfo;
         if (mod != null && mod.ConflictFile != null)
         {
             ExplorerFile(mod.ConflictFile);
         }
         else if (mod != null && mod.File != null)
         {
             ExplorerFile(mod.File);
         }
     }
 }
Exemple #3
0
 private void listTables_DoubleClick(object sender, EventArgs e)
 {
     if (listTables.SelectedIndex >= 0)
     {
         ConflictInfo con = listTables.Items[listTables.SelectedIndex] as ConflictInfo;
         if (con != null && con.ConflictFile != null)
         {
             ExplorerFile(con.ConflictFile);
         }
         else if (con != null && con.File != null)
         {
             ExplorerFile(con.File);
         }
     }
 }
Exemple #4
0
 private void listTables_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         int index = listTables.IndexFromPoint(e.Location);
         if (index >= 0 && index != 65535)
         {
             listTables.SelectedIndex = index;
             ConflictInfo mod = listTables.Items[listTables.SelectedIndex] as ConflictInfo;
             if (mod != null)
             {
                 ctxMenu.Tag = mod.ConflictFile ?? mod.File;
                 ctxMenu.Show(listTables, e.Location);
             }
         }
     }
 }
Exemple #5
0
 private void 用RPFM打开ToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (listTables.SelectedIndex >= 0)
     {
         if (rpfmFile != null && rpfmFile.Length > 0)
         {
             ConflictInfo mod = listTables.Items[listTables.SelectedIndex] as ConflictInfo;
             if (mod != null && mod.ConflictFile != null)
             {
                 Process.Start(rpfmFile, "\"" + mod.ConflictFile + "\"");
             }
             else if (mod != null && mod.File != null)
             {
                 Process.Start(rpfmFile, "\"" + mod.ConflictFile + "\"");
             }
         }
         else
         {
             MessageBox.Show("请设置RPFM的路径");
         }
     }
 }
Exemple #6
0
        private void listMods_SelectedIndexChanged(object sender, EventArgs e)
        {
            listTables.Items.Clear();
            ListBox list = sender as ListBox;

            if (list.SelectedIndex >= 0)
            {
                ModFile mod = list.Items[list.SelectedIndex] as ModFile;

                listTables.Items.Add("文件:   " + mod.FileName);
                listTables.Items.Add("");

                //展示所有冲突的目录
                fileTables[mod.FileName].ForEach(table =>
                {
                    bool conf = false;

                    bool withTag = false;

                    List <string> allFiles = tableFile[table];
                    allFiles = allFiles.Where(p => p != mod.FileName).ToList();
                    if (allFiles.Count > 0)
                    {
                        listTables.Items.Add("目录:   " + table);
                        withTag = true;

                        allFiles.ForEach(o =>
                        {
                            ConflictInfo c = new ConflictInfo();
                            c.File         = mod.FileName;
                            c.Table        = table;
                            c.ConflictType = ConflictType.TABLE;
                            c.ConflictFile = o;
                            listTables.Items.Add(c);
                        });
                        conf = true;
                    }
                    //查看词条冲突情况
                    var tpeName = DBFile.Typename(table);
                    fileFields[mod.FileName].Where(p => p.TableName == tpeName).ToList().ForEach(p =>
                    {
                        List <string> files = fieldFiles[p.TableName + "." + string.Join(".", p.FieldKeyValue)]
                                              .Where(q => q != mod.FileName).ToList();
                        if (files.Count > 0)
                        {
                            if (!withTag)
                            {
                                listTables.Items.Add("目录:   " + table);
                                withTag = true;
                            }
                            files.ForEach(q =>
                            {
                                ConflictInfo c = new ConflictInfo();
                                c.File         = mod.FileName;
                                c.Table        = table;
                                c.ConflictType = ConflictType.KEY;
                                c.ConflictFile = q;
                                c.FieldValue   = p.FieldKeyValue;
                                c.FieldName    = p.FieldKeyName;
                                listTables.Items.Add(c);
                            });
                            conf = true;
                        }
                    });
                    if (!conf && !tsmiHideNormal.Checked)
                    {
                        if (!withTag)
                        {
                            listTables.Items.Add("目录:   " + table);
                            withTag = true;
                        }

                        ConflictInfo con = new ConflictInfo();
                        con.File         = mod.FileName;
                        con.Table        = table;
                        con.ConflictType = ConflictType.NONE;
                        listTables.Items.Add(con);
                    }

                    if (withTag)
                    {
                        listTables.Items.Add("");
                    }
                });
            }
        }