modified: c/CtrlCheckLinks.rb
modified: c/Main.rb deleted: c/ff~ modified: v/Vue1.rb modified: v/VueResult.rb
This commit is contained in:
parent
049d5c90f6
commit
7bf4004c31
@ -2,10 +2,8 @@ class CtrlCheckLinks
|
||||
def saisie
|
||||
liste_dir = "../fichier/".liste_rep
|
||||
#Va checher les fichiers et arborecenses dans le dossier fichier (Méthode dans ReadFolder)
|
||||
|
||||
Gtk.init
|
||||
@v1 = Vue1.new(liste_dir, self)
|
||||
|
||||
@v1.getWindow.show_all
|
||||
Gtk.main
|
||||
|
||||
@ -15,7 +13,18 @@ class CtrlCheckLinks
|
||||
def recupUrls(str)
|
||||
f = ReadFile.new(str)
|
||||
@urls = f.getUrls
|
||||
self.destructionFen
|
||||
self.vueResult(self.verifLiens(@urls))
|
||||
end
|
||||
|
||||
def recupUrlsDoss(str)
|
||||
d = Dir.open(str)
|
||||
liste_exclus = [".", ".."]
|
||||
liste_dir = d.sort - liste_exclus
|
||||
liste_dir.each { |fichier| #pour chaque fichier touvé
|
||||
if (File.ftype(str + "/" + fichier) == "file")
|
||||
self.recupUrls(str + "/" + fichier)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def destructionFen
|
||||
@ -24,7 +33,6 @@ class CtrlCheckLinks
|
||||
end
|
||||
|
||||
def verifLiens(urls)
|
||||
|
||||
resultats = ""
|
||||
urls.each { |n|
|
||||
p = Net::Ping::HTTP.new n , 80
|
||||
|
10
c/Main.rb
10
c/Main.rb
@ -11,14 +11,10 @@ require '../m/ReadFolder'
|
||||
require '../v/Vue1'
|
||||
require '../v/VueResult'
|
||||
|
||||
while 1
|
||||
c = CtrlCheckLinks.new
|
||||
urls = c.saisie
|
||||
if(urls !=nil)
|
||||
resultats = c.verifLiens(urls)
|
||||
c.vueResult(resultats)
|
||||
else
|
||||
break
|
||||
end
|
||||
while urls!=nil
|
||||
c = CtrlCheckLinks.new
|
||||
urls = c.saisie
|
||||
end
|
||||
print "Termine\n"
|
1
c/ff~
1
c/ff~
@ -1 +0,0 @@
|
||||
fdfsdjkfdjskljfldks http://www.google.fr/jbhddzd/zddz"></a> fodfkljskljsd
|
31
v/Vue1.rb
31
v/Vue1.rb
@ -61,16 +61,29 @@ class Vue1
|
||||
@chaine = " "
|
||||
@b.signal_connect('clicked'){
|
||||
@chaine = @nom.text.to_s
|
||||
@chaine = "../fichier/" + @chaine
|
||||
if(File.exist?(@chaine))
|
||||
@ctrl.recupUrls(@chaine)
|
||||
if (@chaine =="")
|
||||
m = Gtk::MessageDialog.new(Gtk::Window.new, Gtk::Dialog::DESTROY_WITH_PARENT,
|
||||
Gtk::MessageDialog::ERROR,
|
||||
Gtk::MessageDialog::BUTTONS_CLOSE,
|
||||
"Erreur : Veuillez saisir un fichier ou dossier !")
|
||||
m.run
|
||||
m.destroy
|
||||
else
|
||||
d = Gtk::MessageDialog.new(Gtk::Window.new, Gtk::Dialog::DESTROY_WITH_PARENT,
|
||||
Gtk::MessageDialog::ERROR,
|
||||
Gtk::MessageDialog::BUTTONS_CLOSE,
|
||||
"Erreur : Fichier inexistant")
|
||||
d.run
|
||||
d.destroy
|
||||
@chaine = "../fichier/" + @chaine
|
||||
if(File.directory?(@chaine))
|
||||
@ctrl.recupUrlsDoss(@chaine)
|
||||
else
|
||||
if(File.exist?(@chaine))
|
||||
@ctrl.recupUrls(@chaine)
|
||||
else
|
||||
d = Gtk::MessageDialog.new(Gtk::Window.new, Gtk::Dialog::DESTROY_WITH_PARENT,
|
||||
Gtk::MessageDialog::ERROR,
|
||||
Gtk::MessageDialog::BUTTONS_CLOSE,
|
||||
"Erreur : Fichier ou dossier inexistant !")
|
||||
d.run
|
||||
d.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
@ -15,7 +15,6 @@ class VueResult
|
||||
vb.pack_start(vh)
|
||||
|
||||
@window.add(vb)
|
||||
|
||||
self.listenerDestroy
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user