Exemple #1
0
        private bool readFromCache(string href)
        {
            string cachedFile = CachePath + Epg.validateFileName(href + ".dat");

            if (File.Exists(cachedFile))
            {
                FileStream fs = null;
                try
                {
                    fs = new FileStream(cachedFile, FileMode.Open);
                    BinaryFormatter formatter = new BinaryFormatter();
                    result.EpgData = (string[])formatter.Deserialize(fs);
                    fs.Close();
                    return(true);
                }
                catch
                {
                    if (fs != null)
                    {
                        fs.Close();
                    }
                }
            }
            return(false);
        }
Exemple #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
//            Type type = epgSagemSimplicity.IEpg;
//            var obj = Activator.CreateInstance(type);

            epgSagemSimplicity.IEpg epg = new epgSagemSimplicity.Epg() as epgSagemSimplicity.IEpg;
            if (epg == null)
            {
                return;
            }
            if (epg.getEpg("HBOC", "c:\\epgtemp\\") != 0)

            {
                epgSagemSimplicity.IEpgDetails epgd = new epgSagemSimplicity.EpgDetails() as epgSagemSimplicity.IEpgDetails;
                if (epgd == null)
                {
                    return;
                }
                //                epgd.Finished += OnDetailsFinished;
                if (epgd.Get("http://www.siol.net/tv-spored.aspx?val=3577441", "c:\\epgtemp\\") != 0)
                {
                    string s = epgd.result;
                }
            }
        }
Exemple #3
0
        private void cacheData(string href)
        {
            // Cache received data
            if (!Directory.Exists(CachePath))
            {
                Directory.CreateDirectory(CachePath);
            }

            FileStream fs = new FileStream(CachePath + Epg.validateFileName(href + ".dat"), FileMode.Create);

            try
            {
                //save to disk
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(fs, result.EpgData);
                fs.Close();
            }
            catch
            {
                fs.Close();
            }
        }