Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
CnVCL 组件包
» TCnXorIniFile如何使用?
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: TCnXorIniFile如何使用?
laiguorong
新警察
UID 1001
Digest Posts 0
Credits 12
Posts 5
点点分 12
Reading Access 10
Registered 2005-8-23
Status Offline
#1
Post at 2009-4-1 11:51
Profile
|
Blog
|
P.M.
|
TCnXorIniFile如何使用?
TCnXorIniFile如何使用?
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#2
Post at 2009-4-1 13:37
Profile
|
Blog
|
P.M.
就像普通IniFile类一样使用,不同之处只是Create时需要传入一字符串参数作为异或加密的种子。保存的ini文件内容会用此字符串简单异或加密。
laiguorong
新警察
UID 1001
Digest Posts 0
Credits 12
Posts 5
点点分 12
Reading Access 10
Registered 2005-8-23
Status Offline
#3
Post at 2009-4-1 18:32
Profile
|
Blog
|
P.M.
|
保存很正常,读取的时候文件大小会变成0字节...
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#4
Post at 2009-4-3 07:18
Profile
|
Blog
|
P.M.
我们检查一下。
Passion
(LiuXiao)
管理员
UID 359
Digest Posts
19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
#5
Post at 2009-4-4 17:59
Profile
|
Blog
|
P.M.
经过检查,是我们在处理异或时有bug,导致有时无法正确解码从而覆盖文件内容。
最新的CVS上已经修复了此问题,并增加了一个XorIni的例子,可参考。
最新发布的20090404CVS包也已经集成了此修改。
calmpurp
新警察
UID 47929
Digest Posts 0
Credits 6
Posts 3
点点分 6
Reading Access 10
Registered 2010-5-16
Status Offline
#6
Post at 2010-5-16 16:27
Profile
|
Blog
|
P.M.
我使用最新的cnvcl_20100501,发现又有这个问题,不正确的加密的种子,会导致文件清空。
zjy
管理员
UID 2
Digest Posts
6
Credits 2385
Posts 1543
点点分 2385
Reading Access 102
Registered 2002-12-16
Location China
Status Offline
#7
Post at 2010-5-16 19:01
Profile
|
Site
|
Blog
|
P.M.
QUOTE:
原帖由
calmpurp
于 2010-5-16 16:27 发表
我使用最新的cnvcl_20100501,发现又有这个问题,不正确的加密的种子,会导致文件清空。
不正确的加密种子会导致解密出来的文本不再满足INI文件的格式,赋值给INI对象后,再从INI对象生成字符串加密保存,就会出现文件被清空的现象了。
Zhou JingYu
CnPack Administrator
http://www.cnpack.org/
calmpurp
新警察
UID 47929
Digest Posts 0
Credits 6
Posts 3
点点分 6
Reading Access 10
Registered 2010-5-16
Status Offline
#8
Post at 2010-5-16 21:33
Profile
|
Blog
|
P.M.
我的代码
try
T:= TCnXorIniFile.Create(Extractfilepath(Paramstr(0))+'project.ini','xin');
edt1.Text := T.ReadString('main','user','');
finally
T.Free;
end;
只要解密字符不对就清空,只是读一下,就清空了?
[
本帖最后由 calmpurp 于 2010-5-16 21:35 编辑
]
zjy
管理员
UID 2
Digest Posts
6
Credits 2385
Posts 1543
点点分 2385
Reading Access 102
Registered 2002-12-16
Location China
Status Offline
#9
Post at 2010-5-17 12:56
Profile
|
Site
|
Blog
|
P.M.
确实是个Bug
因为 TCnStreamIniFile.Destroy 里强制调用了一次 UpdateFile,所以会导致“只要解密字符不对就清空,只是读一下,就清空了”的问题。
SVN中的代码已经修正,增加了内容变更判断。
http://code.google.com/p/cnpack/source/detail?r=594
Zhou JingYu
CnPack Administrator
http://www.cnpack.org/
calmpurp
新警察
UID 47929
Digest Posts 0
Credits 6
Posts 3
点点分 6
Reading Access 10
Registered 2010-5-16
Status Offline
#10
Post at 2010-5-17 18:14
Profile
|
Blog
|
P.M.
谢谢!初学编程,cnpack对我很有帮助,再次感谢!
zjy
管理员
UID 2
Digest Posts
6
Credits 2385
Posts 1543
点点分 2385
Reading Access 102
Registered 2002-12-16
Location China
Status Offline
#11
Post at 2010-5-18 10:07
Profile
|
Site
|
Blog
|
P.M.
QUOTE:
原帖由
calmpurp
于 2010-5-17 18:14 发表
谢谢!初学编程,cnpack对我很有帮助,再次感谢!
不客气!能给更多的人以帮助,正是我们所追求的:)
Zhou JingYu
CnPack Administrator
http://www.cnpack.org/
dtpl
新警察
UID 57584
Digest Posts 0
Credits 6
Posts 2
点点分 6
Reading Access 10
Registered 2011-1-5
Status Offline
#12
Post at 2011-1-5 15:04
Profile
|
Blog
|
P.M.
管理员,你好,我在使用TCnXorIniFile在我的程序中时,也偶尔会出现ini文件中的内容被清空的问题,请问怎么解决,我用的是 CnVCL 组件包 20101001。谢谢了。
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-25 00:19
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.008642 second(s), 9 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats