public RemoteFork.Plugins.BaseItem[] GetM3uList(string PATH)
        {
            System.Net.WebClient WC = new System.Net.WebClient();
            WC.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0");
            WC.Encoding = System.Text.Encoding.UTF8;

            var items = new System.Collections.Generic.List <RemoteFork.Plugins.BaseItem>();

            RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();
            Item.Type        = ItemType.DIRECTORY;
            Item.Description = WC.DownloadString(PATH);

            items.Add(Item);

            return(items.ToArray());
        }
        public RemoteFork.Plugins.BaseItem[] LastModifiedPlayList(string NamePlayList)
        {
            string PathFileUpdateTime = System.IO.Path.GetTempPath() + NamePlayList + ".UpdateTime.tmp";
            string PathFilePlayList   = System.IO.Path.GetTempPath() + NamePlayList + ".PlayList.tmp";

            System.Net.WebRequest request = System.Net.WebRequest.Create("http://super-pomoyka.us.to/trash/ttv-list/ttv." + NamePlayList + ".iproxy.m3u?ip=" + IPAdress + ":" + PortAce);
            request.Method = "HEAD";
            System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)(request.GetResponse());
            var responHeader = response.GetResponseHeader("Last-Modified");

            response.Close();

            System.Net.WebClient WC = new System.Net.WebClient();
            WC.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0");
            WC.Encoding = System.Text.Encoding.UTF8;

            var items = new System.Collections.Generic.List <RemoteFork.Plugins.BaseItem>();

            RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();

            if ((System.IO.File.Exists(PathFileUpdateTime) && System.IO.File.Exists(PathFilePlayList)) == false)
            {
                UpdatePlayList(NamePlayList, PathFilePlayList, PathFileUpdateTime, responHeader);
                Item.Type        = ItemType.DIRECTORY;
                Item.Description = WC.DownloadString(PathFilePlayList);
                items.Add(Item);
                return(items.ToArray());
            }

            if (responHeader != System.IO.File.ReadAllText(PathFileUpdateTime))
            {
                UpdatePlayList(NamePlayList, PathFilePlayList, PathFileUpdateTime, responHeader);
                Item.Type        = ItemType.DIRECTORY;
                Item.Description = WC.DownloadString(PathFilePlayList);
                items.Add(Item);
                return(items.ToArray());
            }

            Item.Type        = ItemType.DIRECTORY;
            Item.Description = WC.DownloadString(PathFilePlayList);
            items.Add(Item);

            return(items.ToArray());
        }
        public RemoteFork.Plugins.BaseItem[] GetTopList()
        {
            var items = new System.Collections.Generic.List <RemoteFork.Plugins.BaseItem>();

            System.Net.WebClient WC = new System.Net.WebClient();
            WC.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0");
            WC.Encoding = System.Text.Encoding.UTF8;

            RemoteFork.Plugins.BaseItem ItemTop       = new RemoteFork.Plugins.BaseItem();
            RemoteFork.Plugins.BaseItem ItemTorrentTV = new RemoteFork.Plugins.BaseItem();
            try
            {
                AceProxEnabl = true;
                string AceMadiaGet = null;
                AceMadiaGet = WC.DownloadString("http://" + IPAdress + ":" + PortAce + "/webui/api/service?method=get_version&format=jsonp&callback=mycallback");
                AceMadiaGet = "<html> Ответ от движка Ace Media получен: " + "<div>" + AceMadiaGet + "</div></html>";

                ItemTorrentTV.Name        = "Torrent TV";
                ItemTorrentTV.Type        = ItemType.DIRECTORY;
                ItemTorrentTV.Link        = "torrenttv";
                ItemTorrentTV.ImageLink   = "http://s1.iconbird.com/ico/1112/Television/w256h25613523820647.png";
                ItemTorrentTV.Description = "<html><img src=\"http://torrent-tv.ru/images/logo.png\"></html>" + WC.DownloadString("http://super-pomoyka.us.to/trash/ttv-list/MyTraf.php");

                ItemTop.ImageLink   = "http://static.acestream.net/sites/acestream/img/ACE-logo.png";
                ItemTop.Name        = "        - AceTorrentPlay -        ";
                ItemTop.Link        = "";
                ItemTop.Type        = ItemType.FILE;
                ItemTop.Description = AceMadiaGet + "<html><p><p><img src=\"http://static.acestream.net/sites/acestream/img/ACE-logo.png\"></html>";

                items.Add(ItemTop);
                items.Add(ItemTorrentTV);
            }
            catch
            {
                AceProxEnabl        = false;
                ItemTop.ImageLink   = "http://errorfix48.ru/uploads/posts/2014-09/1409846068_400px-warning_icon.png";
                ItemTop.Name        = "        - AceTorrentPlay -        ";
                ItemTop.Link        = "";
                ItemTop.Type        = ItemType.FILE;
                ItemTop.Description = "Ответ от движка Ace Media не получен!";
                items.Add(ItemTop);
            }

            System.IO.DriveInfo[] ListDisk = System.IO.DriveInfo.GetDrives();
            foreach (System.IO.DriveInfo Disk in ListDisk)
            {
                if (Disk.DriveType == System.IO.DriveType.Fixed)
                {
                    RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();
                    Item.Name        = Disk.Name + "  " + "(" + Math.Round(Disk.TotalFreeSpace / 1024 / 1024.0 / 1024, 2) + "ГБ свободно из " + Math.Round(Disk.TotalSize / 1024 / 1024.0 / 1024, 2) + "ГБ)";
                    Item.ImageLink   = "http://s1.iconbird.com/ico/1012/AmpolaIcons/w256h2561350597268hddwin.png";
                    Item.Link        = Disk.Name.Replace("\\", "|");
                    Item.Type        = ItemType.DIRECTORY;
                    Item.Description = Disk.Name + "\n" + "\r" + " <html> Метка диска: <div>" + Disk.VolumeLabel + "</div></html>";

                    items.Add(Item);
                }
            }


            return(items.ToArray());
        }
        public RemoteFork.Plugins.BaseItem[] GetTorrentTV()
        {
            var items = new System.Collections.Generic.List <RemoteFork.Plugins.BaseItem>();

            RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();

            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "РАЗВЛЕКАТЕЛЬНЫЕ";
            Item.Link      = "ent";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "ДЕТСКИЕ";
            Item.Link      = "child";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "ПОЗНАВАТЕЛЬНЫЕ";
            Item.Link      = "discover";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "HD";
            Item.Link      = "HD";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "ОБЩИЕ";
            Item.Link      = "common";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "ФИЛЬМЫ";
            Item.Link      = "film";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "МУЖСКИЕ";
            Item.Link      = "man";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "МУЗЫКАЛЬНЫЕ";
            Item.Link      = "music";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "НОВОСТИ";
            Item.Link      = "news";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "РЕГИОНАЛЬНЫЕ";
            Item.Link      = "region";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "РЕЛИГИОЗНЫЕ";
            Item.Link      = "relig";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            Item           = new RemoteFork.Plugins.BaseItem();
            Item.Type      = ItemType.DIRECTORY;
            Item.Name      = "СПОРТ";
            Item.Link      = "sport";
            Item.ImageLink = "http://torrent-tv.ru/images/all_channels.png";
            items.Add(Item);

            return(items.ToArray());
        }
        public override RemoteFork.Plugins.BaseItem[] GetList(string path)
        {
            switch (path)
            {
            case "acetorrentplay":
                return(GetTopList());

            case "acetorrentplay;torrenttv":
                return(GetTorrentTV());
            }


            var items = new System.Collections.Generic.List <RemoteFork.Plugins.BaseItem>();

            string[] PathSpliter = path.Split(';');

            switch (PathSpliter[PathSpliter.Length - 1])
            {
            case "ent":
                return(LastModifiedPlayList("ent"));

            case "child":
                return(LastModifiedPlayList("child"));

            case "common":
                return(LastModifiedPlayList("common"));

            case "discover":
                return(LastModifiedPlayList("discover"));

            case "HD":
                return(LastModifiedPlayList("HD"));

            case "film":
                return(LastModifiedPlayList("film"));

            case "man":
                return(LastModifiedPlayList("man"));

            case "music":
                return(LastModifiedPlayList("music"));

            case "news":
                return(LastModifiedPlayList("news"));

            case "region":
                return(LastModifiedPlayList("region"));

            case "relig":
                return(LastModifiedPlayList("relig"));

            case "sport":
                return(LastModifiedPlayList("sport"));
            }

            string PathFiles = ((string)(PathSpliter[PathSpliter.Length - 1])).Replace("|", "\\");

            switch (System.IO.Path.GetExtension(PathFiles))
            {
            case ".torrent":
                PlayList[] PlayListtoTorrent = GetFileListJSON(PathFiles, IPAdress);
                string     Description       = SearchDescriptions(System.IO.Path.GetFileNameWithoutExtension(PathFiles.Split('(', '.', '[', '|')[0]));

                foreach (PlayList PlayList in PlayListtoTorrent)
                {
                    RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();
                    Item.Name        = PlayList.Name;
                    Item.ImageLink   = "http://s1.iconbird.com/ico/1012/AmpolaIcons/w256h2561350597291videofile.png";
                    Item.Link        = PlayList.Link;
                    Item.Type        = ItemType.FILE;
                    Item.Description = Description;
                    items.Add(Item);
                }

                //Информация о запущенном файле
                //Dim WC As New System.Net.WebClient
                //WC.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0")
                //WC.Encoding = System.Text.Encoding.UTF8
                //Dim AceMadiaInfo As String
                //AceMadiaInfo = WC.DownloadString("http://127.0.0.1:6878/ace/manifest.m3u8?id=" & GetID(PathFiles, IPAdress) & "&format=json&use_api_events=1&use_stop_notifications=1")
                //System.IO.File.WriteAllText("d:\My Desktop\инфо.txt", AceMadiaInfo)

                return(items.ToArray());

            case ".m3u":
                return(GetM3uList(PathFiles));
            }



            string[] ListFolders = System.IO.Directory.GetDirectories(PathFiles);
            foreach (string Fold in ListFolders)
            {
                RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();
                Item.Name      = System.IO.Path.GetFileName(Fold);
                Item.Link      = Fold.Replace("\\", "|");
                Item.ImageLink = "http://s1.iconbird.com/ico/1012/AmpolaIcons/w256h2561350597246folder.png";
                Item.Type      = ItemType.DIRECTORY;
                items.Add(Item);
            }

            if (AceProxEnabl == true)
            {
                foreach (string File in System.IO.Directory.EnumerateFiles(PathFiles, "*.*", System.IO.SearchOption.TopDirectoryOnly).Where((s) => s.EndsWith(".torrent")))
                {
                    RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();
                    Item.ImageLink   = "http://s1.iconbird.com/ico/1012/AmpolaIcons/w256h2561350597291utorrent2.png";
                    Item.Name        = System.IO.Path.GetFileNameWithoutExtension(File);
                    Item.Link        = File.Replace("\\", "|");
                    Item.Description = Item.Name;
                    Item.Type        = ItemType.DIRECTORY;
                    items.Add(Item);
                }
            }

            foreach (string File in System.IO.Directory.EnumerateFiles(PathFiles, "*.*", System.IO.SearchOption.TopDirectoryOnly).Where((s) => s.EndsWith(".mkv") || s.EndsWith(".avi") || s.EndsWith(".mp4")))
            {
                RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();
                Item.ImageLink   = "http://s1.iconbird.com/ico/1012/AmpolaIcons/w256h2561350597291videofile.png";
                Item.Name        = System.IO.Path.GetFileNameWithoutExtension(File);
                Item.Link        = ((string)("http://" + IPAdress + ":" + PortRemoteFork + "/" + File)).Replace("\\", "/");
                Item.Description = Item.Link;
                Item.Type        = ItemType.FILE;
                items.Add(Item);
            }

            foreach (string File in System.IO.Directory.EnumerateFiles(PathFiles, "*.*", System.IO.SearchOption.TopDirectoryOnly).Where((s) => s.EndsWith(".mp3")))
            {
                RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();
                Item.ImageLink   = "http://s1.iconbird.com/ico/1012/AmpolaIcons/w256h2561350597240aimp.png";
                Item.Name        = System.IO.Path.GetFileNameWithoutExtension(File);
                Item.Link        = ((string)("http://" + IPAdress + ":" + PortRemoteFork + "/" + File)).Replace("\\", "/");
                Item.Description = Item.Link;
                Item.Type        = ItemType.FILE;
                items.Add(Item);
            }

            foreach (string File in System.IO.Directory.EnumerateFiles(PathFiles, "*.*", System.IO.SearchOption.TopDirectoryOnly).Where((s) => s.EndsWith(".jpg") || s.EndsWith(".png") || s.EndsWith(".gif") || s.EndsWith(".bmp")))
            {
                RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();
                Item.ImageLink   = "http://s1.iconbird.com/ico/1012/AmpolaIcons/w256h2561350597278imagefile.png";
                Item.Name        = System.IO.Path.GetFileNameWithoutExtension(File);
                Item.Link        = ((string)("http://" + IPAdress + ":" + PortRemoteFork + "/" + File)).Replace("\\", "/");
                Item.Description = Item.Link;
                Item.Type        = ItemType.FILE;
                items.Add(Item);
            }

            foreach (string File in System.IO.Directory.EnumerateFiles(PathFiles, "*.*", System.IO.SearchOption.TopDirectoryOnly).Where((s) => s.EndsWith(".m3u")))
            {
                RemoteFork.Plugins.BaseItem Item = new RemoteFork.Plugins.BaseItem();
                Item.ImageLink   = "http://s1.iconbird.com/ico/0912/VannillACreamIconSet/w128h1281348320736M3U.png";
                Item.Name        = System.IO.Path.GetFileNameWithoutExtension(File);
                Item.Link        = ((string)("http://" + IPAdress + ":" + PortRemoteFork + "/" + File)).Replace("\\", "/");
                Item.Description = Item.Link;
                Item.Type        = ItemType.DIRECTORY;
                items.Add(Item);
            }

            return(items.ToArray());
        }