sync projects

This commit is contained in:
木鱼(iFish) 2015-05-11 19:27:05 +08:00
parent a5dccd5392
commit cb17cf4f05
7 changed files with 1093 additions and 90 deletions

63
.gitattributes vendored
View File

@ -1,63 +0,0 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,13 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
{
public class Train : IEquatable<Train>
{
/// <summary>
/// 创建 <see cref="Train" /> 的新实例(Train)
/// </summary>
public Train()
{
}
/// <summary>
/// ID
/// </summary>
@ -21,8 +28,24 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
/// <summary>
/// 列车编号
/// </summary>
[JsonProperty("c")]
public string Code { get; set; }
[JsonIgnore]
public string Code
{
get { return _code ?? (_code = Codes.JoinAsString("/")); }
set
{
if (value.IsNullOrEmpty() || Codes.Contains(value))
return;
if (!Codes.Contains(value))
Codes.Add(value);
_code = null;
}
}
[JsonProperty("cl")]
public HashSet<string> Codes { get; } = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
/// <summary>
/// 发站
@ -44,7 +67,7 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
string _trainHash;
[JsonIgnore]
public string TrainHash
{
@ -61,7 +84,7 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
string CalculateTrainHash()
{
var data= Id + Code + TrainStops.Select(s => s.Code + (s.Arrive == null ? "" : ((int)s.Arrive.Value.TotalSeconds).ToString()) + ">" + (s.Left == null ? "" : ((int)s.Left.Value.TotalSeconds).ToString())).JoinAsString("|");
var data = Id + TrainStops.Select(s => s.Code + (s.Arrive == null ? "" : ((int)s.Arrive.Value.TotalSeconds).ToString()) + ">" + (s.Left == null ? "" : ((int)s.Left.Value.TotalSeconds).ToString())).JoinAsString("|");
return data.ToLower().MD5();
}
@ -96,7 +119,8 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
{
if (string.IsNullOrEmpty(_key))
{
_key = Id + Code + From + To;
//MOD 仅用ID不使用车次编号。
_key = Id + From + To;
}
return _key;
@ -132,6 +156,7 @@ namespace TrainInfomationProviderService.TrainInfo.Entities
#endregion
char? _trainClass;
string _code;
/// <summary>
/// 列车等级

View File

@ -133,7 +133,7 @@ namespace TrainInfomationProviderService.TrainInfo
indexStorage.TrainInfoStorages.Add(date, curStorage);
}
var allkeys = curStorage.Trains.Select(s => s.Key).ToHashSet(StringComparer.OrdinalIgnoreCase);
var allkeys = curStorage.Trains.ToDictionary(s => s.Key, StringComparer.OrdinalIgnoreCase);
//所有的车次
var alltrains = dateSt.Values.SelectMany(s => s).Select(s =>
{
@ -145,12 +145,16 @@ namespace TrainInfomationProviderService.TrainInfo
i.Id = s.train_no;
return !string.IsNullOrEmpty(i.From) && !string.IsNullOrEmpty(i.To) ? i : null;
}).ExceptNull().Where(s => !allkeys.Contains(s.Key)).ToArray();
}).ExceptNull().ToArray();
var index = 0;
foreach (var train in alltrains)
{
if (allkeys.Contains(train.Key))
if (allkeys.ContainsKey(train.Key))
{
//增加车次编号
allkeys[train.Key].Code = train.Code;
continue;
}
//加载车次停靠站信息
LoadTrainStopInfo(++index, alltrains.Length, date, train);

View File

@ -8,20 +8,6 @@
//frames
var servernode = require("./servernode.js");
servernode.on("roomSelectHide", function () {
hideChatFrameUI();
showChatFloatTip();
});
servernode.on("chatServerLoaded", function (e, serverList) {
servers = serverList;
if (servers)
showChatFloatTip();
port.postMessage("getCurrentRoomInfo");
});
servernode.on("enterRoot", function (e, room) {
//进入房间
sessMgr.ensureLogined(enterroom.bind(room));
});
//服务器
var servers;
@ -73,14 +59,29 @@
}
});
(function ui() {
$("#chat_float_tip").click(showServerList);
})();
$("#chat_float_tip").click(showServerList);
//加载服务器节点列表
servernode.loadServers();
setTimeout(function() {
servernode.loadServers();
}, 1000 * 60 * 11);
servernode.on("roomSelectHide", function () {
hideChatFrameUI();
showChatFloatTip();
});
servernode.on("chatServerLoaded", function (e, serverList) {
servers = serverList;
if (servers)
showChatFloatTip();
port.postMessage("getCurrentRoomInfo");
});
servernode.on("enterRoot", function (e, room) {
//进入房间
sessMgr.ensureLogined(enterroom.bind(room));
});
return {
};

View File

@ -78,7 +78,7 @@
if (server.statusName === "full") {
mp.showMessagePopup("error", "亲,房间已满,换个房间呗~");
} else if (server.statusName == "closed") {
} else if (server.statusName === "closed") {
mp.showMessagePopup("error", "亲,这个房间暂时关闭了,换个房间呗~~");
} else
instance.fireEvent("enterRoot", server);

View File

@ -76,7 +76,7 @@
name: namestr[d.getDay()],
date: formatDate(d),
disabled: d < today || d > maxdays,
selected: d.getTime() == today.getTime(),
selected: d.getTime() === today.getTime(),
datecode: getDateString(d)
});
}