Пример #1
0
        public void Callback(SteamUGCRequestUGCDetailsResult_t param, bool bIOFailure)
        {
            GameEvents.Twice_Second.UnregWithEvent(SteamUGCRequest);

            string Description = param.m_details.m_rgchDescription;

            if (!string.IsNullOrEmpty(Description))
            {
                using (StringReader Reader = new StringReader(Description))
                {
                    string         InputLine;
                    System.Version LatestVersion = null;

                    while ((InputLine = Reader.ReadLine()) != null)
                    {
                        if (InputLine.StartsWith("Mod latest version "))
                        {
                            LatestVersion = System.Version.Parse(InputLine.Remove(0, 18));
                            break;
                        }
                    }

                    if (LatestVersion != null && ModVersion.CompareTo(LatestVersion) == -1)
                    {
                        ModProblemOverwrite(ModName, MyModDirPath + "UpdateText", "New version released! v" + LatestVersion, false);
                    }
                }
            }
        }
Пример #2
0
        private static bool ProcessDumpFile()
        {
            string[]      InputLines;
            List <string> OutputList;

            Console.Write("Reading file \"" + _InputFileName + "\"...");
            try
            {
                InputLines = File.ReadAllLines(_InputFileName);
            }
            catch (Exception ex)
            {
                Console.WriteLine();
                Console.WriteLine("The input file \"" + _InputFileName + "\" cannot be read. " + ex.Message);
                return(false);
            }
            Console.WriteLine(" Done!");

            OutputList = new List <string>();
            bool OkToProcessLine = false;

            Console.Write("Processing dump file...");
            foreach (string InputLine in InputLines)
            {
                if (InputLine.StartsWith("******* ") == true)
                {
                    OkToProcessLine = true;
                }
                else if (OkToProcessLine == true)
                {
                    if (InputLine.Contains("$ =") == true ||
                        InputLine.Contains("$  =") == true)
                    {
                        OutputList.Add(InputLine);
                    }
                }
            }
            Console.WriteLine(" Done!");

            OutputList.Sort(); // Sort the list

            // Custom code to add to the end
            OutputList.Add("charset 2");
            OutputList.Add("*=$c000");

            Console.Write("Writing file \"" + _OutputFileName + "\"...");
            try
            {
                File.WriteAllLines(_OutputFileName, OutputList);
            }
            catch (Exception ex)
            {
                Console.WriteLine();
                Console.WriteLine("The output file \"" + _OutputFileName + "\" cannot be written. " + ex.Message);
                return(false);
            }
            Console.WriteLine(" Done!");

            return(true);
        }
Пример #3
0
        /// <summary>
        /// Reads a line from the instance CSV
        /// </summary>
        /// <returns>The fields in a List, ordered left-to-right in the order parsed, or null if: a) there is no more data, or
        /// b) the EOF string was encountered, or c) MaxRows were read
        /// </returns>
        public override List <string> ReadLine()
        {
            string        InputLine;
            List <string> Fields = null;

            while ((InputLine = NextLine()) != null)
            {
                ++TotLinesRead;
                TotBytesRead += InputLine.Length + 2; // CRLF
                if (SkipLines != 0)
                {
                    if (++LinesSkippedSoFar <= SkipLines)
                    {
                        continue;
                    }
                }
                if (RowsProcessed++ >= MaxRows)
                {
                    break;
                }
                if (HasEOFStr && InputLine.StartsWith(EOFStr))
                {
                    break;
                }
                Fields = Parser.SplitLine(InputLine, RemoveEmbeddedTabs);
                break;
            }
            return(Fields);
        }
Пример #4
0
        /// <summary>
        /// Reads a line from the file, splits it according to the file format, and returns the fields as a List of strings
        /// </summary>
        /// <exception cref="InvalidOperationException">if the file does not have a consistent format</exception>
        /// <returns>the fields as a List of strings</returns>

        public override List <string> ReadLine()
        {
            if (!IsParseable)
            {
                throw new InvalidOperationException("Attempt to read from a file that does not exhibit a consistent format");
            }
            string        InputLine;
            List <string> Fields = null;

            while ((InputLine = Rdr.ReadLine()) != null)
            {
                ++TotLinesRead;
                TotBytesRead += InputLine.Length + 2; // CRLF
                if (SkipLines != 0)
                {
                    if (++LinesSkippedSoFar <= SkipLines)
                    {
                        continue;
                    }
                }
                if (RowsProcessed++ >= MaxRows)
                {
                    break;
                }
                if (HasEOFStr && InputLine.StartsWith(EOFStr))
                {
                    break;
                }
                Fields = ParseLine(InputLine.Replace("\t", TabReplacementString).TrimEnd());
                break;
            }
            return(Fields);
        }