Esempio n. 1
0
 /***********************************************************************************************
  * ApplyData / 2015-08-14 / Wethospu                                                           *
  *                                                                                             *
  * Replaces ID_CATEGORIES, ID_PATHS, ID_TAGS and ID_RACES with relevant html.                  *
  *                                                                                             *
  ***********************************************************************************************/
 private static void ApplyData(string file, DataCollector dungeonData)
 {
     var fileName = Constants.DataOutput + file.Replace(Constants.DataOtherRaw, "");
       var dirName = Path.GetDirectoryName(fileName);
       if (dirName != null)
     Directory.CreateDirectory(dirName);
       var lines = File.ReadAllLines(file, Constants.Encoding);
       Helper.CurrentFile = file;
       var toSave = new StringBuilder();
       toSave.Append(Constants.InitialdataHtml);
       for (var row = 0; row < lines.Length; row++)
       {
     var line = lines[row];
     if (Constants.IsRelease)
       line = line.Trim(new char[] { '\t', ' ' });
     // Ignore comments on release mode. / 2015-10-10 / Wethospu
     if (Constants.IsRelease && line.StartsWith("//"))
       continue;
     // Ignore empty lines.
     if (line == "")
       continue;
     Helper.InitializeWarningSystem(row + 1, line);
     // Ignore whitespace.
     if (string.IsNullOrWhiteSpace(line))
       continue;
     if (line.Contains("ID_PATHS"))
       line = line.Replace("ID_PATHS", dungeonData.GenerateDungeonHtml());
     if (line.Contains("ID_RACES"))
       line = line.Replace("ID_RACES", dungeonData.GenerateRaceHtml());
     if (line.Contains("ID_RANKS"))
       line = line.Replace("ID_RANKS", dungeonData.GenerateRankHtml());
     if (line.Contains("ID_TAGS"))
       line = line.Replace("ID_TAGS", dungeonData.GenerateTagHtml());
     if (line.Contains("ID_EFFECT_TAGS"))
       line = line.Replace("ID_EFFECT_TAGS", dungeonData.GenerateEffectTagHtml());
     toSave.Append(line).Append(Constants.ForcedLineEnding);
       }
       // Save file.
       File.WriteAllText(fileName, toSave.ToString());
 }
Esempio n. 2
0
 /// <summary>
 /// Replaces strings ID_CATEGORIES, ID_PATHS, ID_TAGS and ID_RACES with relevant html.
 /// </summary>
 private static void ApplyData(string file, DataCollector dungeonData)
 {
     var fileName = Constants.DataOutput + file.Replace(Constants.DataOtherRaw, "");
       var dirName = Path.GetDirectoryName(fileName);
       if (dirName != null)
     Directory.CreateDirectory(dirName);
       var lines = File.ReadAllLines(file, Constants.Encoding);
       ErrorHandler.CurrentFile = file;
       var toSave = new StringBuilder();
       toSave.Append(Constants.InitialdataHtml);
       for (var row = 0; row < lines.Length; row++)
       {
     var line = lines[row];
     if (Constants.IsRelease)
       line = line.Trim(new char[] { '\t', ' ' });
     // Ignore comments on release mode to reduce file size.
     if (Constants.IsRelease && line.StartsWith("//"))
       continue;
     // Ignore empty lines to reduce file size.
     if (line == "")
       continue;
     ErrorHandler.InitializeWarningSystem(row + 1, line);
     // Ignore whitespace to reduce file size.
     if (string.IsNullOrWhiteSpace(line))
       continue;
     line = line.Replace("ID_PATHS", dungeonData.GenerateInstanceHtml());
     line = line.Replace("ID_RACES", dungeonData.GenerateRaceHtml());
     line = line.Replace("ID_RANKS", dungeonData.GenerateRankHtml());
     line = line.Replace("ID_TAGS", dungeonData.GenerateTagHtml());
     line = line.Replace("ID_EFFECT_TAGS", dungeonData.GenerateEffectTagHtml());
     line = line.Replace("PATH_ICON", Constants.WebsiteIconLocation);
     line = line.Replace("PATH_MEDIA", Constants.WebsiteMediaLocation);
     line = line.Replace("PATH_THUMB_BIG", Constants.WebsiteThumbBigLocation);
     line = line.Replace("PATH_THUMB_SMALL", Constants.WebsiteThumbSmallLocation);
     toSave.Append(line).Append(Constants.ForcedLineEnding);
       }
       // Save file.
       File.WriteAllText(fileName, toSave.ToString());
 }