Class DomainList
Namespace: OmiyaGames.Cryptography
Assembly: cs.temp.dll.dll
Syntax
public class DomainList : ScriptableObject, ICollection<string>, IEnumerable<string>, IEnumerable
Remarks
Copyright (c) 2016-2020 Omiya Games Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Revision | Description |
---|---|
Version: 0.0.0-preview.1 Date: 5/14/2016 Author: Taro Omiya | Initial verison. |
Version: 0.2.0-preview.1 Date: 4/27/2020 Author: Taro Omiya | Converting to package. |
Version: 0.2.2-preview.1 Date: 5/19/2020 Author: Taro Omiya | Fixing license documentation to be more DocFX friendly. |
Properties
Count
The number of domains stored.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
IsReadOnly
Always returns true.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
Boolean |
Item[Int32]
Gets and sets a string in this list.
Declaration
public string this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Property Value
Type | Description |
---|---|
String |
Methods
Add(String)
NOT implemented.
Declaration
public void Add(string item)
Parameters
Type | Name | Description |
---|---|---|
String | item |
Clear()
NOT implemented.
Declaration
public void Clear()
Contains(String)
Checks if a string is in the DomainList.
Declaration
public bool Contains(string item)
Parameters
Type | Name | Description |
---|---|---|
String | item | String to search for. |
Returns
Type | Description |
---|---|
Boolean | True if item is in the DomainList. |
ConvertToRegex(String, StringBuilder)
Converts a string used to match a domain to a case-insensitive, single-line regular expression. Supports '' (matches any string) and '?' (matches any single character) wildcards, e.g. ".google.com" and "?.google.com"
Declaration
public static Regex ConvertToRegex(string domainString, StringBuilder buf = null)
Parameters
Type | Name | Description |
---|---|---|
String | domainString | A one-line string to match a domain. |
StringBuilder | buf | A StringBuilder to use as cache; its content will be completely replaced. If set to null, this function creates a new StringBuilder. |
Returns
Type | Description |
---|---|
Regex | New |
CopyTo(String[], Int32)
Copies the string domains into another array.
Declaration
public void CopyTo(string[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
String[] | array | Array to copy to. |
Int32 | arrayIndex | Index to start copying from in array. |
Decrypt(DomainList, StringCryptographer)
Decrypts a DomainList into a string array.
Declaration
public static string[] Decrypt(DomainList domainList, StringCryptographer decrypter = null)
Parameters
Type | Name | Description |
---|---|---|
DomainList | domainList | The DomainList to decrypt. |
StringCryptographer | decrypter | The cryptographer to decrypt the DomainList |
Returns
Type | Description |
---|---|
String[] | Decrypted list of domains. |
Decrypt(DomainList, StringCryptographer, ref List<Regex>)
Clears a List<T>, then populates it with decrypted
Declaration
public static void Decrypt(DomainList domainList, StringCryptographer decrypter, ref List<Regex> regularExpressions)
Parameters
Type | Name | Description |
---|---|---|
DomainList | domainList | The DomainList to decrypt. |
StringCryptographer | decrypter | The cryptographer to decrypt the DomainList Can be set to null, in which case the content of domainList will be converted to |
List<Regex> | regularExpressions | List<T> that gets populated with domain-matching |
See Also
Decrypt(DomainList, StringCryptographer, ref List<String>)
Clears a List<T>, then populates it with decrypted strings from a DomainList.
Declaration
public static void Decrypt(DomainList domainList, StringCryptographer decrypter, ref List<string> decryptedDomains)
Parameters
Type | Name | Description |
---|---|---|
DomainList | domainList | The DomainList to decrypt. |
StringCryptographer | decrypter | The cryptographer to decrypt the DomainList. Can be set to null, in which case the content of domainList is copied over directly. |
List<String> | decryptedDomains | List<T> that gets populated with decrypted strings. |
Generate(String, IList<String>, StringCryptographer)
Constructs a new DomainList.
Declaration
public static DomainList Generate(string name, IList<string> allDomains, StringCryptographer encrypter = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the asset. |
IList<String> | allDomains | List of unencrypted strings to store in the asset. |
StringCryptographer | encrypter | An optional cryptographer that encrypts allDomains. |
Returns
Type | Description |
---|---|
DomainList | A mew DomainList. |
Get(AssetBundle, String)
Loads an asset from
Declaration
public static DomainList Get(AssetBundle bundle, string assetNameNoFileExtension = null)
Parameters
Type | Name | Description |
---|---|---|
AssetBundle | bundle | Reference to an asset bundle. |
String | assetNameNoFileExtension | (Optional) A name to a file in an asset bundle. If none is provided, the first file is converted. |
Returns
Type | Description |
---|---|
DomainList | If successful, a loaded DomainList asset. Otherwise, null. |
GetEnumerator()
Provides an enumerator to go through each string entry in the list.
Declaration
public IEnumerator<string> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<String> |
Remove(String)
NOT implemented.
Declaration
public bool Remove(string item)
Parameters
Type | Name | Description |
---|---|---|
String | item |
Returns
Type | Description |
---|---|
Boolean |