public static void dump_descriptor(PhotoshopTypeLibrary.IActionDescriptor desc1, int indent) { string indent_text = " "; int num_items; desc1.GetCount(out num_items); log.WriteLine("Descriptor ({0} items)", num_items); for (int i = 0; i < num_items; i++) { int child_key; int child_type; desc1.GetKey(i, out child_key); desc1.GetType(child_key, out child_type); string indent_str = commoncs.libstring.Multiply(indent_text, indent + 1); log.Write(indent_str); log.Write("[{0}] ", i.ToString()); log.WriteLine(" ( {0} ) ", PSX.IDToStr(child_type)); log.Write(indent_str + "-"); if (child_type == (int)con.phTypeObject) { PhotoshopTypeLibrary.IActionDescriptor child_desc; int child_class_id; desc1.GetObject(child_key, out child_class_id, out child_desc); string sss = string.Format(" ( {0} ) ( {1} ) ", PSX.IDToStr(child_key), PSX.IDToStr(child_class_id)); log.WriteLine(sss); PSX.dump_descriptor(child_desc, indent + 1); } else if (child_type == (int)con.phTypeObjectReference) { log.WriteLine("<handled type>"); } else if (child_type == (int)con.phTypeText) { log.WriteLine("<handled type>"); } else if (child_type == (int)con.phTypeBoolean) { log.WriteLine("<handled type>"); } else if (child_type == (int)con.phTypeEnumerated) { log.WriteLine("<handled type>"); } else if (child_type == (int)con.phTypeType) { log.WriteLine("<handled type>"); } else if (child_type == (int)con.phTypePath) { log.WriteLine("<handled type>"); } else { log.WriteLine("<unhandled type>"); } } }
public static int get_count_from_object_collection(int object_id) { int count = 0; if (object_id == (int)con.phClassDocument) { count = (int)PSX.get_value_from_object((int)con.phClassApplication, -1, (int)con.phKeyNumberOfDocuments); } else if (object_id == (int)con.phClassLayer) { count = (int)PSX.get_value_from_object((int)con.phClassDocument, -1, (int)con.phKeyNumberOfLayers); } else { string msg = string.Format("Invalid object_id {0},{1}: only documents and layers are supported", object_id, PSX.IDToStr(object_id)); var e = new Photoshop6OM.PhotoshoProxyError(msg); throw e; } return(count); }