├── LICENSE ├── .nuget ├── NuGet.exe ├── NuGet.Config ├── Package.nuspec └── NuGet.targets ├── MvcDemo ├── Icon.png ├── Views │ ├── _viewstart.cshtml │ ├── Shared │ │ └── _Layout.cshtml │ ├── Home │ │ └── Index.cshtml │ ├── Web.config │ └── Demo │ │ └── Index.cshtml ├── images │ ├── Logo.png │ ├── qrcode.jpg │ └── step1.png ├── Global.asax ├── Scripts │ ├── _references.js │ ├── npm.js │ └── jquery.upload.js ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── fontawesome-webfont.woff2 │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── Content │ └── site.css ├── App_Start │ ├── FilterConfig.cs │ └── RouteConfig.cs ├── Global.asax.cs ├── Properties │ └── AssemblyInfo.cs ├── Web.Debug.config ├── Web.Release.config ├── Controllers │ ├── HomeController.cs │ └── DemoController.cs ├── packages.config ├── Web.config └── MvcDemo.csproj ├── ConsoleDemo ├── MrJSON-Production.png ├── packages.config ├── app.config ├── Properties │ └── AssemblyInfo.cs ├── QQConnectTest.cs ├── SinaWeiboTest.cs ├── Program.cs └── ConsoleDemo.csproj ├── WinformDemo ├── Resources │ ├── body_bg.jpg │ ├── email.png │ ├── icon_app.ico │ ├── icon_form.ico │ ├── image_add.png │ └── paperfly.png ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── packages.config ├── app.config ├── Program.cs ├── WinformDemo.csproj ├── Form1.cs └── Form1.Designer.cs ├── NetDimension.OpenAuth ├── MemoryFileContent.cs ├── packages.config ├── app.config ├── Properties │ └── AssemblyInfo.cs ├── NetDimension.OpenAuth.csproj └── OpenAuthenticationClientBase.cs ├── NetDimension.OpenAuth.Sina ├── packages.config ├── app.config ├── NetDimension.OpenAuth.Sina.nuspec ├── Properties │ └── AssemblyInfo.cs ├── SinaWeiboClient.cs └── NetDimension.OpenAuth.Sina.csproj ├── NetDimension.OpenAuth.Tencent ├── packages.config ├── app.config ├── Properties │ └── AssemblyInfo.cs ├── QQConnectClient.cs └── NetDimension.OpenAuth.Tencent.csproj ├── NetDimension.OpenAuth.Winform ├── app.config ├── OpenAuthenticationClientExtensions.cs ├── Properties │ └── AssemblyInfo.cs ├── AuthenticationForm.cs ├── NetDimension.OpenAuth.Winform.csproj ├── AuthenticationForm.Designer.cs └── AuthenticationForm.resx ├── .gitattributes ├── .gitignore ├── WeiboSDK.sln └── README.md /LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/LICENSE -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/.nuget/NuGet.exe -------------------------------------------------------------------------------- /MvcDemo/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/Icon.png -------------------------------------------------------------------------------- /MvcDemo/Views/_viewstart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /MvcDemo/images/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/images/Logo.png -------------------------------------------------------------------------------- /MvcDemo/images/qrcode.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/images/qrcode.jpg -------------------------------------------------------------------------------- /MvcDemo/images/step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/images/step1.png -------------------------------------------------------------------------------- /MvcDemo/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MvcDemo.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /MvcDemo/Scripts/_references.js: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /MvcDemo/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /ConsoleDemo/MrJSON-Production.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/ConsoleDemo/MrJSON-Production.png -------------------------------------------------------------------------------- /WinformDemo/Resources/body_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/WinformDemo/Resources/body_bg.jpg -------------------------------------------------------------------------------- /WinformDemo/Resources/email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/WinformDemo/Resources/email.png -------------------------------------------------------------------------------- /WinformDemo/Resources/icon_app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/WinformDemo/Resources/icon_app.ico -------------------------------------------------------------------------------- /WinformDemo/Resources/icon_form.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/WinformDemo/Resources/icon_form.ico -------------------------------------------------------------------------------- /WinformDemo/Resources/image_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/WinformDemo/Resources/image_add.png -------------------------------------------------------------------------------- /WinformDemo/Resources/paperfly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/WinformDemo/Resources/paperfly.png -------------------------------------------------------------------------------- /MvcDemo/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /MvcDemo/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /MvcDemo/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /MvcDemo/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /MvcDemo/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /MvcDemo/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /MvcDemo/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /MvcDemo/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetDimension/WeiboSDK/HEAD/MvcDemo/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /MvcDemo/Content/site.css: -------------------------------------------------------------------------------- 1 | footer 2 | { 3 | background-color:#4400D9; 4 | height:80px; 5 | padding:20px 0; 6 | color:#fff; 7 | margin:30px 0 0 0; 8 | } 9 | -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /WinformDemo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MvcDemo/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace MvcDemo 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /ConsoleDemo/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /WinformDemo/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth/MemoryFileContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace NetDimension.OpenAuth 7 | { 8 | public class MemoryFileContent 9 | { 10 | public string FileName 11 | { 12 | get; 13 | set; 14 | } 15 | 16 | 17 | public byte[] Content 18 | { 19 | get; 20 | set; 21 | 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Sina/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Tencent/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ConsoleDemo/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /WinformDemo/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Sina/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Tencent/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Winform/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MvcDemo/Scripts/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Winform/OpenAuthenticationClientExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace NetDimension.OpenAuth.Winform 8 | { 9 | public static class OpenAuthenticationClientExtensions 10 | { 11 | 12 | public static AuthenticationForm GetAuthenticationForm(this OpenAuthenticationClientBase oauth) 13 | { 14 | var openAuthForm = new AuthenticationForm(oauth); 15 | 16 | return openAuthForm; 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /MvcDemo/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace MvcDemo 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /MvcDemo/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Http; 6 | using System.Web.Mvc; 7 | using System.Web.Routing; 8 | 9 | namespace MvcDemo 10 | { 11 | // 注意: 有关启用 IIS6 或 IIS7 经典模式的说明, 12 | // 请访问 http://go.microsoft.com/?LinkId=9394801 13 | public class MvcApplication : System.Web.HttpApplication 14 | { 15 | protected void Application_Start() 16 | { 17 | AreaRegistration.RegisterAllAreas(); 18 | 19 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 20 | RouteConfig.RegisterRoutes(RouteTable.Routes); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Sina/NetDimension.OpenAuth.Sina.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $id$ 5 | $version$ 6 | $title$ 7 | $author$ 8 | $author$ 9 | http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE 10 | http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE 11 | http://ICON_URL_HERE_OR_DELETE_THIS_LINE 12 | false 13 | $description$ 14 | Summary of changes made in this release of the package. 15 | Copyright 2016 16 | Tag1 Tag2 17 | 18 | -------------------------------------------------------------------------------- /.nuget/Package.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Package 5 | 1.0.0 6 | Anderson 7 | Anderson 8 | http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE 9 | http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE 10 | http://ICON_URL_HERE_OR_DELETE_THIS_LINE 11 | false 12 | Package description 13 | Summary of changes made in this release of the package. 14 | Copyright 2016 15 | Tag1 Tag2 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /MvcDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过下列特性集 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("MvcDemo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Net Dimension Studio")] 12 | [assembly: AssemblyProduct("MvcDemo")] 13 | [assembly: AssemblyCopyright("版权所有(C) Net Dimension Studio 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的某个类型, 19 | // 请针对该类型将 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("6efb0fce-df94-4fc6-a4fb-9dd4a4cca9f6")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /MvcDemo/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /WinformDemo/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.34209 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WinformDemo.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ConsoleDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("ConsoleDemo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Net Dimension Studio")] 12 | [assembly: AssemblyProduct("ConsoleDemo")] 13 | [assembly: AssemblyCopyright("Copyright © Net Dimension Studio 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("37407768-7fbc-49cd-8eb3-4feb35401eb6")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /WinformDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("WinformDemo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Net Dimension Studio")] 12 | [assembly: AssemblyProduct("WinformDemo")] 13 | [assembly: AssemblyCopyright("Copyright © Net Dimension Studio 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("142dd8b1-883b-4b10-a6ae-21678487adb2")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MvcDemo/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("NetDimension.OpenAuth")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Net Dimension Studio")] 12 | [assembly: AssemblyProduct("NetDimension.OpenAuth")] 13 | [assembly: AssemblyCopyright("Copyright © Net Dimension Studio 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("9da79205-1433-42cc-9dd7-6c1913d431d6")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /WinformDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using NetDimension.OpenAuth.Sina; 2 | using NetDimension.OpenAuth.Winform; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Windows.Forms; 7 | 8 | namespace WinformDemo 9 | { 10 | 11 | static class Program 12 | { 13 | 14 | 15 | 16 | /// 17 | /// 应用程序的主入口点。 18 | /// 19 | [STAThread] 20 | static void Main() 21 | { 22 | Application.EnableVisualStyles(); 23 | Application.SetCompatibleTextRenderingDefault(false); 24 | 25 | 26 | //请自行修改appKey,appSecret和回调地址。winform的回调地址可以是一个随便可以访问的地址,貌似不可以访问的地址也是可以的,只要URL中带着Code就行 27 | var client = new SinaWeiboClient("1402038860", "62e1ddd4f6bc33077c796d5129047ca2", "http://qcyn.sina.com.cn"); 28 | 29 | //NetDimension.OpenAuth.Winform封装的一个登录窗口,主要远离就是个WebBrowser控件,然后在该控件的导航事件里面监测Url是不是带有Code,如果有就调用GetAccessTokenByCode 30 | var authForm = client.GetAuthenticationForm(); 31 | 32 | authForm.StartPosition = FormStartPosition.CenterScreen; 33 | authForm.Icon = Properties.Resources.icon_form; 34 | 35 | if (authForm.ShowDialog() == DialogResult.OK) 36 | { 37 | Application.Run(new Form1(client)); 38 | } 39 | 40 | 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Sina/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("NetDimension.OpenAuth.Sina")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Net Dimension Studio")] 12 | [assembly: AssemblyProduct("NetDimension.OpenAuth.Sina")] 13 | [assembly: AssemblyCopyright("Copyright © Net Dimension Studio 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("78b21176-53ca-422c-ac08-00c283fcba92")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Tencent/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("NetDimension.OpenAuth.Tencent")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Net Dimension Studio")] 12 | [assembly: AssemblyProduct("NetDimension.OpenAuth.Tencent")] 13 | [assembly: AssemblyCopyright("Copyright © Net Dimension Studio 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("6c171a85-7a9e-43d6-b1b4-5e29b7f7586f")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Winform/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("NetDimension.OpenAuth.Winform")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Net Dimension Studio")] 12 | [assembly: AssemblyProduct("NetDimension.OpenAuth.Winform")] 13 | [assembly: AssemblyCopyright("Copyright © Net Dimension Studio 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("2c89940c-5f24-4014-b016-49626838709b")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MvcDemo/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = null; 3 | } 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | @ViewBag.Title - WeiboSDK Web Demo 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 32 |
33 | @RenderBody() 34 |
35 | 36 |
37 |
38 | 版权所有 © Net Dimension Studio 2015 保留所有权利。 39 |
40 | 41 |
42 | 43 | @RenderSection("scripts", false) 44 | 45 | 46 | -------------------------------------------------------------------------------- /MvcDemo/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using NetDimension.OpenAuth; 2 | using NetDimension.OpenAuth.Sina; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Configuration; 6 | using System.Linq; 7 | using System.Web; 8 | using System.Web.Mvc; 9 | 10 | namespace MvcDemo.Controllers 11 | { 12 | public class HomeController : Controller 13 | { 14 | // 15 | // GET: /Home/ 16 | 17 | public ActionResult Index() 18 | { 19 | 20 | 21 | return View(); 22 | } 23 | 24 | 25 | public ActionResult GetAuthorizationState() 26 | { 27 | var settings = ConfigurationManager.AppSettings; 28 | 29 | var oauth = new SinaWeiboClient(settings["appKey"], settings["appSecret"], settings["callbackUrl"]); 30 | 31 | 32 | if (Request.Cookies["access_token"] == null || string.IsNullOrEmpty(Request.Cookies["access_token"].Value)) 33 | { 34 | return Json(new 35 | { 36 | authorized = false 37 | }, JsonRequestBehavior.AllowGet); 38 | } 39 | 40 | 41 | 42 | var accessToken = Request.Cookies["access_token"].Value; 43 | var uid = Request.Cookies["uid"].Value; 44 | 45 | oauth.AccessToken = accessToken; 46 | oauth.UID = uid; 47 | 48 | //较v2版的sdk,新的v3版sdk移除了所有的本地化api接口,因为新浪的接口变来变去,踩着滑板鞋也追不着他们魔鬼的步伐。 49 | //因此v3版的调用方式改为直接填写官方api名称和传递官方文档中要求的参数的方式来调用,返回结果需要自行使用json接卸器解析。 50 | var response = oauth.HttpGet("user/show.json", new 51 | { 52 | uid = uid 53 | }); 54 | 55 | 56 | return Json(response.Content.ReadAsStringAsync().Result, JsonRequestBehavior.AllowGet); 57 | 58 | } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /MvcDemo/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /MvcDemo/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "欢迎"; 3 | } 4 | 5 |
6 | 7 | 8 | 9 |
10 | 11 |

欢迎使用WeiboSDK_v3版

12 | 13 |

14 | 项目地址:http://weibosdk.codeplex.com 15 |

16 | 17 |

18 | GitHub:https://github.com/NetDimension/WeiboSDK 19 |

20 | 21 | 22 |

第一步

23 |

根据自己的需求修改Web.config中的appKey、appSecret和callbackUrl字段。

24 |

本示例用的callbackUrl为“http://127.0.0.1:4801/Demo/Authorized”,所以如果要顺利运行本示例请讲在新浪微博开放平台中的回调地址也设置成这个。

25 |

26 | 27 |

28 |

第二步

29 |

如果使用IIS Express调试,请自行修改IIS Express的applicationhost.config文件,确保127.0.0.1:<端口>能够访问(因为新浪后台的回调地址可以使用IP地址,但不能使用localhost)。

30 |

applicationhost.config文件在“文档\IISExpress\config”文件夹中。

31 |

找到下列配置项,并添加“<binding protocol="http" bindinginformation="*:4801:127.0.0.1" />”:

32 | 44 |

另外,如果访问http://127.0.0.1:4801返回Bad Request错误的话,请用管理员权限运行你的VS.

45 |

第三步

46 |

47 | 点这里开始运行Demo 48 |

49 |

如果授权成功,程序会将获取到的access token及当前登录用户的uid暂存到cookie中。

50 | 51 | -------------------------------------------------------------------------------- /NetDimension.OpenAuth.Winform/AuthenticationForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Text.RegularExpressions; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace NetDimension.OpenAuth.Winform 13 | { 14 | public partial class AuthenticationForm : Form 15 | { 16 | OpenAuthenticationClientBase OpenAuth; 17 | 18 | 19 | public string Code 20 | { 21 | get; 22 | private set; 23 | } 24 | public AuthenticationForm(OpenAuthenticationClientBase openAuth) 25 | { 26 | InitializeComponent(); 27 | OpenAuth = openAuth; 28 | } 29 | 30 | private void frmAuthentication_Shown(object sender, EventArgs e) 31 | { 32 | browser.Navigate(OpenAuth.GetAuthorizationUrl()); 33 | } 34 | 35 | private void browser_Navigated(object sender, WebBrowserNavigatedEventArgs e) 36 | { 37 | 38 | //Console.WriteLine(e.Url); 39 | 40 | var pattern = @"code=([\d|a-zA-Z]*)"; 41 | if (Regex.IsMatch(e.Url.Query, pattern)) 42 | { 43 | panelMask.Visible = true; 44 | panelMask.BringToFront(); 45 | var code = Regex.Match(e.Url.Query, pattern).Groups[1].Value; 46 | 47 | Task.Factory.StartNew(() => 48 | { 49 | OpenAuth.GetAccessTokenByCode(code); 50 | UpdateUI(() => 51 | { 52 | if (OpenAuth.IsAuthorized) 53 | { 54 | 55 | Code = code; 56 | this.DialogResult = System.Windows.Forms.DialogResult.OK; 57 | this.Close(); 58 | 59 | } 60 | else 61 | { 62 | 63 | this.DialogResult = System.Windows.Forms.DialogResult.Cancel; 64 | this.Close(); 65 | } 66 | }); 67 | }); 68 | } 69 | } 70 | 71 | private void UpdateUI(Action uiAction) 72 | { 73 | if (this.InvokeRequired) 74 | { 75 | this.Invoke(new MethodInvoker(uiAction)); 76 | } 77 | else 78 | { 79 | uiAction(); 80 | } 81 | } 82 | 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /MvcDemo/Scripts/jquery.upload.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery upload v1.2 3 | * http://www.ponxu.com 4 | * 5 | * @author xwz 6 | */ 7 | (function($) { 8 | var noop = function(){ return true; }; 9 | var frameCount = 0; 10 | 11 | $.uploadDefault = { 12 | url: '', 13 | fileName: 'filedata', 14 | dataType: 'json', 15 | params: {}, 16 | onSend: noop, 17 | onSubmit: noop, 18 | onComplate: noop 19 | }; 20 | 21 | $.upload = function(options) { 22 | var opts = $.extend(jQuery.uploadDefault, options); 23 | if (opts.url == '') { 24 | return; 25 | } 26 | 27 | var canSend = opts.onSend(); 28 | if (!canSend) { 29 | return; 30 | } 31 | 32 | var frameName = 'upload_frame_' + (frameCount++); 33 | var iframe = $('