public bool getParseAdsInfo(string adsinfo) { try { if (adsinfo != null && adsinfo.Length > 0) { // Type | URL | TEXT | TARGET string[] arrAdsinfo = adsinfo.Split('|'); MapAdsInfo.Add(AdsInfo.Type, arrAdsinfo[0]); MapAdsInfo.Add(AdsInfo.Target, arrAdsinfo[1]); if (MapAdsInfo[AdsInfo.Type].Equals("02")) { MapAdsInfo.Add(AdsInfo.URL, arrAdsinfo[2]); } else if (MapAdsInfo[AdsInfo.Type].Equals("03")) { for (int i = 0; i < arrAdsinfo.Length - 2; i++) { string strKey = string.Format("{0}_{1}", AdsInfo.TEXT, i); MapAdsInfo.Add(strKey, arrAdsinfo[i + 2]); } } } } catch { return(false); } return(true); }
public bool getParseAdsInfo(string adsinfo) { try { if (adsinfo != null && adsinfo.Length > 0) { // AdsCount | ( Type | TargetCnt | Target * N | URL | TEXT ) * N string[] arrAdsinfo = adsinfo.Split('|'); int idx = 0; MapAdsInfo.Add(AdsInfo.Count, arrAdsinfo[idx++]); for (int i = 0; i < Convert.ToInt32(MapAdsInfo[AdsInfo.Count]); i++) { Dictionary <string, object> AdsItemMap = new Dictionary <string, object>(); AdsItemMap.Add(AdsInfo.Type, arrAdsinfo[idx++]); List <int> targetList = new List <int>(); int targetCount = Convert.ToInt32(arrAdsinfo[idx++]); for (int j = 0; j < targetCount; j++) { targetList.Add(Convert.ToInt32(arrAdsinfo[idx++])); } AdsItemMap.Add(AdsInfo.Target, targetList); if (AdsItemMap[AdsInfo.Type].Equals("01")) // IMAGE { //AdsItemMap.Add(AdsInfo.URL, arrAdsinfo[idx++]); AdsItemMap.Add(AdsInfo.IMG, arrAdsinfo[idx++]); //URL 에서 이미지 데이터 로드하는것으로 변경 } else if (AdsItemMap[AdsInfo.Type].Equals("02")) // TEXT { List <string> adsTextList = new List <string>(); for (int j = 0; j < 5; j++) { if (!arrAdsinfo[idx].Equals("")) { adsTextList.Add(arrAdsinfo[idx++]); } } AdsItemMap.Add(AdsInfo.TEXT, adsTextList); } MapAdsInfo.Add(Convert.ToString(i), AdsItemMap); } } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } return(true); }