實現此目標需要哪些庫或方法?如何在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. 從Python中檢查SWF的Flash版本和ActionScript版本?
- 3. 如何將文件附加到swf(Actionscript)
- 4. 如何在一個版本中確定文件的文本塊來自以前版本中的哪個文件?
- 5. 在C#應用程序中確定swf文件的路徑
- 6. 如何從Flex SWF中的ActionScript 1/2 swf接收事件?
- 7. 在C#中執行ActionScript窗體SWF文件
- 8. ActionScript 3.0中無法加載SWF文件
- 9. C#中確定引用的dll文件版本#
- 10. 如何在Actionscript中鎖定文件?
- 11. 如何從MATLAB中確定MAT文件的版本?
- 12. flash actionscript 1.0,將外部swf文件加載到父SWF文件
- 13. actionscript 3.0 - .swf嵌套在.swf中?
- 14. 如何確定文本文件中字符的位置(C++)
- 15. 如何確定C中的Unix文本文件?
- 16. 在導出發佈版本後,Flex Actionscript項目swf不工作
- 17. 如何確定Makefile中的python版本?
- 18. 如何在eclipse c/C++版本中檢查純文本文件中的拼寫?
- 19. 如何在C++中確定視頻驅動程序版本?
- 20. 如何確定cefsharp版本
- 21. 如何確定LLVM版本?
- 22. 如何在Flash遊戲開發中縮小ActionScript中的主SWF文件
- 23. 如何使用ActionScript 2找到SWF文件的URL?
- 24. 使用C#從SWF中提取ActionScript
- 25. 如何在ActionScript中確定當前處理的事件?
- 26. 如何確定swf文件的發佈設置?
- 27. 如何正確確定版本號?
- 28. 確定組件版本
- 29. 如何停止加載Flash文件(.swf)(ActionScript 3)
- 30. 根據Flash反編譯器的結果確定ActionScript版本
如何將SWF文件版本字節轉換爲actionscript版本? – 2010-02-03 22:08:36
只有swf文件使用actionscript版本3.0或更高版本時,才能說明。您需要查找FileAttributes標籤。我用相同的僞代碼編輯了答案。希望能幫助到你。 – bhups 2010-02-04 05:50:25