예제 #1
0
        public static void UseGFX(GFXConfig config)
        {
            string path = EnviromentManager.TMP_GFXConfig;

            ToXml(path, config);

            int timeout = 0;

            while (IsGFXLocked() && timeout < 10)
            {
                timeout++;
                System.Threading.Thread.Sleep(1000);
            }
            if (timeout > 9)
            {
                throw new System.Exception("GFX file is locked. Make sure that all game instances are launched correctly.");
            }

            if (!File.Exists(path))
            {
                MessageBox.Show("GFX Setting could not be created! Please check GFX settings!");
            }
            if (File.Exists(path))
            {
                if (File.Exists(EnviromentManager.GwClientXmlPath))
                {
                    File.Delete(EnviromentManager.TMP_BackupGFXConfig);
                    File.Move(EnviromentManager.GwClientXmlPath, EnviromentManager.TMP_BackupGFXConfig);
                }
                File.Move(path, EnviromentManager.GwClientXmlPath);
            }
        }
예제 #2
0
        public static string[] ToXml(string dest, GFXConfig GFXConfig)
        {
            //ToDo: Add Resolution Option and Gamma Slider
            List <string> XmlFormat = new List <string>();

            XmlFormat.AddRange(GetHeader());
            foreach (GFXOption option in GFXConfig.Config)
            {
                XmlFormat.AddRange(option.ToXml());
            }

            XmlFormat.AddRange(GetFoot());
            System.IO.File.WriteAllLines(dest, XmlFormat);
            return(XmlFormat.ToArray());
        }
예제 #3
0
        public static void SaveFile(GFXConfig Config)
        {
            SaveFileDialog savediag = new System.Windows.Forms.SaveFileDialog();

            savediag.DefaultExt       = ".xml";
            savediag.Filter           = "XML Files(*.xml)|*.xml";
            savediag.Title            = "Saving GFX Settings";
            savediag.AddExtension     = true;
            savediag.FileName         = "GW2 Custom GFX";
            savediag.InitialDirectory = EnviromentManager.GwClientPath;
            savediag.ShowDialog();

            if (savediag.FileName != "")
            {
                ToXml(savediag.FileName, Config);
            }
        }
예제 #4
0
        public static void UseGFX(GFXConfig config)
        {
            string path = EnviromentManager.TMP_GFXConfig;

            ToXml(path, config);
            if (!File.Exists(path))
            {
                MessageBox.Show("GFX Setting could not be created! Please check GFX settings!");
            }
            if (File.Exists(path))
            {
                if (File.Exists(EnviromentManager.GwClientXmlPath))
                {
                    File.Delete(EnviromentManager.TMP_BackupGFXConfig);
                    File.Move(EnviromentManager.GwClientXmlPath, EnviromentManager.TMP_BackupGFXConfig);
                }
                File.Move(path, EnviromentManager.GwClientXmlPath);
            }
        }
예제 #5
0
        static public GFXConfig ReadFile(string path)
        {
            GFXConfig tmp_conf = new GFXConfig();
            var       xmlfile  = new XmlDocument();

            xmlfile.Load(path);
            foreach (XmlNode node in xmlfile.SelectNodes("//OPTION"))
            {
                GFXOption gfxoption = new GFXOption();
                gfxoption.Name = node.Attributes["Name"].Value;
                if (SkippedOptions.Contains <string>(gfxoption.Name))
                {
                    continue;
                }
                gfxoption.type       = node.Attributes["Type"].Value;
                gfxoption.Registered = node.Attributes["Registered"].Value == "True";
                gfxoption.Value      = node.Attributes["Value"].Value;
                gfxoption.OldValue   = gfxoption.Value;

                if (node.ChildNodes.Count == 0 && gfxoption.type == "Bool")
                {
                    gfxoption.Options.Add("true");
                    gfxoption.Options.Add("false");
                }

                foreach (XmlNode childnode in node.ChildNodes)
                {
                    switch (childnode.Name)
                    {
                    default: break;

                    case "ENUM":
                        gfxoption.Options.Add(childnode.Attributes["EnumValue"].Value);
                        break;
                    }
                }

                tmp_conf.Config.Add(gfxoption);
            }
            return(tmp_conf);
        }
예제 #6
0
 public static void OverwriteGFX(GFXConfig config)
 {
     ToXml(EnviromentManager.GwClientXmlPath, config);
 }