diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 779ae3c..fb2e329 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -2053 \ No newline at end of file +2060 \ No newline at end of file diff --git a/FLocal.Migration.Console/Program.cs b/FLocal.Migration.Console/Program.cs index 66982e9..cab0c52 100644 --- a/FLocal.Migration.Console/Program.cs +++ b/FLocal.Migration.Console/Program.cs @@ -25,13 +25,15 @@ namespace FLocal.Migration.Console { } [Action] - public static void ImportUsers() { + public static void ImportUsers(int startFromPage) { initializeConfig(); try { - UsersImporter.ImportUsers(); + UsersImporter.ImportUsers(startFromPage); } catch(Exception e) { System.Console.WriteLine(e.GetType().FullName + ": " + e.Message); System.Console.WriteLine(e.StackTrace); + System.Console.WriteLine("=============="); + System.Console.WriteLine(e.ToString()); } } diff --git a/FLocal.Migration.Console/UsersImporter.cs b/FLocal.Migration.Console/UsersImporter.cs index 15e2c8a..0baebeb 100644 --- a/FLocal.Migration.Console/UsersImporter.cs +++ b/FLocal.Migration.Console/UsersImporter.cs @@ -11,9 +11,9 @@ using FLocal.Common.actions; namespace FLocal.Migration.Console { class UsersImporter { - public static void ImportUsers() { + public static void ImportUsers(int startFromPage) { - for(int i=1; i<800; i++) { + for(int i=startFromPage; i<1000; i++) { System.Console.Write("[" + i + "]"); foreach(string userName in ShallerGateway.getUserNames(i)) { User user; @@ -30,10 +30,12 @@ namespace FLocal.Migration.Console { { User.TableSpec.FIELD_LOCATION, new ScalarFieldValue(userData["location"]) }, { User.TableSpec.FIELD_SHOWPOSTSTOUSERS, new ScalarFieldValue("All") }, { User.TableSpec.FIELD_SIGNATURE, new ScalarFieldValue(userData["signature"]) }, + { User.TableSpec.FIELD_SIGNATUREUBB, new ScalarFieldValue(userData["signature"]) }, { User.TableSpec.FIELD_TITLE, new ScalarFieldValue(userData["title"]) }, { User.TableSpec.FIELD_TOTALPOSTS, new ScalarFieldValue("0") }, { User.TableSpec.FIELD_USERGROUPID, new ScalarFieldValue("1") }, { User.TableSpec.FIELD_BIOGRAPHY, new ScalarFieldValue(userData["biography"]) }, + { User.TableSpec.FIELD_BIOGRAPHYUBB, new ScalarFieldValue(userData["biography"]) }, } ); AbstractChange addAccount = new InsertChange( @@ -42,6 +44,10 @@ namespace FLocal.Migration.Console { { Account.TableSpec.FIELD_NAME, new ScalarFieldValue(userName.ToLower()) }, { Account.TableSpec.FIELD_NEEDSMIGRATION, new ScalarFieldValue("1") }, { Account.TableSpec.FIELD_PASSWORDHASH, new ScalarFieldValue("*") }, + { Account.TableSpec.FIELD_IPADDRESS, new ScalarFieldValue("127.0.0.1") }, + { Account.TableSpec.FIELD_ISSTATUSHIDDEN, new ScalarFieldValue("0") }, + { Account.TableSpec.FIELD_ISDETAILEDSTATUSHIDDEN, new ScalarFieldValue("0") }, + { Account.TableSpec.FIELD_REGISTRATIONEMAIL, new ScalarFieldValue("migra@te.d") }, { Account.TableSpec.FIELD_USERID, new ReferenceFieldValue(addUser) }, } ); diff --git a/FLocal.Migration.Gateway/ShallerConnector.cs b/FLocal.Migration.Gateway/ShallerConnector.cs index 9a82084..6d46036 100644 --- a/FLocal.Migration.Gateway/ShallerConnector.cs +++ b/FLocal.Migration.Gateway/ShallerConnector.cs @@ -13,6 +13,14 @@ namespace FLocal.Migration.Gateway { public static readonly Encoding encoding = Encoding.GetEncoding(1251); private const int BUFFER = 1024; + private static HttpWebResponse TryGetResponse(HttpWebRequest request) { + try { + return (HttpWebResponse)request.GetResponse(); + } catch(WebException e) { + throw new ApplicationException("Unable to load " + request.Address, e); + } + } + public static FileInfo getPageInfo(string requestUrl, Dictionary postData, CookieContainer cookies) { string baseUrl = ConfigurationManager.AppSettings["Importer_BaseUrl"]; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(baseUrl + requestUrl); @@ -43,7 +51,7 @@ namespace FLocal.Migration.Gateway { stream.Close(); } request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; FDM; .NET4.0C; .NET4.0E)"; - using(HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { + using(HttpWebResponse response = TryGetResponse(request)) { cookies.Add(response.Cookies); byte[] content;