public static object WEBSOCKET( [ExcelArgument(Description = "", Name = "銘柄コード")] string symbol, [ExcelArgument(Description = "", Name = "市場コード")] string exchange, [ExcelArgument(Description = "", Name = "項目名")] string itemName) { try { string ResultMessage = Validate.ValidateRtdBoard(_websocketStream, symbol, exchange, itemName); if (!string.IsNullOrEmpty(ResultMessage)) { return(ResultMessage); } if (!_websocketStream && CustomRibbon._updatePressed) { middleware.StartWebSocket(); } object ret = null; if (CustomRibbon._updatePressed) { ret = XlCall.RTD(RtdBoard.WebApiRequestServerProgId, null, "WEBSOCKET"); } if (!CustomRibbon._env) { return(0); } Dictionary <string, Tuple <DateTime, BoardElement> > _Cache = _websocketCache; object returnData = ""; if (_Cache.Count > 0) { var tplKey = symbol + "-" + exchange; Tuple <DateTime, BoardElement> tpl; if (_Cache.TryGetValue(tplKey, out tpl)) { returnData = BoardResult.GetBoardItem(tpl.Item2, symbol, int.Parse(exchange), itemName, false); } // 銘柄コード、市場コードのキーでキャッシュに該当データが無い場合、指数としてキャッシュをチェック if (string.IsNullOrEmpty(returnData.ToString())) { // Nullの場合、キャッシュには"0"で登録されるため、市場コ-ド"0"でキャッシュをチェック tplKey = symbol + "-" + "0"; if (_Cache.TryGetValue(tplKey, out tpl)) { returnData = BoardResult.GetBoardItem(tpl.Item2, symbol, int.Parse(exchange), itemName, false); } } } return(returnData); } catch (Exception exception) { if (exception.InnerException == null) { return(exception.Message); } else { return(exception.InnerException.Message); } } }