Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.9 KiB

  1. /********************************************************************
  2. * Project : C:\DEPOT\multimedia\eHomeTest\UserXp\MediaManager\MediaManager.sln
  3. * File : LenCheck.cs
  4. * Summary : Utility class used to verify the length of attributes in the Media Player Library.
  5. * Primary use is for CES demo while word wrap bug exists in product.
  6. * Classes :
  7. * Notes :
  8. * *****************************************************************/
  9. using System;
  10. using System.IO;
  11. namespace MediaManager
  12. {
  13. /// <summary>
  14. /// Summary description for LenCheck.
  15. /// </summary>
  16. public class LenCheck
  17. {
  18. public LenCheck(string attribute, int maxLen, string outputFile, bool fileAppend)
  19. {
  20. string[] results;
  21. int resultsCount = 0;
  22. StreamWriter OutputStream = null;
  23. MPCollection mp = new MPCollection();
  24. results = mp.GetAllItemsAttribute(attribute);
  25. Array.Sort(results);
  26. if ( outputFile != "" )
  27. {
  28. if ( fileAppend == true )
  29. {
  30. OutputStream = File.AppendText(outputFile);
  31. }
  32. else
  33. {
  34. OutputStream = File.CreateText(outputFile);
  35. }
  36. }
  37. Console.WriteLine("Media Manager Length Test\nParameters: Property={0} MaxLen={1} Output={2}",attribute, maxLen, outputFile);
  38. Console.WriteLine("=======================================================");
  39. if ( OutputStream != null)
  40. {
  41. OutputStream.WriteLine("Media Manager Length Test\nParameters: Property={0} MaxLen={1} Output={2}",attribute, maxLen, outputFile);
  42. OutputStream.WriteLine("=======================================================");
  43. }
  44. foreach (string s in results)
  45. {
  46. if ( s.Length > maxLen )
  47. {
  48. resultsCount++;
  49. Console.WriteLine("{0}",s);
  50. if ( OutputStream != null)
  51. {
  52. OutputStream.WriteLine("{0}",s);
  53. }
  54. }
  55. }
  56. Console.WriteLine("************************************************");
  57. Console.WriteLine("Run Complete. {0} Entries met requirements", resultsCount);
  58. if ( OutputStream != null)
  59. {
  60. OutputStream.WriteLine("************************************************");
  61. OutputStream.WriteLine("Run Complete. {0} Entries met requirements", resultsCount);
  62. }
  63. if ( OutputStream != null )
  64. {
  65. OutputStream.Flush();
  66. OutputStream.Close();
  67. }
  68. }
  69. }
  70. }