|
@@ -320,113 +320,114 @@ let CPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ var newDictionary: [String: Any]
|
|
|
|
+ if let dictionary = NSDictionary(contentsOfFile: kStampPlistPath.path) as? [String: Any] {
|
|
|
|
+ newDictionary = dictionary
|
|
|
|
+ }else{
|
|
|
|
+ newDictionary = [:]
|
|
|
|
+ }
|
|
|
|
+ let tag = tagString()
|
|
|
|
+ var text = ""
|
|
|
|
+ var detailText = ""
|
|
|
|
|
|
- if var dictionary = NSDictionary(contentsOfFile: kStampPlistPath.path) as? [String: Any] {
|
|
|
|
- var newDictionary = dictionary
|
|
|
|
-
|
|
|
|
- let tag = tagString()
|
|
|
|
- var text = ""
|
|
|
|
- var detailText = ""
|
|
|
|
-
|
|
|
|
- var stampDictionary: [String: Any] = [:]
|
|
|
|
- if let string = string {
|
|
|
|
- stampDictionary[kStampOfStringKey] = string
|
|
|
|
- text = string
|
|
|
|
- }
|
|
|
|
- if let dateString = dateString {
|
|
|
|
- stampDictionary[kStampOfSubStringKey] = dateString
|
|
|
|
- detailText = dateString
|
|
|
|
- }
|
|
|
|
- if let date = date {
|
|
|
|
- stampDictionary[kStampDateKey] = date
|
|
|
|
- }
|
|
|
|
- if let time = time {
|
|
|
|
- stampDictionary[kStampTimeKey] = time
|
|
|
|
- }
|
|
|
|
- stampDictionary[kStampOfCategoryKey] = categoryString.rawValue
|
|
|
|
-
|
|
|
|
- if let nameString = nameString {
|
|
|
|
- stampDictionary[kStampOfNameKey] = nameString
|
|
|
|
- detailText = "\(detailText) \(nameString)"
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var colorV = 0
|
|
|
|
- if color == .white {
|
|
|
|
- if shape == .rectangle {
|
|
|
|
-
|
|
|
|
- } else if shape == .arrowLeft {
|
|
|
|
-
|
|
|
|
- } else if shape == .arrowRight {
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- colorV = 14
|
|
|
|
- }
|
|
|
|
- } else if color == .red {
|
|
|
|
- if shape == .rectangle {
|
|
|
|
- colorV = 0
|
|
|
|
- } else if shape == .arrowLeft {
|
|
|
|
- colorV = 8
|
|
|
|
- } else if shape == .arrowRight {
|
|
|
|
- colorV = 11
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- } else if color == .green {
|
|
|
|
- if shape == .rectangle {
|
|
|
|
- colorV = 1
|
|
|
|
- } else if shape == .arrowLeft {
|
|
|
|
- colorV = 9
|
|
|
|
- } else if shape == .arrowRight {
|
|
|
|
- colorV = 12
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- } else if color == .blue {
|
|
|
|
- if shape == .rectangle {
|
|
|
|
- colorV = 2
|
|
|
|
- } else if shape == .arrowLeft {
|
|
|
|
- colorV = 10
|
|
|
|
- } else if shape == .arrowRight {
|
|
|
|
- colorV = 13
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ var stampDictionary: [String: Any] = [:]
|
|
|
|
+ if let string = string {
|
|
|
|
+ stampDictionary[kStampOfStringKey] = string
|
|
|
|
+ text = string
|
|
|
|
+ }
|
|
|
|
+ if let dateString = dateString {
|
|
|
|
+ stampDictionary[kStampOfSubStringKey] = dateString
|
|
|
|
+ detailText = dateString
|
|
|
|
+ }
|
|
|
|
+ if let date = date {
|
|
|
|
+ stampDictionary[kStampDateKey] = date
|
|
|
|
+ }
|
|
|
|
+ if let time = time {
|
|
|
|
+ stampDictionary[kStampTimeKey] = time
|
|
|
|
+ }
|
|
|
|
+ stampDictionary[kStampOfCategoryKey] = categoryString.rawValue
|
|
|
|
+
|
|
|
|
+ if let nameString = nameString {
|
|
|
|
+ stampDictionary[kStampOfNameKey] = nameString
|
|
|
|
+ detailText = "\(detailText) \(nameString)"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var colorV = 0
|
|
|
|
+ if color == .white {
|
|
|
|
+ if shape == .rectangle {
|
|
|
|
+
|
|
|
|
+ } else if shape == .arrowLeft {
|
|
|
|
+
|
|
|
|
+ } else if shape == .arrowRight {
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
colorV = 14
|
|
colorV = 14
|
|
}
|
|
}
|
|
-// else if color == 3 { // KMAnnotationStampBlackColor
|
|
|
|
-//// style = .black
|
|
|
|
-// shape = .rectangle
|
|
|
|
-// } else if color == 4 { // KMAnnotationStampLightRedColor
|
|
|
|
-// style = .red
|
|
|
|
-// shape = .rectangle
|
|
|
|
-// } else if color == 5 { // KMAnnotationStampDarkRedColor
|
|
|
|
-// style = .red
|
|
|
|
-// shape = .rectangle
|
|
|
|
-// } else if color == 6 { // KMAnnotationStampPurpleColor
|
|
|
|
-//// style = .purple
|
|
|
|
-// shape = .rectangle
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- stampDictionary[kStampOfColorKey] = colorV
|
|
|
|
- stampDictionary[kStampOfDateKey] = Date()
|
|
|
|
- stampDictionary[kStampNeedExchangKey] = needExchangeFontSize ? "1" : "0"
|
|
|
|
-
|
|
|
|
- newDictionary[tag] = stampDictionary
|
|
|
|
-
|
|
|
|
- var stamp: CStampObject?
|
|
|
|
- if categoryString == .text { // categoryString == 1
|
|
|
|
- stamp = CStampObject(text: text, detailText: dateString ?? "", style: color, shape: shape )
|
|
|
|
- stamp?.dateString = date ?? ""
|
|
|
|
- stamp?.timeString = time ?? ""
|
|
|
|
|
|
+ } else if color == .red {
|
|
|
|
+ if shape == .rectangle {
|
|
|
|
+ colorV = 0
|
|
|
|
+ } else if shape == .arrowLeft {
|
|
|
|
+ colorV = 8
|
|
|
|
+ } else if shape == .arrowRight {
|
|
|
|
+ colorV = 11
|
|
|
|
+ } else {
|
|
|
|
+
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (newDictionary as NSDictionary).write(toFile: kStampPlistPath.path, atomically: true), let stamp = stamp {
|
|
|
|
- stamp.stampKey = tag
|
|
|
|
- stamps.append(stamp)
|
|
|
|
- return true
|
|
|
|
|
|
+ } else if color == .green {
|
|
|
|
+ if shape == .rectangle {
|
|
|
|
+ colorV = 1
|
|
|
|
+ } else if shape == .arrowLeft {
|
|
|
|
+ colorV = 9
|
|
|
|
+ } else if shape == .arrowRight {
|
|
|
|
+ colorV = 12
|
|
|
|
+ } else {
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+ } else if color == .blue {
|
|
|
|
+ if shape == .rectangle {
|
|
|
|
+ colorV = 2
|
|
|
|
+ } else if shape == .arrowLeft {
|
|
|
|
+ colorV = 10
|
|
|
|
+ } else if shape == .arrowRight {
|
|
|
|
+ colorV = 13
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ colorV = 14
|
|
|
|
+ }
|
|
|
|
+ // else if color == 3 { // KMAnnotationStampBlackColor
|
|
|
|
+ //// style = .black
|
|
|
|
+ // shape = .rectangle
|
|
|
|
+ // } else if color == 4 { // KMAnnotationStampLightRedColor
|
|
|
|
+ // style = .red
|
|
|
|
+ // shape = .rectangle
|
|
|
|
+ // } else if color == 5 { // KMAnnotationStampDarkRedColor
|
|
|
|
+ // style = .red
|
|
|
|
+ // shape = .rectangle
|
|
|
|
+ // } else if color == 6 { // KMAnnotationStampPurpleColor
|
|
|
|
+ //// style = .purple
|
|
|
|
+ // shape = .rectangle
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ stampDictionary[kStampOfColorKey] = colorV
|
|
|
|
+ stampDictionary[kStampOfDateKey] = Date()
|
|
|
|
+ stampDictionary[kStampNeedExchangKey] = needExchangeFontSize ? "1" : "0"
|
|
|
|
+
|
|
|
|
+ newDictionary[tag] = stampDictionary
|
|
|
|
+
|
|
|
|
+ var stamp: CStampObject?
|
|
|
|
+ if categoryString == .text { // categoryString == 1
|
|
|
|
+ stamp = CStampObject(text: text, detailText: dateString ?? "", style: color, shape: shape )
|
|
|
|
+ stamp?.dateString = date ?? ""
|
|
|
|
+ stamp?.timeString = time ?? ""
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (newDictionary as NSDictionary).write(toFile: kStampPlistPath.path, atomically: true), let stamp = stamp {
|
|
|
|
+ stamp.stampKey = tag
|
|
|
|
+ stamps.append(stamp)
|
|
|
|
+ return true
|
|
}
|
|
}
|
|
|
|
|
|
return false
|
|
return false
|
|
@@ -458,7 +459,7 @@ let CPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
- if var dictionary = NSDictionary(contentsOfFile: kStampPlistPath.path) as? [String: Any] {
|
|
|
|
|
|
+ if let dictionary = NSDictionary(contentsOfFile: kStampPlistPath.path) as? [String: Any] {
|
|
var newDictionary = dictionary
|
|
var newDictionary = dictionary
|
|
|
|
|
|
let stamp = CStampObject(imageStampFilePath: rPath)
|
|
let stamp = CStampObject(imageStampFilePath: rPath)
|
|
@@ -479,7 +480,7 @@ let CPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- var newDictionary = NSMutableDictionary()
|
|
|
|
|
|
+ let newDictionary = NSMutableDictionary()
|
|
|
|
|
|
let stamp = CStampObject(imageStampFilePath: rPath)
|
|
let stamp = CStampObject(imageStampFilePath: rPath)
|
|
stamp.nameString = nameString
|
|
stamp.nameString = nameString
|
|
@@ -516,7 +517,7 @@ let CPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
- if var dictionary = NSDictionary(contentsOfFile: kStampPlistPath.path) as? [String: Any] {
|
|
|
|
|
|
+ if let dictionary = NSDictionary(contentsOfFile: kStampPlistPath.path) as? [String: Any] {
|
|
var newDictionary = dictionary
|
|
var newDictionary = dictionary
|
|
newDictionary.removeValue(forKey: key)
|
|
newDictionary.removeValue(forKey: key)
|
|
|
|
|