Skip to content

Commit 850341b

Browse files
Update WebForms.cs
1 parent cf16513 commit 850341b

File tree

1 file changed

+71
-3
lines changed

1 file changed

+71
-3
lines changed

class/WebForms.cs

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,23 @@ public class WebForms
1212
public void AddValue(string InputPlace, string Value) => WebFormsData.Add("av" + InputPlace, Value);
1313
public void AddClass(string InputPlace, string Class) => WebFormsData.Add("ac" + InputPlace, Class);
1414
public void AddStyle(string InputPlace, string Style) => WebFormsData.Add("as" + InputPlace, Style);
15+
public void AddStyle(string InputPlace, string Name, string Value) => WebFormsData.Add("as" + InputPlace, Name + ':' + Value);
1516
public void AddOptionTag(string InputPlace, string Text, string Value, bool Selected = false) => WebFormsData.Add("ao" + InputPlace, Value + '|' + Text + (Selected? "|1" : ""));
1617
public void AddCheckBoxTag(string InputPlace, string Text, string Value, bool Checked = false) => WebFormsData.Add("ak" + InputPlace, Value + '|' + Text + (Checked ? "|1" : ""));
1718
public void AddTitle(string InputPlace, string Title) => WebFormsData.Add("al" + InputPlace, Title);
1819
public void AddText(string InputPlace, string Text) => WebFormsData.Add("at" + InputPlace, Text.Replace('\n'.ToString(), "$[ln];"));
20+
public void AddTextToUp(string InputPlace, string Text) => WebFormsData.Add("pt" + InputPlace, Text.Replace('\n'.ToString(), "$[ln];"));
1921
public void AddAttribute(string InputPlace, string Attribute, string Value = "") => WebFormsData.Add("aa" + InputPlace, Attribute + '|' + Value);
2022
public void AddTag(string InputPlace, string TagName, string Id = "") => WebFormsData.Add("nt" + InputPlace, TagName + (!string.IsNullOrEmpty(Id) ? '|' + Id : ""));
23+
public void AddTagToUp(string InputPlace, string TagName, string Id = "") => WebFormsData.Add("ut" + InputPlace, TagName + (!string.IsNullOrEmpty(Id) ? '|' + Id : ""));
2124

2225
// Set
2326
public void SetId(string InputPlace, string Id) => WebFormsData.Add("si" + InputPlace, Id);
2427
public void SetName(string InputPlace, string Name) => WebFormsData.Add("sn" + InputPlace, Name);
2528
public void SetValue(string InputPlace, string Value) => WebFormsData.Add("sv" + InputPlace, Value);
2629
public void SetClass(string InputPlace, string Class) => WebFormsData.Add("sc" + InputPlace, Class);
2730
public void SetStyle(string InputPlace, string Style) => WebFormsData.Add("ss" + InputPlace, Style);
31+
public void SetStyle(string InputPlace, string Name, string Value) => WebFormsData.Add("ss" + InputPlace, Name + ':' + Value);
2832
public void SetOptionTag(string InputPlace, string Text, string Value, bool Selected = false) => WebFormsData.Add("so" + InputPlace, Value + '|' + Text + (Selected ? "|1" : ""));
2933
public void SetChecked(string InputPlace, bool Checked = false) => WebFormsData.Add("sk" + InputPlace, Checked ? "1" : "0");
3034
public void SetCheckBoxTagToList(string InputPlace, string Text, string Value, bool Checked = false) => WebFormsData.Add("sk" + InputPlace, Value + '|' + Text + (Checked ? "|1" : ""));
@@ -42,6 +46,7 @@ public class WebForms
4246
public void InsertValue(string InputPlace, string Value) => WebFormsData.Add("iv" + InputPlace, Value);
4347
public void InsertClass(string InputPlace, string Class) => WebFormsData.Add("ic" + InputPlace, Class);
4448
public void InsertStyle(string InputPlace, string Style) => WebFormsData.Add("is" + InputPlace, Style);
49+
public void InsertStyle(string InputPlace, string Name, string Value) => WebFormsData.Add("is" + InputPlace, Name + ':' + Value);
4550
public void InsertOptionTag(string InputPlace, string Text, string Value, bool Selected = false) => WebFormsData.Add("io" + InputPlace, Value + '|' + Text + (Selected ? "|1" : ""));
4651
public void InsertCheckBoxTag(string InputPlace, string Text, string Value, bool Checked = false) => WebFormsData.Add("ik" + InputPlace, Value + '|' + Text + (Checked ? "|1" : ""));
4752
public void InsertTitle(string InputPlace, string Title) => WebFormsData.Add("il" + InputPlace, Title);
@@ -55,7 +60,9 @@ public class WebForms
5560
public void DeleteClass(string InputPlace, string ClassName) => WebFormsData.Add("dc" + InputPlace, ClassName);
5661
public void DeleteStyle(string InputPlace, string StyleName) => WebFormsData.Add("ds" + InputPlace, StyleName);
5762
public void DeleteOptionTag(string InputPlace, string Value) => WebFormsData.Add("do" + InputPlace, Value);
63+
public void DeleteAllOptionTag(string InputPlace) => WebFormsData.Add("do" + InputPlace, "*");
5864
public void DeleteCheckBoxTag(string InputPlace, string Value) => WebFormsData.Add("dk" + InputPlace, Value);
65+
public void DeleteAllCheckBoxTag(string InputPlace) => WebFormsData.Add("dk" + InputPlace, "*");
5966
public void DeleteTitle(string InputPlace) => WebFormsData.Add("dl" + InputPlace, "1");
6067
public void DeleteText(string InputPlace) => WebFormsData.Add("dt" + InputPlace, "1");
6168
public void DeleteAttribute(string InputPlace, string Attribute) => WebFormsData.Add("da" + InputPlace, Attribute);
@@ -72,6 +79,7 @@ public class WebForms
7279
public void SetTextAlign(string InputPlace, string Align) => WebFormsData.Add("ta" + InputPlace, Align);
7380
public void SetReadOnly(string InputPlace, bool ReadOnly) => WebFormsData.Add("sr" + InputPlace, ReadOnly ? "1" : "0");
7481
public void SetDisabled(string InputPlace, bool Disabled) => WebFormsData.Add("sd" + InputPlace, Disabled ? "1" : "0");
82+
public void SetFocus(string InputPlace, bool Focus) => WebFormsData.Add("sf" + InputPlace, Focus ? "1" : "0");
7583
public void SetMinLength(string InputPlace, int Length) => WebFormsData.Add("mn" + InputPlace, Length.ToString());
7684
public void SetMaxLength(string InputPlace, int Length) => WebFormsData.Add("mx" + InputPlace, Length.ToString());
7785
public void SetSelectedValue(string InputPlace, string Value) => WebFormsData.Add("ts" + InputPlace, Value);
@@ -80,6 +88,14 @@ public class WebForms
8088
public void SetCheckedIndex(string InputPlace, int Index, bool Selected) => WebFormsData.Add("ki" + InputPlace, Index.ToString() + "|" + (Selected ? "1" : "0"));
8189
public void CallScript(string ScriptText) => WebFormsData.Add("_" , ScriptText.Replace('\n'.ToString(), "$[ln];"));
8290
public void LoadUrl(string InputPlace, string Url) => WebFormsData.Add("lu" + InputPlace, Url);
91+
public void ChangeUrl(string Url) => WebFormsData.Add("cu", Url);
92+
public void RemoveSessionCache(string CacheKey) => WebFormsData.Add("rs", CacheKey);
93+
public void RemoveAllSessionCache() => WebFormsData.Add("rs", "*");
94+
public void RemoveCache(string CacheKey) => WebFormsData.Add("rd", CacheKey);
95+
public void RemoveAllCache() => WebFormsData.Add("rd", "*");
96+
public void SetSessionCache() => WebFormsData.Add("cs", "1");
97+
public void SetCache(int Second) => WebFormsData.Add("cd", Second.ToString());
98+
public void SetCache() => WebFormsData.Add("cd", "*");
8399

84100
// Increase
85101
public void IncreaseMinLength(string InputPlace, int Value) => WebFormsData.Add("+n" + InputPlace, Value.ToString());
@@ -97,6 +113,25 @@ public class WebForms
97113
public void DescreaseHeight(string InputPlace, int Value) => WebFormsData.Add("-h" + InputPlace, Value.ToString());
98114
public void DescreaseValue(string InputPlace, int Value) => WebFormsData.Add("-v" + InputPlace, Value.ToString());
99115

116+
// Save
117+
public void SaveId(string InputPlace, string Key = ".") => WebFormsData.Add("@gi" + InputPlace, Key);
118+
public void SaveName(string InputPlace, string Key = ".") => WebFormsData.Add("@gn" + InputPlace, Key);
119+
public void SaveValue(string InputPlace, string Key = ".") => WebFormsData.Add("@gv" + InputPlace, Key);
120+
public void SaveValueLength(string InputPlace, string Key = ".") => WebFormsData.Add("@ge" + InputPlace, Key);
121+
public void SaveClass(string InputPlace, string Key = ".") => WebFormsData.Add("@gc" + InputPlace, Key);
122+
public void SaveStyle(string InputPlace, string Key = ".") => WebFormsData.Add("@gs" + InputPlace, Key);
123+
public void SaveTitle(string InputPlace, string Key = ".") => WebFormsData.Add("@gl" + InputPlace, Key);
124+
public void SaveText(string InputPlace, string Key = ".") => WebFormsData.Add("@gt" + InputPlace, Key);
125+
public void SaveTextLength(string InputPlace, string Key = ".") => WebFormsData.Add("@gg" + InputPlace, Key);
126+
public void SaveAttribute(string InputPlace, string Attribute, string Key = ".") => WebFormsData.Add("@ga" + InputPlace, Key + '|' + Attribute);
127+
public void SaveWidth(string InputPlace, string Key = ".") => WebFormsData.Add("@gw" + InputPlace, Key);
128+
public void SaveHeight(string InputPlace, string Key = ".") => WebFormsData.Add("@gh" + InputPlace, Key);
129+
public void SaveReadOnly(string InputPlace, string Key = ".") => WebFormsData.Add("@gr" + InputPlace, Key);
130+
public void SaveSelectedIndex(string InputPlace, string Key = ".") => WebFormsData.Add("@gx" + InputPlace, Key);
131+
public void SaveTextAlign(string InputPlace, string Key = ".") => WebFormsData.Add("@ta" + InputPlace, Key);
132+
public void SaveNodeLength(string InputPlace, string Key = ".") => WebFormsData.Add("@nl" + InputPlace, Key);
133+
public void SaveVisible(string InputPlace, string Key = ".") => WebFormsData.Add("@vi" + InputPlace, Key);
134+
100135
// Pre Runner
101136
public void AssignDelay(float Second, int Index = -1)
102137
{
@@ -188,6 +223,16 @@ public string ExportToWebFormsTag(int Width, int Height, string src = null)
188223
{
189224
return ExportToWebFormsTag(Width.ToString() + "px", Height.ToString() + "px", src);
190225
}
226+
227+
public NameValueCollection ExportToNameValue()
228+
{
229+
return WebFormsData;
230+
}
231+
232+
public void AppendForm(WebForms form)
233+
{
234+
WebFormsData.AddList(form.ExportToNameValue().GetList());
235+
}
191236
}
192237

193238
public class InputPlace
@@ -203,6 +248,32 @@ public class InputPlace
203248
public static string QueryAll(string Query) => "[" + Query.Replace("=", "$[eq];");
204249
}
205250

251+
/// <summary>
252+
/// Do Not Add Any Data Before Or After It
253+
/// </summary>
254+
public class Fetch
255+
{
256+
public static string Random(int MaxValue) => "@mr" + MaxValue;
257+
public static string Random(int MinValue, int MaxValue) => "@mr" + MaxValue + "," + MinValue;
258+
public static string DateYear() => "@dy";
259+
public static string DateMonth() => "@dm";
260+
public static string DateDay() => "@dd";
261+
public static string DateHours() => "@dh";
262+
public static string Dateinutes() => "@di";
263+
public static string DateSeconds() => "@ds";
264+
public static string DateMilliseconds() => "@dl";
265+
public static string Session(string Key) => "@cs" + Key;
266+
public static string Session(string Key, string ReplaceValue) => "@cs" + Key + "," + ReplaceValue;
267+
public static string SessionAndRemove(string Key) => "@cl" + Key;
268+
public static string SessionAndRemove(string Key, string ReplaceValue) => "@cl" + Key + "," + ReplaceValue;
269+
public static string Saved(string Key = ".") => "@cl" + Key;
270+
public static string Cache(string Key) => "@cd" + Key;
271+
public static string Cache(string Key, string ReplaceValue) => "@cd" + Key + "," + ReplaceValue;
272+
public static string CacheAndRemove(string Key) => "@ct" + Key;
273+
public static string CacheAndRemove(string Key, string ReplaceValue) => "@ct" + Key + "," + ReplaceValue;
274+
public static string Script(string ScriptText) => "@_" + ScriptText.Replace('\n'.ToString(), "$[ln];");
275+
}
276+
206277
public static class ExtensionWebFormsMethods
207278
{
208279
/// <summary>
@@ -213,9 +284,6 @@ public static string AppendPlace(this string Text, string Value)
213284
if (Text.Length < 1)
214285
return Value;
215286

216-
if (Text[0] != '>')
217-
Text = '>' + Text;
218-
219287
return Text + "|" + Value;
220288
}
221289

0 commit comments

Comments
 (0)