public bool DataReady() { if (dropType != null) { if (dropType.droptype == enumDroptype.OBJECT) { bool bTypeOK = false; if (data != null) { DropTypeObject dpp = dropType as DropTypeObject; if (dpp != null) { if (dpp.ObjectType.IsAssignableFrom(data.GetType())) { bTypeOK = true; } } } return(bTypeOK); } else { int i; string[] ss = data as string[]; if (ss != null) { if (ss.Length > 0) { if (dropType.droptype == enumDroptype.FILE || dropType.droptype == enumDroptype.FILES) { for (i = 0; i < ss.Length; i++) { if (System.IO.File.Exists(ss[i])) { return(true); } } return(false); } else if (dropType.droptype == enumDroptype.FOLDER || dropType.droptype == enumDroptype.FOLDERS) { for (i = 0; i < ss.Length; i++) { if (System.IO.Directory.Exists(ss[i])) { return(true); } } return(false); } } return(true); } } return(false); } return(false); }
public override object Clone() { DropTypeObject obj = new DropTypeObject(); obj.droptype = droptype; obj._type = _type; obj._obj = _obj; return(obj); }
public object GetValue() { if (dropType != null) { if (dropType.droptype == enumDroptype.OBJECT) { bool bTypeOK = false; if (data != null) { DropTypeObject dpp = dropType as DropTypeObject; if (dpp != null) { if (dpp.ObjectType.IsAssignableFrom(data.GetType())) { bTypeOK = true; } } } if (bTypeOK) { return(data); } } else { int i; string[] ss = data as string[]; if (ss != null) { if (ss.Length > 0) { if (dropType.droptype == enumDroptype.FILE) { for (i = 0; i < ss.Length; i++) { if (System.IO.File.Exists(ss[i])) { return(ss[i]); } } } else if (dropType.droptype == enumDroptype.FOLDER) { for (i = 0; i < ss.Length; i++) { if (System.IO.Directory.Exists(ss[i])) { return(ss[i]); } } } else if (dropType.droptype == enumDroptype.FILES) { int nCount = 0; bool[] include = new bool[ss.Length]; for (i = 0; i < ss.Length; i++) { include[i] = System.IO.File.Exists(ss[i]); if (include[i]) { nCount++; } } string[] a = new string[nCount]; int j = 0; for (i = 0; i < ss.Length; i++) { if (include[i]) { a[j] = ss[i]; j++; } } return(a); } else if (dropType.droptype == enumDroptype.FOLDERS) { int nCount = 0; bool[] include = new bool[ss.Length]; for (i = 0; i < ss.Length; i++) { include[i] = System.IO.Directory.Exists(ss[i]); if (include[i]) { nCount++; } } string[] a = new string[nCount]; int j = 0; for (i = 0; i < ss.Length; i++) { if (include[i]) { a[j] = ss[i]; j++; } } return(a); } } return(ss); } } return(data); } return(null); }
public bool AddType(DropType ty) { if (dropType == null) { dropType = new enumDroptype[1]; dropType[0] = ty.droptype; if (ty.droptype == enumDroptype.OBJECT) { DropTypeObject p = ty as DropTypeObject; if (p != null) { if (performerTypes == null) { performerTypes = new ObjectTypes(); } performerTypes.AddType(p.ObjectType); } } return(true); } else { int i; for (i = 0; i < dropType.Length; i++) { if (dropType[i] == ty.droptype) { if (ty.droptype == enumDroptype.OBJECT) { DropTypeObject p = ty as DropTypeObject; if (p != null) { return(performerTypes.AddType(p.ObjectType)); } return(false); } else { return(false); } } } enumDroptype[] a = new enumDroptype[dropType.Length + 1]; for (i = 0; i < dropType.Length; i++) { a[i] = dropType[i]; } a[dropType.Length] = ty.droptype; dropType = a; if (ty.droptype == enumDroptype.OBJECT) { DropTypeObject p = ty as DropTypeObject; if (p != null) { if (performerTypes == null) { performerTypes = new ObjectTypes(); } performerTypes.AddType(p.ObjectType); } } return(true); } }