csharp: json to csharp

news/2024/7/5 8:21:24

 http://json2csharp.com/
 http://jsonclassgenerator.codeplex.com/
 http://jsonutils.com/ JSON生成类文件
 https://github.com/bladefist/JsonUtils ///

http://jsonlint.com/ 检测JSON文件

http://json.codeplex.com/

https://www.mssqltips.com/sqlservertip/3449/making-sql-server-metadata-queries-easier-with-these-new-views/

http://www.sqlteam.com/article/using-metadata

https://github.com/dotnet/docfx  文档转换

http://www.codeproject.com/Articles/192938/jQuery-Templates-View-Engines-and-JSON-Services

http://www.codeproject.com/Articles/266473/JSON-API

http://www.codeproject.com/Articles/630300/JSON-Viewer

http://www.codeproject.com/Articles/78928/Create-JSON-from-C-using-JSON-Library

http://www.codeproject.com/Articles/159450/fastJSON

 

  public class Rating
    {
        public int max { get; set; }
        public int numRaters { get; set; }
        public string average { get; set; }
        public int min { get; set; }
    }

    public class Tag
    {
        public int count { get; set; }
        public string name { get; set; }
        public string title { get; set; }
    }

    public class Images
    {
        public string small { get; set; }
        public string large { get; set; }
        public string medium { get; set; }
    }

    public class Series
    {
        public string id { get; set; }
        public string title { get; set; }
    }

    public class Example
    {
        public Rating rating { get; set; }
        public string subtitle { get; set; }
        public IList<string> author { get; set; }
        public string pubdate { get; set; }
        public IList<Tag> tags { get; set; }
        public string origin_title { get; set; }
        public string image { get; set; }
        public string binding { get; set; }
        public IList<string> translator { get; set; }
        public string catalog { get; set; }
        public string pages { get; set; }
        public Images images { get; set; }
        public string alt { get; set; }
        public string id { get; set; }
        public string publisher { get; set; }
        public string isbn10 { get; set; }
        public string isbn13 { get; set; }
        public string title { get; set; }
        public string url { get; set; }
        public string alt_title { get; set; }
        public string author_intro { get; set; }
        public string summary { get; set; }
        public Series series { get; set; }
        public string price { get; set; }
    }

  

 WebClient client = new WebClient();
                client.Credentials = CredentialCache.DefaultCredentials;  
                client.Encoding = Encoding.UTF8;
                strjson = client.DownloadString(URL);
                //MessageBox.Show(strjson);
                //string reply = client.UploadString(URL, data);

                //var jsonlist = JsonConvert.DeserializeObject<List<DoubanBoookInfo>>(strjson);
                BookExample book = new BookExample();
                book = JsonConvert.DeserializeObject<BookExample>(strjson);

                // MessageBox.Show(book.title);
                this.textBoxprice.Text = book.price;
                this.textBoxpubdate.Text = book.pubdate;
                this.textBoxtitle.Text = book.title;
                this.textBoxImage.Text = book.image;
                Images imgurl = book.images;
                Encoding encoding = Encoding.GetEncoding("utf-8");
                //验证服务器证书回调方法 
                ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult); 
                //1
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(book.image);
                request.Method = "GET"; 
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                //String ver = response.ProtocolVersion.ToString();
                Stream stream = response.GetResponseStream();
                List<byte> list = new List<byte>();
                while (true)
                {
                    int data = stream.ReadByte();
                    if (data == -1)
                        break;
                    else
                    {
                        byte b = (byte)data;
                        list.Add(b);
                    }
                }
                byte[] photocontent = list.ToArray();
                Image photo = BytesToImage(photocontent);
                this.pictureBox1.Image = photo;

                //2
                HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(imgurl.large);
                objRequest.Method = "GET"; 
                HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
                Stream streambs = objResponse.GetResponseStream(); 
                System.Drawing.Image img = System.Drawing.Image.FromStream(streambs);
                this.pictureBox2.Image = img;

  

        /// <summary>
        /// 
        /// </summary>
        /// <param name="bytes"></param>
        /// <returns></returns>
        public Image BytesToImage(byte[] bytes)
        {
            MemoryStream ms = new MemoryStream(bytes);
            ms.Position = 0;
            Image img = Image.FromStream(ms);
            ms.Close();
            return img;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public byte[] StreamToBytes(Stream stream)
        {
            byte[] bytes = new byte[stream.Length];
            stream.Read(bytes, 0, bytes.Length);
            // 设置当前流的位置为流的开始
            stream.Seek(0, SeekOrigin.Begin);
            return bytes;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="bytes"></param>
        /// <returns></returns>
        public Stream BytesToStream(byte[] bytes)
        {
            Stream stream = new MemoryStream(bytes);
            return stream;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private byte[] SetImageToByteArray(string fileName)
        {
            FileStream fs = null;
            try
            {
                fs = new FileStream(fileName, FileMode.Open, System.IO.FileAccess.Read, FileShare.ReadWrite);
                Bitmap bt = new Bitmap(fs);
                int streamLength = (int)fs.Length;
                byte[] image = new byte[streamLength];
                fs.Read(image, 0, streamLength);

                return image;
            }
            catch (Exception)
            {

                throw;

            }
            finally
            {

                fs.Close();
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="fileName"></param>
        public void StreamToFile(Stream stream, string fileName)
        {
            // 把 Stream 转换成 byte[]
            byte[] bytes = new byte[stream.Length];
            stream.Read(bytes, 0, bytes.Length);
            // 设置当前流的位置为流的开始
            stream.Seek(0, SeekOrigin.Begin);
            // 把 byte[] 写入文件
            FileStream fs = new FileStream(fileName, FileMode.Create);
            BinaryWriter bw = new BinaryWriter(fs);
            bw.Write(bytes);
            bw.Close();
            fs.Close();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public Stream FileToStream(string fileName)
        {
            // 打开文件
            FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            // 读取文件的 byte[]
            byte[] bytes = new byte[fileStream.Length];
            fileStream.Read(bytes, 0, bytes.Length);
            fileStream.Close();
            // 把 byte[] 转换成 Stream
            Stream stream = new MemoryStream(bytes);
            return stream;
        }

  https://github.com/CosmosOS/Cosmos

http://cosmos.codeplex.com/

https://github.com/dotnet/corefx

https://github.com/fsharp

https://github.com/Microsoft/vscode/

https://github.com/adobe/brackets

https://github.com/qihangnet/npoi.css

https://github.com/hprose

https://ltaf.codeplex.com/SourceControl/latest

https://github.com/jmarnold/EmbeddedMail

https://xunit.codeplex.com/

https://github.com/markrendle/Simple.Data

https://github.com/jamietre/CsQuery

https://github.com/Microsoft/vscode/

https://github.com/matteocrippa/awesome-swift

https://github.com/kud1ing/awesome-rust

https://github.com/avelino/awesome-go

https://github.com/sorrycc/awesome-javascript

https://github.com/quozd/awesome-dotnet

https://github.com/Moq/moq4

http://fastreflectionlib.codeplex.com/SourceControl/latest

https://github.com/davidebbo/WebActivator

https://razorgenerator.codeplex.com/

https://github.com/RazorGenerator/RazorGenerator

http://dan.cx/projects/routejs

https://github.com/enyim/EnyimMemcached

https://github.com/tathamoddie/System.IO.Abstractions

 https://github.com/NLog/NLog

http://www.quartz-scheduler.net/

http://dotnetopenauth.net/

https://pangusegment.codeplex.com/

http://lucenenet.apache.org/

https://github.com/NancyFx

https://github.com/quartznet/

http://sourceforge.net/projects/quartznet/

https://github.com/DotNetOpenAuth/DotNetOpenAuth

https://github.com/DotNetOpenAuth/DotNetOpenAuth.Samples

https://github.com/NancyFx

https://github.com/MassTransit/MassTransit

http://code.google.com/p/masstransit/

ASP.NET MVC 3 RTM Tools Update

https://www.microsoft.com/zh-cn/download/confirmation.aspx?id=1491

http://orchard.codeplex.com/SourceControl/latest

http://aspnet.codeplex.com/SourceControl/latest

https://github.com/Microsoft/dotnet

https://github.com/dotnet/core

https://github.com/aspnet/EntityFramework

http://www.dotnetfoundation.org/projects

https://www.myget.org/gallery/dotnet-core

转载于:https://www.cnblogs.com/geovindu/p/5082557.html


http://www.niftyadmin.cn/n/4819034.html

相关文章

2.2 CPU 上下文切换是什么意思?(下)

怎么查看系统的上下文切换情况 过多的上下文切换&#xff0c;会把 CPU 时间消耗在寄存器、内核栈以及虚拟内存等数据的保存和恢复上&#xff0c;缩短进程真正运行的时间&#xff0c;成了系统性能大幅下降的一个 元凶。 使用 vmstat 这个工具&#xff0c;来查询系统的上下文切换…

在C++中集成Lua脚本(LuaWrapper )

在C中集成Lua脚本出处 在C中集成Lua脚本作者&#xff1a; 沐枫 &#xff08;第二人生成员&#xff09;版权所有转载请注明原出处主页&#xff1a;第二人生 http://www.d2-life.com   http://www.d2-life.com/LBS/blogview.asp?logID41为什么要用Lua作脚本&#xff1…

求最大连续子序列和

题目描述&#xff1a; 数组 int a[] {-4 , 3 ,56 , -15 , 34 , 0 , -14 , 4} ; 某几个连续的子序列其和最大&#xff0c;比如a0a1 -1 。a1a2a3a4 78 。则[a1 a2 a3 a4]组成的数组即是所求。 分析&#xff1a; 如果能够找到每个位置结束的最大连续子串和&#xff0c;那么保留…

SEO中巧用个人博客优化关键字

草根皆知&#xff0c;SEO中关键字外链优化是很重要的一部分&#xff0c;增加外链的方法也有很多种&#xff0c;最常用的有论坛、博客发布链接;许多站长对此是深恶痛绝&#xff0c;删贴、封ID绝不手软&#xff0c;外链往往无法长久。 因为急需提高网站关键词的权重&#xff0c;因…

(virus) 该死的病毒

今天打开ie浏览网站就发现&#xff0c;很多流行的网站都访问不了要么就是一直停滞不前&#xff0c;并且不断抱错说是访问某个网站的jpg含有ani病毒&#xff0c;可是我并没有访问这个网站&#xff0c;查询了下网络&#xff0c;似乎很多人都遇到了这样的问题&#xff0c;这个应该…

baidu luaplus luabind

luaplus介绍LuaPlus: 好用的Lua For C扩展 - 沐枫小筑(C) - C...LuaPlus是Lua的C增强,也就是说,LuaPlus本身就是在Lua的源码上进行增强得来的。用它与C进行合作,是比较好的一个选择。 LuaPlus目前版本为:LuaPlus for Lua 5.01 Distribution Build 1080 (February 28, 2004)。大…

关于三极管的应用

关于三极管的应用&#xff0c;摘自网络。 https://blog.csdn.net/u014453443/article/details/81117745 https://www.sohu.com/a/255293365_486207 https://baijiahao.baidu.com/s?id1606014850652442161&wfrspider&forpc 转载于:https://www.cnblogs.com/whylinux/…

你用哪一套script 語言呢

你用哪一套script 語言呢 更改我的閱讀文章字型大小大 小 作者 : alexyz(Alex) [ 貼文 110 | 人氣 6961 | 評價 35 ] [ 回應本文 ] [ 發表新文 ] [ 回上頁 ] [ 回討論區列表 ] [ 回知識入口 ] 12/23/2005 11:53:40 AM Hi, 現在似乎愈來愈多遊戲都會包含一個script en…