Inheritance: IDisposable, INotifyPropertyChanged
Beispiel #1
0
        private void GetFromWebBrowser(IList <SongInfo> result, IList <WBResult> webPages)
        {
            App.Debug("Web");

            string title;
            Match  match;

            for (int i = 0; i < webPages.Count; ++i)
            {
                match = this.Regex.Match(webPages[i].Title);
                if (!match.Success)
                {
                    continue;
                }

                App.Debug("Match : " + webPages[i].ToString());

                title = match.Groups["title"].Value.Trim();
                if (!string.IsNullOrWhiteSpace(title))
                {
                    var si = new SongInfo(this);
                    si.Title = title;

                    if (webPages[i].Url != null && this.UrlRegex.IsMatch(webPages[i].Url))
                    {
                        si.Url = webPages[i].Url;
                    }

                    si.Handle  = webPages[i].Handle;
                    si.MainTab = webPages[i].MainTab;

                    IParseRule.AddToList(result, si);
                }
            }
        }
Beispiel #2
0
        private static bool AddToList(IList <SongInfo> result, SongInfo si)
        {
            IParseRule.GetTagsFromFile(si);

            if (!string.IsNullOrWhiteSpace(si.Title))
            {
                if (result != null)
                {
                    lock (result)
                        result.Add(si);
                }
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        private SongInfo GetFromPlayer(IList <SongInfo> result)
        {
            IntPtr hwnd = IntPtr.Zero;

            hwnd = this.GetWindowHandle(hwnd);
            if (hwnd == IntPtr.Zero)
            {
                return(null);
            }

            SongInfo si = new SongInfo(this);

            si.Handle = hwnd;

            // 파이프 : 성공시 return
            if ((this.ParseFlag & ParseFlags.Pipe) == ParseFlags.Pipe)
            {
                App.Debug("Pipe Parse");

                if (this.GetTagsFromPipe(si))
                {
                    if (IParseRule.AddToList(result, si))
                    {
                        return(si);
                    }
                }

                return(null);
            }

            // 추가 파싱 : 성공하면 Return
            if ((this.ParseFlag & ParseFlags.ManualParse) == ParseFlags.ManualParse)
            {
                App.Debug("Manual Parse");
                if (this.ParseManual(si, hwnd))
                {
                    if (IParseRule.AddToList(result, si))
                    {
                        return(si);
                    }
                }

                return(null);
            }

            // 핸들 체크 (윈도우가 여러개 감지되면 각각 따로 작업합니다)
            if ((this.ParseFlag & ParseFlags.Title) == ParseFlags.Title)
            {
                bool first = true;
                do
                {
                    App.Debug("Handle : {0} : 0x{1:X8}", this.WndClass, hwnd);

                    if (!first)
                    {
                        si        = new SongInfo(this);
                        si.Handle = hwnd;
                    }
                    first = false;

                    // 타이틀 파싱 : 성공하면 Return
                    if (this.GetTagsFromTitle(si, hwnd))
                    {
                        IParseRule.AddToList(result, si);
                    }
                }while ((hwnd = this.GetWindowHandle(hwnd)) != IntPtr.Zero);
            }

            return(si);
        }
Beispiel #4
0
 public SongInfo(IParseRule rule)
 {
     this.Rule = rule;
 }