Skip to content

Commit

Permalink
Reverting a BIG mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
alyral authored Jul 6, 2021
1 parent cef6e35 commit a3f4fd7
Showing 1 changed file with 9 additions and 52 deletions.
61 changes: 9 additions & 52 deletions Werewolf for Telegram/Database/AchievementsReworked.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//Rextester.Program.Main is the entry point for your code. Don't change it.
//Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354)

using System;
using System.Collections;
using System.Collections.Generic;
Expand All @@ -9,56 +6,10 @@
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Rextester
namespace Database
{
public class Program
{
public static void Main(string[] args)
{
//Your code goes here
var useXml = false;
var achvs = Enum.GetValues(typeof(AchievementsReworked)).Cast<AchievementsReworked>().ToList();
var text = "Result:";
foreach (var achv in achvs)
{
text += Environment.NewLine;
if (!useXml)
{
text += Environment.NewLine;
}
text += GetResult(achv, useXml);
}
Console.WriteLine(text);
}
public static string GetResult(AchievementsReworked a, bool useXml)
{
string name = a.GetName();
string name_string = a.GetName(false);
string descr = a.GetDescription();
string descr_string = a.GetDescription(false);
if (useXml)
{
// Lines
var string_key_name = $" <string key=\"{name_string}\">";
var string_key_descr = $" <string key=\"{descr_string}\">";
var string_closure = $" </string>";
var string_value_name = $" <value>{name}</value>";
var string_value_descr = $" <value>{descr}</value>";
var n = Environment.NewLine;
// Strings
var rTxt = string_key_name + n + string_value_name + n + string_closure + n;
rTxt += string_key_descr + n + string_value_descr + n + string_closure;
return rTxt;
}
else
{
return $"{name_string}: {name}{Environment.NewLine}{descr_string}: {descr}";
}
}
}
public enum AchievementsReworked
{
[Display(Name = "None"), Description("You haven't played a game yet!")]
Expand Down Expand Up @@ -272,7 +223,10 @@ public static string GetDescription(this AchievementsReworked value, bool text =
return value.ToString();
}
else
return $"Achievement{value.ToString()}Descr";
{
var achvId = (int)value;
return $"Achievement{achvId.ToString()}Descr";
}
}
public static string GetName(this AchievementsReworked value, bool text = true)
{
Expand All @@ -287,7 +241,10 @@ public static string GetName(this AchievementsReworked value, bool text = true)
return (descriptionAttributes.Length > 0) ? descriptionAttributes[0].Name : value.ToString();
}
else
return $"Achievement{value.ToString()}Name";
{
var achvId = (int)value;
return $"Achievement{achvId.ToString()}Name";
}
}

public static byte[] ToByteArray(this BitArray bits)
Expand Down

0 comments on commit a3f4fd7

Please sign in to comment.