Append() public method

public Append ( object s ) : void
s object
return void
        public override void DoLayout()
        {
            base.DoLayout();
            if (Index == 0)
            {
                Staff.TopSpacing = 5;
                Staff.BottomSpacing = 4;
            }
            Height = Resources.WordsFont.Size;

            var endingsStrings = new StringBuilder();
            for (int i = 0, j = _endings.Count; i < j; i++)
            {
                endingsStrings.Append(_endings[i] + 1);
                endingsStrings.Append(". ");
            }
            _endingsString = endingsStrings.ToString();
        }
Beispiel #2
0
        public static void FillFromJson(Settings settings, dynamic json)
        {
            if (!json) return;
            if (Std.JsonExists(json, "scale")) settings.Scale = json.scale;
            if (Std.JsonExists(json, "width")) settings.Width = json.width;
            if (Std.JsonExists(json, "height")) settings.Height = json.height;
            if (Std.JsonExists(json, "engine")) settings.Engine = json.engine;
            if (Std.JsonExists(json, "stretchForce")) settings.StretchForce = json.stretchForce;
            if (Std.JsonExists(json, "forcePianoFingering")) settings.ForcePianoFingering = json.forcePianoFingering;

            if (Std.JsonExists(json, "atRoot"))
            {
                settings.ScriptFile = json.atRoot;
                // append script name
                if (!settings.ScriptFile.EndsWith(".js"))
                {
                    if (!settings.ScriptFile.EndsWith("/"))
                    {
                        settings.ScriptFile += "/";
                    }
                    settings.ScriptFile += "AlphaTab.js";
                }
                if (!settings.ScriptFile.StartsWith("http") && !settings.ScriptFile.StartsWith("https"))
                {
                    var root = new StringBuilder();
                    root.Append(HtmlContext.window.location.protocol);
                    root.Append("//");
                    root.Append(HtmlContext.window.location.hostname);
                    if (HtmlContext.window.location.port.As<bool>())
                    {
                        root.Append(":");
                        root.Append(HtmlContext.window.location.port);
                    }
                    root.Append(settings.ScriptFile);
                    settings.ScriptFile = root.ToString();
                }
            }
            else
            {
                settings.ScriptFile = Environment.ScriptFile;
            }

            if (Std.JsonExists(json, "layout"))
            {
                if (JsContext.@typeof(json.layout) == "string")
                {
                    settings.Layout.Mode = json.layout;
                }
                else
                {
                    if (json.layout.mode) settings.Layout.Mode = json.layout.mode;
                    if (json.layout.additionalSettings)
                    {
                        string[] keys = Std.JsonKeys(json.layout.additionalSettings);
                        foreach (var key in keys)
                        {
                            settings.Layout.AdditionalSettings[key] = json.layout.additionalSettings[key];
                        }
                    }
                }
            }

            if (Std.JsonExists(json, "staves"))
            {
                settings.Staves = new FastList<StaveSettings>();
                string[] keys = Std.JsonKeys(json.staves);
                foreach (var key in keys)
                {
                    var val = json.staves[key];
                    if (JsContext.@typeof(val) == "string")
                    {
                        settings.Staves.Add(new StaveSettings(val));
                    }
                    else
                    {
                        if (val.id)
                        {
                            var staveSettings = new StaveSettings(val.id);
                            if (val.additionalSettings)
                            {
                                string[] keys2 = Std.JsonKeys(val.additionalSettings);
                                foreach (var key2 in keys2)
                                {
                                    staveSettings.AdditionalSettings[key2] = val.additionalSettings[key2];
                                }
                            }
                            settings.Staves.Add(staveSettings);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public virtual void BeginRender(float width, float height)
        {
            Buffer = new StringBuilder();

            Buffer.Append("<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"");
            Buffer.Append(width);
            Buffer.Append("px\" height=\"");
            Buffer.Append(height);
            Buffer.Append("px\" class=\"alphaTabSurfaceSvg\">\n");
            _currentPath = new StringBuilder();
            _currentPathIsEmpty = true;
        }