Esempio n. 1
0
        public static void Write(TextWriter projWriter, FieldResearch.RewardEncounter pokemon, List <int> written)
        {
            if (written.Contains(pokemon.Key))
            {
                written.Remove(pokemon.Key);

                string encounterFileName = GetFileNameBase(pokemon);
                projWriter.WriteLine("    <!-- #region " + pokemon.name + " -->");

                // Add .xml as part of _datafiles
                projWriter.WriteLine("    <FixIntermediateFile Include=\"" + ProjXmlFolder + encounterFileName + ".xml\">");
                projWriter.WriteLine(@"      <Visible>true</Visible>");
                projWriter.WriteLine(@"    </FixIntermediateFile>");

                // Add .html.xml as DependentUpon .xsl
                projWriter.WriteLine("    <XslTransform  Include=\"" + srcFolder + encounterFileName + ".html.xml\">");
                projWriter.WriteLine(@"     <Visible>true</Visible>");
                projWriter.WriteLine(@"     <DependentUpon>encounter.xsl</DependentUpon>");
                projWriter.WriteLine(@"     <Dependencies>");
                projWriter.WriteLine(@"       js\global.js;");
                projWriter.WriteLine(@"       " + ProjXmlFolder + encounterFileName + ".xml;");
                projWriter.WriteLine(@"       " + srcFolder + @"index.css;");
                projWriter.WriteLine(@"       charts\research\index.css;");
                projWriter.WriteLine(@"       charts\index.css;");
                projWriter.WriteLine(@"       index.css;");
                projWriter.WriteLine(@"     </Dependencies>");
                projWriter.WriteLine(@"     <OutputFileName>" + encounterFileName + ".html</OutputFileName>");
                projWriter.WriteLine(@"    </XslTransform>");

                projWriter.WriteLine("    <!-- #endregion " + pokemon.name + " -->");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Write out an Encounter chart for the specified Pokemon, if it hasn't already been written.
        /// </summary>
        /// <param name="_research"></param>
        /// <param name="updateDateTime"></param>
        /// <param name="written"></param>
        /// <returns></returns>
        public static bool Write(FieldResearch.RewardEncounter pokemon, DateTime updateDateTime, List <int> written)
        {
            bool upToDate = true;

            if (!written.Contains(pokemon.Key))
            {
                upToDate = WriteEncounter(pokemon, updateDateTime) && upToDate;
                written.Add(pokemon.Key);
            }

            return(upToDate);
        }
Esempio n. 3
0
        /// <summary>
        /// Write out a single RaidBoss XML file if necessary, then return the text that should be included in the .proj file.
        /// </summary>
        /// <param name="raidboss"></param>
        /// <returns>The text that should be included in the .proj file</returns>
        private static bool WriteEncounter(FieldResearch.RewardEncounter pokemon, DateTime updateDateTime)
        {
            bool     upToDate          = true;
            string   encounterFileName = GetFileNameBase(pokemon);
            string   filePath          = Path.Combine(OutputXmlFolder, encounterFileName + ".xml");
            DateTime lastUpdated       = Utils.GetLastUpdated(filePath);

            if (!File.Exists(filePath) || lastUpdated < updateDateTime)
            {
                Utils.WriteXML(new Encounter(pokemon, Utils.GetEncounterPossibilities(pokemon.PokemonTranslator, 15), updateDateTime), filePath);
                upToDate = false;
            }

            string htmlFilePath = Path.Combine(HtmlFileFolder, encounterFileName + ".html.xml");

            if (!File.Exists(htmlFilePath))
            {
                using (TextWriter htmlWriter = new StreamWriter(htmlFilePath))
                {
                    htmlWriter.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                    htmlWriter.WriteLine("<!DOCTYPE Root [");
                    htmlWriter.WriteLine("  <!ENTITY Constants SYSTEM \"/_datafiles/constants.xml\">");
                    htmlWriter.WriteLine("  <!ENTITY Settings SYSTEM \"/_datafiles/settings.xml\">");
                    htmlWriter.WriteLine("  <!ENTITY PokeSprites SYSTEM \"/_datafiles.manual/infrequent/pokemon.sprites.xml\">");
                    htmlWriter.WriteLine("  <!ENTITY Images SYSTEM \"/_datafiles.manual/infrequent/images.xml\">");
                    htmlWriter.WriteLine("  <!ENTITY PokeStats SYSTEM \"/_datafiles/pokestats.gen" + PokeFormulas.GetGeneration(pokemon.id) + ".xml\">");
                    htmlWriter.WriteLine("  <!ENTITY Encounter SYSTEM \"/_datafiles/encounter/" + encounterFileName + ".xml\">");
                    htmlWriter.WriteLine("]>");
                    htmlWriter.WriteLine("<?xml-stylesheet type=\"text/xsl\" href=\"encounter.xsl\" output=\"" + encounterFileName + ".html\"?>");
                    htmlWriter.WriteLine("<Root xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
                    htmlWriter.WriteLine("  &Constants; ");
                    htmlWriter.WriteLine("  &Settings;");
                    htmlWriter.WriteLine("  &PokeSprites;");
                    htmlWriter.WriteLine("  &Images;");
                    htmlWriter.WriteLine("  &PokeStats;");
                    htmlWriter.WriteLine("  &Encounter;");
                    htmlWriter.WriteLine("</Root> ");
                }

                upToDate = false;
            }

            return(upToDate);
        }