示例#1
0
        public ExternalLrcInfo[] LookupLrc(string Title, string Artist)
        {
            lock (host)
            {
                try
                {
                    host.SetContextOnCurrentThread();
                    host.CallFunction("lookupLrc", Title, Artist);

                    var lrcs = api.GetLrcs();
                    for (int i = 0; i < lrcs.Length; i++)
                    {
                        lrcs[i].Source = Name;
                    }
                    return(lrcs);
                }
                catch
                {
                    //ignore
                    return(ExternalLrcInfo.EmptyArray);
                }
                finally
                {
                    host.RemoveContextOnCurrentThread();
                }
            }
        }
示例#2
0
 public JsDownloadSource(string jsContent, string name, bool debug = false, string debugSource = "")
 {
     host = new ChakraHost(debug, false);
     host.ProjectNamespace("Windows.Data.Xml.Dom");
     host.ProjectNamespace("Windows.Networking");
     host.ProjectNamespace("Windows.Web");
     host.ProjectNamespace("LightLrcComponent");
     host.ProjectObjectToGlobal(xml, "xmlhttp");
     host.ProjectObjectToGlobal(api, "api");
     host.RunScript(jsContent, debugSource);
     host.RemoveContextOnCurrentThread();
     Name = name;
 }