AdIdNameInCSVUtils.m 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // AdIdNameInCSVUtils.m
  3. // UUTUtils2.1
  4. //
  5. // Created by zhuge on 2020/7/15.
  6. // Copyright © 2020 dym. All rights reserved.
  7. //
  8. #import "AdIdNameInCSVUtils.h"
  9. #import "ProjectInfo.h"
  10. @implementation AdIdNameInCSVUtils
  11. static AdIdNameInCSVUtils *spAdIdNameInCSVUtils = nil;
  12. + (AdIdNameInCSVUtils *)shared {
  13. if (spAdIdNameInCSVUtils == nil) {
  14. spAdIdNameInCSVUtils = [[AdIdNameInCSVUtils alloc] init];
  15. }
  16. return spAdIdNameInCSVUtils;
  17. }
  18. - (void)initWithProjectPath:(ProjectInfo *)project {
  19. self.projectInfo = project;
  20. self.mdConfigs = [NSMutableDictionary dictionaryWithContentsOfFile:project.path.adNameInCSVPlist];
  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.adNameInCSVPlist atomically:YES];
  33. }
  34. @end