Skip to content

Commit a3f4fd7

Browse files
authored
Reverting a BIG mistake
1 parent cef6e35 commit a3f4fd7

1 file changed

Lines changed: 9 additions & 52 deletions

File tree

Werewolf for Telegram/Database/AchievementsReworked.cs

Lines changed: 9 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//Rextester.Program.Main is the entry point for your code. Don't change it.
2-
//Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354)
3-
41
using System;
52
using System.Collections;
63
using System.Collections.Generic;
@@ -9,56 +6,10 @@
96
using System.Linq;
107
using System.Reflection;
118
using System.Text;
12-
using System.Text.RegularExpressions;
139
using System.Threading.Tasks;
1410

15-
namespace Rextester
11+
namespace Database
1612
{
17-
public class Program
18-
{
19-
public static void Main(string[] args)
20-
{
21-
//Your code goes here
22-
var useXml = false;
23-
var achvs = Enum.GetValues(typeof(AchievementsReworked)).Cast<AchievementsReworked>().ToList();
24-
var text = "Result:";
25-
foreach (var achv in achvs)
26-
{
27-
text += Environment.NewLine;
28-
if (!useXml)
29-
{
30-
text += Environment.NewLine;
31-
}
32-
text += GetResult(achv, useXml);
33-
}
34-
Console.WriteLine(text);
35-
}
36-
public static string GetResult(AchievementsReworked a, bool useXml)
37-
{
38-
string name = a.GetName();
39-
string name_string = a.GetName(false);
40-
string descr = a.GetDescription();
41-
string descr_string = a.GetDescription(false);
42-
if (useXml)
43-
{
44-
// Lines
45-
var string_key_name = $" <string key=\"{name_string}\">";
46-
var string_key_descr = $" <string key=\"{descr_string}\">";
47-
var string_closure = $" </string>";
48-
var string_value_name = $" <value>{name}</value>";
49-
var string_value_descr = $" <value>{descr}</value>";
50-
var n = Environment.NewLine;
51-
// Strings
52-
var rTxt = string_key_name + n + string_value_name + n + string_closure + n;
53-
rTxt += string_key_descr + n + string_value_descr + n + string_closure;
54-
return rTxt;
55-
}
56-
else
57-
{
58-
return $"{name_string}: {name}{Environment.NewLine}{descr_string}: {descr}";
59-
}
60-
}
61-
}
6213
public enum AchievementsReworked
6314
{
6415
[Display(Name = "None"), Description("You haven't played a game yet!")]
@@ -272,7 +223,10 @@ public static string GetDescription(this AchievementsReworked value, bool text =
272223
return value.ToString();
273224
}
274225
else
275-
return $"Achievement{value.ToString()}Descr";
226+
{
227+
var achvId = (int)value;
228+
return $"Achievement{achvId.ToString()}Descr";
229+
}
276230
}
277231
public static string GetName(this AchievementsReworked value, bool text = true)
278232
{
@@ -287,7 +241,10 @@ public static string GetName(this AchievementsReworked value, bool text = true)
287241
return (descriptionAttributes.Length > 0) ? descriptionAttributes[0].Name : value.ToString();
288242
}
289243
else
290-
return $"Achievement{value.ToString()}Name";
244+
{
245+
var achvId = (int)value;
246+
return $"Achievement{achvId.ToString()}Name";
247+
}
291248
}
292249

293250
public static byte[] ToByteArray(this BitArray bits)

0 commit comments

Comments
 (0)