|
@@ -1031,23 +1031,68 @@ extension AutoTest {
|
|
return object
|
|
return object
|
|
}
|
|
}
|
|
|
|
|
|
- func update(_ property:NSDictionary) {
|
|
|
|
|
|
+ func update(_ property:NSDictionary) -> AutoTest? {
|
|
|
|
+ let cClass = property["Class"] as! NSString
|
|
|
|
+ let oClass = self.m_info["Class"] as! NSString
|
|
|
|
+
|
|
let cID = property["ID"] as! NSString
|
|
let cID = property["ID"] as! NSString
|
|
let cType = property["Type"] as! NSString
|
|
let cType = property["Type"] as! NSString
|
|
let cExtention = property["Extention"] as! NSString
|
|
let cExtention = property["Extention"] as! NSString
|
|
let cName = property["Name"] as! NSString
|
|
let cName = property["Name"] as! NSString
|
|
let cParams = property["Params"] as? NSDictionary
|
|
let cParams = property["Params"] as? NSDictionary
|
|
|
|
|
|
- self.m_id = cID as String
|
|
|
|
- self.m_info = NSDictionary(dictionary: property)
|
|
|
|
- self._type = String(cType)
|
|
|
|
- self._extention = String(cExtention)
|
|
|
|
- self._name = String(cName)
|
|
|
|
- if nil != cParams {
|
|
|
|
- self._params = cParams ?? [:];
|
|
|
|
|
|
+ var object = self;
|
|
|
|
+ if (cClass.isEqual(to: oClass)) {
|
|
|
|
+ self.m_id = cID as String
|
|
|
|
+ self.m_info = NSDictionary(dictionary: property)
|
|
|
|
+ self._type = String(cType)
|
|
|
|
+ self._extention = String(cExtention)
|
|
|
|
+ self._name = String(cName)
|
|
|
|
+ if nil != cParams {
|
|
|
|
+ self._params = cParams ?? [:];
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ let fileType = self.fileType() as String
|
|
|
|
+ let key = self.fileType() as String
|
|
|
|
+ let ID = cID
|
|
|
|
+
|
|
|
|
+ // 移除原来的Object
|
|
|
|
+ if cacheObjects.value(forKey: key) != nil {
|
|
|
|
+ let objectInfo = cacheObjects.value(forKey: key) as! NSMutableDictionary
|
|
|
|
+
|
|
|
|
+ if objectInfo.value(forKey: ID as String) != nil {
|
|
|
|
+ objectInfo.setValue(nil, forKey: ID as String)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var objectInfo = cacheObjects.value(forKey: key) as? NSMutableDictionary
|
|
|
|
+ if (nil == objectInfo) {
|
|
|
|
+ objectInfo = NSMutableDictionary()
|
|
|
|
+ cacheObjects.setValue(objectInfo, forKey: key)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let params = NSMutableDictionary(dictionary: property)
|
|
|
|
+ let clsname = "KdanAuto"//Bundle.main.infoDictionary! ["CFBundleExecutable"]
|
|
|
|
+ let className = String((clsname )+"."+(params["Class"] as! String))
|
|
|
|
+ let cl = NSClassFromString(className) as! AutoTest.Type
|
|
|
|
+
|
|
|
|
+ object = cl.shared()!
|
|
|
|
+ object.m_id = ID as String
|
|
|
|
+ object.m_info = NSDictionary(dictionary: params)
|
|
|
|
+ object._fileType = fileType
|
|
|
|
+ object._type = String(cType)
|
|
|
|
+ object._extention = String(cExtention)
|
|
|
|
+ object._name = String(cName)
|
|
|
|
+ if nil != cParams {
|
|
|
|
+ object._params = cParams ?? [:];
|
|
|
|
+ }
|
|
|
|
+ objectInfo!.setValue(object, forKey: ID as String)
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
AutoTest.saveObjects()
|
|
AutoTest.saveObjects()
|
|
|
|
+
|
|
|
|
+ return object
|
|
}
|
|
}
|
|
|
|
|
|
func delete() {
|
|
func delete() {
|