Пример #1
0
        // Author
        private void Button_Click_8(object sender, RoutedEventArgs e)
        {
            SevennZipVP sz = new SevennZipVP();
            string vpTable;
            string fpTable;
            string p = string.Empty;
            var s = Pinxsystem.ElementAt(comboBox_syslist.SelectedIndex);

            if (s.SysName == "Visual Pinball" || s.SysName == "Future Pinball")
            {
                foreach (var item in tables_grid.SelectedItems)
                {
                    var itemTable = item as Table;
                    vpTable = itemTable.Name + ".vpt";
                    fpTable = itemTable.Name + ".fpt";
                    if (s.SysName == "Visual Pinball")
                        p = System.IO.Path.Combine(s.TablePath, vpTable);
                    else if (s.SysName == "Future Pinball")
                        p = System.IO.Path.Combine(s.TablePath, fpTable);

                    p = "\"" + p + "\"";
                    sz.GetTableInfo(p, itemTable.Name, s.SysName, "Author");
                    string line = null;
                    itemTable.Author = string.Empty;
                    DirectoryInfo di;// = new DirectoryInfo(@"TableInfo\");
                    FileInfo[] fi;// = di.GetFiles(@"*.*");

                    if (s.SysName == "Visual Pinball")
                    {
                        if (File.Exists("AuthorName"))
                        {
                            System.IO.StreamReader file = new System.IO.StreamReader("AuthorName", Encoding.Unicode);
                            line = file.ReadLine();
                            if (line != null || line != string.Empty)
                            {
                                file.Close();
                                file = new System.IO.StreamReader("AuthorName", Encoding.Unicode);
                                while ((line = file.ReadLine()) != null)
                                {
                                    itemTable.Author = line;
                                }
                                file.Close();
                            }
                        }
                    }
                    else if (s.SysName == "Future Pinball")
                    {
                        if (File.Exists("Table Data"))
                        {
                            System.IO.StreamReader file = new System.IO.StreamReader("Table Data", Encoding.Default);
                            line = file.ReadToEnd();
                            line.ToString();
                            if (line != null || line != string.Empty)
                            {
                                file.Close();
                                file = new System.IO.StreamReader("Table Data");
                                var myRegex = new Regex(@"0����-\\0\\0\\0(\w.*)");
                                MatchCollection AllMatches = myRegex.Matches(line);
                                foreach (Match SomeMatch in AllMatches)
                                {
                                    itemTable.Author = SomeMatch.Groups[1].Value;
                                }

                            }

                        }
                    }

                }
            }
        }
Пример #2
0
        //Scan for rom
        private void Button_Click_24(object sender, RoutedEventArgs e)
        {
            SevennZipVP sz = new SevennZipVP();
            string vpTable;
            string fpTable;
            string p = string.Empty;
            var s = Pinxsystem.ElementAt(comboBox_syslist.SelectedIndex);

            if (s.SysName == "Visual Pinball" || s.SysName == "Future Pinball")
            {
                foreach (var item in tables_grid.SelectedItems)
                {
                    var itemTable = item as Table;
                    vpTable = itemTable.Name + ".vpt";
                    fpTable = itemTable.Name + ".fpt";
                    if (s.SysName == "Visual Pinball")
                        p = System.IO.Path.Combine(s.TablePath, vpTable);
                    else if (s.SysName == "Future Pinball")
                        p = System.IO.Path.Combine(s.TablePath, fpTable);

                    p = "\"" + p + "\"";
                    sz.GetTableInfo(p, itemTable.Name, s.SysName, "Rom");
                    string line = null;
                    itemTable.Rom = string.Empty;

                    if (s.SysName == "Visual Pinball")
                    {
                        //cGameName.*= "(\w+)"
                        if (File.Exists("GameData"))
                        {
                            System.IO.StreamReader file = new System.IO.StreamReader("GameData", Encoding.UTF8);
                            line = file.ReadLine();
                            if (line != null || line != string.Empty)
                            {
                                file.Close();
                                file = new System.IO.StreamReader("GameData", Encoding.UTF8);
                                line = file.ReadToEnd();

                                //var myRegex = new Regex(@"Const cGameName.*= *""(\w+)""");
                                var myRegex = new Regex(@"cGameName *= *""(\w+)""");
                                //Const cGameName= *"(\w+)"

                                MatchCollection AllMatches = myRegex.Matches(line);
                                foreach (Match SomeMatch in AllMatches)
                                {
                                    itemTable.Rom = SomeMatch.Groups[1].Value;
                                }

                                if (itemTable.Rom == string.Empty)
                                {
                                    //  myRegex = new Regex(@"GameName.=""(\w+)""");
                                    myRegex = new Regex(@"Const RomSet1 = ""(\w+)""");
                                    AllMatches = myRegex.Matches(line);
                                    foreach (Match SomeMatch in AllMatches)
                                    {
                                        itemTable.Rom = SomeMatch.Groups[1].Value;
                                    }

                                }
                                if (itemTable.Rom == string.Empty)
                                {
                                    //  myRegex = new Regex(@"GameName.=""(\w+)""");
                                    myRegex = new Regex(@"Const Romset1.*=.*""(\w+)""");
                                    AllMatches = myRegex.Matches(line);
                                    foreach (Match SomeMatch in AllMatches)
                                    {
                                        itemTable.Rom = SomeMatch.Groups[1].Value;
                                    }

                                }
                                if (itemTable.Rom == string.Empty)
                                {
                                    //  myRegex = new Regex(@"GameName.=""(\w+)""");
                                    myRegex = new Regex(@"Const RS1.*=.*""(\w+)""");
                                    AllMatches = myRegex.Matches(line);
                                    foreach (Match SomeMatch in AllMatches)
                                    {
                                        itemTable.Rom = SomeMatch.Groups[1].Value;
                                    }

                                }

                                if (itemTable.Rom == string.Empty)
                                {
                                    //  myRegex = new Regex(@"GameName.=""(\w+)""");
                                    myRegex = new Regex(@"GameName=""(\w+)""");
                                    AllMatches = myRegex.Matches(line);
                                    foreach (Match SomeMatch in AllMatches)
                                    {
                                        itemTable.Rom = SomeMatch.Groups[1].Value;
                                    }

                                }
                                if (itemTable.Rom == string.Empty)
                                {
                                    //  myRegex = new Regex(@"GameName.=""(\w+)""");
                                    myRegex = new Regex(@"GameName = ""(\w+)""");
                                    AllMatches = myRegex.Matches(line);
                                    foreach (Match SomeMatch in AllMatches)
                                    {
                                        itemTable.Rom = SomeMatch.Groups[1].Value;
                                    }

                                }
                                if (itemTable.Rom == string.Empty)
                                {
                                    //  myRegex = new Regex(@"GameName.=""(\w+)""");
                                    myRegex = new Regex(@"Const cGameName.*= ""(\w+)""");
                                    AllMatches = myRegex.Matches(line);
                                    foreach (Match SomeMatch in AllMatches)
                                    {
                                        itemTable.Rom = SomeMatch.Groups[1].Value;
                                    }

                                }

                                file.Close();
                            }
                        }
                    }

                }
            }
        }