VictoriaFreSh 2020.7.38 → 2020.7.43

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/victoriafresh.rb +30 -16
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a39fedfddb83014e92fd898251a01010a116a89766dddb607dd9ac10d98fd470
4
- data.tar.gz: aa1df0393ee1fb5b7c9cb127e62c9413cec9cd16984547baa0271aa4fbd0398d
3
+ metadata.gz: 3cd9a3ba2ec266174958ab7fed3a2dfba2656ffb0b0833742fb91fe078a28617
4
+ data.tar.gz: 44f60f5f60c7d0126a5994e1ba99afa435a2c153a4a84d46dd9406ddf0bbb9b1
5
5
  SHA512:
6
- metadata.gz: 890dd1f57aa777c450ac052007375f3c36519b9dd3e6e116f8f5bd9a3caa3c1874d9f58d4b0657211b18b1f15073cc7006d6f680f7cf3259f2299ca4b30cccf3
7
- data.tar.gz: 6e3fb87d0f7e9e431027c6dfd44b86b7634593322391509e29151080747967493ff37aded92bcda98dc84cbbc004d3923b1421068be3f27c88d506e7dbd91e75
6
+ metadata.gz: 965aea54528d639258d17c780a28160fb33d4043f026eb000c3c1ad51e5b11960c3655b2b5b96ad1c1fe02e926417603560eadbaca2d42b436380573883ce233
7
+ data.tar.gz: ae2bbe7ab8f2a894af168acbebbe9e6861bd2e46baf5fe19d65049d986575848f3d27fe9fbf6e0827e9c604d1814b21e26e3921737e5455601c6405a32bac8eb
@@ -8,7 +8,9 @@ require 'cbor'
8
8
 
9
9
  class VictoriaFresh
10
10
  def releaseFiles(victoriaFreshPackagedFileString, contentString) #释放目录树
11
- packagedFile=Com::Stupidbeauty::Victoriafresh::FileMessage.decode(victoriaFreshPackagedFileString) #解码文件消息对象。
11
+ # packagedFile=Com::Stupidbeauty::Victoriafresh::FileMessage.decode(victoriaFreshPackagedFileString) #解码文件消息对象。
12
+ packagedFile=CBOR.decode(victoriaFreshPackagedFileString) #解码
13
+
12
14
 
13
15
  puts packagedFile #Debug
14
16
 
@@ -19,23 +21,29 @@ class VictoriaFresh
19
21
 
20
22
  timeObject=getTimeObject(packagedFile) #构造时间戳对象
21
23
 
22
- victoriaFreshData=contentString[packagedFile.file_start_index, packagedFile.file_length] #获取内容
24
+ # victoriaFreshData=contentString[packagedFile.file_start_index, packagedFile.file_length] #获取内容
25
+ victoriaFreshData=contentString[ packagedFile['file_start_index'], packagedFile['file_length'] ] #获取内容
23
26
 
24
- pathToMake=pathPrefix + '/' + packagedFile.name #构造文件名
27
+ # pathToMake=pathPrefix + '/' + packagedFile.name #构造文件名
28
+ pathToMake=pathPrefix + '/' + packagedFile['name'] #构造文件名
25
29
 
26
- victoriaFreshDataFile=File.new(pathToMake , "wb") #数据文件。
27
- victoriaFreshDataFile.syswrite(victoriaFreshData) #写入文件。
30
+ victoriaFreshDataFile=File.new(pathToMake , "wb") #数据文件。
31
+ victoriaFreshDataFile.syswrite(victoriaFreshData) #写入文件。
28
32
  victoriaFreshDataFile.close #关闭文件。
29
-
33
+
30
34
  FileUtils.touch pathToMake, :mtime => timeObject #设置修改时间
31
-
35
+
32
36
  end #writeFile(pathPrefix, packagedFile, contentString) #写入文件
33
37
 
34
38
  def getTimeObject(packagedFile) #构造时间戳对象
35
- puts packagedFile.timestamp #Debug
39
+ # puts packagedFile.timestamp #Debug
40
+ puts packagedFile['timestamp'] #Debug
36
41
 
37
- seconds=packagedFile.timestamp.seconds #获取秒数
38
- microSeconds=packagedFile.timestamp.nanos/ 1000.0 #获取毫秒数
42
+ # seconds=packagedFile.timestamp.seconds #获取秒数
43
+ seconds=packagedFile['timestamp']['seconds'] #获取秒数
44
+
45
+ # microSeconds=packagedFile.timestamp.nanos/ 1000.0 #获取毫秒数
46
+ microSeconds=packagedFile['timestamp']['nanos'] / 1000.0 #获取毫秒数
39
47
 
40
48
  timeObject=Time.at(seconds, microSeconds) #构造时间对象
41
49
 
@@ -47,7 +55,8 @@ class VictoriaFresh
47
55
 
48
56
  puts 'mkdir' #Debug
49
57
 
50
- pathToMake=File.join(pathPrefix, packagedFile.name)
58
+ # pathToMake=File.join(pathPrefix, packagedFile.name)
59
+ pathToMake=File.join(pathPrefix, packagedFile['name'])
51
60
 
52
61
  puts pathToMake #Debug.
53
62
 
@@ -62,18 +71,23 @@ class VictoriaFresh
62
71
  end #makeDirectory(pathPrefix, packagedFile) #创建目录
63
72
 
64
73
  def releaseFile( pathPrefix, packagedFile, contentString) #释放一个文件
65
- puts packagedFile.name #Debug
74
+ # puts packagedFile.name #Debug
75
+ puts packagedFile['name'] #Debug
66
76
 
67
- puts packagedFile.timestamp #Debug
77
+ # puts packagedFile.timestamp #Debug
78
+ puts packagedFile['timestamp'] #Debug
68
79
 
69
- if packagedFile.is_file #是文件,则直接写入文件
80
+ # if packagedFile.is_file #是文件,则直接写入文件
81
+ if packagedFile['is_file'] #是文件,则直接写入文件
70
82
  writeFile(pathPrefix, packagedFile, contentString) #写入文件
71
83
  else #是目录,则创建目录,并递归处理
72
84
  makeDirectory(pathPrefix, packagedFile) #创建目录
73
85
 
74
- direcotryPathPrefix=pathPrefix + '/' + packagedFile.name #构造针对该目录的路径前缀
86
+ # direcotryPathPrefix=pathPrefix + '/' + packagedFile.name #构造针对该目录的路径前缀
87
+ direcotryPathPrefix=pathPrefix + '/' + packagedFile['name'] #构造针对该目录的路径前缀
75
88
 
76
- subFiles=packagedFile.sub_files #获取子文件列表。
89
+ # subFiles=packagedFile.sub_files #获取子文件列表。
90
+ subFiles=packagedFile['sub_files'] #获取子文件列表。
77
91
 
78
92
  subFiles.each do |currentSubFile| #一个个子文件地释放
79
93
  releaseFile(direcotryPathPrefix, currentSubFile, contentString) #释放子文件
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: VictoriaFreSh
3
3
  version: !ruby/object:Gem::Version
4
- version: 2020.7.38
4
+ version: 2020.7.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hxcan Cai