AlphaTab.Collections.StringBuilder.AppendChar C# (CSharp) Method

AppendChar() public method

public AppendChar ( int i ) : void
i int
return void
        public void AppendChar(int i)
        {
            _sb.Append(Std.StringFromCharCode(i));
        }

Usage Example

Example #1
0
        public byte[] LoadBinary(string path)
        {
            var xhr = new XMLHttpRequest();
            xhr.open("GET", path, false);
            xhr.responseType = "arraybuffer";

            if (xhr.responseType != "arraybuffer")
            {
                // use VB Loader to load binary array
                dynamic vbArr = VbAjaxLoader("GET", path);
                var fileContents = vbArr.toArray();

                // decode byte array to string
                var data = new StringBuilder();
                var i = 0;
                while (i < (fileContents.length - 1))
                {
                    data.AppendChar((char)(fileContents[i]));
                    i++;
                }

                var reader = GetBytesFromString(data.ToString());
                return reader;
            }

            xhr.send();

            if (xhr.status == 200)
            {
                var reader = NewUint8Array(xhr.response);
                return reader;
            }
            // Error handling
            if (xhr.status == 0)
            {
                throw new FileLoadException("You are offline!!\n Please Check Your Network.");
            }
            if (xhr.status == 404)
            {
                throw new FileLoadException("Requested URL not found.");
            }
            if (xhr.status == 500)
            {
                throw new FileLoadException("Internel Server Error.");
            }
            if (xhr.statusText == "parsererror")
            {
                throw new FileLoadException("Error.\nParsing JSON Request failed.");
            }
            if (xhr.statusText == "timeout")
            {
                throw new FileLoadException("Request Time out.");
            }
            throw new FileLoadException("Unknow Error: " + xhr.responseText);
        }
All Usage Examples Of AlphaTab.Collections.StringBuilder::AppendChar