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