Jump to content

Gwendalin

Members
  • Posts

    94
  • Joined

  • Last visited

  • Days Won

    2

Gwendalin last won the day on May 18 2019

Gwendalin had the most liked content!

2 Followers

Profile Information

  • Gender
    Female
  • Location
    In the back of your mind whispering dirty things

Recent Profile Visitors

4,660 profile views

Gwendalin's Achievements

  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!
×
×
  • Create New...