Show / Hide Table of Contents

    Class Util

    A class to hold a variety of helper utilities

    Inheritance
    Object
    Util
    Namespace: RCM
    Assembly: Anki.Resources.SDK.dll
    Syntax
    public static class Util

    Properties

    AssemblyDirectory

    The path of the executing assembly.

    Declaration
    public static string AssemblyDirectory { get; }
    Property Value
    Type Description
    String

    The path of the executing assembly.

    Remarks

    https://stackoverflow.com/questions/52797/how-do-i-get-the-path-of-the-assembly-the-code-is-in

    Methods

    BuildNameToRelativePathXref(String, String)

    A helper to go from partial file name to the full file name

    Declaration
    public static Dictionary<string, string> BuildNameToRelativePathXref(string path, string extension = "json")
    Parameters
    Type Name Description
    String path

    The path to search within

    String extension

    The file name extension (defualt is json)

    Returns
    Type Description
    Dictionary<String, String>

    The dictionary mapping the partial file names to the path

    ImageOpen(String)

    Open a bitmap image at the given path

    Declaration
    public static Bitmap ImageOpen(string imagePath)
    Parameters
    Type Name Description
    String imagePath

    The path to the image file.

    Returns
    Type Description
    Bitmap

    The bitmap image

    JsonToNormal(JsonElement)

    Converts the JSON element to a C# object

    Declaration
    public static object JsonToNormal(JsonElement item)
    Parameters
    Type Name Description
    JsonElement item

    The JSON element

    Returns
    Type Description
    Object

    The new thing

    NumberOfBitsSet(UInt32)

    Counts the number of bits set

    Declaration
    public static uint NumberOfBitsSet(uint value)
    Parameters
    Type Name Description
    UInt32 value

    The value to count bits in

    Returns
    Type Description
    UInt32

    The number of bits set

    RemoveBasePath(String, String)

    This is use to remove the base path from the full path

    Declaration
    public static string RemoveBasePath(string basePath, string path)
    Parameters
    Type Name Description
    String basePath

    The path that should be removed

    String path

    The path that is to be modified

    Returns
    Type Description
    String

    The resulting path

    Tag(String)

    Map a 4-character tag string to the UInt32 form

    Declaration
    public static uint Tag(string tagStr)
    Parameters
    Type Name Description
    String tagStr

    The 4 character tag string

    Returns
    Type Description
    UInt32

    The representation as a machine word

    ToDict(Dictionary<String, Object>)

    Convert the JSON to a dictionary to an array of strings

    Declaration
    public static Dictionary<string, object> ToDict(Dictionary<string, object> jsonDictionary)
    Parameters
    Type Name Description
    Dictionary<String, Object> jsonDictionary

    The dictionary of JSON elements

    Returns
    Type Description
    Dictionary<String, Object>

    The dictionary

    ToDict(JsonElement)

    Convert the JSON element to an a dictionary

    Declaration
    public static Dictionary<string, object> ToDict(JsonElement jsonDictionary)
    Parameters
    Type Name Description
    JsonElement jsonDictionary

    The JSON element

    Returns
    Type Description
    Dictionary<String, Object>

    The dictionary

    Back to top Copyright (c) 2020 by Randall Maas