}
int page;
private void Thread_BGW_DoWork(object sender, DoWorkEventArgs e)
{
//efface la recherche HTML précédente
PageHtml = "";
//télécharge les pages de la recherche
page = 0;
dix:
renouvellement();
if (NbrTrack == 0)
{
int A = ci.IndexOf(PageHtml, "of about ", 1, System.Globalization.CompareOptions.Ordinal);
if (A == 0)
{
return; // TODO: might not be correct. Was : Exit Sub
}
int B = ci.IndexOf(PageHtml, "<", A + 12, System.Globalization.CompareOptions.Ordinal);
string voir = PageHtml.Substring(A + 12, B - (A + 12));
NbrTrack = Convert.ToInt32(voir);
}
if (page * 50 < NbrTrack)
{
page = page + 1;
ProssesBAR = ((page * 50) / NbrTrack) * 100;
goto dix;
}
}
public void renouvellement()
{
page -= 1;
for (int i = 0; i <= 100; i++)
{
page += 1;
string AdrSite = "http://www.radioblogclub.fr/search/" + page * 50 + "/" + RECHERCHE_TXT.Text;
System.Net.WebClient WebClient = new System.Net.WebClient();
System.IO.StreamReader Sr = new System.IO.StreamReader(WebClient.OpenRead(AdrSite), System.Text.Encoding.Default);
PageHtml = PageHtml + Sr.ReadToEnd();
//Récupére le code
Sr.Dispose();
Sr = null;
WebClient.Dispose();
WebClient = null;
REMPLIRLISTE();
}
}
private void REMPLIRLISTE()
{
//fouille le code html pour extraire les noms de fichier dans la listebox
int B = 1;
int B2 = 1;
int A = ci.IndexOf(PageHtml, "open/", B, System.Globalization.CompareOptions.Ordinal);
B = ci.IndexOf(PageHtml, "</td>", B, System.Globalization.CompareOptions.Ordinal);
//--------------------------------
string NomComplet = PageHtml.Substring(A, B - A);
//--------------------------------
string amp NomComplet.Replace("[&|amp;]", "&"); NomComplet amp;
//-------------------------------
//Important pour certain titre... (avec "&")
string aà NomComplet.Replace("[ÃÂ]", "à"); NomComplet aà;
//-------------------------
char[] Caractaire_Separateur = new Char[] { '\'', '>' }; // Caractère : ,
// On découpe et on mais sous forme d'un tableau
string[] Result_Separation = NomComplet.Split(Caractaire_Separateur);
string o = Result_Separation[1];
ListeNom_LB.Items.Add(o);
int A2 = Strings.InStr(B2, PageHtml, "BlogThisTrack.start('", CompareMethod.Text);
if (A2 == 1) MessageBox.Show("erreur RadioBlogClub.com a changé");
B2 = Strings.InStr(A2, PageHtml, "')", CompareMethod.Text);
switch (ListeNom_LB.Items.Count) {
case 0:
ListCount_LBL.texte = "Aucun Fichier Trouvé";
break;
case 1:
ListCount_LBL.texte = "Un Fichier Trouvé";
break;
default : // si plusieurs fichier trouver.
ListCount_LBL.texte = ListeNom_LB.Items.Count + " Fichiers Trouvés";
break;
}
PageHtml = "";
//Efface la recherche, (une longue string).
Timer1.Enabled = false;
}
----------------------------------------------------------
Et retirer la ligne :
----------------------------------------------------------
private void Thread_BGW_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
//Ligne a retirer
//--------------------
REMPLIRLISTE();
//--------------------
GO_CMD.Enabled = true;
RECHERCHE_TXT.Enabled = true;
}
----------------------------------------------------------
Et voila les titres des chanson devrai apparaitre. Bien sur ce code n'est qu'une rustine. parce que si les noms s'affiche, la liste c'est réduite toute seule.
leproc
Messages postés81Date d'inscriptionlundi 26 septembre 2005StatutMembreDernière intervention22 octobre 2008 25 sept. 2007 à 23:13
Euh faut qu'on m'explique a quoi sert la pré-visualisation (apparement tout est déja enregistré a ce moment la).
Et 2 j'arrive pas a mettre a jour, l'image et le code.
29 janv. 2008 à 17:06
23 janv. 2008 à 14:50
Tu ne pourrais pas mettre plutot un texte.ToLower() ?
7 oct. 2007 à 14:39
26 sept. 2007 à 16:36
voila la solution
dans form1 remplacer :
----------------------------------------------------------
private void ListeNom_LB_SelectedIndexChanged(object sender, EventArgs e)
{
ListeREF_LB.SelectedIndex = ListeNom_LB.SelectedIndex;
ListeREFSEL = ListeREF_LB.SelectedItem.ToString();
ListeNomSEL = ListeNom_LB.SelectedItem.ToString();
// désactive list box.
ListeNom_LB.Enabled = false;
Thread2_BGW.RunWorkerAsync();
}
int page;
private void Thread_BGW_DoWork(object sender, DoWorkEventArgs e)
{
//efface la recherche HTML précédente
PageHtml = "";
//télécharge les pages de la recherche
page = 0;
dix:
renouvellement();
if (NbrTrack == 0)
{
int A = ci.IndexOf(PageHtml, "of about ", 1, System.Globalization.CompareOptions.Ordinal);
if (A == 0)
{
return; // TODO: might not be correct. Was : Exit Sub
}
int B = ci.IndexOf(PageHtml, "<", A + 12, System.Globalization.CompareOptions.Ordinal);
string voir = PageHtml.Substring(A + 12, B - (A + 12));
NbrTrack = Convert.ToInt32(voir);
}
if (page * 50 < NbrTrack)
{
page = page + 1;
ProssesBAR = ((page * 50) / NbrTrack) * 100;
goto dix;
}
}
public void renouvellement()
{
page -= 1;
for (int i = 0; i <= 100; i++)
{
page += 1;
string AdrSite = "http://www.radioblogclub.fr/search/" + page * 50 + "/" + RECHERCHE_TXT.Text;
System.Net.WebClient WebClient = new System.Net.WebClient();
System.IO.StreamReader Sr = new System.IO.StreamReader(WebClient.OpenRead(AdrSite), System.Text.Encoding.Default);
PageHtml = PageHtml + Sr.ReadToEnd();
//Récupére le code
Sr.Dispose();
Sr = null;
WebClient.Dispose();
WebClient = null;
REMPLIRLISTE();
}
}
private void REMPLIRLISTE()
{
//fouille le code html pour extraire les noms de fichier dans la listebox
int B = 1;
int B2 = 1;
int A = ci.IndexOf(PageHtml, "open/", B, System.Globalization.CompareOptions.Ordinal);
B = ci.IndexOf(PageHtml, "</td>", B, System.Globalization.CompareOptions.Ordinal);
//--------------------------------
string NomComplet = PageHtml.Substring(A, B - A);
//--------------------------------
string amp NomComplet.Replace("[&|amp;]", "&"); NomComplet amp;
//-------------------------------
//Important pour certain titre... (avec "&")
string aà NomComplet.Replace("[ÃÂ]", "à"); NomComplet aà;
//-------------------------
char[] Caractaire_Separateur = new Char[] { '\'', '>' }; // Caractère : ,
// On découpe et on mais sous forme d'un tableau
string[] Result_Separation = NomComplet.Split(Caractaire_Separateur);
string o = Result_Separation[1];
ListeNom_LB.Items.Add(o);
int A2 = Strings.InStr(B2, PageHtml, "BlogThisTrack.start('", CompareMethod.Text);
if (A2 == 1) MessageBox.Show("erreur RadioBlogClub.com a changé");
B2 = Strings.InStr(A2, PageHtml, "')", CompareMethod.Text);
ListeREF_LB.Items.Add("h" + PageHtml.Substring(A2 + 21, B2 - A2 - 22) + "&k=657ecb3231ac0b275497d4d6f00b61a1");
// AJOUT DE L'URL
switch (ListeNom_LB.Items.Count) {
case 0:
ListCount_LBL.texte = "Aucun Fichier Trouvé";
break;
case 1:
ListCount_LBL.texte = "Un Fichier Trouvé";
break;
default : // si plusieurs fichier trouver.
ListCount_LBL.texte = ListeNom_LB.Items.Count + " Fichiers Trouvés";
break;
}
PageHtml = "";
//Efface la recherche, (une longue string).
Timer1.Enabled = false;
}
----------------------------------------------------------
Et retirer la ligne :
----------------------------------------------------------
private void Thread_BGW_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
//Ligne a retirer
//--------------------
REMPLIRLISTE();
//--------------------
GO_CMD.Enabled = true;
RECHERCHE_TXT.Enabled = true;
}
----------------------------------------------------------
Et voila les titres des chanson devrai apparaitre. Bien sur ce code n'est qu'une rustine. parce que si les noms s'affiche, la liste c'est réduite toute seule.
25 sept. 2007 à 23:13
Et 2 j'arrive pas a mettre a jour, l'image et le code.