ImportConsole now uses NConsoler (third-party) to parse command-line args; some bugfixes in userlist and pageouter

main
Inga 🏳‍🌈 15 years ago
parent bdad094172
commit 9f5b5febea
  1. 2
      Builder/IISMainHandler/build.txt
  2. 12
      Builder/IISMainHandler/product.wxs
  3. 10
      IISMainHandler/PageOuter.cs
  4. 2
      IISMainHandler/handlers/BoardHandler.cs
  5. 3
      IISMainHandler/handlers/ThreadHandler.cs
  6. 2
      IISMainHandler/handlers/response/BoardAsThread.cs
  7. 2
      IISMainHandler/handlers/response/UserListHandler.cs
  8. 4
      ImportConsole/ImportConsole.csproj
  9. 20
      ImportConsole/Program.cs
  10. BIN
      ThirdParty/NConsoler/NConsoler.dll
  11. 2
      templates/Full/UserList.xslt

@ -61,6 +61,9 @@
<Component Id="ImportConsole.pdb" Guid="6E5DCF23-7247-4DE0-BB6D-1A8463723437">
<File Id="ImportConsole.pdb" Source="..\..\ImportConsole\bin\Release\ImportConsole.pdb" KeyPath="yes" Checksum="yes"/>
</Component>
<Component Id="NConsoler.dll" Guid="F39FD087-8961-4871-9D59-FDB83002BC91">
<File Id="NConsoler.dll" Source="..\..\ThirdParty\NConsoler\NConsoler.dll" KeyPath="yes" Checksum="yes"/>
</Component>
<!--Component Id="MySql.Data.dll" Guid="90646729-6B21-4BEE-94C3-F39F5288EFB3">
<File Id="MySql.Data.dll" Source="..\..\ThirdParty\mysql-connector-net-6.2.3\MySql.Data\Provider\bin\Release\MySql.Data.dll" KeyPath="yes" Checksum="yes"/>
</Component>
@ -105,12 +108,15 @@
<ComponentRef Id='MySQLConnector.dll' />
<ComponentRef Id='MySQLConnector.pdb' />
</Feature>
<!--Feature Id='ThirdParty' Title='ThirdParty libraries/tools' Level='1'>
<Feature Id='MySql.Data' Title='MySql Connector/NET' Level='1'>
<Feature Id='ThirdParty' Title='ThirdParty libraries/tools' Level='1'>
<Feature Id='NConsoler' Title='NConsoler' Level='1'>
<ComponentRef Id='NConsoler.dll' />
</Feature>
<!--Feature Id='MySql.Data' Title='MySql Connector/NET' Level='1'>
<ComponentRef Id='MySql.Data.dll' />
<ComponentRef Id='MySql.Data.pdb' />
</Feature>
</Feature-->
</Feature>
<Feature Id="Data" Title="Various data sets" Level="1">
<ComponentRef Id="_7z.exe"/>
<Feature Id="Templates" Title="Templates" Level="1">

@ -41,13 +41,17 @@ namespace FLocal.IISHandler {
}
}
public static PageOuter createFromGet(string[] requestParts, long perPage, Dictionary<char, Func<long>> customAction) {
/*public static PageOuter createFromGet(string[] requestParts, long perPage, Dictionary<char, Func<long>> customAction) {
return createFromGet(requestParts, perPage, customAction, 2);
}*/
public static PageOuter createFromGet(string[] requestParts, long perPage, int offset) {
return createFromGet(requestParts, perPage, new Dictionary<char, Func<long>>(), offset);
}
public static PageOuter createFromGet(string[] requestParts, long perPage) {
/*public static PageOuter createFromGet(string[] requestParts, long perPage) {
return createFromGet(requestParts, perPage, new Dictionary<char,Func<long>>());
}
}*/
public XElement exportToXml(int left, int current, int right) {
XElement result = new XElement("pageOuter",

@ -20,7 +20,7 @@ namespace FLocal.IISHandler.handlers {
override protected XElement[] getSpecificData(WebContext context) {
Board board = Board.LoadById(int.Parse(context.requestParts[1]));
PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.threadsPerPage);
PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.threadsPerPage, 2);
IEnumerable<Thread> threads = board.getThreads(pageOuter, context);
return new XElement[] {
new XElement("currentLocation", board.exportToXmlSimpleWithParent(context)),

@ -48,7 +48,8 @@ namespace FLocal.IISHandler.handlers {
new JoinSpec[0]
)
}
}
},
2
);
IEnumerable<Post> posts = thread.getPosts(pageOuter, context);
thread.incrementViewsCounter();

@ -20,7 +20,7 @@ namespace FLocal.IISHandler.handlers.response {
override protected XElement[] getSpecificData(WebContext context) {
Board board = Board.LoadById(int.Parse(context.requestParts[1]));
PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.postsPerPage);
PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.postsPerPage, 2);
IEnumerable<Thread> threads = board.getThreads(
pageOuter,
context, new SortSpec[] {

@ -19,7 +19,7 @@ namespace FLocal.IISHandler.handlers.response {
}
override protected XElement[] getSpecificData(WebContext context) {
PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.usersPerPage);
PageOuter pageOuter = PageOuter.createFromGet(context.requestParts, context.userSettings.usersPerPage, 1);
IEnumerable<User> users = User.getUsers(pageOuter, context);
return new XElement[] {
new XElement("users",

@ -31,6 +31,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="NConsoler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=652faff55808657c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\NConsoler\NConsoler.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">

@ -7,10 +7,11 @@ using FLocal.Common.actions;
using FLocal.Common.dataobjects;
using FLocal.Core;
using System.Configuration;
using NConsoler;
namespace FLocal.ImportConsole {
class Program {
static void Main(string[] args) {
public static void Main(string[] args) {
if(!FLocal.Common.Config.isInitialized) {
lock(typeof(FLocal.Common.Config)) {
@ -18,12 +19,20 @@ namespace FLocal.ImportConsole {
FLocal.Common.Config.Init(ConfigurationManager.AppSettings);
}
}
Consolery.Run(typeof(Program), args);
}
}
[Action]
public static void ImportUsers() {
for(int i=1; i<800; i++) {
Console.Write("[" + i + "]");
foreach(string userName in ShallerGateway.getUserNames(i)) {
Console.Write(".");
try {
User.LoadByName(userName);
Console.Write("-");
} catch(NotFoundInDBException) {
Dictionary<string, string> userData = ShallerGateway.getUserInfo(userName);
AbstractChange addUser = new InsertChange(
User.TableSpec.instance,
@ -49,8 +58,15 @@ namespace FLocal.ImportConsole {
}
);
ChangeSetUtil.ApplyChanges(addUser, addAccount);
Console.Write(".");
}
}
}
}
[Action]
public static void ProcessUpload(string pathToUpload) {
throw new NotImplementedException();
}
}
}

Binary file not shown.

@ -51,7 +51,7 @@
<td>
<xsl:text>ñòðàíèöû:</xsl:text>
<xsl:apply-templates select="users/pageOuter" mode="withCurrent">
<xsl:with-param name="baseLink">/UserList/<xsl:value-of select="currentLocation/thread/id"/>/</xsl:with-param>
<xsl:with-param name="baseLink">/Users/</xsl:with-param>
</xsl:apply-templates>
</td>
</tr>

Loading…
Cancel
Save