modified: README.md

modified:   c/ff
	modified:   c/main.rb
	modified:   m/ReadFile.rb
This commit is contained in:
Quentin 2013-12-18 10:41:37 +01:00
parent 26e8968796
commit 119cb1a977
4 changed files with 48 additions and 20 deletions

View File

@ -1,5 +1,11 @@
curling-g32 curling-g32
=========== ==========================================================================
Projet Acsi Curling 2013-2014 Projet Acsi Curling 2013-2014
Albert Jeremy, Aviles Adrien, Geoffrey Sentost, Quentin Rouland Albert Jeremy, Aviles Adrien, Geoffrey Sentost, Quentin Rouland
==========================================================================
Requiert :
* Gtk2 : gem install gtk2
* net/ping : gem install net-ping

4
c/ff
View File

@ -1,3 +1 @@
www.google.fr fdfsdjkfdjskljfldks http://www.google.fr fodfkljskljsd
www.japanimes.tk
www.fakeadresse.com

View File

@ -2,13 +2,14 @@
#lib #lib
require 'gtk2' # lib graphique require 'gtk2' # lib graphique
#require 'net-ping' #lib netwotk require 'net/http' #lib netwotk
require 'uri'
#include #include
require '../m/ReadFile' require '../m/ReadFile'
require '../v/Vue1' require '../v/Vue1'
require '../v/VueError' require '../v/VueError'
Gtk.init Gtk.init
v1 = Vue1.new v1 = Vue1.new
@ -18,15 +19,12 @@ v1.listenerDestroy
v1.getWindow.show_all v1.getWindow.show_all
Gtk.main Gtk.main
str = v1.getEntry str = v1.getEntry
#print str
if(File.exist?(str)) if(File.exist?(str))
f = ReadFile.new(str) f = ReadFile.new(str)
tabL = f.getLines url = f.getUrls
puts url
for i in tabL
puts i
end
else else
vd = VueError.new("Fichier inexistant") vd = VueError.new("Fichier inexistant")
vd.getDialog.run vd.getDialog.run
@ -37,4 +35,29 @@ end
# def ping(host)
# begin
# url=URI.parse(host)
# start_time = Time.now
# response=Net::HTTP.get(url)
# end_time = Time.now - start_time
# if response==""
# return false
# else
# puts "response time : #{end_time}"
# return true
# end
# rescue Errno::ECONNREFUSED
# return false
# end
# end
#
# if(ping "")
# puts('vrai')
# else
# puts('faux')
# end
print "Termine\n" print "Termine\n"

View File

@ -3,14 +3,15 @@ class ReadFile
@fic = File.open(pFic, "r") @fic = File.open(pFic, "r")
end end
def getLines def getALL
i=0 all = @fic.read
tabLines = [] return all
@fic.each_line { |ligne| end
tabLines[i] = ligne
i = i + 1 def getUrls
} txt = self.getALL
return tabLines url = txt.match /http[^\s]*/
return url
end end
end end