-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathChatMessages.cs
117 lines (101 loc) · 3.42 KB
/
ChatMessages.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Text.RegularExpressions;
using AceCreator;
namespace AceCreator
{
public class ChatMessages
{
public static Collection<Regex> WeenieGetInfo = new Collection<Regex>();
public static Collection<Regex> ExportFiles = new Collection<Regex>();
public static Collection<Regex> MyLocations = new Collection<Regex>();
public static Collection<Regex> MyLandblock = new Collection<Regex>();
public static Collection<Regex> ParentGUID = new Collection<Regex>();
public ChatMessages()
{
// Weenie WCID
WeenieGetInfo.Add(new Regex("^GUID:.*"));
ExportFiles.Add(new Regex("^Exported.*"));
MyLocations.Add(new Regex("^Your location is:.*"));
MyLandblock.Add(new Regex("^CurrentLandblock:.*"));
ParentGUID.Add(new Regex("^GUID:.*"));
}
public static bool GetWeenieInfo(string text, out string wcid, out string guid)
{
foreach (Regex regex in WeenieGetInfo)
{
if (regex.IsMatch(text))
{
// Util.WriteToChat("CapGroup1= " + RegExGroup(@"WeenieClassId: (.*)", text));
wcid = RegExGroup(@"WeenieClassId: (.*)", text);
guid = RegExGroup("^GUID: (.*)", text);
return true;
}
}
wcid = "False";
guid = "False";
return false;
}
public static bool LogMyLocations(string text, out string location)
{
foreach (Regex regex in MyLocations)
{
if (regex.IsMatch(text))
{
location = RegExGroup("^Your location is: (.*)", text);
return true;
}
}
location = "False";
return false;
}
public static bool GetCurrentLandblock(string text, out string landblock)
{
foreach (Regex regex in MyLandblock)
{
if (regex.IsMatch(text))
{
landblock = RegExGroup("^CurrentLandblock: (.*)", text);
return true;
}
}
landblock = "False";
return false;
}
public static bool GetParentGUID(string text, out string guid)
{
foreach (Regex regex in MyLandblock)
{
if (regex.IsMatch(text))
{
guid = RegExGroup("^GUID: (.*)", text);
return true;
}
}
guid = "False";
return false;
}
public static string RegExGroup(string pattern, string text)
{
Regex r = new Regex(pattern, RegexOptions.IgnoreCase);
// match the regex pattern against string
Match m = r.Match(text);
Group g = m.Groups[1];
string mystring = g.Value;
return mystring;
}
public static bool FileExport(string text)
{
foreach (Regex regex in ExportFiles)
{
if (regex.IsMatch(text))
{
return true;
}
}
return false;
}
}
}