实现此目标需要哪些库或方法?如何在C#中确定swf文件的actionscript版本?
0
A
回答
2
读取SWF文件的前4个字节。前3个字节是读取(CWS或FWS)的签名,下一个字节是SWF文件版本。所以你不需要任何库,只需简单的文件IO就足够了。对于动作脚本版本,您需要查找FileAttributes标签。所以这里是做这个的伪代码。 (在SWF文件中的数据是Little Endian,所以请相应地编写你的readInt或readShort函数)。
signature = read 3 UTF Bytes as String;
version = read one byte;
size = read unsigned int; (int is 32 bit)
if (signature == "CWS") // i.e. SWF is compressed
then uncompress the rest of the bytes; //swf uses zlib compression, first 7 bytes are compressed
rect_byte = read unsigned Byte;
rect_bits = rect_byte >> 3; //first 5 bits says how many bits are required for one dimensoin of the swf
total_bits = rect_bits * 4;
rect_bytes = Math.ceil((total_bits - 3)/ 8); //till here we have information about swf dimension
read rect_bytes number of bytes;
read unsigned short as frame rate;
read unsigned short as frame count;
while true do {
read unsigned short into swf_tag_code_len;
tagcode = swf_tag_code_len >>6; // first 6 bits determine the tag code
taglen = swf_tag_code_len & 0x3F; // last 10 bits determines the length of tag (if length is less than 63)
if (taglen >= 63) { // if tag is bigger than 63 bytes, then next four bytes tell the length
taglen = read unsgined int;
}
if (tagcode == 69) {// here we go, we are looking for this tag (fileattribute) {
b = read unsigned byte;
if (b & (1 << 3)) { // 4th least significant bit tell about actionscript version
it is actionscript version 3;
} else { either it is 1.0 or 2.0;}
}
}
0
有一个商业库,可以与你的努力帮助:
http://www.aspose.com/categories/.net-components/aspose.flash-for-.net/default.aspx
然而,你的另一种选择是分析和直接读取SWF和使用这样的指南:http://www.m2osw.com/swf_alexref.html
相关问题
- 1. C#如何确定Excel文件版本
- 2. 如何在SWFC中指定Actionscript版本?
- 3. 从Python中检查SWF的Flash版本和ActionScript版本?
- 4. 如何确定给定文件版本的ClearCase目录版本?
- 5. 如何将文件附加到swf(Actionscript)
- 6. AS3 Flash SWF文件版本
- 7. 如何在一个版本中确定文件的文本块来自以前版本中的哪个文件?
- 8. 如何确定swf可以发布的最低版本?
- 9. 在C#应用程序中确定swf文件的路径
- 10. 如何从Flex SWF中的ActionScript 1/2 swf接收事件?
- 11. 在C#中执行ActionScript窗体SWF文件
- 12. ActionScript 3.0中无法加载SWF文件
- 13. 如何在Actionscript中锁定文件?
- 14. flash actionscript 1.0,将外部swf文件加载到父SWF文件
- 15. C#中确定引用的dll文件版本#
- 16. 如何从MATLAB中确定MAT文件的版本?
- 17. actionscript 3.0 - .swf嵌套在.swf中?
- 18. 在导出发布版本后,Flex Actionscript项目swf不工作
- 19. 如何确定文本文件中字符的位置(C++)
- 20. 如何确定C中的Unix文本文件?
- 21. 确定文件的最新版本(python)
- 22. 如何确定Makefile中的python版本?
- 23. 如何在eclipse c/C++版本中检查纯文本文件中的拼写?
- 24. 如何在C++中确定视频驱动程序版本?
- 25. 如何确定LLVM版本?
- 26. 如何确定OpenCV版本
- 27. 如何确定cefsharp版本
- 28. 如何在Flash游戏开发中缩小ActionScript中的主SWF文件
- 29. 如何使用ActionScript 2找到SWF文件的URL?
- 30. 使用C#从SWF中提取ActionScript
如何将SWF文件版本字节转换为actionscript版本? – 2010-02-03 22:08:36
只有swf文件使用actionscript版本3.0或更高版本时,才能说明。您需要查找FileAttributes标签。我用相同的伪代码编辑了答案。希望能帮助到你。 – bhups 2010-02-04 05:50:25