|
|
@ -48,16 +48,16 @@ namespace FLocal.IISHandler { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static PageOuter createFromUrl(FLocal.Common.URL.AbstractUrl url, long perPage, Dictionary<char, Func<string, long>> customAction) { |
|
|
|
public static PageOuter createFromUrl(FLocal.Common.URL.AbstractUrl url, long perPage, Dictionary<char, Func<string, long>> customAction) { |
|
|
|
string[] requestParts = url.remainder.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); |
|
|
|
if(url.remainder.Contains("/")) throw new WrongUrlException(); |
|
|
|
int offset = 0; |
|
|
|
string[] requestParts = url.remainder.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries); |
|
|
|
bool reversed = (requestParts.Length > (offset+1)) && (requestParts[offset+1].ToLower() == "reversed"); |
|
|
|
bool reversed = (requestParts.Length > 1) && (requestParts[1].ToLower() == "reversed"); |
|
|
|
if(requestParts.Length > offset) { |
|
|
|
if(requestParts.Length > 0) { |
|
|
|
if(requestParts[offset].ToLower() == "all") { |
|
|
|
if(requestParts[0].ToLower() == "all") { |
|
|
|
return new PageOuter(perPage, reversed); |
|
|
|
return new PageOuter(perPage, reversed); |
|
|
|
} else if(Char.IsDigit(requestParts[offset][0])) { |
|
|
|
} else if(Char.IsDigit(requestParts[0][0])) { |
|
|
|
return new PageOuter(long.Parse(requestParts[offset]), perPage, perPage, reversed); |
|
|
|
return new PageOuter(long.Parse(requestParts[0]), perPage, perPage, reversed); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return new PageOuter(customAction[requestParts[offset][0]](requestParts[offset].Substring(1)), perPage, perPage, reversed); |
|
|
|
return new PageOuter(customAction[requestParts[0][0]](requestParts[0].Substring(1)), perPage, perPage, reversed); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return new PageOuter(0, perPage, perPage, reversed); |
|
|
|
return new PageOuter(0, perPage, perPage, reversed); |
|
|
|