yEnc 0.0.25 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/y_enc.rb +13 -11
  2. metadata +2 -2
@@ -1,15 +1,15 @@
1
+ require 'zlib'
2
+
1
3
  class YEnc
2
4
 
3
5
  def initialize filepath, outputpath
4
6
  @filepath = filepath
5
7
  @outputpath = outputpath
6
- puts "Searching for file: #{@filepath}"
7
8
  end
8
9
 
9
10
  def decode
10
11
  if is_yenc?
11
12
  #Continue decoding
12
- puts "File is verified as yEncoded file. Beginning decoding."
13
13
  begin_read = false
14
14
 
15
15
  File.open(@filepath, 'r').each_line do |line|
@@ -20,7 +20,6 @@ class YEnc
20
20
  next
21
21
  end
22
22
  if line.include?("=yend")
23
- puts "Reached the end of file"
24
23
  begin_read=false
25
24
  break #stop looking through the file we are done
26
25
  end
@@ -55,27 +54,30 @@ class YEnc
55
54
  end
56
55
  @new_file.close
57
56
  else
58
- puts "This is not a yEncoded file."
57
+ false
59
58
  end
60
59
  end
61
60
 
61
+ #Does this pass the crc32 check
62
+ def pass_crc32?
63
+
64
+ end
65
+
62
66
  private
63
67
 
64
68
  def is_yenc?
65
69
  File.read(@filepath).include?("=ybegin")
66
70
  end
67
71
 
72
+ def breakdown_endline line
73
+ @crc32 = line[/crc32=(.*)/,1] if @crc32.nil?
74
+ end
75
+
68
76
  def breakdown_header line
69
77
  @filename=line[/name=(.*)/,1] if @filename.nil?
70
78
  @filesize =line[/size=([^\s]+)/,1] if @filesize.nil?
71
79
  @line=line[/line=([^\s]+)/,1] if @line.nil?
72
- puts "File Name: #{@filename}"
73
- puts "Size: #{@filesize} Length: #{@line}"
74
- puts "Creating file: #{@outputpath}#{@filename}"
75
80
  @new_file = File.new(@outputpath + @filename, "wb")
76
81
  end
77
82
 
78
- end
79
-
80
- y = YEnc.new("/Users/scontapay/yenc.txt", "/Users/scontapay/")
81
- y.decode
83
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yEnc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-07 00:00:00.000000000 Z
12
+ date: 2012-07-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: yEnc decoder written in Ruby
15
15
  email: sam.contapay@gmail.com