Exemple #1
0
        /*public bool Host_DaysToExpire(SciterElement el, SciterValue[] args, out SciterValue result)
         * {
         *      result = new SciterValue(Ion.Ion.DaysToExpire);
         *      return true;
         * }*/

        public bool Host_GenerateSVGSprite(SciterElement el, SciterValue[] args, out SciterValue result)
        {
            string sv_outputpath = args[0].Get("");
            var    sv_icons      = args[1];

            sv_icons.Isolate();

            var xml = new SvgSpriteXML();

            foreach (var item in sv_icons.Keys)
            {
                string hash = item.Get("");
                if (!Joiner._iconsByHash.ContainsKey(hash))
                {
                    continue;
                }
                var icon = Joiner._iconsByHash[hash];
                icon.id = sv_icons[hash].Get("");
                xml.AddIcon(icon);
            }
            File.WriteAllText(sv_outputpath, xml.ToXML());

            result = null;
            return(true);
        }
Exemple #2
0
        public void Host_GenerateSVGSprite(SciterValue[] args)
        {
            string sv_outputpath = args[0].Get("");

            if (!Directory.Exists(Path.GetDirectoryName(sv_outputpath)))
            {
                return;
            }

            var sv_icons = args[1];

            sv_icons.Isolate();

            var xml = new SvgSpriteXML();

            foreach (var item in sv_icons.Keys)
            {
                string hash = item.Get("");
                if (!Joiner._iconsByHash.ContainsKey(hash))
                {
                    continue;
                }
                var icon = Joiner._iconsByHash[hash];
                icon.id = sv_icons[hash].Get("");
                xml.AddIcon(icon);
            }
            File.WriteAllText(sv_outputpath, xml.ToXML());
        }
Exemple #3
0
        public void Host_GenerateSVGSprite(SciterValue[] args)
        {
            var sv_icons = args[0];

            sv_icons.Isolate();

            var xml    = new SvgSpriteXML();
            var hashes = sv_icons.Keys;

            foreach (var item in hashes)
            {
                string hash = item.Get("");
                if (!Joiner._iconsByHash.ContainsKey(hash))
                {
                    continue;
                }
                var icon = Joiner._iconsByHash[hash];
                icon.id = sv_icons[hash].Get("");

                if (icon.EnsureIsLoaded())
                {
                    xml.AddIcon(icon);
                }
            }

            string svg_outputpath = args[1].Get("");
            string dir            = Path.GetDirectoryName(svg_outputpath);

            if (!Directory.Exists(dir))
            {
                App.AppWnd.ShowMessageBox("Could not create the SVG sprite files for this project because the output directory doesn't exists: " + svg_outputpath, Consts.AppName);
                return;
            }

            // save icon-sprites.json
            File.WriteAllText(svg_outputpath, xml.ToXML());
        }