Program.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. namespace MipSdk_CompoundFileProtection
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. ConfigSettings config = new ConfigSettings();
  11. Dictionary<string, string> fileToLabelMap = new Dictionary<string, string>();
  12. AppInfoExtended appInfo = new AppInfoExtended()
  13. {
  14. ApplicationId = config.ClientId,
  15. ApplicationName = config.AppName,
  16. ApplicationVersion = config.AppVersion,
  17. IsMultiTenantApp = Convert.ToBoolean(config.IsMultiTenantApp),
  18. RedirectUri = config.RedirectUri,
  19. TenantId = config.TenantId
  20. };
  21. Action action = new Action(appInfo);
  22. string rootPath = @"D:\mip\testfiles\compound\input";
  23. Random rand = new Random();
  24. // Build a mapping of label to file.
  25. // Randomly selects one of the two labels below.
  26. // This is for demo purposes. Replace with your own label Id if testing.
  27. for(int i = 1; i <= 6; i++)
  28. {
  29. List<string> labelsInUse = new List<string>()
  30. {
  31. "cf3f4243-49e2-4f99-af45-df2b9e7146fd",
  32. "836ff34f-b604-4a62-a68c-d6be4205d569"
  33. };
  34. string filePath = Path.Combine(rootPath, "test" + i.ToString() + ".txt");
  35. string selectedLabel = labelsInUse[rand.Next(0, 2)];
  36. fileToLabelMap.Add(filePath, selectedLabel);
  37. }
  38. //action.ListLabels();
  39. // Pass set of all files and labels to SDK functions.
  40. action.LabelMultipleFiles(fileToLabelMap);
  41. }
  42. }
  43. }