[Swfed-svn] swfed-svn [362] (get|replace) ShapeData のサンプルコード

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 2月 3日 (木) 23:28:19 JST


Revision: 362
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=362
Author:   yoya
Date:     2011-02-03 23:28:19 +0900 (Thu, 03 Feb 2011)

Log Message:
-----------
(get|replace)ShapeData のサンプルコード

Added Paths:
-----------
    trunk/sample/swfgetshapedata.php
    trunk/sample/swfreplaceshapedata.php


-------------- next part --------------
Added: trunk/sample/swfgetshapedata.php
===================================================================
--- trunk/sample/swfgetshapedata.php	                        (rev 0)
+++ trunk/sample/swfgetshapedata.php	2011-02-03 14:28:19 UTC (rev 362)
@@ -0,0 +1,21 @@
+<?php
+
+if ($argc != 3) {
+    fprintf(STDERR, "Usage: swfgetshapedata <swf_file> <shape_id>\n");
+    exit(1);
+}
+
+$swf_filename = $argv[1];
+$shape_id = $argv[2];
+$swfdata = file_get_contents($swf_filename);
+
+$obj = new SWFEditor();
+if ($obj->input($swfdata) == false) {
+    fprintf(STDERR, "input failed\n");
+    exit(1);
+}
+
+//echo $obj->getShapeData($shape_id);
+echo $obj->getTagContentsByCID($shape_id);
+
+

Added: trunk/sample/swfreplaceshapedata.php
===================================================================
--- trunk/sample/swfreplaceshapedata.php	                        (rev 0)
+++ trunk/sample/swfreplaceshapedata.php	2011-02-03 14:28:19 UTC (rev 362)
@@ -0,0 +1,28 @@
+<?php
+
+if (($argc < 4) || ($argc%2 != 0)) {
+	fprintf(STDERR, "Usage: swfreplaceshapedata <swf_file> <shape_id> <shape_file> [<shape_id2> <shape_file2> [...]]\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);
+}
+
+for ($i=2 ; $i < $argc ; $i+=2) {
+	$shape_id = $argv[$i];
+	$shape_filename = $argv[$i+1];
+	$shapedata = file_get_contents($shape_filename);
+	if ($obj->replaceShapeData($shape_id, $shapedata) == false) {
+		fprintf(STDERR, "replaceShapeData($shape_id, ...) failed\n");
+		exit(1);
+	}
+}
+
+echo $obj->output();



Swfed-svn メーリングリストの案内
Back to archive index