AdIdNameUtils.m 1020 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // AdIdNameUtils.m
  3. // UUTUtils2.1
  4. //
  5. // Created by zhuge on 2018/7/11.
  6. // Copyright © 2018年 dym. All rights reserved.
  7. //
  8. #import "AdIdNameUtils.h"
  9. #import "ProjectInfo.h"
  10. @implementation AdIdNameUtils
  11. static AdIdNameUtils *spAdIdNameUtils = nil;
  12. + (AdIdNameUtils *)shared {
  13. if (spAdIdNameUtils == nil) {
  14. spAdIdNameUtils = [[AdIdNameUtils alloc] init];
  15. }
  16. return spAdIdNameUtils;
  17. }
  18. - (void)initWithProjectPath:(ProjectInfo *)project {
  19. self.projectInfo = project;
  20. self.mdConfigs = [NSMutableDictionary dictionaryWithContentsOfFile:project.path.adNamePlist];
  21. if (self.mdConfigs == nil) {
  22. self.mdConfigs = [NSMutableDictionary dictionaryWithCapacity:0];
  23. }
  24. }
  25. - (void)setAdIdIndex:(NSString *)idIndex withName:(NSString *)name {
  26. self.mdConfigs[idIndex] = name;
  27. }
  28. - (NSString *)adNameForAdIdIndex:(NSString *)idIndex {
  29. return self.mdConfigs[idIndex];
  30. }
  31. - (void)save {
  32. [self.mdConfigs writeToFile:self.projectInfo.path.adNamePlist atomically:YES];
  33. }
  34. @end