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]
using System; using System.Collections; using System.Threading; using System.IO.Compression; using System.Text.RegularExpressions; using System.IO; using Tamir.SharpSsh; using System.Data.SQLite; using Dizzy; namespace Dizzy { public class ProtocolException : ApplicationException { public ProtocolException () {} public ProtocolException (string Message) {} } public class Protocol { // I transfer attivi public delegate void Del (string src, string dest, int transferredBytes, int totalBytes, string message); Thread finder, listUpdater; // Dati letti dal thread che cerca per capire cosa cercare string keyword, user, type; public Protocol () { } public void Search(string keyword, string user, string type) { if (this.finder != null && this.finder.IsAlive) { Log.Info ("Ricerca in corso"); return; } if (!System.IO.File.Exists(GlobalConfig.ListFileName ())) { // Dovremmo notificare l'utente che non c'è la lista Log.Warning ("La lista non è presente, chiedo di scaricarla"); this.UpdateFileList (); } Log.Debug ("Call", "Avvio la ricerca nel database"); this.keyword = keyword; this.user = user; this.type = type; this.finder.Start (); } protected File ReadFile(StreamReader file) { string path = file.ReadLine(); string user = file.ReadLine (); int size = System.Convert.ToInt32(file.ReadLine (), 10); } protected void _Search() { // Questa funzione viene chiamata quando qualcuno richiede // una ricerca. Inoltre abbiamo la quasi certezza che ne venga // chiamata solo un'istanza nello stesso momento. EventManager.SearchStarted (); ArrayList files; try { files = list.Search (this.keyword, this.type, this.user); } catch (Exception e) { // Probabilmente stiamo solamente scaricando il database, // ma tant'è. Log.Error ("Impossibile effettuare la ricerca nel database: " + e.Message); } // this.fileTreeView.Clear (); EventManager.FileTreeViewClear (); foreach(File f in files) { // this.fileTreeView.AddFile (f); EventManager.FileTreeViewAddFile (f); } EventManager.SearchFinished (); if (files.Count == 0) EventManager.ErrorMessage ("Nessun risultato trovato!"); } public void UpdateFileList () { if(this.listUpdater != null && this.listUpdater.IsAlive) { Log.Warning ("La lista è già in fase di aggiornamento, non faccio nulla"); return; } this.listUpdater.Start (); // _UpdateFileList (); } protected void _UpdateFileList () { // SFTPConnection s; Sftp s; if (!GlobalConfig.authenticated) { Log.Info ("I dati di autenticazione non sono presenti"); EventManager.AuthenticationRequired (); Log.Debug ("Auth", "Ho acquisito utente e password"); } EventManager.ListUpdateStarted (); GlobalConfig.password); try { s.Connect (); } catch (Exception e) { Log.Error ("Autenticazione errata (" + e.Message + ")"); GlobalConfig.authenticated = false; } if(!GlobalConfig.authenticated) { EventManager.ErrorMessage ("Autenticazione fallita"); } else { try { Log.Debug ("Net", "Aggiornamento della lista avviato"); s.Get(GlobalConfig.GetValue("index"), GlobalConfig.ListFileName()); Log.Info ("Lista Aggiornata"); s.Close (); }} catch (Exception e) { Log.Error ("Errore: " + e.Message); } } EventManager.ListUpdateFinished (); } public void Disconnect () { foreach(FileTransfer t in this.transfers) { Log.Info ("Termino i trasferimenti in corso"); t.Stop (); } } public void DisconnectPath (string GUID) { FileTransfer stoppedTransfer = null; foreach(FileTransfer t in this.transfers) { if ( t.GetGUID () == GUID) { t.Stop (); stoppedTransfer = t; } } if(stoppedTransfer != null) transfers.Remove (stoppedTransfer); } public void Download(File f, string downloadFolder) { Log.Info ("Comincio il download di " + f.name); // Preparo gli argomento da passare alla funzione. if (!GlobalConfig.authenticated) { Log.Debug ("Auth", "Chiedo di effettuare l'autenticazione"); EventManager.AuthenticationDialog (); } args.Add (f); args.Add (downloadFolder); t.Start (args); this.threads.Add (t); } protected void _Download(object args) { // Questi cast sono piuttosto brutali ma posso passare // solo un oggetto a Download e quindi è il meglio che // mi riesce di fare. File f = (File) ((ArrayList) args)[0]; string downloadFolder = (string) ((ArrayList) args)[1]; FileDownlad transfer; try { transfer = new FileDownlad (f, GlobalConfig.GetValue("user"), GlobalConfig.password, downloadFolder); this.transfers.Add (transfer); } catch (Exception e) { Log.Error (e.Message); GlobalConfig.authenticated = false; EventManager.ErrorMessage ("Autenticazione fallita"); return; } try {transfer.Start ();} catch (Exception) { // Si lamenterà se e quando termineremo il trasferimento // brutalmente ma per ora sembra che non ci possiamo fare niente. } } public void Upload(string f) { // Preparo gli argomento da passare alla funzione. if (!GlobalConfig.authenticated) EventManager.AuthenticationDialog (); args.Add (f); t.Start (args); this.threads.Add (t); } protected void _Upload(object args) { // Questi cast sono piuttosto brutali ma posso passare // solo un oggetto a Download e quindi è il meglio che // mi riesce di fare. string f = (string) ((ArrayList) args)[0]; Log.Info ("Avvio l'upload di " + f); FileUpload transfer; try { this.transfers.Add (transfer); } catch (Exception e) { Log.Error (e.Message); GlobalConfig.authenticated = false; EventManager.ErrorMessage ("Autenticazione fallita"); return; } try {transfer.Start ();} catch (Exception) { // Ci potrebbero essere dei problemi ma per ora non // vogliamo occuparcene. } } } }