private TreeNode JsonToTreeNode(Hashtable json_tree, State parent) { string str = (string)json_tree["type"]; switch (str) { case "blank": return(new BlankClip()); case "clip": return(this.GetClipByNameAndMarkInUse((string)json_tree["name"], parent)); case "blend2d": Blend2d sb = new Blend2d(JsonToTreeNode((Hashtable)json_tree["blend1"], parent), JsonToTreeNode((Hashtable)json_tree["blend2"], parent), (string)json_tree["control"]); sb.state = parent; return(sb); /*case "list": * ListBlend lb = new ListBlend(); * lb.control = (string) json_tree["control"]; * ArrayList json_blends = (ArrayList) json_tree["blends"]; * lb.blends = new TreeNode[json_blends.Count]; * for( int i=0;i<json_blends.Count;i++ ) { * lb.blends[i] = JsonToTreeNode( (Hashtable) json_blends[i] ); * } * return lb; * break;*/ case "additive": AdditiveBlend ab = new AdditiveBlend( (Clip)JsonToTreeNode((Hashtable)json_tree["difference_clip"], parent), JsonToTreeNode((Hashtable)json_tree["blend"], parent), (string)json_tree["control"], (string)json_tree["additive_control"] ); ab.state = parent; return(ab); default: throw new System.Exception("Could not create"); } }
private TreeNode JsonToTreeNode( Hashtable json_tree , State parent ) { string str = (string) json_tree["type"]; switch( str ) { case "blank": return( new BlankClip() ); case "clip": return( this.GetClipByNameAndMarkInUse( (string) json_tree["name"] , parent) ); case "blend2d": Blend2d sb = new Blend2d(JsonToTreeNode( (Hashtable) json_tree["blend1"] , parent ) , JsonToTreeNode( (Hashtable) json_tree["blend2"] , parent ) , (string) json_tree["control"] ); sb.state = parent; return sb; /*case "list": ListBlend lb = new ListBlend(); lb.control = (string) json_tree["control"]; ArrayList json_blends = (ArrayList) json_tree["blends"]; lb.blends = new TreeNode[json_blends.Count]; for( int i=0;i<json_blends.Count;i++ ) { lb.blends[i] = JsonToTreeNode( (Hashtable) json_blends[i] ); } return lb; break;*/ case "additive": AdditiveBlend ab = new AdditiveBlend( (Clip) JsonToTreeNode( (Hashtable) json_tree["difference_clip"] , parent ) , JsonToTreeNode( (Hashtable) json_tree["blend"], parent) , (string) json_tree["control"], (string) json_tree["additive_control"] ); ab.state = parent; return ab; default: throw new System.Exception( "Could not create" ); } }