• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Json.JsonReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中JsonFx.Json.JsonReader的典型用法代码示例。如果您正苦于以下问题:C# JsonReader类的具体用法?C# JsonReader怎么用?C# JsonReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JsonReader类属于JsonFx.Json命名空间,在下文中一共展示了JsonReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: JobList

 private List<string> JobList()
 {
     List<string> Jobs = new List<string>();
        string URL = Deployinator.Config.JenkinsUrl + "/api/json";
        Log.Info("requesting " + URL);
        HttpWebRequest Req = (HttpWebRequest)WebRequest.Create(URL);
        HttpWebResponse Resp = (HttpWebResponse)Req.GetResponse();
        if ( Resp.StatusCode == System.Net.HttpStatusCode.OK)
             {
                  System.IO.Stream ResponseStream = Resp.GetResponseStream();
                  System.IO.StreamReader StreamReader = new System.IO.StreamReader(ResponseStream);
                  JsonReader Reader = new JsonReader();
                  String Json = StreamReader.ReadToEnd();
                  Dictionary<string, Object> JsonDict = Reader.Read<Dictionary<string, Object>>(Json);
                  Dictionary<string, Object>[] JsonJobs = (Dictionary<string, Object>[]) JsonDict["jobs"];
                  for ( int i = 0 ; i < JsonJobs.Length ; i++ )
                       {
                            Dictionary<string, Object> JsonJob = (Dictionary<string, Object>) JsonJobs[i];
                            Jobs.Add((string)JsonJob["name"]);
                       }
             }
        else
             {
                  Log.Info("returned non 200 " + Resp.StatusCode.ToString());
             }
        return Jobs;
 }
开发者ID:otakup0pe,项目名称:sifteo4devops,代码行数:27,代码来源:Jenkins.cs


示例2: ExtractAppRevenueData

        public List<dynamic> ExtractAppRevenueData(string appName, string queryString)
        {
            var revenueData = DistimoService.GetDistimoData(SupportedDistimoApis.Revenues, queryString);

            var reader = new JsonReader();
            dynamic output = reader.Read(revenueData);

            List<dynamic> filteredList = new List<dynamic>();

            try
            {
                foreach (dynamic line in output.lines)
                {
                    string localAppName = line.data.application;

                    if (localAppName.Contains(appName))
                        filteredList.Add(line);
                }
            }
            catch (RuntimeBinderException)
            {
                // too many requests, try again
                Thread.Sleep(1100);
                return ExtractAppRevenueData(appName, queryString);
            }

            return filteredList;
        }
开发者ID:hunt3ri,项目名称:StatIt,代码行数:28,代码来源:RevenuesService.cs


示例3: handleMessage

        public void handleMessage(Message msg)
        {

            if (msg is CardTypesMessage)
            {
                JsonReader jsonReader = new JsonReader();
                Dictionary<string, object> dictionary = (Dictionary<string, object>)jsonReader.Read(msg.getRawText());
                Dictionary<string, object>[] d = (Dictionary<string, object>[])dictionary["cardTypes"];

                this.cardids = new int[d.GetLength(0)];
                this.cardnames = new string[d.GetLength(0)];
                this.cardImageid = new int[d.GetLength(0)];

                for (int i = 0; i < d.GetLength(0); i++)
                {
                    cardids[i] = Convert.ToInt32(d[i]["id"]);
                    cardnames[i] = d[i]["name"].ToString();
                    cardImageid[i] = Convert.ToInt32(d[i]["cardImage"]);
                }
                
                App.Communicator.removeListener(this);//dont need the listener anymore
            }
            
            return;
        }
开发者ID:noHero123,项目名称:imagechanger.mod,代码行数:25,代码来源:imagechanger.cs


示例4: onReqChangeSuccess

 private void onReqChangeSuccess(BaseWWWRequest obj)
 {
     try
     {
         ChangeEquipData data = new JsonFx.Json.JsonReader().Read<ChangeEquipData>(this.UTF8String);
         base.responseData = data;
         if (data.eid != 0)
         {
             this.onReqChangeFail(obj);
         }
         else
         {
             if (data.shipVO != null)
             {
                 GameData.instance.UpdateUserShip(data.shipVO);
             }
             if (data.detailInfo != null)
             {
                 GameData.instance.UserInfo.UpdateDetailInfo(data.detailInfo);
             }
             this.UpdateEquip();
             this.OnChangeEquipSuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         z.log(exception.Message);
         this.onReqChangeFail(obj);
     }
 }
开发者ID:lavender1213,项目名称:ShipGirlBot,代码行数:30,代码来源:ReqEquipment.cs


示例5: LoadData

        public void LoadData()
        {
            // Make sure it's time to update
            if( DateTime.Compare(nextUpdate, DateTime.UtcNow) == 1 ) {
                return;
            }

            nextUpdate = DateTime.UtcNow.AddHours(1);

            // Grab new data
            WebClient wc = new WebClient();

            try {
                wc.QueryString.Add("formatting", "1");

                String period = (String) mod.config.GetWithDefault("data-period", "1-day");
                String result = wc.DownloadString(new Uri("http://api.scrollspost.com/v1/prices/" + period));

                // Load it up
                List<APIPriceCheckResult> prices = new JsonReader().Read<List<APIPriceCheckResult>>(result);
                foreach( APIPriceCheckResult scroll in prices ) {
                    scrolls[scroll.card_id] = scroll;
                }

            } catch ( WebException we ) { // eeeeeeeeeeeeeeee
                App.Popups.ShowOk(this, "fail", "HTTP Error", "Unable to load pricing data, contact [email protected] for help.\n\n" + we.Message, "Ok");
                mod.WriteLog("Failed to load pricing data", we);
            }
        }
开发者ID:noHero123,项目名称:ScrollsPost,代码行数:29,代码来源:PriceManager.cs


示例6: onReqChangeSuccess

 private void onReqChangeSuccess(BaseWWWRequest obj)
 {
     try
     {
         DestroyShipData data = new JsonFx.Json.JsonReader().Read<DestroyShipData>(this.UTF8String);
         base.responseData = data;
         if (data.eid != 0)
         {
             this.onReqChangeFail(obj);
         }
         else
         {
             if (data.userVo != null)
             {
                 GameData.instance.UserInfo.UpdateResource(data.userVo);
             }
             if (data.equipmentVo != null)
             {
                 GameData.instance.SetUserEquipments(data.equipmentVo);
             }
             if (data.detailInfo != null)
             {
                 GameData.instance.UserInfo.UpdateDetailInfo(data.detailInfo);
             }
             this.UpdateShips();
             this.OnDestroySuccess(EventArgs.Empty);
         }
     }
     catch (Exception exception)
     {
         z.log(exception.Message);
         this.onReqChangeFail(obj);
     }
 }
开发者ID:lavender1213,项目名称:ShipGirlBot,代码行数:34,代码来源:ReqDestroyShip.cs


示例7: Convert

        public object Convert(int operation, string packet)
        {
            object _packet = null;
            UserOperation userOperation = (UserOperation)operation;

            JsonReader jsonReader = new JsonReader(packet);

            switch(userOperation)
            {
                case UserOperation.LOGIN:
                    _packet = jsonReader.Deserialize<LoginReply>();
                    break;
                case UserOperation.REGISTER:
                    _packet = jsonReader.Deserialize<RegisterReply>();
                    break;
                case UserOperation.CHARSELECT:
                case UserOperation.CREATECHAR:
                case UserOperation.DELETECHAR:
                case UserOperation.SELECTCHAR:
                    _packet = jsonReader.Deserialize<CharSelectPacket>();
                    break;
                default:
                    break;
            }

            return _packet;
        }
开发者ID:osROSE,项目名称:UnityRose,代码行数:27,代码来源:UserManager.cs


示例8: Convert

        public object Convert(int operation, string packet)
        {
            object _packet = null;

            CharacterOperation key = (CharacterOperation)operation;

            JsonReaderSettings settings = new JsonReaderSettings();
            settings.AddTypeConverter (new VectorConverter());
            settings.AddTypeConverter (new QuaternionConverter());

            JsonReader jsonReader = new JsonReader(packet, settings);

            switch(key)
            {
                case CharacterOperation.GROUNDCLICK:
                    _packet = jsonReader.Deserialize<GroundClick>();
                    break;
                case CharacterOperation.INSTANTIATE:
                    _packet = jsonReader.Deserialize<InstantiateChar>();
                    break;
                case CharacterOperation.DESTROY:
                    _packet = jsonReader.Deserialize<DestroyChar>();
                    break;
                default:
                    break;
            }

            return _packet;
        }
开发者ID:osROSE,项目名称:UnityRose,代码行数:29,代码来源:CharacterManager.cs


示例9: CreateJob

        public string CreateJob(string jsondata)
        {
            var newjob = new WorkerJob();

            newjob.ID = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10);

            var jr = new JsonReader(jsondata);
            var jo = jr.Deserialize() as Dictionary<string, object>;

            if (jo.ContainsKey("callback"))
                newjob.CallbackUrl = jo["callback"].ToString();

            if (jo.ContainsKey("jobtype"))
                newjob.JobType = jo["jobtype"].ToString();

            // parse args...
            if (jo.ContainsKey("jobargs"))
                Utilities.FillArgsFromJson(newjob.JobArgs, jo["jobargs"]);

            newjob.MyUrl = "http://" + _worker.Config.Hostname + ":" + _worker.Config.Port;

            Console.WriteLine("WorkerJobController: Created job #" + newjob.ID + " with callback url " + newjob.CallbackUrl);

            m_jobs.Add(newjob);
            return newjob.ID;
        }
开发者ID:possan,项目名称:mapreduce,代码行数:26,代码来源:WorkerJobController.cs


示例10: readJsonfromGoogle

            public void readJsonfromGoogle(string txt)
            {
                JsonReader jsonReader = new JsonReader();
                Dictionary<string, object> dictionary = (Dictionary<string, object>)jsonReader.Read(txt);
                dictionary = (Dictionary<string, object>)dictionary["feed"];
                Dictionary<string, object>[] entrys = (Dictionary<string, object>[])dictionary["entry"];
                for (int i = 0; i < entrys.GetLength(0); i++)
                {
                    /*for (int j = 0; j < 4; j++)
                    {
                        dictionary = (Dictionary<string, object>)entrys[i]["gsx$r"+(j+1)];
                        Console.WriteLine((string)dictionary["$t"]);
                    
                    }*/

                    dictionary = (Dictionary<string, object>)entrys[i]["gsx$r1"];
                    if (((string)dictionary["$t"]).ToLower() == "version")
                    {
                        dictionary = (Dictionary<string, object>)entrys[i]["gsx$r2"];
                        this.newestversion=(string)dictionary["$t"];
                        Console.WriteLine("version string recived");
                    }

                }
            }
开发者ID:noHero123,项目名称:guildchat.mod,代码行数:25,代码来源:versionchecker.cs


示例11: JsonTcpCommunication

 public JsonTcpCommunication(TcpClient socket)
     : base(socket)
 {
     JsonResolverStrategy resolver = new JsonResolverStrategy();
     _jsonIn = new JsonReader(new DataReaderSettings(resolver));
     _jsonOut = new JsonWriter(new DataWriterSettings(new ConventionResolverStrategy(ConventionResolverStrategy.WordCasing.CamelCase)));
 }
开发者ID:raabmar,项目名称:The-Tangibles,代码行数:7,代码来源:JsonTcpCommunication.cs


示例12: handleMessage

        public void handleMessage(Message msg)
        {
            if (msg is RoomEnterMessage)
            {
                RoomEnterMessage rms = (RoomEnterMessage)msg;
                this.nomssg.Add(rms.roomName);

            }

            if (msg is RoomInfoMessage)
            {
                Console.WriteLine("joinleave bearbeitet: " + msg.getRawText());
                //"removed";
                //"updated";
                JsonReader jsonReader = new JsonReader();
                Dictionary<string, object> dictionary = (Dictionary<string, object>)jsonReader.Read(msg.getRawText());
                string roomname = (string)dictionary["roomName"];

                

                if (msg.getRawText().Contains("removed"))
                {
                    Dictionary<string, object>[] d = (Dictionary<string, object>[])dictionary["removed"];

                    for (int i = 0; i < d.Length; i++)
                    {
                        string ltext = d[i]["name"] + " has left the room";
                        
                        RoomChatMessageMessage leftmessage = new RoomChatMessageMessage(roomname, "<color=#777460>" + ltext + "</color>");
                        App.ChatUI.handleMessage(leftmessage);
                        App.ArenaChat.ChatRooms.ChatMessage(leftmessage);
                    }

                }

                if (msg.getRawText().Contains("updated") && this.nomssg.Contains(roomname))
                {
                    nomssg.RemoveAll(item => item == roomname);
                }
                else
                {
                    if (msg.getRawText().Contains("updated"))
                    {
                        Dictionary<string, object>[] d = (Dictionary<string, object>[])dictionary["updated"];

                        for (int i = 0; i < d.Length; i++)
                        {
                            string ltext = d[i]["name"] + " has joined the room";
                            RoomChatMessageMessage leftmessage = new RoomChatMessageMessage(roomname, "<color=#777460>" + ltext + "</color>");
                            App.ChatUI.handleMessage(leftmessage);
                            App.ArenaChat.ChatRooms.ChatMessage(leftmessage);
                        }

                    }

                }
            }
            
            return;
        }
开发者ID:noHero123,项目名称:joinleave.mod,代码行数:60,代码来源:joinleave.cs


示例13: ExecuteDynamic

        public static IRestResponse<dynamic> ExecuteDynamic(this IRestClient client, IRestRequest request)
        {
            var response = client.Execute<dynamic>(request);

            dynamic content = new JsonReader().Read(response.Content);
            response.Data = content;

            return response;
        }
开发者ID:Krusen,项目名称:soe-census-api-csharp,代码行数:9,代码来源:Extensions.cs


示例14: LoadShipConfigs

 private void LoadShipConfigs()
 {
     if (this.shipConfigs != null)
     {
         AllConfigs configs = new JsonFx.Json.JsonReader().Read<AllConfigs>(this.shipConfigs);
         AllShipConfigs.instance.setShips(configs.shipCard);
         ServerRequestManager.instance.OnLoadConfigsComplete();
     }
 }
开发者ID:lavender1213,项目名称:ShipGirlBot,代码行数:9,代码来源:LoadConfigs.cs


示例15: GetDecoder

        public IDecoder GetDecoder()
        {
            var jsonReader = new JsonReader(new DataReaderSettings(DefaultEncoderDecoderConfiguration.CombinedResolverStrategy()
                , new TeamCityDateFilter()), new[] { "application/.*json", "text/.*json" });

            var readers = new List<IDataReader> { jsonReader };
            var dataReaderProvider = new RegExBasedDataReaderProvider(readers);
            return new DefaultDecoder(dataReaderProvider);
        }
开发者ID:byran,项目名称:TeamCitySharp,代码行数:9,代码来源:TeamcityJsonEncoderDecoderConfiguration.cs


示例16: tryUpdate

        public static bool tryUpdate()
        {
            WebClientTimeOut client = new WebClientTimeOut ();
            String versionMessageRaw;
            try {
                versionMessageRaw = client.DownloadString (new Uri("http://mods.scrollsguide.com/version"));
            } catch (WebException) {
                return false;
            }

            JsonReader reader = new JsonReader ();
            VersionMessage versionMessage = (VersionMessage)reader.Read (versionMessageRaw, typeof(VersionMessage));

            int version = versionMessage.version ();
            String installPath = Platform.getGlobalScrollsInstallPath () + Path.DirectorySeparatorChar + "ModLoader" + Path.DirectorySeparatorChar;

            try {
                File.Delete (installPath + "Updater.exe");
            } catch {}

            if (!System.IO.Directory.Exists(installPath)) {
                System.IO.Directory.CreateDirectory(installPath);
            }

            if (version > ModLoader.getVersion()) {

                byte[] asm;
                try {
                    asm = client.DownloadData(new Uri("http://mods.scrollsguide.com/download/update"));
                } catch (WebException) {
                    return false;
                }
                File.WriteAllBytes (installPath + "Updater.exe", asm);
                if (CheckToken (installPath + "Updater.exe", token)) {

                    try {
                        App.Popups.ShowInfo ("Scrolls Summoner is updating", "Please wait while the update is being downloaded");
                        Dialogs.showNotification("Scrolls Summoner is updating", "Please wait while the update is being downloaded");
                    } catch { }

                    if (Platform.getOS () == Platform.OS.Win) {
                        new Process { StartInfo = { FileName = installPath + "Updater.exe", Arguments = "" } }.Start ();
                    } else if (Platform.getOS () == Platform.OS.Mac) {
                        Assembly.LoadFrom (installPath + "Updater.exe").EntryPoint.Invoke (null, new object[] { new string[] {} });
                    }
                    return true;
                }

                try {
                    App.Popups.KillCurrentPopup();
                } catch {}
            }

            return false;
        }
开发者ID:svgorbunov,项目名称:ScrollsModLoader,代码行数:55,代码来源:Updater.cs


示例17: Load

 public PresetData Load(string fileName) {
     // ファイル読み込み
     try {
         using (FileStream fs = File.OpenRead(fileName))  {
             var reader = new JsonFx.Json.JsonReader(fs);
             return (PresetData)reader.Deserialize(typeof(PresetData));
         }
     } catch(Exception e) {
         LogUtil.Log("ACCプリセットの読み込みに失敗しました", e);
         return null;
     }
 }
开发者ID:trzr,项目名称:CM3D2.AlwaysColorChangeEx.Plugin,代码行数:12,代码来源:PresetManager.cs


示例18: GetDecoder

        public IDecoder GetDecoder()
        {
            var jsonReader = new JsonReader(new DataReaderSettings(CombinedResolverStrategy()), new[] { "application/.*json", "text/.*json" });
            var xmlReader = new XmlReader(new DataReaderSettings(CombinedResolverStrategy()),
                                          new[] {"application/.*xml", "text/.*xhtml", "text/xml", "text/html"});

            var readers = new List<IDataReader> {jsonReader, xmlReader};

            var dataReaderProvider = new RegExBasedDataReaderProvider(readers);

            return new DefaultDecoder(dataReaderProvider);
        }
开发者ID:carcer,项目名称:EasyHttp,代码行数:12,代码来源:DefaultEncoderDecoderConfiguration.cs


示例19: onSuccess

    private void onSuccess(BaseWWWRequest obj)
    {
        try
        {
            AllConfigs configs;
            if (this.needZip)
            {
                configs = new JsonFx.Json.JsonReader().Read<AllConfigs>(base.UTF8String);
            }
            else
            {
                configs = new JsonFx.Json.JsonReader().Read<AllConfigs>(this.UTF8String);
            }
            if (configs.eid != 0)
            {
                this.onFail(obj);
            }
            else
            {
                z.log("setShips");
                AllShipConfigs.instance.setShips(configs.shipCard);
                z.log("shipCard");
                GameConfigs.instance.PrepareEquipmentConfigs(configs.shipEquipment);
                z.log("PrepareEquipmentConfigs");
                GameConfigs.instance.PreparePVEExploreLevels(configs.pveExplore);
                z.log("PreparePVEExploreLevels");
                GameConfigs.instance.SetShopItems(configs.shipShop);
                GameConfigs.instance.SetShipEvoItems(configs.shipItem);
                GameConfigs.instance.SetSkillConfigs(configs.shipSkill);
                z.log("SetSkillConfigs");
                GameConfigs.instance.SetBuffConfigs(configs.shipSkillBuff);
                GameConfigs.instance.GlobalConfig = configs.globalConfig;
                GameConfigs.instance.marketingConfigs = configs.marketingConfigs;
                z.log("marketingConfigs");
                PVEConfigs.instance.SetCampaignChapters(configs.shipCampaign);
                PVEConfigs.instance.SetCampaignLevels(configs.shipCampaignLevel);
                GameConfigs.instance.errCode = configs.errorCode;

                //if (this.testShipUpdate && (this.shipUpdateconfigs != null))
                //{
                //    UpdateConfigs configs2 = JsonReader.Deserialize<UpdateConfigs>(this.shipUpdateconfigs.text);
                //    UpdateManager.Instance.SetShips(configs2.ships);
                //}

                ServerRequestManager.instance.OnLoadConfigsComplete();
            }
        }
        catch (Exception e)
        {
            z.log(e.Message+ "  " + e.StackTrace);
            this.onFail(obj);
        }
    }
开发者ID:lavender1213,项目名称:ShipGirlBot,代码行数:53,代码来源:LoadConfigs.cs


示例20: Encode

        public void Encode()
        {
            var id = new InstrumentData() { Pitch = 31, Roll = 89 };

            var x = new JsonWriter();
            var js = x.Write(id);

            var y = new JsonReader();
            var decoded = y.Read<InstrumentData>(js);

            Assert.AreEqual(id.Roll, decoded.Roll);
            Assert.AreEqual(id.Pitch, decoded.Pitch);
        }
开发者ID:jbwagner,项目名称:KInstruments,代码行数:13,代码来源:WebserverTests.cs



注:本文中的JsonFx.Json.JsonReader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DAL.Common类代码示例发布时间:2022-05-26
下一篇:
C# BLL.BaseDal类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap