// // AdIdNameInCSVUtils.m // UUTUtils2.1 // // Created by zhuge on 2020/7/15. // Copyright © 2020 dym. All rights reserved. // #import "AdIdNameInCSVUtils.h" #import "ProjectInfo.h" @implementation AdIdNameInCSVUtils static AdIdNameInCSVUtils *spAdIdNameInCSVUtils = nil; + (AdIdNameInCSVUtils *)shared { if (spAdIdNameInCSVUtils == nil) { spAdIdNameInCSVUtils = [[AdIdNameInCSVUtils alloc] init]; } return spAdIdNameInCSVUtils; } - (void)initWithProjectPath:(ProjectInfo *)project { self.projectInfo = project; self.mdConfigs = [NSMutableDictionary dictionaryWithContentsOfFile:project.path.adNameInCSVPlist]; if (self.mdConfigs == nil) { self.mdConfigs = [NSMutableDictionary dictionaryWithCapacity:0]; } } - (void)setAdIdIndex:(NSString *)idIndex withName:(NSString *)name { self.mdConfigs[idIndex] = name; } - (NSString *)adNameForAdIdIndex:(NSString *)idIndex { return self.mdConfigs[idIndex]; } - (void)save { [self.mdConfigs writeToFile:self.projectInfo.path.adNameInCSVPlist atomically:YES]; } @end