ProjectExtensions (MethodExtensions)
static class · namespace z3n7 · source MethodExtensions/DictionaryExtensions.cs, MethodExtensions/ListExtentions.cs, MethodExtensions/StringExtentions.cs
public static class ProjectExtensions
Other parts of this type: ProjectExtensions (Accounts), ProjectExtensions (Browser), ProjectExtensions (Diagnostic), ProjectExtensions (Essentials), ProjectExtensions (Mail), ProjectExtensions (Reports), ProjectExtensions (Requests), ProjectExtensions (Traffic)
Extension methods: dictionaries and ZennoPoster lists.
Methods
DicToVars
public static void DicToVars(this Dictionary<string, string> dict, IZennoPosterProjectModel project)
Extension method for Dictionary<string, string>. source
Sets a project variable for every key of the dictionary.
ListFromFile
public static List<string> ListFromFile(this IZennoPosterProjectModel project, string listName, string fileName)
Extension method for IZennoPosterProjectModel. source
Replaces the content of a ZennoPoster list with the lines of a file.
| Parameter | Description |
|---|---|
listName |
Project list name. |
fileName |
File to read. |
Returns: The lines.
ListSync
public static List<string> ListSync(this IZennoPosterProjectModel project, string listName)
Extension method for IZennoPosterProjectModel. source
Copies a ZennoPoster list into a new List<string>.
public static List<string> ListSync(this IZennoPosterProjectModel project, string listName, List<string> localList)
Extension method for IZennoPosterProjectModel. source
Replaces the content of a ZennoPoster list with localList.
Returns: localList.
RndFromList
public static string RndFromList(this IZennoPosterProjectModel project, string listName, bool remove = false)
Extension method for IZennoPosterProjectModel. source
Returns a random line of a ZennoPoster list.
| Parameter | Description |
|---|---|
listName |
Project list name. |
remove |
Also remove it from the project list. |
ToJson
public static void ToJson(this IZennoPosterProjectModel project, string json, bool thrw = false, int objIndex = 1)
Extension method for IZennoPosterProjectModel. source
Loads JSON into project.Json. When the text is not JSON, takes the line starting with {objIndex}: and loads the rest of it. Failures are logged as warnings.
| Parameter | Description |
|---|---|
json |
JSON text, or numbered lines of JSON. |
thrw |
Throw when the second attempt also fails. |
objIndex |
Line number prefix to look for. |