// // AdIdNameUtils.m // UUTUtils2.1 // // Created by zhuge on 2018/7/11. // Copyright © 2018年 dym. All rights reserved. // #import "AdIdNameUtils.h" #import "ProjectInfo.h" @implementation AdIdNameUtils static AdIdNameUtils *spAdIdNameUtils = nil; + (AdIdNameUtils *)shared { if (spAdIdNameUtils == nil) { spAdIdNameUtils = [[AdIdNameUtils alloc] init]; } return spAdIdNameUtils; } - (void)initWithProjectPath:(ProjectInfo *)project { self.projectInfo = project; self.mdConfigs = [NSMutableDictionary dictionaryWithContentsOfFile:project.path.adNamePlist]; 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.adNamePlist atomically:YES]; } @end