OSDN Git Service

replaceActionString のテストスクリプト
authoryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Thu, 9 Jun 2011 16:40:52 +0000 (16:40 +0000)
committeryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Thu, 9 Jun 2011 16:40:52 +0000 (16:40 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/swfed/trunk@581 7c90b180-03d5-4157-b861-58a559ae9d1e

sample/swfreplaceactionstring.php [new file with mode: 0644]

diff --git a/sample/swfreplaceactionstring.php b/sample/swfreplaceactionstring.php
new file mode 100644 (file)
index 0000000..959723a
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+
+if (($argc < 4) || ($argc%2 != 0)) {
+    fprintf(STDERR, "Usage: swfreplaceactionstring <swf_file> <from_str> <to_str> [<from_str2> <to_str2> [...]]\n");
+    exit(1);
+}
+
+$swf_filename = $argv[1];
+
+$swfdata = file_get_contents($swf_filename);
+$obj = new SWFEditor();
+
+if ($obj->input($swfdata) == false) {
+    fprintf(STDERR, "input failed\n");
+    exit(1);
+}
+
+$params = array();
+for ($i=2 ; $i < $argc ; $i+=2) {
+    $from_str = $argv[$i];
+    $to_str = $argv[$i+1];
+    $params[$from_str] = $to_str;
+}
+
+if ($obj->replaceActionString($params) == false) {
+    fprintf(STDERR, "replaceActionString(params) failed\n");
+    exit(1);
+}
+
+
+echo $obj->output();