NETPGP-20 debugSave on NSDictionary
authorDirk Zimmermann <dirk@pep-project.org>
Mon, 04 Sep 2017 17:28:50 +0200
changeset 21535d652fb8393
parent 214 ab77645073b3
child 216 f3f9abeb7c2b
NETPGP-20 debugSave on NSDictionary
pEpObjCAdapter.xcodeproj/project.pbxproj
pEpObjCAdapter/NSDictionary+Extension.h
pEpObjCAdapter/NSDictionary+Extension.m
     1.1 --- a/pEpObjCAdapter.xcodeproj/project.pbxproj	Mon Sep 04 17:20:02 2017 +0200
     1.2 +++ b/pEpObjCAdapter.xcodeproj/project.pbxproj	Mon Sep 04 17:28:50 2017 +0200
     1.3 @@ -24,6 +24,7 @@
     1.4  		434226811D4F60000083ED79 /* PepTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 434226801D4F60000083ED79 /* PepTests.m */; };
     1.5  		43676B661C57EA1A00233933 /* B623F674_sec.asc in Resources */ = {isa = PBXBuildFile; fileRef = 43676B641C57EA1A00233933 /* B623F674_sec.asc */; };
     1.6  		43D27DE01F5DA07A00795687 /* NSData+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 43D27DDF1F5DA07A00795687 /* NSData+Extension.m */; };
     1.7 +		43D27DE61F5DA7B700795687 /* NSDictionary+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 43D27DE51F5DA7B700795687 /* NSDictionary+Extension.m */; };
     1.8  		43DFB03E1E36122200175C9C /* MessageHeapBufferOverflow.txt in Resources */ = {isa = PBXBuildFile; fileRef = 43DFB03D1E36122200175C9C /* MessageHeapBufferOverflow.txt */; };
     1.9  		43E02A201C71F65B008F05E9 /* A3FC7F0A_sec.asc in Resources */ = {isa = PBXBuildFile; fileRef = 43E02A1C1C71F65B008F05E9 /* A3FC7F0A_sec.asc */; };
    1.10  		43E02A211C71F65B008F05E9 /* A3FC7F0A.asc in Resources */ = {isa = PBXBuildFile; fileRef = 43E02A1D1C71F65B008F05E9 /* A3FC7F0A.asc */; };
    1.11 @@ -136,6 +137,8 @@
    1.12  		43676B641C57EA1A00233933 /* B623F674_sec.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = B623F674_sec.asc; sourceTree = "<group>"; };
    1.13  		43D27DDF1F5DA07A00795687 /* NSData+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Extension.m"; sourceTree = "<group>"; };
    1.14  		43D27DE31F5DA0D400795687 /* NSData+Extension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+Extension.h"; sourceTree = "<group>"; };
    1.15 +		43D27DE41F5DA78700795687 /* NSDictionary+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Extension.h"; sourceTree = "<group>"; };
    1.16 +		43D27DE51F5DA7B700795687 /* NSDictionary+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Extension.m"; sourceTree = "<group>"; };
    1.17  		43DFB03D1E36122200175C9C /* MessageHeapBufferOverflow.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MessageHeapBufferOverflow.txt; sourceTree = "<group>"; };
    1.18  		43E02A1C1C71F65B008F05E9 /* A3FC7F0A_sec.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = A3FC7F0A_sec.asc; sourceTree = "<group>"; };
    1.19  		43E02A1D1C71F65B008F05E9 /* A3FC7F0A.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = A3FC7F0A.asc; sourceTree = "<group>"; };
    1.20 @@ -222,6 +225,8 @@
    1.21  				43209B351ECC2ACD007E7E2E /* PEPSession.m */,
    1.22  				43D27DE31F5DA0D400795687 /* NSData+Extension.h */,
    1.23  				43D27DDF1F5DA07A00795687 /* NSData+Extension.m */,
    1.24 +				43D27DE41F5DA78700795687 /* NSDictionary+Extension.h */,
    1.25 +				43D27DE51F5DA7B700795687 /* NSDictionary+Extension.m */,
    1.26  			);
    1.27  			path = pEpObjCAdapter;
    1.28  			sourceTree = "<group>";
    1.29 @@ -407,6 +412,7 @@
    1.30  			files = (
    1.31  				43D27DE01F5DA07A00795687 /* NSData+Extension.m in Sources */,
    1.32  				43209B411ECC2DB8007E7E2E /* PEPObjCAdapter.m in Sources */,
    1.33 +				43D27DE61F5DA7B700795687 /* NSDictionary+Extension.m in Sources */,
    1.34  				43209B431ECC2DC0007E7E2E /* PEPSession.m in Sources */,
    1.35  				43209B3F1ECC2DB0007E7E2E /* PEPLanguage.m in Sources */,
    1.36  				43209B401ECC2DB4007E7E2E /* PEPMessage.m in Sources */,
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/pEpObjCAdapter/NSDictionary+Extension.h	Mon Sep 04 17:28:50 2017 +0200
     2.3 @@ -0,0 +1,16 @@
     2.4 +//
     2.5 +//  NSDictionary_NSDictionary_Extension.h
     2.6 +//  pEpObjCAdapter
     2.7 +//
     2.8 +//  Created by Dirk Zimmermann on 04.09.17.
     2.9 +//  Copyright © 2017 p≡p. All rights reserved.
    2.10 +//
    2.11 +
    2.12 +#import <Foundation/Foundation.h>
    2.13 +
    2.14 +@interface NSDictionary (Extension)
    2.15 +
    2.16 +- (void)debugSaveToBasePath:(NSString * _Nonnull)basePath fileName:(NSString * _Nonnull)fileName
    2.17 +               theExtension:(NSString * _Nonnull)theExtension;
    2.18 +
    2.19 +@end
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/pEpObjCAdapter/NSDictionary+Extension.m	Mon Sep 04 17:28:50 2017 +0200
     3.3 @@ -0,0 +1,26 @@
     3.4 +//
     3.5 +//  NSDictionary+Extension.m
     3.6 +//  pEpObjCAdapter
     3.7 +//
     3.8 +//  Created by Dirk Zimmermann on 04.09.17.
     3.9 +//  Copyright © 2017 p≡p. All rights reserved.
    3.10 +//
    3.11 +
    3.12 +#import <Foundation/Foundation.h>
    3.13 +
    3.14 +#import "NSDictionary+Extension.h"
    3.15 +
    3.16 +@implementation NSDictionary (Extension)
    3.17 +
    3.18 +- (void)debugSaveToBasePath:(NSString * _Nonnull)basePath fileName:(NSString * _Nonnull)fileName
    3.19 +theExtension:(NSString * _Nonnull)theExtension
    3.20 +{
    3.21 +    NSDate *now = [NSDate date];
    3.22 +    NSString *nowDesc = [now description];
    3.23 +    NSString *filePath = [NSString stringWithFormat:@"%@/%@_%@.%@",
    3.24 +                          basePath, fileName, nowDesc, theExtension];
    3.25 +    NSURL *url = [NSURL fileURLWithPath:filePath];
    3.26 +    [self writeToURL:url atomically:YES];
    3.27 +}
    3.28 +
    3.29 +@end