Beispiel #1
0
 /// <summary>
 ///     Method that executes the other read methods.
 /// </summary>
 public void readFiles()
 {
     gInterpreter = new GraphicsInterpreter();
     readDirectory();
     readConfigFile();
     readInputFile();
     client.applyButton.Enabled = false;
     client.ChangedConfig       = false;
 }
 public GraphicsState(GraphicsInterpreter graphicsInterpreter)
 {
     this.GraphicsInterpreter = graphicsInterpreter;
 }
 public GraphicsState(GraphicsInterpreter graphicsInterpreter)
 {
     this.GraphicsInterpreter = graphicsInterpreter;
 }
Beispiel #4
0
        /// <summary>
        ///     Reads the each line of BmEngine and saves it to a string list.
        ///     Overwrites pre-existing file if it's not created by Launcher.
        ///     Initializes the GUI after every parameter has been read.
        /// </summary>
        private void readConfigFile()
        {
            // creates files if they don't exist
            if (!File.Exists(ConfigFile))
            {
                logger.Warn("readConfigFile - BmEngine not found at {0}. Generating it now.", ConfigFile);
                File.Create(ConfigFile).Dispose();
                using (StreamWriter file = new StreamWriter(ConfigFile))
                {
                    file.Write(BmEnginePremade);
                    logger.Debug("readConfigFile - generated BmEngine at: {0}", ConfigFile);
                }
            }

            if (!File.Exists(UserEngineFile))
            {
                logger.Warn("readConfigFile - UserEngine not found at {0}. Generating it now.", UserEngineFile);
                File.Create(UserEngineFile).Dispose();
                using (StreamWriter file = new StreamWriter(UserEngineFile))
                {
                    file.Write(UserEnginePremade);
                    logger.Debug("readConfigFile - generated UserEngine at: {0}", UserEngineFile);
                }
            }

            string[] confLines = File.ReadAllLines(ConfigFile);

            // if-condition only relevant if BmEngine was not created by the Launcher. Will overwrite existing file
            if (!confLines.Last().Equals("[Generated by Batman: Arkham Asylum - Advanced Launcher]"))
            {
                ConfigInfo.IsReadOnly     = false;
                UserEngineInfo.IsReadOnly = false;
                File.Delete(ConfigFile);
                using (StreamWriter file = new StreamWriter(ConfigFile))
                {
                    file.Write(BmEnginePremade);
                    ConfigInfo.IsReadOnly = true;
                }

                File.Delete(UserEngineFile);
                using (StreamWriter file = new StreamWriter(UserEngineFile))
                {
                    file.Write(UserEnginePremade);
                    UserEngineInfo.IsReadOnly = true;
                }

                logger.Debug(
                    "readConfigFile - Replacing BmEngine & UserEngine with custom made Advanced Launcher files.");
            }

            for (int i = 0; i < confLines.Length; i++)
            {
                ConfigList.Add(confLines[i]);
                if (i >= 1161 && i <= 1165)
                {
                    GraphicsInterpreter.checkIntro(confLines[i]);
                }

                if (i == 663 || (i >= 1108 && i <= 1133))
                {
                    GraphicsInterpreter.checkTex(confLines[i]);
                }

                if (i == LineInt)
                {
                    gInterpreter.interpretGraphics(confLines[i], true, LineInt);
                }
            }

            logger.Info("readConfigFile - processed BmEngine & UserEngine.");

            new GuiInitializer().init();
        }