コード例 #1
0
ファイル: CountryInfo.cs プロジェクト: jrwren/yahoofinance
 public CountryInfo(string id, string name, CurrencyInfo cur)
 {
     if (string.IsNullOrEmpty(id)) throw new ArgumentException("ID is NULL.", "id");
     if (string.IsNullOrEmpty(name)) throw new ArgumentException("Name is NULL.", "name");
     if (cur == null) throw new ArgumentException("Currency is NULL.", "cur");
     this.ID = id;
     this.Name = name;
     this.Currency = cur;
 }
コード例 #2
0
ファイル: YCurrencyID.cs プロジェクト: jrwren/yahoofinance
 /// <summary>
 /// Overloaded constructor
 /// </summary>
 /// <param name="baseCur"></param>
 /// <param name="depCur"></param>
 /// <remarks></remarks>
 public YCurrencyID(CurrencyInfo baseCur, CurrencyInfo depCur)
 {
     this.BaseCurrency = baseCur;
     this.DepCurrency = depCur;
 }
コード例 #3
0
ファイル: WorldMarket.cs プロジェクト: jrwren/yahoofinance
        public YCurrencyID GetYCurrencyIDFromString(string id)
        {
            string idStr = id.ToUpper();
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\A[A-Z][A-Z][A-Z][A-Z][A-Z][A-Z]=X\z");
            if (idStr.Length == 8 && regex.Match(idStr).Success)
            {
                CurrencyInfo b = null;
                CurrencyInfo dep = null;
                string baseStr = idStr.Substring(0, 3);
                string depStr = idStr.Substring(3, 3);
                foreach (CurrencyInfo cur in mCurrencies)
                {
                    if (baseStr == cur.ID) { b = new CurrencyInfo(cur.ID, cur.Name); }
                    else if (depStr == cur.ID) { dep = new CurrencyInfo(cur.ID, cur.Name); }

                    if (b != null && dep != null) { return new YCurrencyID(b, dep); }
                }

                return null;
            }
            else
            {
                return null;
            }
        }
コード例 #4
0
ファイル: YCurrencyID.cs プロジェクト: jrwren/yahoofinance
 public YCurrencyID()
 {
     mBaseCurrency = null;
     mDepCurrency = null;
 }