viewgit/index.php:465 Only variables should be passed by reference [2048]

viewgit/index.php:466 Non-static method GeSHi::get_language_name_from_extension() should not be called statically [2048]

  1.  
  2. using System;
  3.  
  4. namespace Dizzy
  5. {
  6.  
  7.  
  8. public class FileType {
  9.  
  10. int type;
  11. const int UNKNOWN = 0;
  12. const int VIDEO = 1;
  13. const int AUDIO = 2;
  14. const int BOOK = 3;
  15.  
  16. public FileType(string filename) {
  17.  
  18. if(filename.EndsWith(".avi"))
  19. type = VIDEO;
  20. else if(filename.EndsWith(".pdf"))
  21. type = BOOK;
  22. else if(filename.EndsWith(".mp3"))
  23. type = AUDIO;
  24. else
  25. type = UNKNOWN;
  26.  
  27. }
  28.  
  29. public string Name()
  30. {
  31. if(type == VIDEO)
  32. return "Video";
  33. else if(type == BOOK)
  34. return "Book";
  35. else if(type == AUDIO)
  36. return "Audio";
  37. else
  38. return "Sconosciuto";
  39. }
  40. }
  41.  
  42. public class File
  43. {
  44.  
  45.  
  46. public string user;
  47. public string name;
  48. public string path;
  49. public int size;
  50. public FileType type;
  51.  
  52. public File (string path, string user) : this (path, user, 0) {}
  53. public File (string path, string user, int size) : this (path, user, "", size) {}
  54. public File (string path, string user, string name, int size)
  55. {
  56. // Determino il tipo di file
  57. type = new FileType (path);
  58. string [] a;
  59. if (user == "")
  60. {
  61. a = path.Split('/');
  62. if (a.Length >= 2)
  63. user = a[2];
  64. }
  65. this.user = user;
  66. this.path = path;
  67. this.size = size;
  68.  
  69. if (name == "")
  70. {
  71. string[] pieces = path.Split ('/');
  72. name = pieces[pieces.Length - 1];
  73. }
  74.  
  75. this.name = name;
  76.  
  77. }
  78.  
  79. public string SizeToString () {
  80.  
  81. // Piccoli bytes
  82. if (size < 1024)
  83. return size.ToString() + " B";
  84. else if (size < 1024*1024)
  85. {
  86. return (size/1024).ToString () + " KB";
  87. }
  88. else
  89. return System.Convert.ToString( (size/1024/1024).ToString () + " MB");
  90. }
  91.  
  92.  
  93. }
  94. }