├── 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 |
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 = $('').attr('name', frameName);
34 | var form = $('').attr('name', 'form_' + frameName);
35 | form.attr("target", frameName).attr('action', opts.url);
36 |
37 | // form中增加数据域
38 | var formHtml = '';
39 | for (key in opts.params) {
40 | formHtml += '';
41 | }
42 | form.append(formHtml);
43 |
44 | iframe.appendTo("body");
45 | form.appendTo("body");
46 |
47 | form.submit(opts.onSubmit);
48 |
49 | // iframe 在提交完成之后
50 | iframe.load(function() {
51 | var contents = $(this).contents().get(0);
52 | var data = $(contents).find('body').text();
53 | if ('json' == opts.dataType) {
54 | data = window.eval('(' + data + ')');
55 | }
56 | opts.onComplate(data);
57 | setTimeout(function() {
58 | iframe.remove();
59 | form.remove();
60 | }, 5000);
61 | });
62 |
63 | // 文件框
64 | var fileInput = $('input[type=file][name=' + opts.fileName + ']', form);
65 | fileInput.click();
66 | };
67 | })(jQuery);
68 |
69 | // 选中文件, 提交表单(开始上传)
70 | var onChooseFile = function(fileInputDOM) {
71 | var form = $(fileInputDOM).parent();
72 | form.submit();
73 | };
74 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/ConsoleDemo/QQConnectTest.cs:
--------------------------------------------------------------------------------
1 | using NetDimension.OpenAuth.Tencent;
2 | using NetDimension.OpenAuth.Winform;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 |
9 | namespace ConsoleDemo
10 | {
11 | class QQConnectTest
12 | {
13 | public QQConnectTest()
14 | {
15 | var openAuth = new QQConnectClient("101194847", "2904a4765f7d449918aceedc66600eec", "http://dev.ohtrip.cn");
16 | var form = openAuth.GetAuthenticationForm();
17 |
18 |
19 |
20 |
21 | if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
22 | {
23 | console.info("用户授权成功!");
24 | console.data("AccessToken={0}\tOpenId={1}", openAuth.AccessToken, openAuth.OpenId);
25 | StartTest(openAuth);
26 | }
27 | else
28 | {
29 | console.error("用户授权失败!");
30 | }
31 |
32 |
33 | }
34 |
35 | private void StartTest(QQConnectClient openAuth)
36 | {
37 |
38 | console.attention("按任意键获取用户信息");
39 | Console.ReadKey(true);
40 | GetUserInfo(openAuth);
41 |
42 | console.attention("按任意键发布一条图片微博");
43 | Console.ReadKey(true);
44 | PostImageStatus(openAuth);
45 |
46 | console.attention("按任意键发布一条文字微博");
47 | Console.ReadKey(true);
48 | PostStatus(openAuth);
49 | }
50 |
51 | private void GetUserInfo(QQConnectClient openAuth)
52 | {
53 | var response = openAuth.HttpGet("user/get_user_info");
54 |
55 | if (response.IsSuccessStatusCode)
56 | {
57 | console.data(response.Content.ReadAsStringAsync().Result);
58 | }
59 | }
60 |
61 | private void PostStatus(QQConnectClient openAuth)
62 | {
63 | console.info("发布一条微博...");
64 |
65 |
66 | var result = openAuth.HttpPost("t/add_t", new Dictionary
67 | {
68 | {"content", string.Format("发布自WeiboSDK_V3@{0:HH:mm:ss}", DateTime.Now)}
69 | });
70 |
71 |
72 | if (result.IsSuccessStatusCode)
73 | {
74 |
75 | console.data(result.Content.ReadAsStringAsync().Result);
76 | console.info("发布成功!");
77 | }
78 | }
79 |
80 | private void PostImageStatus(QQConnectClient openAuth)
81 | {
82 | console.info("发布一条图片微博...");
83 |
84 | var imgPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"MrJSON-Production.png");
85 |
86 | var buff = File.ReadAllBytes(imgPath);
87 |
88 | var result = openAuth.HttpPost("t/add_pic_t", new Dictionary {
89 |
90 | {"content" , string.Format("SDK TEST {0:HH:mm:ss}", DateTime.Now)},
91 | {"pic" , buff}
92 | });
93 |
94 |
95 |
96 | if (result.IsSuccessStatusCode)
97 | {
98 |
99 | console.data(result.Content.ReadAsStringAsync().Result);
100 | console.info("发布成功!");
101 | }
102 | }
103 |
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/MvcDemo/Views/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
39 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/MvcDemo/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/ConsoleDemo/SinaWeiboTest.cs:
--------------------------------------------------------------------------------
1 | using NetDimension.OpenAuth.Sina;
2 | using NetDimension.OpenAuth.Winform;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text;
8 |
9 | namespace ConsoleDemo
10 | {
11 | class SinaWeiboTest
12 | {
13 | public SinaWeiboTest()
14 | {
15 | console.info("等待用户授权...");
16 |
17 |
18 |
19 | var openAuth = new SinaWeiboClient("1402038860", "62e1ddd4f6bc33077c796d5129047ca2", "http://qcyn.sina.com.cn");
20 |
21 | var form = openAuth.GetAuthenticationForm();
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
30 | {
31 | console.info("用户授权成功!");
32 | console.data("AccessToken={0}", openAuth.AccessToken);
33 |
34 |
35 | StartTest(openAuth);
36 |
37 | }
38 | else
39 | {
40 | console.error("用户授权失败!");
41 | }
42 | }
43 |
44 | private void StartTest(SinaWeiboClient openAuth)
45 | {
46 | console.attention("按任意键发布一条文字微博");
47 | Console.ReadKey(true);
48 | PostStatus(openAuth);
49 |
50 | console.attention("按任意键发布一条图片微博");
51 | Console.ReadKey(true);
52 | PostImageStatus(openAuth);
53 |
54 | console.attention("按任意键获取最新微博");
55 | Console.ReadKey(true);
56 | GetFrindTimeline(openAuth);
57 | }
58 |
59 | private void GetFrindTimeline(SinaWeiboClient openAuth)
60 | {
61 | console.info("获取当前登录用户及其所关注用户的最新微博...");
62 |
63 |
64 | var result = openAuth.HttpGet("statuses/friends_timeline.json", new Dictionary
65 | {
66 | {"count", 5},
67 | {"page", 1},
68 | {"base_app" , 0}
69 | });
70 | console.attention("{0}", result);
71 |
72 | if (result.IsSuccessStatusCode)
73 | {
74 |
75 | console.data(result.Content.ReadAsStringAsync().Result);
76 | console.info("获取成功!");
77 | }
78 |
79 | }
80 |
81 | private void PostImageStatus(SinaWeiboClient openAuth)
82 | {
83 | console.info("发布一条图片微博...");
84 |
85 | var imgPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"MrJSON-Production.png");
86 | var result = openAuth.HttpPost("statuses/upload.json", new Dictionary {
87 |
88 | {"status" , string.Format("发布自SinaWeiboSDK_V3@{0:HH:mm:ss}", DateTime.Now)},
89 | {"pic" , new FileInfo(imgPath)}
90 | });
91 |
92 | console.attention("{0}", result);
93 |
94 |
95 | if (result.IsSuccessStatusCode)
96 | {
97 |
98 | console.data(result.Content.ReadAsStringAsync().Result);
99 | console.info("发布成功!");
100 | }
101 | }
102 |
103 | private void PostStatus(SinaWeiboClient openAuth)
104 | {
105 | console.info("发布一条微博...");
106 |
107 |
108 | var result = openAuth.HttpPost("statuses/update.json", new Dictionary
109 | {
110 | {"status" , string.Format("发布自SinaWeiboSDK_V3@{0:HH:mm:ss}", DateTime.Now)}
111 | });
112 |
113 | console.attention("{0}", result);
114 | if (result.IsSuccessStatusCode)
115 | {
116 |
117 | console.data(result.Content.ReadAsStringAsync().Result);
118 | console.info("发布成功!");
119 | }
120 | }
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ConsoleDemo/Program.cs:
--------------------------------------------------------------------------------
1 | using NetDimension.OpenAuth;
2 | using NetDimension.OpenAuth.Sina;
3 | using NetDimension.OpenAuth.Tencent;
4 | using NetDimension.OpenAuth.Winform;
5 | using Newtonsoft.Json.Linq;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Diagnostics;
9 | using System.Linq;
10 | using System.Text;
11 |
12 | namespace ConsoleDemo
13 | {
14 |
15 | class Program
16 | {
17 | [STAThread]
18 | static void Main(string[] args)
19 | {
20 |
21 |
22 | var act = new Func