From: <fr...@us...> - 2009-02-12 16:46:12
|
Revision: 2648 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=2648&view=rev Author: framug Date: 2009-02-12 16:46:03 +0000 (Thu, 12 Feb 2009) Log Message: ----------- Fix many little things. Modified Paths: -------------- trunk/plugins/WebEPGfr/WebEPGfrSetup.Designer.cs trunk/plugins/WebEPGfr/WebEPGfrSetup.cs trunk/plugins/WebEPGfr/XmlToolBox.cs Modified: trunk/plugins/WebEPGfr/WebEPGfrSetup.Designer.cs =================================================================== --- trunk/plugins/WebEPGfr/WebEPGfrSetup.Designer.cs 2009-02-11 22:42:39 UTC (rev 2647) +++ trunk/plugins/WebEPGfr/WebEPGfrSetup.Designer.cs 2009-02-12 16:46:03 UTC (rev 2648) @@ -38,6 +38,7 @@ this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabGeneral = new System.Windows.Forms.TabPage(); + this.label12 = new System.Windows.Forms.Label(); this.guiChkpostprocess = new System.Windows.Forms.CheckBox(); this.pictureBox5 = new System.Windows.Forms.PictureBox(); this.var_Version = new System.Windows.Forms.Label(); @@ -90,6 +91,7 @@ this.mardi = new System.Windows.Forms.CheckBox(); this.lundi = new System.Windows.Forms.CheckBox(); this.libinfo = new System.Windows.Forms.Label(); + this.Repertoire_XMLTV_MP = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tabGeneral.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); @@ -142,22 +144,22 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 114); + this.label3.Location = new System.Drawing.Point(6, 145); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(147, 13); + this.label3.Size = new System.Drawing.Size(170, 13); this.label3.TabIndex = 7; - this.label3.Text = "Répertoire XMLTV en sortie : "; + this.label3.Text = "Répertoire XMLTVde WebEPGfr : "; // // Repertoire_XMLTV // - this.Repertoire_XMLTV.Location = new System.Drawing.Point(205, 111); + this.Repertoire_XMLTV.Location = new System.Drawing.Point(205, 142); this.Repertoire_XMLTV.Name = "Repertoire_XMLTV"; this.Repertoire_XMLTV.Size = new System.Drawing.Size(253, 20); this.Repertoire_XMLTV.TabIndex = 8; // // Config_Parcourir // - this.Config_Parcourir.Location = new System.Drawing.Point(489, 109); + this.Config_Parcourir.Location = new System.Drawing.Point(489, 139); this.Config_Parcourir.Name = "Config_Parcourir"; this.Config_Parcourir.Size = new System.Drawing.Size(75, 24); this.Config_Parcourir.TabIndex = 9; @@ -180,6 +182,8 @@ // // tabGeneral // + this.tabGeneral.Controls.Add(this.Repertoire_XMLTV_MP); + this.tabGeneral.Controls.Add(this.label12); this.tabGeneral.Controls.Add(this.guiChkpostprocess); this.tabGeneral.Controls.Add(this.pictureBox5); this.tabGeneral.Controls.Add(this.var_Version); @@ -199,10 +203,19 @@ this.tabGeneral.Text = "Général"; this.tabGeneral.UseVisualStyleBackColor = true; // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(6, 115); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(178, 13); + this.label12.TabIndex = 18; + this.label12.Text = "Répertoire XMLTV de MediaPortal : "; + // // guiChkpostprocess // this.guiChkpostprocess.AutoSize = true; - this.guiChkpostprocess.Location = new System.Drawing.Point(6, 206); + this.guiChkpostprocess.Location = new System.Drawing.Point(6, 222); this.guiChkpostprocess.Name = "guiChkpostprocess"; this.guiChkpostprocess.Size = new System.Drawing.Size(221, 17); this.guiChkpostprocess.TabIndex = 17; @@ -232,7 +245,7 @@ // backup // this.backup.AutoSize = true; - this.backup.Location = new System.Drawing.Point(6, 183); + this.backup.Location = new System.Drawing.Point(6, 199); this.backup.Name = "backup"; this.backup.Size = new System.Drawing.Size(207, 17); this.backup.TabIndex = 14; @@ -242,7 +255,7 @@ // // Nom_Fichier_Guide // - this.Nom_Fichier_Guide.Location = new System.Drawing.Point(205, 147); + this.Nom_Fichier_Guide.Location = new System.Drawing.Point(205, 171); this.Nom_Fichier_Guide.Name = "Nom_Fichier_Guide"; this.Nom_Fichier_Guide.Size = new System.Drawing.Size(127, 20); this.Nom_Fichier_Guide.TabIndex = 12; @@ -250,7 +263,7 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 151); + this.label4.Location = new System.Drawing.Point(6, 174); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(110, 13); this.label4.TabIndex = 11; @@ -773,6 +786,15 @@ this.libinfo.TabIndex = 11; this.libinfo.Text = "libinfo"; // + // Repertoire_XMLTV_MP + // + this.Repertoire_XMLTV_MP.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Repertoire_XMLTV_MP.Location = new System.Drawing.Point(202, 115); + this.Repertoire_XMLTV_MP.Name = "Repertoire_XMLTV_MP"; + this.Repertoire_XMLTV_MP.Size = new System.Drawing.Size(365, 13); + this.Repertoire_XMLTV_MP.TabIndex = 19; + this.Repertoire_XMLTV_MP.Text = "C:\\Program Files\\Team MediaPortal\\MediaPortal\\XMLTV"; + // // WebEPGfrSetup // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -881,5 +903,7 @@ private System.Windows.Forms.Button btnTestConfigZguideTV; private System.Windows.Forms.Label label11; private System.Windows.Forms.CheckBox guiChkpostprocess; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label Repertoire_XMLTV_MP; } } \ No newline at end of file Modified: trunk/plugins/WebEPGfr/WebEPGfrSetup.cs =================================================================== --- trunk/plugins/WebEPGfr/WebEPGfrSetup.cs 2009-02-11 22:42:39 UTC (rev 2647) +++ trunk/plugins/WebEPGfr/WebEPGfrSetup.cs 2009-02-12 16:46:03 UTC (rev 2648) @@ -49,7 +49,6 @@ InfosSuivantSites InfosSuivantSites; ListViewItem MyItem; - String _Repertoire_XMLTV_MP; String _Nom_Fichier_Guide_MP = "TVguide.xml"; String _DTD = ""; bool _TVServer = System.IO.File.Exists(Config.GetFolder(Config.Dir.Plugins) + @"\Windows\TvPlugin.dll"); @@ -167,7 +166,7 @@ private void EcrireXMLConfig() { // Ecrire la configuration de WebEPGfr - XmlConfig.WriteXmlConfig("WebEPGfr", "WebEPGfr", "Repertoire XMLTV de MP", Repertoire_XMLTV.Text.ToString()); + XmlConfig.WriteXmlConfig("WebEPGfr", "WebEPGfr", "Repertoire XMLTV de MP", Repertoire_XMLTV_MP.Text.ToString()); XmlConfig.WriteXmlConfig("WebEPGfr", "WebEPGfr", "Nom du fichier guide de MP", _Nom_Fichier_Guide_MP.ToString()); XmlConfig.WriteXmlConfig("WebEPGfr", "WebEPGfr", "Repertoire XMLTV de WebEPGfr", Repertoire_XMLTV.Text.ToString()); XmlConfig.WriteXmlConfig("WebEPGfr", "WebEPGfr", "Nom du fichier guide de WebEPGfr", Nom_Fichier_Guide.Text.ToString()); @@ -201,7 +200,7 @@ // Lire le XML de configuration private void LireXMLConfig() { - _Repertoire_XMLTV_MP = XmlConfig.ReadXmlConfig("WebEPGfr", "WebEPGfr", "Repertoire XMLTV de MP", ""); + Repertoire_XMLTV_MP.Text = XmlConfig.ReadXmlConfig("WebEPGfr", "WebEPGfr", "Repertoire XMLTV de MP", ""); Repertoire_XMLTV.Text = XmlConfig.ReadXmlConfig("WebEPGfr", "WebEPGfr", "Repertoire XMLTV de WebEPGfr", ""); Nom_Fichier_Guide.Text = XmlConfig.ReadXmlConfig("WebEPGfr", "WebEPGfr", "Nom du fichier guide de WebEPGfr", ""); backup.Checked = XmlConfig.ReadXmlConfig("WebEPGfr", "WebEPGfr", "backup", false); @@ -265,24 +264,29 @@ var_Version.Text = var_Version.Text.Substring(0, 3); // Je r\xE9cup\xE8re l'info du r\xE9pertoire XMLTV qui est configur\xE9 dans MediaPortal - if (Repertoire_XMLTV.Text == "") + if (Repertoire_XMLTV_MP.Text == "") { // Le fameux serveur tele TvBusinessLayer layer = new TvBusinessLayer(); - Repertoire_XMLTV.Text = layer.GetSetting("xmlTv", "").Value; + Repertoire_XMLTV_MP.Text = layer.GetSetting("xmlTv", "").Value; // Si on ne trouve rien, c'est que le plugin xmltv du TVServer n'est pas configure - if (Repertoire_XMLTV.Text == "") + if (Repertoire_XMLTV_MP.Text == "") { // donc, je le force par defaut au repertoire du client ou est installe MediaPortal - Repertoire_XMLTV.Text = AppDomain.CurrentDomain.BaseDirectory + "xmltv"; ; + Repertoire_XMLTV_MP.Text = AppDomain.CurrentDomain.BaseDirectory + "xmltv"; ; } - _Repertoire_XMLTV_MP = Repertoire_XMLTV.Text; } // Le nom du fichier guide est TVguide.xml par d\xE9faut, dans MediaPortal if (Nom_Fichier_Guide.Text == "") { Nom_Fichier_Guide.Text = _Nom_Fichier_Guide_MP; } + + // Si le r\xE9pertoire XMLTV de WebEPGfr n'existe pas, je met le r\xE9pertoire XMLTV de MP par defaut + if (Repertoire_XMLTV.Text == "") + { + Repertoire_XMLTV.Text = Repertoire_XMLTV_MP.Text; + } } // cas sans le serveur tele @@ -294,16 +298,21 @@ var_Version.Text = var_Version.Text.Substring(0, 3); // Je r\xE9cup\xE8re l'info du r\xE9pertoire XMLTV qui est configur\xE9 dans MediaPortal - if (Repertoire_XMLTV.Text == "") + if (Repertoire_XMLTV_MP.Text == "") { - Repertoire_XMLTV.Text = XmlConfig.ReadXmlConfig("MediaPortal", "xmltv", "folder", ""); - _Repertoire_XMLTV_MP = Repertoire_XMLTV.Text; + Repertoire_XMLTV_MP.Text = XmlConfig.ReadXmlConfig("MediaPortal", "xmltv", "folder", ""); } // Le nom du fichier guide est TVguide.xml par d\xE9faut, dans MediaPortal if (Nom_Fichier_Guide.Text == "") { Nom_Fichier_Guide.Text = _Nom_Fichier_Guide_MP; } + + // Si le r\xE9pertoire XMLTV de WebEPGfr n'existe pas, je met le r\xE9pertoire XMLTV de MP par defaut + if (Repertoire_XMLTV.Text == "") + { + Repertoire_XMLTV.Text = Repertoire_XMLTV_MP.Text; + } } // R\xE9cup\xE8re le num\xE9ro de l'assembly @@ -323,7 +332,7 @@ oGrabber = new XMLGrabber(); oGrabber.Configuration.Fichier_Guide_WebEPGfr = this.Nom_Fichier_Guide.Text.ToString(); - oGrabber.Configuration.Repertoire_XMLTV_Mediaportal = this.Repertoire_XMLTV.Text.ToString(); + oGrabber.Configuration.Repertoire_XMLTV_Mediaportal = this.Repertoire_XMLTV_MP.Text.ToString(); oGrabber.Configuration.Repertoire_XMLTV_WebEPGfr = this.Repertoire_XMLTV.Text.ToString(); if (oUsedGrabber == InfosSuivantSites.Grabber.Kazer) { @@ -380,7 +389,7 @@ oGrabber = new XMLGrabber(); oGrabber.Configuration.Fichier_Guide_WebEPGfr = this.Nom_Fichier_Guide.Text.ToString(); - oGrabber.Configuration.Repertoire_XMLTV_Mediaportal = this.Repertoire_XMLTV.Text.ToString(); + oGrabber.Configuration.Repertoire_XMLTV_Mediaportal = this.Repertoire_XMLTV_MP.Text.ToString(); oGrabber.Configuration.Repertoire_XMLTV_WebEPGfr = this.Repertoire_XMLTV.Text.ToString(); if (oUsedGrabber == InfosSuivantSites.Grabber.Kazer) { @@ -491,7 +500,7 @@ { //On essai de telecharger le fichier oGrabber = new XMLGrabber(); oGrabber.Configuration.DestinationFile = this.Nom_Fichier_Guide.Text.ToString(); - oGrabber.Configuration.Repertoire_XMLTV_Mediaportal = this.Repertoire_XMLTV.Text.ToString(); + oGrabber.Configuration.Repertoire_XMLTV_Mediaportal = this.Repertoire_XMLTV_MP.Text.ToString(); oGrabber.Configuration.Repertoire_XMLTV_WebEPGfr = this.Repertoire_XMLTV.Text.ToString(); oGrabber.Configuration.DownloadUri = new Uri(sUri); if (oGrabber.DownloadXmlTvFile() == 0) Modified: trunk/plugins/WebEPGfr/XmlToolBox.cs =================================================================== --- trunk/plugins/WebEPGfr/XmlToolBox.cs 2009-02-11 22:42:39 UTC (rev 2647) +++ trunk/plugins/WebEPGfr/XmlToolBox.cs 2009-02-12 16:46:03 UTC (rev 2648) @@ -27,23 +27,70 @@ { get { - if ((_sUserHash != null) && (_oDownloadUri == null)) { _oDownloadUri = new Uri(@"http://www.kazer.org/gen_xml.php?u=" + _sUserHash); } + if ((_sUserHash != null) && (_oDownloadUri == null)) + { + _oDownloadUri = new Uri(@"http://www.kazer.org/gen_xml.php?u=" + _sUserHash); + } return _oDownloadUri; } - set { _oDownloadUri = value; } + set + { + _oDownloadUri = value; + } } - public string File { get { return _sFile; } set { _sFile = value; } } - public string MappingFile { get { return _sMappingFile; } set { _sMappingFile = value; } } + + public string File + { + get + { + return _sFile; + } + set + { + _sFile = value; + } + } + + public string MappingFile + { + get + { + return _sMappingFile; + } + set + { + _sMappingFile = value; + } + } + public string Repertoire_XMLTV_Mediaportal { - get { return _sDestinationPath; } + get + { + return _sDestinationPath; + } set { _sDestinationPath = value; - if (_sDestinationPath.Substring(_sDestinationPath.Length - 1, 1) != @"\") { _sDestinationPath = _sDestinationPath + @"\"; } + if (_sDestinationPath.Substring(_sDestinationPath.Length - 1, 1) != @"\") + { + _sDestinationPath = _sDestinationPath + @"\"; + } } } - public string DestinationFile { get { return _sDestinationFile; } set { _sDestinationFile = value; } } + + public string DestinationFile + { + get + { + return _sDestinationFile; + } + set + { + _sDestinationFile = value; + } + } + public string Repertoire_XMLTV_WebEPGfr { get @@ -53,28 +100,61 @@ set { _sKazerDestinationPath = value; - if (_sKazerDestinationPath.Substring(_sKazerDestinationPath.Length - 1, 1) != @"\") { _sKazerDestinationPath = _sKazerDestinationPath + @"\"; } + if (_sKazerDestinationPath.Substring(_sKazerDestinationPath.Length - 1, 1) != @"\") + { + _sKazerDestinationPath = _sKazerDestinationPath + @"\"; + } } } - public string Fichier_Guide_WebEPGfr { get { return _sDestinationFile; } set { _sDestinationFile = value; } } - public string Fichier_Guide_Mediaportal { get { return _sMPDestinationFile; } set { _sMPDestinationFile = value; } } + public string Fichier_Guide_WebEPGfr + { + get + { + return _sDestinationFile; + } + set + { + _sDestinationFile = value; + } + } + + public string Fichier_Guide_Mediaportal + { + get + { + return _sMPDestinationFile; + } + set + { + _sMPDestinationFile = value; + } + } + public string UserHash { get { - if (_sUserHash != null) { _oDownloadUri = new Uri(@"http://www.kazer.org/gen_xml.php?u=" + _sUserHash); } + if (_sUserHash != null) + { + _oDownloadUri = new Uri(@"http://www.kazer.org/gen_xml.php?u=" + _sUserHash); + } return _sUserHash; } - set { _sUserHash = value; } + set + { + _sUserHash = value; + } } #endregion } + public struct XMLTVChannel { public string sId; public string sDisplayName; } + public struct XMLTVProgram { public string StartTime; @@ -104,7 +184,10 @@ /// Constructeur de la classe ///</summary> public XMLGrabber() - { Configuration = new XMLGrabberConfiguration(); this.AutoConfigure(); } + { + Configuration = new XMLGrabberConfiguration(); + this.AutoConfigure(); + } #endregion <<CONSTRUCTEUR>> #region <<PUBLIC METHODS>> @@ -117,33 +200,47 @@ Configuration.File = ""; Configuration.DestinationFile = @"TVguide.xml"; Configuration.Fichier_Guide_WebEPGfr = Configuration.DestinationFile; - Configuration.Fichier_Guide_Mediaportal =Configuration.DestinationFile; + Configuration.Fichier_Guide_Mediaportal = Configuration.DestinationFile; Configuration.Repertoire_XMLTV_Mediaportal = @"C:\Program Files\Team MediaPortal\MediaPortal\XMLTV"; - try { Configuration.DownloadUri = new Uri(Environment.GetEnvironmentVariable("TEMP").ToString()); } - catch { } + try + { + Configuration.DownloadUri = new Uri(Environment.GetEnvironmentVariable("TEMP").ToString()); + } + catch + { + } //Si c:\.... n'existe pas on teste sur d:\.... System.IO.DirectoryInfo oFolder = new DirectoryInfo(Configuration.Repertoire_XMLTV_Mediaportal); if (oFolder.Exists == false) { if (System.IO.Directory.Exists(@"D:\Program Files\Team MediaPortal\MediaPortal\XMLTV")==true ) - { Configuration.Repertoire_XMLTV_Mediaportal = @"D:\Program Files\Team MediaPortal\MediaPortal\XMLTV"; } + { + Configuration.Repertoire_XMLTV_Mediaportal = @"D:\Program Files\Team MediaPortal\MediaPortal\XMLTV"; + } else - { Configuration.Repertoire_XMLTV_Mediaportal = Environment.GetEnvironmentVariable("TEMP").ToString(); } + { + Configuration.Repertoire_XMLTV_Mediaportal = Environment.GetEnvironmentVariable("TEMP").ToString(); + } } + oFolder = null; Configuration.Repertoire_XMLTV_WebEPGfr = Configuration.Repertoire_XMLTV_Mediaportal; } /// <summary> /// Inutilis\xE9 /// </summary> - public void ReadConfig() { } + public void ReadConfig() + { + } /// <summary> /// Inutilis\xE9 /// </summary> - public void SaveConfig() { } + public void SaveConfig() + { + } ///<summary> /// Telecharge le Fichier (Configuration.DownloadUri) vers (DestinationFolder + DestinationFile) @@ -186,13 +283,21 @@ } } else - { return -1; } + { + return -1; + } } else { //telechargement d'une page Internet Configuration.File = HttpDownloader(DownloadUri); - if (Configuration.File.Length > 3) { return 0; } - else { return -1; } + if (Configuration.File.Length > 3) + { + return 0; + } + else + { + return -1; + } } } @@ -204,18 +309,22 @@ { string sMappingPath = Configuration.Repertoire_XMLTV_Mediaportal; - if (sMappingPath.Substring(sMappingPath.Length - 1, 1) != @"\") { sMappingPath = sMappingPath + @"\"; } + if (sMappingPath.Substring(sMappingPath.Length - 1, 1) != @"\") + { + sMappingPath = sMappingPath + @"\"; + } // Lecture des Mappings FileInfo aFile = new FileInfo(sMappingPath + sMappingFile); if (aFile.Exists == true) { GetMapping(sMappingPath + sMappingFile); } + aFile = null; return 0; } /// <summary> - /// Get Mapping Value For Kazer.org or ZguideTV + /// Get Mapping Value for Kazer.org or ZguideTV /// </summary> /// <returns>0 Si R\xE9ussite</returns> public long GetMappings() @@ -262,11 +371,11 @@ oStreamWriter.Close(); oStreamReader.Close(); - oXmltVFile = new XMLTVFile(); //Contient le fichier xmltv aboutie. + oXmltVFile = new XMLTVFile(); //Contient le fichier xmltv abouti. oXmltVFile.Load(this.Configuration.File.ToString()); if (ChannelsToKeep != null) //Il y a une liste de fichier a preserver { - Log.Info("WebEPGfr : Preservation des cannaux"); + Log.Info("WebEPGfr : Preservation des canaux"); oXmltVFile.Channel_KeepOnly(this.ChannelsToKeep ); } @@ -296,7 +405,7 @@ string sLastFinalFile = oTempFile.Directory.ToString() + @"\" + Configuration.DestinationFile.ToString(); if (File.Exists(sLastFinalFile)) - {//Effece lancien TVguide.xml + {//Efface l'ancien TVguide.xml File.Delete(sLastFinalFile); } @@ -314,11 +423,14 @@ oFinalFile.Delete(); // Suppression du fichier tnt ou complet } + //Nettoyage oStreamWriter = null; oStreamReader = null; if (File.Exists(oTempFile.Directory + @"\Writing.xml")) - { File.Delete(oTempFile.Directory + @"\Writing.xml"); } + { + File.Delete(oTempFile.Directory + @"\Writing.xml"); + } oTempFile = null; oFinalFile = null; @@ -349,7 +461,10 @@ if (oDTDFile.Exists == false) {//Copie du DTD oDTDFile = new FileInfo(@"xmltv.dtd"); - if (oDTDFile.Exists == true) { oDTDFile.CopyTo(oXMLTVFile.Directory + @"\xmltv.dtd", true); } + if (oDTDFile.Exists == true) + { + oDTDFile.CopyTo(oXMLTVFile.Directory + @"\xmltv.dtd", true); + } } oDTDFile = null; try @@ -358,10 +473,15 @@ oXMLTVSource.Load(Configuration.File); bReturn = true; //Enfin Si on arrive Ici c'est que le DTD a valid\xE9 le document } - catch { } + catch + { + } } } - catch { } + catch + { + } + //Clean oXMLTVFile = null; oXMLTVSource = null; @@ -385,7 +505,10 @@ if (oDTDFile.Exists == false) {//Copie du DTD oDTDFile = new FileInfo(@"xmltv.dtd"); - if (oDTDFile.Exists == true) { oDTDFile.CopyTo(oXMLTVFile.Directory + @"\xmltv.dtd", true); } + if (oDTDFile.Exists == true) + { + oDTDFile.CopyTo(oXMLTVFile.Directory + @"\xmltv.dtd", true); + } } oDTDFile = null; try @@ -399,10 +522,15 @@ } oElementList = null; } - catch { } + catch + { + } } } - catch { } + catch + { + } + //Clean oXMLTVFile = null; oXMLTVSource = null; @@ -423,8 +551,12 @@ if (oDTDFile.Exists == false) { oDTDFile = new FileInfo(@"xmltv.dtd"); - if (oDTDFile.Exists == true) { oDTDFile.CopyTo(oXMLTVFile.Directory + @"\xmltv.dtd", true); } + if (oDTDFile.Exists == true) + { + oDTDFile.CopyTo(oXMLTVFile.Directory + @"\xmltv.dtd", true); + } } + oDTDFile = null; oXMLTVSource = new XmlDocument(); @@ -432,7 +564,6 @@ return oXMLTVSource; } - //Clean oXMLTVFile = null; return oReturnXmlFile; @@ -457,8 +588,14 @@ { Stream oStream = oWClient.OpenRead(oUri.ToString()); StreamReader oStreamReader = new StreamReader(oStream, System.Text.Encoding.GetEncoding("iso-8859-1")); - if (Configuration.Repertoire_XMLTV_WebEPGfr != null) { sPath = Configuration.Repertoire_XMLTV_WebEPGfr; } - else { sPath = Environment.GetEnvironmentVariable("TEMP").ToString(); } + if (Configuration.Repertoire_XMLTV_WebEPGfr != null) + { + sPath = Configuration.Repertoire_XMLTV_WebEPGfr; + } + else + { + sPath = Environment.GetEnvironmentVariable("TEMP").ToString(); + } StreamWriter oStreamWriter = new System.IO.StreamWriter(sPath + @"\LopezTemp.txt", false, oStreamReader.CurrentEncoding); string sTempline = ""; @@ -502,8 +639,14 @@ string sPath = ""; try { - if (Configuration.Repertoire_XMLTV_WebEPGfr != null) { sPath = Configuration.Repertoire_XMLTV_WebEPGfr ; } - else { sPath = Environment.GetEnvironmentVariable("TEMP").ToString(); } + if (Configuration.Repertoire_XMLTV_WebEPGfr != null) + { + sPath = Configuration.Repertoire_XMLTV_WebEPGfr ; + } + else + { + sPath = Environment.GetEnvironmentVariable("TEMP").ToString(); + } // Create a new WebClient instance. System.Net.WebClient oWebClient = new System.Net.WebClient(); @@ -512,8 +655,10 @@ MediaPortal.GUI.Library.Log.Info("T\xE9l\xE9chargement r\xE9ussi de " + sPath + @"\LopezTemp.zip"); return sPath + @"\LopezTemp.zip"; } - catch { return string.Empty ; } - + catch + { + return string.Empty ; + } } ///<summary> @@ -528,12 +673,17 @@ { foreach (System.Collections.DictionaryEntry aMapping in this) { - if (sTempLine.IndexOf(aMapping.Key.ToString()) > 0) { Log.Info("WebEPGfr : mapping trouv\xE9" + aMapping.Key.ToString() + "->" + aMapping.Value.ToString()); } + if (sTempLine.IndexOf(aMapping.Key.ToString()) > 0) + { + Log.Info("WebEPGfr : mapping trouv\xE9" + aMapping.Key.ToString() + "->" + aMapping.Value.ToString()); + } sTempLine = sTempLine.Replace(aMapping.Key.ToString(), aMapping.Value.ToString()); } } } - catch { } + catch + { + } return sTempLine; } @@ -547,10 +697,18 @@ string sMappingPath = Configuration.Repertoire_XMLTV_WebEPGfr; try { -// if (this.Configuration.MappingFile.Length == 0) { this.Configuration.MappingFile = "KazerIntegrator.ini"; } - if (this.Configuration.MappingFile.Length == 0) { this.Configuration.MappingFile = InfosSuivantSites.GetMappingFileName(_GrabberMethod); } - if (sMappingPath.Substring(sMappingPath.Length - 1, 1) != @"\") { sMappingPath = sMappingPath + @"\"; } + if (this.Configuration.MappingFile.Length == 0) + { + this.Configuration.MappingFile = InfosSuivantSites.GetMappingFileName(_GrabberMethod); + } + + if (sMappingPath.Substring(sMappingPath.Length - 1, 1) != @"\") + { + sMappingPath = sMappingPath + @"\"; + } + FileInfo aFile = new FileInfo(sMappingPath + this.Configuration.MappingFile); + if (aFile.Exists) { lReturn = 0; @@ -560,8 +718,8 @@ catch (Exception ) { } + return lReturn; - } ///<summary> @@ -586,12 +744,17 @@ try { if (base[sLookFor] == null) - { base.Add(sLookFor, sWillBe); } + { + base.Add(sLookFor, sWillBe); + } } - finally { } + finally + { + } } } } + while (sReadLine != null); oStreamReader.Close(); oStreamReader = null; @@ -610,7 +773,10 @@ private string sPath = @"TvGuide.xml"; #region <<CONSTRUCTEUR>> - public XMLTVFile() { } + public XMLTVFile() + { + } + public XMLTVFile(XmlDocument aDocument) { this.InnerXml = aDocument.InnerXml; @@ -634,6 +800,7 @@ if (oReturn.Count > 0) oReturn.Sort(); return oReturn; } + /// <summary> /// Retourne un Canal sur la base d'informations Partielles /// </summary> @@ -659,10 +826,13 @@ PartialChannel.sId = aNode.Attributes["id"].Value; } } - catch { } + catch + { + } } return PartialChannel; } + /// <summary> /// Renomme un Canal sur la base d'informations Partielles /// </summary> @@ -684,10 +854,13 @@ //this.Save); } } - catch { } + catch + { + } } return lReturnValue; } + public long Channel_Merge(string sIdToMerge, string sReplaceId) { long lReturnValue = 0; @@ -700,8 +873,14 @@ /// <returns>0 Si R\xE9ussite</returns> public long Channel_Delete(XMLTVChannel ChannelToDelete) { - if (ChannelToDelete.sId != null) { return Channel_Delete(ChannelToDelete.sId); } - else { return -1; } + if (ChannelToDelete.sId != null) + { + return Channel_Delete(ChannelToDelete.sId); + } + else + { + return -1; + } } /// <summary> /// Supprime un Canal @@ -722,7 +901,9 @@ } } - catch { } + catch + { + } } return lReturnValue; } @@ -758,7 +939,10 @@ } catch { - if (oProgList[iProg].HasChildNodes == false) { this.DocumentElement.RemoveChild(oProgList[iProg]); } + if (oProgList[iProg].HasChildNodes == false) + { + this.DocumentElement.RemoveChild(oProgList[iProg]); + } } iProg = iProg - 1; } @@ -769,7 +953,10 @@ } catch (Exception) { - if (oChannelList[iChannel].HasChildNodes == false) { this.DocumentElement.RemoveChild(oChannelList[iChannel]); } + if (oChannelList[iChannel].HasChildNodes == false) + { + this.DocumentElement.RemoveChild(oChannelList[iChannel]); + } } iChannel = iChannel - 1; } @@ -806,6 +993,7 @@ //} return lReturnValue; } + public long Channel_KeepOnly(ArrayList oChannelsToKeep) { long lReturnValue = -1; @@ -829,7 +1017,10 @@ } catch (Exception) { - if (oChannelList[iChannel].HasChildNodes == false) { this.DocumentElement.RemoveChild(oChannelList[iChannel]); } + if (oChannelList[iChannel].HasChildNodes == false) + { + this.DocumentElement.RemoveChild(oChannelList[iChannel]); + } } iChannel = iChannel - 1; } @@ -848,7 +1039,9 @@ this.DocumentElement.RemoveChild(oProgList[iProg]); } } - catch { } + catch + { + } iProg = iProg - 1; } oProgList = null; @@ -868,7 +1061,13 @@ /// Sauve le Document sous DocumentPath ou si il n'a pas \xE9t\xE9 defini dans repertoire de travail\TvGuide.XML /// </summary> /// <returns></returns> - public void Save() { if (sPath.Length > 0) { this.Save(sPath); } } + public void Save() + { + if (sPath.Length > 0) + { + this.Save(sPath); + } + } #endregion #region <<ACCESSOR>> @@ -877,7 +1076,17 @@ /// Par defaut, il s'agit du fichier TvGuide.XML dans le repertoire courant. /// </summary> /// <returns></returns> - public string DocumentPath { get { return sPath; } set { sPath = value; } } + public string DocumentPath + { + get + { + return sPath; + } + set + { + sPath = value; + } + } #endregion } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |