コード例 #1
0
        /**
         * Modifies the UT2settings.cfg file.
         */
        protected bool ModifyUT2Settings(System.Timers.Timer timer)
        {
            string file = FilesHandler.GetApplicationDataPath() + @"\Flight One Software\Ultimate Traffic 2\UT2settings.cfg";

            if (!File.Exists(file))
            {
                return(false);
            }

            List <string> fileContent    = Helper.GetTextFileContent(file);
            List <string> newFileContent = new List <string>();

            string newLine = "FSX Location=" + migrateTarget.GetSimPath();

            foreach (string line in fileContent)
            {
                if (!line.Contains("FSX Location"))
                {
                    newFileContent.Add(line);
                    continue;
                }

                if (line.Equals(newLine))
                {
                    timer.Stop();

                    try
                    {
                        timers.Remove(timer);
                    }
                    catch (Exception)
                    {
                    }

                    return(true);
                }
            }

            newFileContent.Add(newLine);

            Helper.SetTextFileContent(file, newFileContent);

            return(true);
        }
コード例 #2
0
 /**
  * Returns the full application data path if the getFullPath parameter is set to true.
  */
 public string GetAppDataPath(bool getFullPath)
 {
     return((getFullPath ? FilesHandler.GetApplicationDataPath() + "\\" : "") + this.appDataPath);
 }