示例#1
0
        /// <summary>
        /// 获取最新微博信息
        /// </summary>
        public void NewList()
        {
            int weiboid = 0;

            if (!int.TryParse(nv["weiboid"], out weiboid))
            {
                //return;
            }
            E_Weibo data = new E_Weibo();

            data.EnterpriseID = ep.EnterpriceID;
            data.WeiboID      = weiboid;
            T_Weibo             bll = new T_Weibo();
            DataTable           dt  = bll.GetNewList(data);
            JsonArrayCollection jac = new JsonArrayCollection();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    JsonObjectCollection colDR = new JsonObjectCollection();
                    colDR.Add(new JsonStringValue("weiboid", dr["weiboid"].ToString()));
                    colDR.Add(new JsonStringValue("username", dr["TrueName"].ToString()));
                    colDR.Add(new JsonStringValue("date", dr["AddDate"].ToString()));
                    colDR.Add(new JsonStringValue("showdate", WEIBOHelper.ShowTime(dr["AddDate"].ToString())));
                    colDR.Add(new JsonStringValue("weibo", dr["Detail"].ToString()));
                    colDR.Add(new JsonStringValue("img", MLMGC.COMP.Config.GetEnterpriseAvatarUrl(dr["Avatar"].ToString())));
                    jac.Add(colDR);
                }
            }
            HttpContext.Current.Response.Write("{\"list\":" + jac.ToString() + "}");
        }
示例#2
0
        public void ShowData(string jsonStr)
        {
            this.ClientList.Items.Clear();
            this.ClientIDList = new List <int>();

            JsonTextParser       parser   = new JsonTextParser();
            JsonObjectCollection jsonData = (JsonObjectCollection)parser.Parse(jsonStr);

            JsonArrayCollection data = (JsonArrayCollection)jsonData["data"];

            for (int i = 0; i < data.Count; i++)
            {
                JsonObjectCollection itemData = (JsonObjectCollection)data[i];

                string isAdmin = Strings.CommonsClientIsAdmin0;
                if (((JsonNumericValue)itemData["is_admin"]).Value == 1)
                {
                    isAdmin = Strings.CommonsClientIsAdmin1;
                }

                ListViewItem item = new ListViewItem(new string[] { "", ((JsonStringValue)itemData["name"]).Value, ((JsonStringValue)itemData["ip"]).Value, isAdmin });
                this.ClientList.Items.Add(item);

                this.ClientIDList.Add((int)((JsonNumericValue)itemData["id"]).Value);
            }
        }
示例#3
0
        /// <summary>
        /// 获取最新微博信息
        /// </summary>
        public void TopList()
        {
            int weiboid = 0;

            if (!int.TryParse(nv["weiboid"], out weiboid))
            {
                return;
            }
            T_Weibo   bll = new T_Weibo();
            DataTable dt  = bll.GetMainList(new E_Weibo()
            {
                WeiboID = weiboid, Count = 5
            });
            JsonArrayCollection jac = new JsonArrayCollection();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    JsonObjectCollection colDR = new JsonObjectCollection();
                    colDR.Add(new JsonStringValue("weiboid", dr["weiboid"].ToString()));
                    colDR.Add(new JsonStringValue("username", dr["RealName"].ToString()));
                    colDR.Add(new JsonStringValue("date", dr["AddDate"].ToString()));
                    colDR.Add(new JsonStringValue("showdate", WEIBOHelper.ShowTime(dr["AddDate"].ToString())));
                    colDR.Add(new JsonStringValue("weibo", dr["Detail"].ToString()));
                    colDR.Add(new JsonStringValue("img", MLMGC.COMP.Config.GetPersonalAvatarUrl(dr["Avatar"].ToString())));
                    jac.Add(colDR);
                }
            }
            HttpContext.Current.Response.Write("{\"list\":" + jac.ToString() + "}");
        }
示例#4
0
        public void ReadAllMyFriends(string content, bool printMessage)
        {
            if (printMessage)
            {
                SetMessageLn("读取我的所有朋友信息...");
            }

            this._allMyFriendsList.Clear();

            //我的所有好友
            JsonTextParser      parser            = new JsonTextParser();
            JsonArrayCollection arrayAllMyFriends = parser.Parse(content) as JsonArrayCollection;

            foreach (JsonObjectCollection item in arrayAllMyFriends)
            {
                FriendInfo friend = new FriendInfo();
                friend.Id   = JsonHelper.GetIntegerValue(item["uid"]);
                friend.Name = JsonHelper.GetStringValue(item["real_name"]);
                this._allMyFriendsList.Add(friend);
                if (printMessage)
                {
                    SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")");
                }
            }

            if (printMessage)
            {
                SetMessageLn(string.Format("您有{0}个朋友", new object[] { this._allMyFriendsList.Count }));
            }
        }
示例#5
0
        public static void LoadColoring()
        {
            if (!File.Exists(FileColor))
            {
                return;
            }


            string text = "", key;
            int    val;

            using (StreamReader sr = new StreamReader(FileColor)) {
                text = sr.ReadToEnd();
            }

            try {
                JsonTextParser      parser         = new JsonTextParser();
                JsonArrayCollection jsoncollection = (JsonArrayCollection)(parser.Parse(text));
                foreach (JsonObjectCollection obj in jsoncollection)
                {
                    key = obj["k"].GetValue().ToString();
                    val = Convert.ToInt32(obj["v"].GetValue());

                    if (!DictCellColor.ContainsKey(key))
                    {
                        DictCellColor.Add(key, val);
                    }
                }
            } catch (Exception ex) { }
        }
示例#6
0
        internal void Load(JsonObjectCollection data)
        {
            if (data == null)
            {
                return;
            }

            if (data[EstResultsCountField] != null)
            {
                EstimatedResultsCount = int.Parse(data[EstResultsCountField].GetValue().ToString());
            }

            if (data[CurrentPageIndexField] != null)
            {
                CurrentPageIndex = int.Parse(data[CurrentPageIndexField].GetValue().ToString());
            }

            if (data[MoreResultsUrlField] != null)
            {
                MoreResultsUrl = data[MoreResultsUrlField].GetValue().ToString();
            }

            if (data[PagesField] != null)
            {
                JsonArrayCollection pagesColl = (JsonArrayCollection)data[PagesField];
                foreach (JsonObjectCollection pageCol in pagesColl)
                {
                    GCursorPage page = new GCursorPage();
                    page.Load(pageCol);

                    PageList.Add(page);
                }
            }
        }
示例#7
0
        internal virtual void Load(JsonObjectCollection data)
        {
            if (data == null)
            {
                return;
            }

            if (data[ResultsField] != null)
            {
                JsonArrayCollection resultsArray = (JsonArrayCollection)data[ResultsField];

                foreach (JsonObjectCollection resultColl in resultsArray)
                {
                    T result = (T)Activator.CreateInstance(typeof(T));
                    result.Load(resultColl);
                    result.SetProxy(Proxy);

                    SearchResultsList.Add(result);
                }
            }

            if (data[CursorField] != null)
            {
                JsonObjectCollection cursorColl = (JsonObjectCollection)data[CursorField];
                Cursor.Load(cursorColl);
            }
        }
示例#8
0
        public void RealTimeDownload(List <string> chatDownloadList)   //채티방 접속 중 실시간 다운로드 함수
        {
            JsonObjectCollection jsonDownloadObject  = new JsonObjectCollection();
            JsonArrayCollection  jsonArrayCollection = new JsonArrayCollection("uploadList");

            jsonDownloadObject.Add(new JsonStringValue("userId", UserInfo.userId));
            jsonDownloadObject.Add(new JsonStringValue("roomId", Chat_Form.roomId));

            for (int i = 0; i < chatDownloadList.Count; i++)
            {
                jsonArrayCollection.Add(new JsonStringValue(null, chatDownloadList[i]));
                JsonSend.fileName = chatDownloadList[i];
            }

            JsonSend jsonSend = new JsonSend();

            jsonDownloadObject.Add(jsonArrayCollection);

            string jsonStringRT = jsonDownloadObject.ToString();
            string jsonResultRT = jsonSend.JsonSendToServer(jsonStringRT, 6);

            Debug.WriteLine("<Chat_Form> real time download json send : " + jsonStringRT);
            Debug.WriteLine("<Chat_Form> real time download json response : " + jsonResultRT);

            if (jsonResultRT.Equals("created file"))
            {
                Debug.WriteLine("실시간 파일 생성 완료");
            }

            chatDownloadList.Clear();
        }
示例#9
0
        public static List <Listdata> GetMakerList(string url, bool noti)
        {
            List <Listdata> listMaker = new List <Listdata>();

            try {
                string result = Network.GET(url);

                JsonTextParser      parser        = new JsonTextParser();
                JsonArrayCollection objCollection = (JsonArrayCollection)parser.Parse(result);

                foreach (JsonObjectCollection item in objCollection)
                {
                    Listdata data = GetListData(item, noti);
                    if (noti)
                    {
                        data.Url = url;
                    }


                    listMaker.Add(data);
                }

                listMaker.Sort();
            } catch (Exception ex) {
                listMaker.Clear();
            }

            return(listMaker);
        }
示例#10
0
        /// <summary>
        /// 获取当前显示的预约客户
        /// </summary>
        private void GetNowReservation()
        {
            string ids = nv["ids"];

            if (!string.IsNullOrEmpty(ids) && !MLMGC.COMP.StringUtil.IsStringArrayList(ids))
            {
                HttpContext.Current.Response.Write("Error");
                return;
            }
            DataTable dt = new T_ClientInfoHelper().GetReservationNow(new E_Reservation()
            {
                EnterpriseID  = bp.EnterpriceID,
                EPUserTMRID   = bp.EPUserTMRID,
                ClientInfoIDs = ids
            });
            JsonArrayCollection jac = new JsonArrayCollection();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    JsonObjectCollection colDR = new JsonObjectCollection();
                    colDR.Add(new JsonStringValue("nid", dr["ReservationID"].ToString()));
                    colDR.Add(new JsonStringValue("id", dr["ClientInfoID"].ToString()));
                    colDR.Add(new JsonStringValue("name", dr["ClientName"].ToString()));
                    colDR.Add(new JsonStringValue("date", Convert.ToDateTime(dr["ReservationDate"].ToString()).ToString("yyyy-MM-dd HH:mm")));
                    colDR.Add(new JsonStringValue("minute", dr["AdvanceMinute"].ToString()));
                    colDR.Add(new JsonStringValue("type", dr["ReType"].ToString()));
                    jac.Add(colDR);
                }
            }
            HttpContext.Current.Response.Write(jac.ToString());
        }
示例#11
0
        public void ShowData(string jsonStr)
        {
            this.MenuClassList.Items.Clear();
            this.MenuClassList.Items.Add(Strings.MenuClassFormListFirst);
            this.MenuClassList.SelectedIndex = 0;

            this.MenuClassIDList = new List <int>();
            this.MenuClassIDList.Add(0);

            JsonTextParser       parser   = new JsonTextParser();
            JsonObjectCollection jsonData = (JsonObjectCollection)parser.Parse(jsonStr);

            JsonArrayCollection data = (JsonArrayCollection)jsonData["data"];

            for (int i = 0; i < data.Count; i++)
            {
                JsonObjectCollection itemData = (JsonObjectCollection)data[i];

                this.MenuClassList.Items.Add(((JsonStringValue)itemData["name"]).Value);
                this.MenuClassIDList.Add((int)((JsonNumericValue)itemData["id"]).Value);
            }

            //选定上一次所选定的索引
            this.MenuClassList.SelectedIndex = this.PrevSelectedIndex;
        }
示例#12
0
        public static void SaveDatabase(List <Idol> idols)
        {
            CheckDirectory();

            JsonArrayCollection root = new JsonArrayCollection();

            foreach (Idol idol in idols)
            {
                JsonObjectCollection obj = new JsonObjectCollection();
                obj.Add(new JsonNumericValue("Id", idol.Id));
                obj.Add(new JsonStringValue("Rarity", idol.Rarity.ToString()));
                obj.Add(new JsonNumericValue("RarityNumber", idol.RarityNumber));
                obj.Add(new JsonStringValue("Type", idol.Type.ToString()));
                obj.Add(new JsonNumericValue("Vocal", idol.Vocal));
                obj.Add(new JsonNumericValue("Dance", idol.Dance));
                obj.Add(new JsonNumericValue("Visual", idol.Visual));
                obj.Add(new JsonStringValue("Name", idol.Name));
                obj.Add(new JsonStringValue("OriginalName", idol.OriginalName));
                obj.Add(new JsonStringValue("CenterSkill", idol.CenterSkill.ToString()));
                obj.Add(new JsonStringValue("CenterSkillType", idol.CenterSkillType.ToString()));
                obj.Add(new JsonStringValue("CenterSkillCondition", idol.CenterSkillCondition.ToString()));
                obj.Add(new JsonStringValue("Skill", idol.Skill.ToString()));
                root.Add(obj);
            }

            using (StreamWriter sw = new StreamWriter(DataPath)) {
                sw.Write(root);
            }
        }
示例#13
0
        public static int Main(String[] args)
        {
            string func = string.Empty;
            string arg  = "arg";

            JsonObjectCollection collection    = new JsonObjectCollection();
            JsonArrayCollection  argCollection = new JsonArrayCollection("args");

            if (args.Length > 1)
            {
                func = args[0];
                collection.Add(new JsonStringValue("func", func));

                for (int i = 1; i < args.Length; i++)
                {
                    argCollection.Add(new JsonStringValue(arg + i, args[i]));
                }
            }
            collection.Add(argCollection);

            string s = collection.ToString();

            s = s + "<EOF>";

            Console.WriteLine(s);

            StartClient(s);

            return(0);
        }
示例#14
0
        public static Dictionary <int, int> GetCheck()
        {
            Dictionary <int, int> dict = Data.Idols.ToDictionary(i => i.Id, i => 0);

            if (!File.Exists(CountPath))
            {
                return(dict);
            }

            JsonTextParser      parser = new JsonTextParser();
            JsonArrayCollection root   = null;

            using (StreamReader sr = new StreamReader(CountPath)) {
                root = (JsonArrayCollection)parser.Parse(sr.ReadToEnd());
            }

            foreach (JsonObjectCollection obj in root)
            {
                try {
                    int id    = getInt(obj["Id"]);
                    int count = getInt(obj["Count"]);

                    dict[id] = count;
                }catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
            }

            return(dict);
        }
示例#15
0
        public static List <Listdata> Week(string weekCode, string type)
        {
            List <Listdata> list = new List <Listdata>();
            int             week = 0;

            try {
                week = Convert.ToInt32(weekCode);
            } catch { return(list); }

            try {
                string result = Network.GET(@"http://www.anissia.net/anitime/list?w=" + weekCode);

                JsonTextParser      parser = new JsonTextParser();
                JsonArrayCollection obj    = (JsonArrayCollection)parser.Parse(result);

                foreach (JsonObjectCollection item in obj)
                {
                    Listdata listitem = new Listdata()
                    {
                        Title = item["s"].GetValue().ToString(),
                        Url   = string.Format("{0}{1}", "http://www.anissia.net/anitime/cap?i=", item["i"].GetValue()),
                        Type  = type, Time = item["t"].GetValue().ToString(),
                        Tag   = item["i"].GetValue().ToString(),
                    };

                    list.Add(listitem);
                }
            } catch (Exception ex) {
                list.Clear();
            }

            return(list);
        }
示例#16
0
        public static JsonObjectCollection ConvertStatisticToJson(SpeedStatistics statistic, string statisticName)
        {
            JsonObjectCollection jsonTest         = new JsonObjectCollection(statisticName);
            JsonArrayCollection  jsonRecords      = new JsonArrayCollection("Records");
            JsonArrayCollection  jsonTime         = new JsonArrayCollection("Time");
            JsonArrayCollection  jsonAverageSpeed = new JsonArrayCollection("AverageSpeed");
            JsonArrayCollection  jsonMomentSpeed  = new JsonArrayCollection("MomentSpeed");

            for (int i = 0; i < BenchmarkTest.INTERVAL_COUNT; i++)
            {
                // Number of records & timespan.
                var rec = statistic.GetRecordAt(i);
                jsonRecords.Add(new JsonNumericValue(rec.Key));
                jsonTime.Add(new JsonNumericValue(rec.Value.TotalMilliseconds));

                // Average speed.
                var averageSpeed = statistic.GetAverageSpeedAt(i);
                jsonAverageSpeed.Add(new JsonNumericValue(averageSpeed));


                // Moment write speed.
                var momentSpeed = statistic.GetMomentSpeedAt(i);
                jsonMomentSpeed.Add(new JsonNumericValue(momentSpeed));
            }

            jsonTest.Add(jsonRecords);
            jsonTest.Add(jsonTime);
            jsonTest.Add(jsonAverageSpeed);
            jsonTest.Add(jsonMomentSpeed);

            return(jsonTest);
        }
示例#17
0
        /// <summary>
        /// 获取团队信息
        /// </summary>
        public void GetTeamInfo()
        {
            int     teamid = int.Parse(nv["teamid"].ToString());
            DataSet ds     = new T_Team().GetTeamParent(new E_Team()
            {
                TeamID = teamid, EnterpriseID = ep.EnterpriceID
            });
            JsonArrayCollection jac = new JsonArrayCollection();

            if (MLMGC.COMP.Data.DataSetIsNotNull(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    JsonObjectCollection colDR = new JsonObjectCollection();
                    colDR.Add(new JsonStringValue("text", dr["TeamName"].ToString()));
                    colDR.Add(new JsonStringValue("value", dr["TeamID"].ToString()));
                    jac.Add(colDR);
                }
            }
            else
            {
                JsonObjectCollection colDR = new JsonObjectCollection();
                colDR.Add(new JsonStringValue("text", "无"));
                colDR.Add(new JsonStringValue("value", "0"));
                jac.Add(colDR);
            }
            HttpContext.Current.Response.Write(jac.ToString());
        }
示例#18
0
        /// <summary>
        /// 自动分配
        /// </summary>
        private void AutoAllot()
        {
            int amount = 0, type = 0;

            int.TryParse(nv["num"], out amount);
            string sort = nv["orderby"];

            int.TryParse(nv["type"], out type);

            //---------------验证数据是否正确---------------
            if (amount <= 0)
            {
                HttpContext.Current.Response.Write("参数错误");
                HttpContext.Current.Response.End();
            }
            if (!(new string[] { "asc", "desc" }).Contains(sort))
            {
                HttpContext.Current.Response.Write("参数错误");
                HttpContext.Current.Response.End();
            }
            if (type < 2 || type > 6)
            {
                HttpContext.Current.Response.Write("参数错误");
                HttpContext.Current.Response.End();
            }

            E_Allot data = new E_Allot();

            data.EnterpriseID = bp.EnterpriceID;
            data.TeamID       = bp.TeamID;
            data.AllotAmount  = amount;
            data.AllotSort    = sort;
            data.SetMode      = type;
            T_Allot   bll = new T_Allot();
            DataTable dt  = bll.AutoAllot(data);

            new MLMGC.BLL.Enterprise.T_Log().Add(new MLMGC.DataEntity.Enterprise.E_Log()
            {
                EnterpriseID = bp.EnterpriceID, UserID = bp.UserID, LogTitle = "自动分配", IP = MLMGC.COMP.Requests.GetRealIP()
            });

            JsonArrayCollection jac = new JsonArrayCollection();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    jac.Add(new JsonObjectCollection()
                    {
                        new JsonStringValue("objName", dr[0].ToString()), new JsonStringValue("Amount", dr[1].ToString())
                    });
                }
                HttpContext.Current.Response.Write("succ");
            }
            else
            {
                HttpContext.Current.Response.Write("error");
            }
        }
示例#19
0
        public static void SaveSetting()
        {
            JsonObjectCollection root = new JsonObjectCollection();

            JsonArrayCollection archive = new JsonArrayCollection("Archive");

            foreach (ArchiveData data in Data.DictArchive.Values.ToList())
            {
                JsonObjectCollection obj = new JsonObjectCollection();

                obj.Add(new JsonStringValue("Title", data.Title));
                obj.Add(new JsonStringValue("Episode", data.Episode.ToString()));

                if (data.SeasonTitle != null)
                {
                    obj.Add(new JsonStringValue("SeasonTitle", data.SeasonTitle));
                }

                archive.Add(obj);
            }

            JsonArrayCollection season = new JsonArrayCollection("Season");

            foreach (SeasonData data in Data.DictSeason.Values.ToList())
            {
                JsonObjectCollection obj = new JsonObjectCollection();

                obj.Add(new JsonStringValue("Title", data.Title));
                obj.Add(new JsonStringValue("Week", data.Week.ToString()));
                obj.Add(new JsonStringValue("TimeString", data.TimeString));
                obj.Add(new JsonStringValue("Keyword", data.Keyword));

                if (data.ArchiveTitle != null)
                {
                    obj.Add(new JsonStringValue("ArchiveTitle", data.ArchiveTitle));
                }

                season.Add(obj);
            }

            JsonObjectCollection setting = new JsonObjectCollection("Setting");

            setting.Add(new JsonStringValue("SaveDirectory", SaveDirectory));
            setting.Add(new JsonStringValue("Tray", Tray.ToString()));
            setting.Add(new JsonStringValue("NoQuestion", NoQuestion.ToString()));
            setting.Add(new JsonStringValue("OldVersion", Version.NowVersion));
            setting.Add(new JsonStringValue("ShowRaws", ShowRaws.ToString()));

            root.Add(archive);
            root.Add(season);
            root.Add(setting);

            lock (locker) {
                using (StreamWriter sw = new StreamWriter(FileSetting)) {
                    sw.Write(root);
                }
            }
        }
示例#20
0
        private void PluralPostData(string message)
        {
            string postData = string.Empty;

            int count = this.DicDeviceID.Count;

            if (count > APPLY_COUNT)
            {
                int nCount = 0;

                JsonObjectCollection totalCollection = new JsonObjectCollection();
                JsonObjectCollection Collection      = new JsonObjectCollection("data");
                JsonArrayCollection  arrayCollection = new JsonArrayCollection("registration_ids");

                //Collection.Add(new JsonStringValue("type", type));
                Collection.Add(new JsonStringValue("msg", message));

                foreach (KeyValuePair <Int64, DeviceInfo> each in this.DicDeviceID)
                {
                    if (nCount > APPLY_COUNT)
                    {
                        totalCollection.Add(arrayCollection);
                        totalCollection.Add(Collection);

                        SendGCMNotification(API_KEY, totalCollection.ToString());

                        arrayCollection.Clear();
                        nCount = 0;
                    }
                    arrayCollection.Add(new JsonStringValue(null, each.Value.deviceid));
                    nCount++;
                }
                totalCollection.Add(arrayCollection);
                totalCollection.Add(Collection);

                SendGCMNotification(API_KEY, totalCollection.ToString());
            }
            else
            {
                JsonObjectCollection Collection      = new JsonObjectCollection("data");
                JsonObjectCollection totalCollection = new JsonObjectCollection();
                JsonArrayCollection  arrayCollection = new JsonArrayCollection("registration_ids");

                foreach (KeyValuePair <Int64, DeviceInfo> each in this.DicDeviceID)
                {
                    arrayCollection.Add(new JsonStringValue(null, each.Value.deviceid));
                }

                Collection.Add(new JsonStringValue(null, message));
                totalCollection.Add(arrayCollection);
                totalCollection.Add(Collection);

                SendGCMNotification(API_KEY, totalCollection.ToString());
            }

            SendGCMNotification(API_KEY, postData);
        }
示例#21
0
        public static JsonArrayCollection IllustratorText(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Text.Illustrator.Format textUIFormat = (Contents.Text.Illustrator.Format)source;
            string chipId;

            foreach (Contents.Text.Illustrator.Information information in textUIFormat.Information)
            {
                JsonObjectCollection savedItem = default(JsonObjectCollection);
                JsonObjectCollection item      = new JsonObjectCollection();

                chipId = ((Contents.Text.Assign.TypeInt)information.Assign).Param.ToString(CultureInfo.InvariantCulture);

                if (existingData != null)
                {
                    int Count = existingData.Count;
                    for (int idx = 0; idx < Count; idx++)
                    {
                        if (existingData[idx] != null &&
                            existingData[idx]["jp_name"] == information.Name)
                        {
                            savedItem = (JsonObjectCollection)existingData[idx];
                            existingData.RemoveAt(idx);
                            break;
                        }
                    }
                }

                item["chip"]    = chipId;
                item["jp_CV"]   = information.CV;
                item["tr_CV"]   = "";
                item["jp_name"] = information.Name;
                item["tr_name"] = "";

                if (savedItem != default(JsonObjectCollection))
                {
                    if (!String.IsNullOrEmpty(savedItem["tr_name"]))
                    {
                        information.Name = savedItem["tr_name"];
                        item["tr_name"]  = savedItem["tr_name"];
                    }
                    if (!String.IsNullOrEmpty(savedItem["tr_CV"]))
                    {
                        information.CV = savedItem["tr_CV"];
                        item["tr_CV"]  = savedItem["tr_CV"];
                    }
                }
                if (saveJson)
                {
                    data.Add(item);
                }
            }
            return(data);
        }
示例#22
0
        public string ConvertTo(object obj)
        {
            if (obj == null)
            {
                return("");
            }

            string             rtn = "";
            UnitDataCollection udc = null;

            if (obj is UnitDataCollection)
            {
                udc = (UnitDataCollection)obj;
            }
            else
            {
                throw new Exception("QueryByPage2Json无法转化" + obj.GetType().FullName + "类型数据!");
            }

            if (udc.QueryTable != null)
            {
                JsonObjectCollection jsonrtn = new JsonObjectCollection();
                //jsonrtn.Add(new JsonStringValue("Count_Of_OnePage", udc.Count_Of_OnePage + ""));
                jsonrtn.Add(new JsonStringValue("page", udc.CurrentPage + ""));
                //jsonrtn.Add(new JsonStringValue("total", udc.TotalPage + ""));
                jsonrtn.Add(new JsonStringValue("total", udc.TotalRow + ""));

                DataTableStd        dts     = udc.QueryTable;
                JsonArrayCollection jsonobj = new JsonArrayCollection("rows");
                for (int j = 0; j < dts.RowLength; j++)
                {
                    JsonObjectCollection jac = new JsonObjectCollection();
                    foreach (string colname in dts.ColumnNames)
                    {
                        if (dts.ColumnDateType(colname).FullName == typeof(DateTime).FullName)
                        {
                            DateTimeStd dtime = DateTimeStd.ParseStd(dts[j, colname]);
                            jac.Add(new JsonStringValue(colname, dtime != null ? dtime.Value.ToString("yyyy/MM/dd HH:mm:ss") : ""));
                        }
                        else
                        {
                            jac.Add(new JsonStringValue(colname, ComFunc.nvl(dts[j, colname])));
                        }
                    }
                    jsonobj.Add(jac);
                }
                jsonrtn.Add(jsonobj);



                rtn = jsonrtn.ToString();
            }

            return(rtn);
        }
示例#23
0
        public static bool JsonOutput(string filename, List <Core.Node> ChildList)
        {
            JsonUtility.GenerateIndentedJsonText = true;
            JsonArrayCollection collection = new JsonArrayCollection("Map");

            foreach (var child in ChildList)
            {
                JsonObjectCollection obj = new JsonObjectCollection();
                JsonArrayCollection  array;
                float[] arrayValue;

                // class Name
                obj.Add(new JsonStringValue("Class", child.GetClassName()));
                // Object Name
                obj.Add(new JsonStringValue("Name", child.GetObjectName()));

                /////////////// Positon ///////////////
                array      = new JsonArrayCollection("Position");
                arrayValue = child.GetPosition();
                array.Add(new JsonNumericValue(null, arrayValue[0]));
                array.Add(new JsonNumericValue(null, arrayValue[1]));
                array.Add(new JsonNumericValue(null, arrayValue[2]));

                obj.Add(array);

                //////////////// Scale ////////////////
                array      = new JsonArrayCollection("Scale");
                arrayValue = child.GetScale();
                array.Add(new JsonNumericValue(null, arrayValue[0]));
                array.Add(new JsonNumericValue(null, arrayValue[1]));
                array.Add(new JsonNumericValue(null, arrayValue[2]));

                obj.Add(array);

                ///////////// Front Vector ////////////
                array      = new JsonArrayCollection("FrontVector");
                arrayValue = child.GetFrontVector();
                array.Add(new JsonNumericValue(null, arrayValue[0]));
                array.Add(new JsonNumericValue(null, arrayValue[1]));
                array.Add(new JsonNumericValue(null, arrayValue[2]));

                obj.Add(array);


                // Add This Object
                collection.Add(obj);
            }
            JsonObjectCollection root = new JsonObjectCollection();

            root.Add(collection);
            System.IO.File.WriteAllText("test.json", root.ToString());

            return(true);
        }
示例#24
0
    //{"data":{ "retFlag": 0, "message": "登录成功。", "userID": 1, "userName": "******", "realName": "管理员", "userType": 1, "roleIDS": "", "email": "", "staffID": 21, "staffName": "管理员", "deptID": 105, "deptName": "", "orgID": 0, "orgName": "", "myDeptIDS": "" },"response":"Checklogin"}
    //private string getJson<MyTable>(MyTable item) where MyTable : ITableImplement, new()
    //{
    //    return getJsonObj(item).ToString();
    //}
    private JsonArrayCollection getJsonObj <MyTable>(List <MyTable> list, string jsonName) where MyTable : ITableImplement, new()
    {
        JsonArrayCollection arrs = new JsonArrayCollection();

        foreach (MyTable item in list)
        {
            arrs.Add(getJsonObj(item, ""));
        }
        arrs.Name = jsonName;
        return(arrs);
    }
示例#25
0
        public static JsonArrayCollection UIText(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Text.UI.Format textUIFormat = (Contents.Text.UI.Format)source;
            string currentAssign;

            foreach (Contents.Text.UI.Information information in textUIFormat.Information)
            {
                JsonObjectCollection savedItem = default(JsonObjectCollection);
                JsonObjectCollection item      = new JsonObjectCollection();
                if (information.Assign.GetType() == typeof(Contents.Text.Assign.TypeInt))
                {
                    currentAssign = ((Contents.Text.Assign.TypeInt)information.Assign).Param.ToString(CultureInfo.InvariantCulture);
                }
                else
                {
                    currentAssign = ((Contents.Text.Assign.TypeString)information.Assign).Param.Trim();
                }

                if (existingData != null)
                {
                    int Count = existingData.Count;
                    for (int idx = 0; idx < Count; idx++)
                    {
                        if (existingData[idx] != null &&
                            existingData[idx]["jp_text"] == information.Text)
                        {
                            savedItem = (JsonObjectCollection)existingData[idx];
                            existingData.RemoveAt(idx);
                            break;
                        }
                    }
                }

                item["assign"]  = currentAssign;
                item["jp_text"] = information.Text;
                item["tr_text"] = "";

                if (savedItem != default(JsonObjectCollection))
                {
                    if (!String.IsNullOrEmpty(savedItem["tr_text"]))
                    {
                        information.Text = savedItem["tr_text"];
                        item["tr_text"]  = savedItem["tr_text"];
                    }
                }
                if (saveJson)
                {
                    data.Add(item);
                }
            }
            return(data);
        }
示例#26
0
        public static JsonArrayCollection SeraphyRoom(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Text.SeraphyRoom.Format seraphyFormat = (Contents.Text.SeraphyRoom.Format)source;
            if (seraphyFormat != null)
            {
                Contents.Text.SeraphyRoom.Information information = seraphyFormat.Information[0];
                if (information.Assign != null)
                {
                    foreach (Contents.Text.SeraphyRoom.Information innerInformation in seraphyFormat.Information)
                    {
                        JsonObjectCollection savedItem = default(JsonObjectCollection);
                        JsonObjectCollection item      = new JsonObjectCollection();

                        if (existingData != null)
                        {
                            int Count = existingData.Count;
                            for (int idx = 0; idx < Count; idx++)
                            {
                                if (existingData[idx] != null &&
                                    existingData[idx]["jp_text"] == innerInformation.Text)
                                {
                                    savedItem = (JsonObjectCollection)existingData[idx];
                                    existingData.RemoveAt(idx);
                                    break;
                                }
                            }
                        }


                        item["text_id"] = innerInformation.TextId;
                        item["jp_text"] = innerInformation.Text;
                        item["tr_text"] = "";

                        if (savedItem != default(JsonObjectCollection))
                        {
                            if (!String.IsNullOrEmpty(savedItem["tr_text"]))
                            {
                                innerInformation.Text = savedItem["tr_text"];
                                item["tr_text"]       = savedItem["tr_text"];
                            }
                        }

                        if (saveJson)
                        {
                            data.Add(item);
                        }
                    }
                }
            }
            return(data);
        }
示例#27
0
        public string Refreshnickarrayinfo(string[] fnickarray)
        {
            JsonObjectCollection ret       = new JsonObjectCollection();
            JsonArrayCollection  jsonArray = new JsonArrayCollection("refreshnickarray");

            for (int i = 0; i < fnickarray.Length; i++)
            {
                jsonArray.Add(new JsonStringValue(null, fnickarray[i]));
            }
            ret.Add(jsonArray);
            return(ret.ToString());
        }
示例#28
0
        public string Refreshchatnickarrayinfo(List <string> chatnickarray)
        {
            JsonObjectCollection ret       = new JsonObjectCollection();
            JsonArrayCollection  jsonArray = new JsonArrayCollection("refreshchatnickarray");

            for (int i = 0; i < chatnickarray.Count; i++)
            {
                jsonArray.Add(new JsonStringValue(null, chatnickarray[i]));
            }
            ret.Add(jsonArray);
            return(ret.ToString());
        }
示例#29
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            HttpWebRequest wReq;
            HttpWebResponse wRes;
            int count = CommentCount + 20;
            Uri uri = new Uri("http://powdertoy.co.uk/Browse/Comments.json?ID=" + textBox1.Text + "& Start =" + CommentCount + "&Count=" + count); // string 을 Uri 로 형변환
            wReq = (HttpWebRequest)WebRequest.Create(uri); // WebRequest 객체 형성 및 HttpWebRequest 로 형변환
            wReq.Method = "GET"; // 전송 방법 "GET" or "POST"
            wReq.ServicePoint.Expect100Continue = false;
            wReq.CookieContainer = new CookieContainer();
            string res = null;

            using (wRes = (HttpWebResponse)wReq.GetResponse())
            {
                Stream respPostStream = wRes.GetResponseStream();
                StreamReader readerPost = new StreamReader(respPostStream, Encoding.GetEncoding("EUC-KR"), true);

                res = readerPost.ReadToEnd();
            }
            JsonTextParser parser = new JsonTextParser();
            JsonObject obj = parser.Parse(res);
            JsonArrayCollection col = (JsonArrayCollection)obj;

            List<string> Username = new List<string>();
            List<string> CommentText = new List<string>();
            List<string> Timestamp = new List<string>();
            List<DateTime> Date = new List<DateTime>();

            foreach (JsonObjectCollection joc in col)
            {
                Username.Add((string)joc["Username"].GetValue());
                CommentText.Add((string)joc["Text"].GetValue());
                Timestamp.Add((string)joc["Timestamp"].GetValue());
                Console.WriteLine(Username[Username.Count - 1] + CommentText[CommentText.Count - 1] + Timestamp[Timestamp.Count - 1]);
                TimeSpan t = TimeSpan.FromSeconds(Convert.ToInt32(Timestamp[Timestamp.Count - 1]));
                Date.Add(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc) + t);
                int hour = t.Hours + 9;
                if (hour > 24)
                {
                    hour = hour - 24;
                    if (hour >= 12)
                        hour = hour + 12;
                }
            }
            if (전에[1] != CommentText[1])
            {              
                notifyIcon1.Visible = true; // 트레이의 아이콘을 보이게 한다.
                notifyIcon1.BalloonTipText = CommentText[0];
                notifyIcon1.ShowBalloonTip(500);
                전에 = CommentText.ToArray();
                timer1.Start();
            }
        }
示例#30
0
        public static JsonArrayCollection Awakening_Skill_Info(object source, JsonArrayCollection existingData, bool saveJson)
        {
            JsonArrayCollection data = new JsonArrayCollection();

            Contents.Text.ChipAwakeningInfos.Format skillAwakenFormat = (Contents.Text.ChipAwakeningInfos.Format)source;

            foreach (Contents.Text.ChipAwakeningInfos.Information information in skillAwakenFormat.Information)
            {
                JsonObjectCollection savedItem = default(JsonObjectCollection);
                JsonObjectCollection item      = new JsonObjectCollection();

                if (existingData != null)
                {
                    int Count = existingData.Count;
                    for (int idx = 0; idx < Count; idx++)
                    {
                        if (existingData[idx] != null &&
                            existingData[idx]["jp_name"] == information.Name)
                        {
                            savedItem = (JsonObjectCollection)existingData[idx];
                            existingData.RemoveAt(idx);
                            break;
                        }
                    }
                }

                item["id"]      = information.SkillId;
                item["jp_name"] = information.Name;
                item["tr_name"] = "";
                item["jp_desc"] = information.Description;
                item["tr_desc"] = "";

                if (savedItem != default(JsonObjectCollection))
                {
                    if (!String.IsNullOrEmpty(savedItem["tr_desc"]))
                    {
                        information.Description = savedItem["tr_desc"];
                        item["tr_desc"]         = savedItem["tr_desc"];
                    }
                    if (!String.IsNullOrEmpty(savedItem["tr_name"]))
                    {
                        information.Name = savedItem["tr_name"];
                        item["tr_name"]  = savedItem["tr_name"];
                    }
                }
                if (saveJson)
                {
                    data.Add(item);
                }
            }
            return(data);
        }