Jump to content

Gwendalin

Members
  • Posts

    94
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Gwendalin

  1. Gwendalin

    Speed question

    yeah, let me clean it up a little for you... I'm working on v2 so i have a lot of stuff that is working but slow commented out trying to upgrade it.
  2. Gwendalin

    Speed question

    yeah, This takes about 30 seconds var cloneInfo = lbXML .Descendants("Game") .Where(x => (string)x.Element("ID").Value == element.Element("GameID").Value) .Select(x => (x.Element("Title").Value)).ToArray(); //name = cloneInfo.First(); ------------------------------------------------------------------------------------------------------------------------------ this takes about 3 minutes var cloneInfo = lbXML .Descendants("Game") .Where(x => (string)x.Element("ID").Value == element.Element("GameID").Value) .Select(x => (x.Element("Title").Value)).ToArray(); name = cloneInfo.First();
  3. Gwendalin

    Speed question

    Thanks Joyce... unfortunately it is still slow when assigning name. var cloneInfo = lbXML .Descendants("Game") .Where(x => (string)x.Element("ID").Value == element.Element("GameID").Value) .Select(x => (x.Element("Title").Value)).ToArray(); name = cloneInfo.First();
  4. Gwendalin

    Speed question

    Why does assigning this variable significantly slow my program down? If i have the name = cloneinfo.element line commented out the program completes in under a minute. When i enable the line it takes like 2 - minutes to complete. Shouldn't the value be read into memory already when it is assigned to clone info? i'm just reassigning it to a different variable name. var cloneInfo = lbXML .Descendants("Game") .Where(x => (string)x.Element("ID").Value == element.Element("GameID").Value) .Select(x => (x.Element("Title").Value)); name = cloneInfo.ElementAt(0);
  5. I saw it. It actually wasn't that bad, and i went in expecting it to be a train wreck! There were a few typical bad parts as with any video game movie, but on a whole it was surprisingly ok. Jim Carrey was obnoxious at fist and seemed to be stuck with his old routine, but i think he found his stride later in the movie. Don't expect too much from the movie and go in expecting a fun popcorn movie and you will probably enjoy it.
  6. This is where eggnog comes from! Don't listen to Marshy's lies! Panda I think i have new found love for you... Pumpkin spice is vile too!
  7. So this time I secretly stalked Crest at one of his festivals he was going to a while back. Embedded Video Link I present to you all Crest in the wild!
  8. It's been a while... enjoy this scary trip to the 80's.
  9. I finally got it working!!! Well at least 98% working I need to work on how it renames my clones. Right now i add the parent name to the clone followed by the version, but that is not correct for some clones that truly do have a different name, so now it shows as a misname. BUT the actual function of the program is working. I also got my filter working so it will not display any of the checked items. I'm so excited... i haven't programmed anything in a really long time, and even then i never completed my programs. This is my first actual working program!!! Here is a screen shot of it. The red box means that I'm missing that rom... If it is a clone i display the parent so i know where to find the game to add it. If i dont have any info in the Mame fields that means that Mame removed the rom, or changed the name of the rom, and i need to remove it from my front end. All i have to do is fix my names, and maybe get creative and clean up some of the interface, have the cells be the correct size for what is displayed, or add some options like change the color of the highlighted cells. Im really excited because I actually figured out how to read two different XML files and compare the data when they are so different. This is what a game and clone looks like in my front end xml. A clone is considered an additional application. This is what a game and clone looks like in mame. The clone looks like the parent, but it has an extra attirbute. if anyone is interested here is my code. YES it is very ugly, and not optimized, but maybe i can get cleaned up later.
  10. i tried this, and it was randomly changing the text to green. i would mess with the [4,2] values, and nothing would change so i was getting discouraged. this.dgMissingSystems[4, 2].Style.ForeColor = Color.ForestGreen; so far this worked, and i was able to change cell numbers and it worked. Now to get it to pull the cell numbers dynamically. I think i can get it. i do have to start with 0 to get the first cell. this.dgMissingSystems[1, 1].Style.BackColor = System.Drawing.Color.Red;  Ok... i think i was just getting tunnel vision, and because my forecolor worked once i kind of stopped paying attention during my testing. The reason it wasn't showing was because there was no text to change. oh i also had this... so i was dancing around the answer... this.dgMissingSystems.Rows[dgMissingSystems.Rows.Count].Cells[1].Style.BackColor = Color.Red; Ok i got it semi working now.... Now my problem is it is only keeping one cell highlighted. I know another cell should be red, but only one is. not sure whats going on... the yellow box, and one above it should be red as well. Nevermind... i'm a ditz, and had my numbers backwards! i think its working now! Thanks Marsh!
  11. I got farther... but now I'm starting to hit the wall. I got my data displaying from both xml files. If i have data showing in one column but not the other that means it is either missing or named wrong. I want to make it more clear by marking the wrong cell, but i cant figure out how to change a single cell's background. I have tried many different options. Also I'm trying to break up the program into functions, but i have trouble with scope. For instance I got my filter to work. It checks one xml document and gets the genre of the game, and blocks it from populating. I'm trying to make a global xml variable so i only have to load it once, but i can't get it to be read in any other section of the code. i'm going to keep working at it... I'll be more detailed if i need help. Anyways here is what the program looks like so far. Its ugly, but it is mostly working. The Mame columns are reading from my mame.xml, and the LB columns are reading from my lB.xml. if there is a rom in Mame but not in LB it will have a blank field. If the name is different in LB from Mame it will list both roms names, and i will need to update my LB frontend. If there is a field empty in the mame columns that means that it is an old entry and needs to be deleted from the front end. Here is my code so far... its messy i know. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Xml.Linq; using System.Text.RegularExpressions; namespace Mame_Check { public partial class Form1 : Form { Dictionary<string, Machines> dictMame = new Dictionary<string, Machines>(); Dictionary<string, Machines> dictLB = new Dictionary<string, Machines>(); public Form1() { InitializeComponent(); btnSearch.Enabled = false; //if (btnSearch.Enabled == true) { LoadXml(); } } private void LoadXml() { XElement mameXML = XElement.Load(tbMamexml.Text); XElement launchboxXML = XElement.Load(tbLBXML.Text); IEnumerable<XElement> mame = mameXML.Elements(); IEnumerable<XElement> lb = launchboxXML.Elements(); //Read LaunchBox XML foreach (var lbSystem in lb) { try { Machines machine = new Machines(); machine.Name = lbSystem.Element("Title").Value + " " + lbSystem.Element("Version").Value; machine.Rom = System.IO.Path.GetFileNameWithoutExtension(lbSystem.Element("ApplicationPath").Value); machine.Genre = lbSystem.Element("Genre").Value; var clones = from nm in launchboxXML.Elements("AdditionalApplication") where (string)nm.Element("GameID") == lbSystem.Element("ID").Value select nm; if (machine.CloneOf == null && this.clbFIlter.CheckedItems.Contains(machine.Genre) == false) { dictLB.Add(machine.Rom, machine); } foreach (var clone in clones) { Machines cmachine = new Machines(); cmachine.Name = lbSystem.Element("Title").Value + " " + clone.Element("Name").Value; cmachine.Rom = System.IO.Path.GetFileNameWithoutExtension(clone.Element("ApplicationPath").Value); cmachine.Name = Regex.Replace(cmachine.Name, @"Play ", ""); cmachine.Name = Regex.Replace(cmachine.Name, @" Version...", ""); cmachine.CloneOf = machine.Name; cmachine.Genre = machine.Genre; if (this.clbFIlter.CheckedItems.Contains(cmachine.Genre) == false) { dictLB.Add(cmachine.Rom, cmachine); } } } catch { } } //Read Mame XML foreach (var mSystem in mame) { try { Machines machine = new Machines(); machine.Name = mSystem.Element("description").Value; machine.Rom = mSystem.Attribute("name").Value; //Clones if (null != mSystem.Attribute("cloneof") && this.clbFIlter.CheckedItems.Contains(machine.Genre) == false) { machine.CloneOf = mSystem.Attribute("cloneof").Value; } if (this.clbFIlter.CheckedItems.Contains(machine.Genre) == false) { dictMame.Add(machine.Rom, machine); } } catch { } } } private void LoadListBox() { XElement launchboxXML = XElement.Load(tbLBXML.Text); IEnumerable<XElement> lb = launchboxXML.Elements(); //Load listcheck box foreach (var lbSystem in lb) { try { string genre; genre = lbSystem.Element("Genre").Value; if (this.clbFIlter.Items.Contains(genre) != true) { this.clbFIlter.Items.Add(genre); } } catch { } } } private void BtnSearch_Click(object sender, EventArgs e) { LoadXml(); //Check Mame systems foreach (KeyValuePair<string, Machines> item in dictMame) { string key = item.Key; try { //If system is a parent if (item.Value.CloneOf == null) { //If parent is in Mame, but not in LaunchBox if (dictLB.ContainsKey(key) != true) { //this.dgMissingSystems.Rows[dgMissingSystems.Rows.Count].Cells[1].Style.BackColor = Color.Red; this.dgMissingSystems.Rows.Add(item.Value.Name, item.Value.Rom, "", "", "", "", "", ""); } else { //Parent is Named differently than in LaunchBox if (item.Value.Name != dictLB[key].Name) { this.dgMissingSystems.Rows.Add(item.Value.Name, item.Value.Rom, "", "", dictLB[key].Name, dictLB[key].Rom, "", ""); } } } else //If system is a clone { //If clone is in Mame, but not in LaunchBox if (dictLB.ContainsKey(item.Key) != true) { this.dgMissingSystems.Rows.Add(item.Value.CloneOf, "", item.Value.Name, item.Value.Rom, "", "", "", ""); } else { //If clone is Named differently than in LaunchBox if (item.Value.Name != dictLB[key].Name) { this.dgMissingSystems.Rows.Add(item.Value.CloneOf, "", item.Value.Name, item.Value.Rom, dictLB[key].CloneOf, "", dictLB[key].Name, dictLB[key].Rom); } } //dgMissingSystems[4, 2].Style.ForeColor = Color.ForestGreen; } } catch { } } //check LaunchBox systems foreach (KeyValuePair<string, Machines> item in dictLB) { try { //If system is a parent if (item.Value.CloneOf == null) { //If parent is in LaunchBox, but not Mame if (dictMame.ContainsKey(item.Key) != true) { this.dgMissingSystems.Rows.Add("", "", "", "", item.Value.Name, item.Value.Rom, "", ""); } } else //If system is a clone { //If clone is in LaunchBox, but not in Mame if (dictMame.ContainsKey(item.Key) != true) { this.dgMissingSystems.Rows.Add("", "", "", "", item.Value.CloneOf, "", item.Value.Name, item.Value.Rom); } } } catch { } } } private void BtnMameBrowse_Click(object sender, EventArgs e) { DialogResult result = openFileDialogMame.ShowDialog(); if (result == DialogResult.OK) { tbMamexml.Text = openFileDialogMame.FileName; if (tbMamexml.Text != "" && tbLBXML.Text != "") { btnSearch.Enabled = true; } } } private void BtnLBBrowse_Click(object sender, EventArgs e) { DialogResult result = openFileDialogLB.ShowDialog(); if (result == DialogResult.OK) { tbLBXML.Text = openFileDialogLB.FileName; LoadListBox(); if (tbMamexml.Text != "" && tbLBXML.Text != "") { btnSearch.Enabled = true; } } } } }
  12. WOO HOOO I'm getting there... this is all populated on its own from reading my xml file. Now i just have to compare the data to the other xml file, and have it display only the info that is different or missing. I'm excited... i have not programed anything in a really long time! Thanks Phenom, and Marsh for your guidance!
  13. Ok here is another upate to hopefully show what i'm trying to do. Mame lists out all of its games files, and a bunch of stuff i dont care about in an XML file. My frontend Launchbox stores all of its info in an xml file as well but does not have the same information tags so i can't do a straight comparison. I want to be able to see what i have in my front end compared to that mame has. I am able to go through both xml files and pull the data i need from each, as an individual variable. Now i need to store them in an array or list or something so i can go through and compare the individual files, and then display what is different or missing. i need to get my individual data into this data grid after sorting, but i'm not sure the best way to store the individual data first. i just typed this data in for an example... right now the button is the only thing working, and it just reads the xml files, and shows a message box of the individual variable.
  14. Ok everything is working properly at least from my xml side. Now i'm just not sure how to list everything in one big list. XElement root = XElement.Load(@"C:\source\repos\WindowsFormsApp1\WindowsFormsApp1\test.xml"); IEnumerable < XElement > games = root.Elements(); foreach (var game in games) { try { string pName = game.Element("Title").Value + " " + game.Element("Version").Value; string pRom = System.IO.Path.GetFileNameWithoutExtension(game.Element("ApplicationPath").Value); var clones = from nm in root.Elements("AdditionalApplication") where (string)nm.Element("GameID") == game.Element("ID").Value select nm; if (clones.Any() == false) { MessageBox.Show("Parent: " + pName + " Rom: " + pRom); } try { foreach (var clone in clones) { string cName = clone.Element("Name").Value; string cRom = System.IO.Path.GetFileNameWithoutExtension(clone.Element("ApplicationPath").Value); cName = Regex.Replace(cName, @"Play ", ""); cName = Regex.Replace(cName, @" Version...", ""); MessageBox.Show("Parent: " + pName + " Rom: " + pRom + "\n" + "Clone: " + cName + " Rom: " + cRom); } } catch { } } catch { }
  15. What i'm trying to do is make a program that will let me know what i'm missing from my front end when I update Mame. The front end is not reliable when importing new roms so i have to do it manually, and since Mame changes things frequently it is a pain. there is not always a parent - clone relationship. sometimes it will be just a parent. Sometimes the parent can have multiple clones or just one clone. I want my program to basically look like this... but i'm going to have it only display what is different in my lists. As you can see there are different amounts of clones (they call them orphans), and not all have clones (above the first parent). This is what i have so far, and it is showing correct data, but i have to step through it each time. I'm just not sure how to get all the individual data listed at the same time. XElement root = XElement.Load(@"C:\source\repos\WindowsFormsApp1\WindowsFormsApp1\test.xml"); IEnumerable < XElement > games = root.Elements(); foreach (var game in games) { try { string pName = game.Element("Title").Value + " " + game.Element("Version").Value; string pRom = System.IO.Path.GetFileNameWithoutExtension(game.Element("ApplicationPath").Value); var clone = from nm in root.Elements("AdditionalApplication") where (string)nm.Element("GameID") == game.Element("ID").Value select nm; MessageBox.Show("Parent: " + pName + " Rom: " + pRom); try { foreach (var game2 in clone) { string cName = game2.Element("Name").Value; string cRom = System.IO.Path.GetFileNameWithoutExtension(game2.Element("ApplicationPath").Value); MessageBox.Show("Parent: " + pName + " Rom: " + pRom + "\n" + " " + "Clone: " + cName + " Rom: " + cRom); } } catch { } }
  16. I figured out how to read the xml and pull the data i need. Now i'm not sure the best way to display it. What should i use to feed my data into to display it? This is what i'm looking to do. Should i load everything into a list... dataset...something else? parent name | version | file name clone name | version | file name parent name | version | file name etc....
  17. Is anyone good at XML and C#? Would anyone be able to help or create a program to read and compare xml documents?
  18. Check out my enclosed ecosystem. Hopefully it works. I have 2 cherry shrimps, a blue rainbow shrimp, and an aminbo or something like that shrimp. he's clear. You can see my two cherry shrimps in this pic. Here is the other side Here you can see the blue shrimp on the moss ball in the back. The clear shrimp is to the left of the cherry shrimp in the front. Blue shrimp and cherry shrimp on moss ball on the right.
  19. In my latest expose'... I hacked Panda's company's CCTV, and bring you another view of our elusive Panda.
  20. What if you just run instersect in vr desktop. I have a vive but i have never used vr desktop, nor looked into its capabilities, but i think it displays your desktop in vr space if i'm not mistaken. As for cardboard box... if you are going to go vr do it right!
  21. Tell me that you adore me!

    1. Damian666

      Damian666

      I don't, I love you mistress :p

    2. AccurateNoodle
×
×
  • Create New...