@@ -14,68 +14,68 @@ class Database
1414 /// <summary>
1515 /// URLs for database files
1616 /// </summary>
17- const string dbOpenFiles = "https://www.dropbox.com/s/0dwmqk1pkj2ndkz/ftp-files.json?raw=true" ;
18- const string dbOpenServers = "https://raw.githubusercontent.com/HerbL27/FileMasta/master/Public/ftp-servers.txt" ;
19- public const string dbTopSearches = "https://www.dropbox.com/s/512qe4ogan92vea/top-searches.txt?raw=true" ;
17+ const string DbOpenFiles = "https://www.dropbox.com/s/0dwmqk1pkj2ndkz/ftp-files.json?raw=true" ;
18+ const string DbOpenServers = "https://raw.githubusercontent.com/HerbL27/FileMasta/master/Public/ftp-servers.txt" ;
19+ public const string DbTopSearches = "https://www.dropbox.com/s/512qe4ogan92vea/top-searches.txt?raw=true" ;
2020
2121 /// <summary>
2222 /// Database file names
2323 /// </summary>
24- const string fileNameFiles = "ftp-files.json" ;
25- const string fileNameServers = "ftp-servers.txt" ;
24+ const string FileNameFiles = "ftp-files.json" ;
25+ const string FileNameServers = "ftp-servers.txt" ;
2626
2727 /// <summary>
2828 /// Checks if database files exists at users data directory, if so whether they're
2929 /// the same size, and downloads the latest one if either return false
3030 /// </summary>
3131 public static void UpdateLocalDatabase ( )
3232 {
33- Program . log . Info ( "Starting database updates" ) ;
33+ Program . Log . Info ( "Starting database updates" ) ;
3434
3535 try
3636 {
37- if ( IsFileOutOfDate ( dbOpenFiles , fileNameFiles ) )
37+ if ( IsFileOutOfDate ( DbOpenFiles , FileNameFiles ) )
3838 {
39- Program . log . Info ( $ "Updating { fileNameFiles } ...") ;
39+ Program . Log . Info ( $ "Updating { FileNameFiles } ...") ;
4040 using ( var client = new WebClient ( ) )
41- client . DownloadFile ( new Uri ( dbOpenFiles ) , $ "{ LocalExtensions . PathData } { fileNameFiles } ") ;
42- Program . log . Info ( $ "{ fileNameFiles } updated") ;
41+ client . DownloadFile ( new Uri ( DbOpenFiles ) , $ "{ LocalExtensions . PathData } { FileNameFiles } ") ;
42+ Program . Log . Info ( $ "{ FileNameFiles } updated") ;
4343 }
4444 }
4545 catch ( Exception ex )
4646 {
47- Program . log . Error ( $ "Failed to update { fileNameFiles } ", ex ) ;
47+ Program . Log . Error ( $ "Failed to update { FileNameFiles } ", ex ) ;
4848 MessageBox . Show ( MainForm . Form , "Unable to update database.\n \n " + ex . Message ) ;
4949 }
5050 finally
5151 {
5252 // Deserializes database first line containing meta info
53- MainForm . DbMetaData = JsonConvert . DeserializeObject < Metadata > ( File . ReadLines ( $ "{ LocalExtensions . PathData } { fileNameFiles } ") . First ( ) ) ;
53+ MainForm . DbMetaData = JsonConvert . DeserializeObject < Metadata > ( File . ReadLines ( $ "{ LocalExtensions . PathData } { FileNameFiles } ") . First ( ) ) ;
5454
5555 // Store files in the main form, skipping the first line as it contains the db metadata
56- foreach ( var item in File . ReadAllLines ( $ "{ LocalExtensions . PathData } { fileNameFiles } ") . Skip ( 1 ) )
56+ foreach ( var item in File . ReadLines ( $ "{ LocalExtensions . PathData } { FileNameFiles } ") . Skip ( 1 ) )
5757 if ( StringExtensions . IsValidJSON ( item ) )
5858 MainForm . DbOpenFiles . Add ( JsonConvert . DeserializeObject < FtpFile > ( item ) ) ;
5959 }
6060
6161 try
6262 {
63- if ( IsFileOutOfDate ( dbOpenServers , fileNameServers ) )
63+ if ( IsFileOutOfDate ( DbOpenServers , FileNameServers ) )
6464 {
65- Program . log . Info ( $ "Updating { fileNameServers } ...") ;
65+ Program . Log . Info ( $ "Updating { FileNameServers } ...") ;
6666 using ( var client = new WebClient ( ) )
67- client . DownloadFile ( new Uri ( dbOpenServers ) , $ "{ LocalExtensions . PathData } { fileNameServers } ") ;
68- Program . log . Info ( $ "{ fileNameServers } updated") ;
67+ client . DownloadFile ( new Uri ( DbOpenServers ) , $ "{ LocalExtensions . PathData } { FileNameServers } ") ;
68+ Program . Log . Info ( $ "{ FileNameServers } updated") ;
6969 }
7070 }
7171 catch ( Exception ex )
7272 {
73- Program . log . Error ( $ "UPDATE FAILED { fileNameServers } ", ex ) ;
73+ Program . Log . Error ( $ "UPDATE FAILED { FileNameServers } ", ex ) ;
7474 MessageBox . Show ( MainForm . Form , "Unable to update database.\n \n " + ex . Message ) ;
7575 }
7676 finally
7777 {
78- MainForm . DbOpenServers . AddRange ( File . ReadAllLines ( $ "{ LocalExtensions . PathData } { fileNameServers } ") ) ;
78+ MainForm . DbOpenServers . AddRange ( File . ReadLines ( $ "{ LocalExtensions . PathData } { FileNameServers } ") ) ;
7979 }
8080 }
8181
@@ -89,7 +89,7 @@ public static bool IsFileOutOfDate(string webFile, string fileName)
8989 {
9090 try
9191 {
92- Program . log . Info ( $ "Checking if '{ fileName } ' needs to be updated") ;
92+ Program . Log . Info ( $ "Checking if '{ fileName } ' needs to be updated") ;
9393
9494 if ( File . Exists ( $ "{ LocalExtensions . PathData } { fileName } ") )
9595 if ( WebExtensions . WebFileSize ( $ "{ webFile } ") == new FileInfo ( $ "{ LocalExtensions . PathData } { fileName } ") . Length )
@@ -99,7 +99,7 @@ public static bool IsFileOutOfDate(string webFile, string fileName)
9999 else
100100 return true ;
101101 }
102- catch ( Exception ex ) { Program . log . Error ( $ "Unable to check '{ fileName } ' for update, URL : { webFile } ", ex ) ; return true ; }
102+ catch ( Exception ex ) { Program . Log . Error ( $ "Unable to check '{ fileName } ' for update, URL : { webFile } ", ex ) ; return true ; }
103103 }
104104
105105 /// <summary>
0 commit comments