Show / Hide Table of Contents

Class BlockBase

A generic block used to process information in RuriLib.

Inheritance
System.Object
ViewModelBase
BlockBase
BlockBypassCF
BlockCaptcha
BlockFunction
BlockKeycheck
BlockLSCode
BlockParse
BlockRequest
BlockTCP
BlockUtility
SBlockBrowserAction
SBlockElementAction
SBlockExecuteJS
SBlockNavigate
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
ViewModelBase.PropertyChanged
ViewModelBase.OnPropertyChanged(String)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: RuriLib
Assembly: RuriLib.dll
Syntax
public abstract class BlockBase : ViewModelBase, INotifyPropertyChanged

Properties

| Improve this Doc View Source

Disabled

Whether the block should be skipped or processed.

Declaration
public bool Disabled { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsCaptcha

Whether the block is a captcha-related block.

Declaration
[JsonIgnore]
public bool IsCaptcha { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsSelenium

Whether the block is a selenium-related block.

Declaration
[JsonIgnore]
public bool IsSelenium { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Label

The label of the block.

Declaration
public string Label { get; set; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

FromLS(List<String>)

Builds a block from multiple lines of LoliScript code.

Declaration
public virtual BlockBase FromLS(List<string> lines)
Parameters
Type Name Description
System.Collections.Generic.List<System.String> lines

The lines of LoliScript code

Returns
Type Description
BlockBase

The parsed block object

| Improve this Doc View Source

FromLS(String)

Builds a block from a line of LoliScript code.

Declaration
public virtual BlockBase FromLS(string line)
Parameters
Type Name Description
System.String line

The line of LoliScript code

Returns
Type Description
BlockBase

The parsed block object

| Improve this Doc View Source

GetFirstAvailableFileName(String, String, String)

Gets the first available name in the given folder by incrementing a number at the end of the filename.

Declaration
public static string GetFirstAvailableFileName(string basePath, string fileName, string extension)
Parameters
Type Name Description
System.String basePath

The path to the folder

System.String fileName

The name of the file without numbers at the end

System.String extension

The extension of the file

Returns
Type Description
System.String

The first available filename (including extension)

| Improve this Doc View Source

InsertVariables(BotData, Boolean, Boolean, List<String>, String, String, String)

Adds a single or list variable with the given value.

Declaration
public static void InsertVariables(BotData data, bool isCapture, bool recursive, List<string> values, string variableName, string prefix, string suffix)
Parameters
Type Name Description
BotData data

The BotData used for variable replacement and insertion

System.Boolean isCapture

Whether the variable should be marked for Capture

System.Boolean recursive

Whether the variable to add should be a list or a single value

System.Collections.Generic.List<System.String> values

The list of values. In case recursive is set to false, only the first value of the list will be taken.

System.String variableName

The name of the variable to create

System.String prefix

The string to add at the start of the value

System.String suffix

The string to add at the end of the value

| Improve this Doc View Source

MakeValidFileName(String, Boolean)

Fixes the filename to be compatible with the filesystem indicization.

Declaration
public static string MakeValidFileName(string name, bool underscore = true)
Parameters
Type Name Description
System.String name

The name of the file

System.Boolean underscore

Whether to replace the unallowed characters with an underscore instead of removing them

Returns
Type Description
System.String

The valid filename ready to be saved to disk

| Improve this Doc View Source

ParseArguments(String, Char, Char)

Parses an argument between two bracket delimiters.

Declaration
public static List<string> ParseArguments(string input, char delimL, char delimR)
Parameters
Type Name Description
System.String input

The string to parse the argument from

System.Char delimL

The left bracket delimiter

System.Char delimR

The right bracket delimiter

Returns
Type Description
System.Collections.Generic.List<System.String>

The argument between the delimiters

| Improve this Doc View Source

Process(BotData)

Executes the actual block logic.

Declaration
public virtual void Process(BotData data)
Parameters
Type Name Description
BotData data

The BotData needed for variable replacement

| Improve this Doc View Source

ReplaceValues(String, BotData)

Replaces variables in a given input string.

Declaration
public static string ReplaceValues(string input, BotData data)
Parameters
Type Name Description
System.String input

The string to replace variables into

BotData data

The BotData needed for variable replacement

Returns
Type Description
System.String

The string where variables have been replaced

| Improve this Doc View Source

ReplaceValuesRecursive(String, BotData)

Replaces variables recursively, expanding lists or dictionaries with jolly indices.

Declaration
public static List<string> ReplaceValuesRecursive(string input, BotData data)
Parameters
Type Name Description
System.String input

The string to replace variables into

BotData data

The BotData needed for variable replacement

Returns
Type Description
System.Collections.Generic.List<System.String>

An array of values obtained replacing the original input with each of the possible values of the first List or Dictionary variable found

| Improve this Doc View Source

SaveScreenshot(Screenshot, BotData)

Saves a Selenium screenshot to a file with automatically generated name.

Declaration
public static void SaveScreenshot(Screenshot screenshot, BotData data)
Parameters
Type Name Description
OpenQA.Selenium.Screenshot screenshot

The Selenium screenshot

BotData data

The BotData used for path creation

| Improve this Doc View Source

SaveScreenshot(Bitmap, BotData)

Saves a screenshot to a file with automatically generated name.

Declaration
public static void SaveScreenshot(Bitmap screenshot, BotData data)
Parameters
Type Name Description
System.Drawing.Bitmap screenshot

The bitmap image

BotData data

The BotData used for path creation

| Improve this Doc View Source

ToLS(Boolean)

Converts the block to LoliScript code.

Declaration
public virtual string ToLS(bool indent = true)
Parameters
Type Name Description
System.Boolean indent
Returns
Type Description
System.String
| Improve this Doc View Source

TruncatePretty(String, Int32)

Truncates a string to fit a given size and adds ' [...]' (5 characters) at the end to display that the string would be longer.

Declaration
public static string TruncatePretty(string input, int max)
Parameters
Type Name Description
System.String input

The string to truncate

System.Int32 max

The maximum length of the string

Returns
Type Description
System.String

The truncated string, or the same string if its length was not exceeding the maximum size

| Improve this Doc View Source

UpdateSeleniumData(BotData)

Updates the ADDRESS and SOURCE variables basing on the selenium-driven browser's URL bar and page source.

Declaration
public static void UpdateSeleniumData(BotData data)
Parameters
Type Name Description
BotData data

The BotData containing the driver and the variables

Implements

System.ComponentModel.INotifyPropertyChanged
  • Improve this Doc
  • View Source
Back to top Generated by DocFX