Beispiel #1
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public NicoLiveException(LiveStatusCode code, string id,
                          Exception innerException)
     : base(id + ": " + LiveStatusCodeUtil.GetDescription(code),
            innerException)
 {
     this.ErrorCode = code;
 }
        /// <summary>
        /// コンストラクタ
        /// </summary>
        protected LiveInfomationBase(XmlNode node, string rootName,
                                     string idString)
            : this()
        {
            var root = node.SelectSingleNode("/" + rootName);

            if (root == null)
            {
                throw new NicoLiveException(
                          LiveStatusCode.XmlParseError, idString);
            }

            // 放送情報が正しく取得できたか調べます。
            var status = root.Attributes["status"];

            if (status == null)
            {
                throw new NicoLiveException(
                          LiveStatusCode.XmlParseError, idString);
            }

            // 放送情報の取得に失敗した場合、その理由を返します。
            if (status.Value != "ok")
            {
                var code = root.SelectSingleNode("error/code");
                if (code != null)
                {
                    throw new NicoLiveException(
                              LiveStatusCodeUtil.GetCode(code.InnerText), idString);
                }
                else
                {
                    throw new NicoLiveException(
                              LiveStatusCode.UnknownError, idString);
                }
            }

            // 取得時刻です。
            var time = root.Attributes["time"];

            if (time != null)
            {
                this.Time = StrUtil.ToDateTime(time.Value);
            }

            this.RootNode = root;
            this.IdString = idString;
        }
Beispiel #3
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public NicoLiveException(LiveStatusCode code)
     : base(LiveStatusCodeUtil.GetDescription(code))
 {
     this.ErrorCode = code;
 }