)formatter.Deserialize(stream);
86 | stream.Close();
87 | }
88 | }
89 |
90 | private Assembly MyResolveEventHandler(object sender, ResolveEventArgs args)
91 | {
92 | Assembly[] ayAssemblies = AppDomain.CurrentDomain.GetAssemblies();
93 | foreach (Assembly item in ayAssemblies)
94 | {
95 | if (item.FullName == args.Name)
96 | {
97 | return item;
98 | }
99 | }
100 |
101 | return null;
102 | }
103 |
104 | }
105 | }
106 |
107 | }
--------------------------------------------------------------------------------
/src/Evernote OAuth/EvernoteOAuthNet/EvernoteOAuthNet/LoginForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 | using System.Web;
9 | using System.Collections.Specialized;
10 |
11 | namespace EvernoteOAuthNet
12 | {
13 | internal partial class LoginForm : Form
14 | {
15 | private oAuthEvernote _oauth;
16 | private String _token;
17 | private String _verifier;
18 | private String _tokenSecret;
19 | private bool _linkedAppNotebookSelected;
20 |
21 | public String Token
22 | {
23 | get
24 | {
25 | return _token;
26 | }
27 | }
28 |
29 | public String Verifier
30 | {
31 | get
32 | {
33 | return _verifier;
34 | }
35 | }
36 |
37 | public String TokenSecret
38 | {
39 | get
40 | {
41 | return _tokenSecret;
42 | }
43 | }
44 |
45 | public bool LinkedAppNotebookSelected
46 | {
47 | get
48 | {
49 | return _linkedAppNotebookSelected;
50 | }
51 | }
52 |
53 |
54 | public LoginForm(oAuthEvernote o, string windowTitle)
55 | {
56 | _oauth = o;
57 | _token = null;
58 | InitializeComponent();
59 | this.Text = windowTitle;
60 | this.addressTextBox.Text = o.AuthorizationLink;
61 | _token = _oauth.Token;
62 | _tokenSecret = _oauth.TokenSecret;
63 | browser.Navigate(new Uri(_oauth.AuthorizationLink));
64 |
65 | }
66 |
67 | private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
68 | {
69 |
70 | }
71 |
72 | private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
73 | {
74 | this.addressTextBox.Text = e.Url.ToString();
75 | }
76 |
77 | private void browser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
78 | {
79 | //if (browser.Url.ToString().Contains(_oauth.CALLBACK_URL) | browser.Url.ToString().Contains(_oauth.CALLBACK_ALT_URL))
80 | if (!browser.Url.ToString().Contains(@"evernote.com") & !browser.Url.ToString().Contains(@"yinxiang.com"))
81 | {
82 | string queryParams = e.Url.Query;
83 | if (queryParams.Length > 0)
84 | {
85 | //Store the Token and Token Secret
86 | NameValueCollection qs = HttpUtility.ParseQueryString(queryParams);
87 | if (qs["oauth_token"] != null)
88 | {
89 | _token = qs["oauth_token"];
90 | }
91 | if (qs["oauth_verifier"] != null)
92 | {
93 | _verifier = qs["oauth_verifier"];
94 | }
95 | if (qs["sandbox_lnb"] != null)
96 | {
97 | _linkedAppNotebookSelected = qs["sandbox_lnb"] == "true" ? true : false;
98 | }
99 | }
100 | this.Close();
101 | }
102 | }
103 |
104 | private void addressTextBox_KeyPress(object sender, KeyPressEventArgs e)
105 | {
106 | //Cancel the key press so the user can't enter a new url
107 | e.Handled = true;
108 | }
109 |
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/Evernote OAuth/EvernoteOAuthNet/EvernoteOAuthNet/LoginForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace EvernoteOAuthNet
2 | {
3 | partial class LoginForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginForm));
32 | this.browser = new System.Windows.Forms.WebBrowser();
33 | this.addressTextBox = new System.Windows.Forms.TextBox();
34 | this.SuspendLayout();
35 | //
36 | // browser
37 | //
38 | this.browser.Location = new System.Drawing.Point(0, 0);
39 | this.browser.MinimumSize = new System.Drawing.Size(20, 20);
40 | this.browser.Name = "browser";
41 | this.browser.ScriptErrorsSuppressed = true;
42 | this.browser.ScrollBarsEnabled = false;
43 | this.browser.Size = new System.Drawing.Size(864, 669);
44 | this.browser.TabIndex = 0;
45 | this.browser.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
46 | this.browser.Navigated += new System.Windows.Forms.WebBrowserNavigatedEventHandler(this.browser_Navigated);
47 | this.browser.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.webBrowser1_Navigating);
48 | //
49 | // addressTextBox
50 | //
51 | this.addressTextBox.Dock = System.Windows.Forms.DockStyle.Top;
52 | this.addressTextBox.Location = new System.Drawing.Point(0, 0);
53 | this.addressTextBox.Name = "addressTextBox";
54 | this.addressTextBox.Size = new System.Drawing.Size(864, 20);
55 | this.addressTextBox.TabIndex = 1;
56 | this.addressTextBox.Visible = false;
57 | //
58 | // LoginForm
59 | //
60 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
61 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
62 | this.ClientSize = new System.Drawing.Size(864, 669);
63 | this.Controls.Add(this.browser);
64 | this.Controls.Add(this.addressTextBox);
65 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
66 | this.MaximizeBox = false;
67 | this.MinimizeBox = false;
68 | this.Name = "LoginForm";
69 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
70 | this.Text = "Please provide authorization to access your Evernote account";
71 | this.ResumeLayout(false);
72 | this.PerformLayout();
73 |
74 | }
75 |
76 | #endregion
77 |
78 | private System.Windows.Forms.WebBrowser browser;
79 | private System.Windows.Forms.TextBox addressTextBox;
80 | }
81 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 |
9 | # Build results
10 |
11 | [Dd]ebug/
12 | [Rr]elease/
13 | x64/
14 | build/
15 | [Bb]in/
16 | [Oo]bj/
17 |
18 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
19 | !packages/*/build/
20 |
21 | # MSTest test Results
22 | [Tt]est[Rr]esult*/
23 | [Bb]uild[Ll]og.*
24 |
25 | *_i.c
26 | *_p.c
27 | *.ilk
28 | *.meta
29 | *.obj
30 | *.pch
31 | *.pdb
32 | *.pgc
33 | *.pgd
34 | *.rsp
35 | *.sbr
36 | *.tlb
37 | *.tli
38 | *.tlh
39 | *.tmp
40 | *.tmp_proj
41 | *.log
42 | *.vspscc
43 | *.vssscc
44 | .builds
45 | *.pidb
46 | *.log
47 | *.scc
48 |
49 | # Visual C++ cache files
50 | ipch/
51 | *.aps
52 | *.ncb
53 | *.opensdf
54 | *.sdf
55 | *.cachefile
56 |
57 | # Visual Studio profiler
58 | *.psess
59 | *.vsp
60 | *.vspx
61 |
62 | # Guidance Automation Toolkit
63 | *.gpState
64 |
65 | # ReSharper is a .NET coding add-in
66 | _ReSharper*/
67 | *.[Rr]e[Ss]harper
68 |
69 | # TeamCity is a build add-in
70 | _TeamCity*
71 |
72 | # DotCover is a Code Coverage Tool
73 | *.dotCover
74 |
75 | # NCrunch
76 | *.ncrunch*
77 | .*crunch*.local.xml
78 |
79 | # Installshield output folder
80 | [Ee]xpress/
81 |
82 | # DocProject is a documentation generator add-in
83 | DocProject/buildhelp/
84 | DocProject/Help/*.HxT
85 | DocProject/Help/*.HxC
86 | DocProject/Help/*.hhc
87 | DocProject/Help/*.hhk
88 | DocProject/Help/*.hhp
89 | DocProject/Help/Html2
90 | DocProject/Help/html
91 |
92 | # Click-Once directory
93 | publish/
94 |
95 | # Publish Web Output
96 | *.Publish.xml
97 |
98 | # NuGet Packages Directory
99 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
100 | #packages/
101 |
102 | # Windows Azure Build Output
103 | csx
104 | *.build.csdef
105 |
106 | # Windows Store app package directory
107 | AppPackages/
108 |
109 | # Others
110 | sql/
111 | *.Cache
112 | ClientBin/
113 | [Ss]tyle[Cc]op.*
114 | ~$*
115 | *~
116 | *.dbmdl
117 | *.[Pp]ublish.xml
118 | *.pfx
119 | *.publishsettings
120 |
121 | # RIA/Silverlight projects
122 | Generated_Code/
123 |
124 | # Backup & report files from converting an old project file to a newer
125 | # Visual Studio version. Backup files are not needed, because we have git ;-)
126 | _UpgradeReport_Files/
127 | Backup*/
128 | UpgradeLog*.XML
129 | UpgradeLog*.htm
130 |
131 | # SQL Server files
132 | App_Data/*.mdf
133 | App_Data/*.ldf
134 |
135 |
136 | #LightSwitch generated files
137 | GeneratedArtifacts/
138 | _Pvt_Extensions/
139 | ModelManifest.xml
140 |
141 | # =========================
142 | # Windows detritus
143 | # =========================
144 |
145 | # Windows image file caches
146 | Thumbs.db
147 | ehthumbs.db
148 |
149 | # Folder config file
150 | Desktop.ini
151 |
152 | # Recycle Bin used on file shares
153 | $RECYCLE.BIN/
154 |
155 | # Mac desktop service store files
156 | .DS_Store
157 |
158 | # Windows image file caches
159 | Thumbs.db
160 | ehthumbs.db
161 |
162 | # Folder config file
163 | Desktop.ini
164 |
165 | # Recycle Bin used on file shares
166 | $RECYCLE.BIN/
167 |
168 | # Windows Installer files
169 | *.cab
170 | # *.msi
171 | *.msm
172 | *.msp
173 |
174 | # =========================
175 | # Operating System Files
176 | # =========================
177 |
178 | # OSX
179 | # =========================
180 |
181 | .DS_Store
182 | .AppleDouble
183 | .LSOverride
184 |
185 | # Icon must end with two \r
186 | Icon
187 |
188 | # Thumbnails
189 | ._*
190 |
191 | # Files that might appear on external disk
192 | .Spotlight-V100
193 | .Trashes
194 |
195 | # Directories potentially created on remote AFP share
196 | .AppleDB
197 | .AppleDesktop
198 | Network Trash Folder
199 | Temporary Items
200 | .apdisk
201 |
202 |
--------------------------------------------------------------------------------
/src/EvernoteSDK/ENResource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Imaging;
4 | using Evernote.EDAM.Type;
5 | using EvernoteSDK.Advanced;
6 |
7 | namespace EvernoteSDK
8 | {
9 | public class ENResource
10 | {
11 | private byte[] _data;
12 | public byte[] Data
13 | {
14 | get
15 | {
16 | return _data;
17 | }
18 | set
19 | {
20 | if (value != null && value.Length >= Int32.MaxValue)
21 | {
22 | ENSDKLogger.ENSDKLogError("Data length for resource is greater than Int32.");
23 | value = null;
24 | }
25 |
26 | DataHash = null;
27 | _data = value;
28 | }
29 | }
30 |
31 | public string MimeType {get; set;}
32 | public string Filename {get; set;}
33 | internal string SourceUrl {get; set;}
34 | private string Guid {get; set;}
35 |
36 | private byte[] _dataHash;
37 | internal byte[] DataHash
38 | {
39 | get
40 | {
41 | // Compute and cache the hash value.
42 | if (_dataHash == null && Data.Length > 0)
43 | {
44 | _dataHash = Data.Enmd5();
45 | }
46 | return _dataHash;
47 | }
48 | set
49 | {
50 | _dataHash = value;
51 | }
52 | }
53 |
54 | internal ENResource()
55 | {
56 | }
57 |
58 | public ENResource(byte[] data, string mimeType, string filename)
59 | {
60 | Data = data;
61 | MimeType = mimeType;
62 | Filename = filename;
63 |
64 | if (data == null)
65 | {
66 | throw new ArgumentException("Invalid argument", "data");
67 | }
68 | }
69 |
70 | public ENResource(byte[] data, string mimeType) : this(data, mimeType, null)
71 | {
72 | }
73 |
74 | public ENResource(Image image) : this()
75 | {
76 | System.IO.MemoryStream memstream = new System.IO.MemoryStream();
77 | image.Save(memstream, image.RawFormat);
78 | Data = memstream.ToArray();
79 |
80 | if (image.RawFormat.Equals(ImageFormat.Png))
81 | {
82 | MimeType = Evernote.EDAM.Limits.Constants.EDAM_MIME_TYPE_PNG;
83 | }
84 | else if (image.RawFormat.Equals(ImageFormat.Jpeg))
85 | {
86 | MimeType = Evernote.EDAM.Limits.Constants.EDAM_MIME_TYPE_JPEG;
87 | //ElseIf image.RawFormat.Equals(ImageFormat.Gif) Then
88 | // TODO: Find out if it's OK to include the GIF format
89 | // Me.mimeType = Evernote.EDAM.Limits.Constants.EDAM_MIME_TYPE_GIF
90 | }
91 | else
92 | {
93 | throw new ArgumentException("Unsupported image format", "image");
94 | }
95 | }
96 |
97 | internal static ENResource ResourceWithServiceResource(Resource serviceResource)
98 | {
99 | if (serviceResource.Data.Body == null)
100 | {
101 | ENSDKLogger.ENSDKLogError("Can't create an ENResource from an EDAMResource with no body");
102 | return null;
103 | }
104 |
105 | var resource = new ENResource();
106 | resource.Data = serviceResource.Data.Body;
107 | resource.MimeType = serviceResource.Mime;
108 | resource.Filename = serviceResource.Attributes.FileName;
109 | resource.SourceUrl = serviceResource.Attributes.SourceURL;
110 | return resource;
111 | }
112 |
113 | internal Resource EDAMResource()
114 | {
115 | if (Data == null)
116 | {
117 | return null;
118 | }
119 |
120 | Resource resource = new Resource();
121 | resource.Guid = Guid;
122 | if (resource.Guid == null && Data != null)
123 | {
124 | resource.Data = new Data();
125 | resource.Data.BodyHash = DataHash;
126 | resource.Data.Size = Data.Length;
127 | resource.Data.Body = Data;
128 | }
129 | resource.Mime = MimeType;
130 | ResourceAttributes attributes = new ResourceAttributes();
131 | if (Filename != null)
132 | {
133 | attributes.FileName = Filename;
134 | }
135 | if (SourceUrl != null)
136 | {
137 | attributes.SourceURL = SourceUrl;
138 | }
139 | resource.Attributes = attributes;
140 | return resource;
141 | }
142 |
143 | }
144 |
145 | }
--------------------------------------------------------------------------------
/samples/CS/SampleAppAdvanced/SampleAppAdvanced/SampleAppAdvanced.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {62E1BF07-DE5C-41D9-B524-38964E166D68}
8 | Exe
9 | Properties
10 | SampleAppAdvanced
11 | SampleAppAdvanced
12 | v4.0
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 | SampleAppAdvanced.Program
36 |
37 |
38 |
39 | ..\..\..\..\assemblies\CsQuery.dll
40 |
41 |
42 | ..\..\..\..\assemblies\en-html2enml.dll
43 |
44 |
45 | ..\..\..\..\assemblies\Evernote.dll
46 |
47 |
48 | ..\..\..\..\assemblies\EvernoteOAuthNet.dll
49 |
50 |
51 | False
52 | ..\..\..\..\assemblies\EvernoteSDK.dll
53 |
54 |
55 | ..\..\..\..\assemblies\PreMailer.Net.dll
56 |
57 |
58 | ..\..\..\..\assemblies\SgmlReaderDll.dll
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | ..\..\..\..\assemblies\Thrift.dll
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
85 |
--------------------------------------------------------------------------------
/src/Evernote OAuth/AuthSample/AuthSample/AuthSample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {79764ACF-F279-4F37-92C4-EFF488F0F14E}
9 | WinExe
10 | Properties
11 | AuthSample
12 | AuthSample
13 | v4.0
14 |
15 |
16 | 512
17 |
18 |
19 | x86
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | x86
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 | AuthSample.Program
39 |
40 |
41 |
42 | False
43 | .\EvernoteOAuthNet.dll
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | ResXFileCodeGenerator
61 | Resources.Designer.cs
62 | Designer
63 |
64 |
65 | True
66 | Resources.resx
67 | True
68 |
69 |
70 |
71 | SettingsSingleFileGenerator
72 | Settings.Designer.cs
73 |
74 |
75 | True
76 | Settings.settings
77 | True
78 |
79 |
80 |
81 |
88 |
--------------------------------------------------------------------------------
/src/Evernote OAuth/EvernoteOAuthNet/EvernoteOAuthNet/EvernoteOAuth.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.Specialized;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace EvernoteOAuthNet
8 | {
9 | public class EvernoteOAuth
10 | {
11 |
12 | public EvernoteOAuth(HostService service, string consumerKey, string consumerSecret, string windowTitle = "Please provide authorization to access your Evernote account")
13 | {
14 | _service = service;
15 | _consumerKey = consumerKey;
16 | _consumerSecret = consumerSecret;
17 | _windowTitle = windowTitle;
18 | _supportLinkedAppNotebook = false;
19 | }
20 |
21 | public EvernoteOAuth(HostService service, string consumerKey, string consumerSecret, bool supportLinkedAppNotebook, string windowTitle = "Please provide authorization to access your Evernote account")
22 | {
23 | _service = service;
24 | _consumerKey = consumerKey;
25 | _consumerSecret = consumerSecret;
26 | _supportLinkedAppNotebook = supportLinkedAppNotebook;
27 | _windowTitle = windowTitle;
28 | }
29 |
30 | public enum HostService { Production, Sandbox, Yinxiang };
31 |
32 | private string _consumerKey;
33 | private string _consumerSecret;
34 | private HostService _service;
35 | private string _windowTitle;
36 |
37 | private oAuthEvernote _oauth;
38 |
39 | private string _oauth_token;
40 | private string _edam_noteStoreUrl;
41 | private string _edam_userId;
42 | private long _edam_expires;
43 | private string _edam_webApiUrlPrefix;
44 | private bool _supportLinkedAppNotebook = false;
45 | private bool _linkedAppNotebookSelected;
46 |
47 | public string Token { get { return _oauth_token; } set { _oauth_token = value; } }
48 | public string NoteStoreUrl { get { return _edam_noteStoreUrl; } set { _edam_noteStoreUrl = value; } }
49 | public string UserId { get { return _edam_userId; } set { _edam_userId = value; } }
50 | public long Expires { get { return _edam_expires; } set { _edam_expires = value; } }
51 | public string WebApiUrlPrefix { get { return _edam_webApiUrlPrefix; } set { _edam_webApiUrlPrefix = value; } }
52 | public bool SupportLinkedAppNotebook { get { return _supportLinkedAppNotebook; } set { _supportLinkedAppNotebook = value; } }
53 | public bool LinkedAppNotebookSelected { get { return _linkedAppNotebookSelected; } set { _linkedAppNotebookSelected = value; } }
54 |
55 |
56 | public string Authorize()
57 | {
58 | try
59 | {
60 | _oauth = new oAuthEvernote(_service, _consumerKey, _consumerSecret, _supportLinkedAppNotebook, _windowTitle);
61 | String requestToken = _oauth.getRequestToken();
62 | // txtOutput.Text += "\n" + "Received request token: " + requestToken;
63 |
64 | _oauth.authorizeToken(_windowTitle);
65 | // txtOutput.Text += "\n" + "Token was authorized: " + _oauth.Token + " with verifier: " + _oauth.Verifier;
66 |
67 | NameValueCollection accessInfo = _oauth.getAccessToken();
68 |
69 | Token = accessInfo["oauth_token"];
70 | NoteStoreUrl = accessInfo["edam_noteStoreUrl"];
71 | UserId = accessInfo["edam_userId"];
72 | Expires = Convert.ToInt64(accessInfo["edam_expires"]);
73 | WebApiUrlPrefix = accessInfo["edam_webApiUrlPrefix"];
74 | LinkedAppNotebookSelected = _oauth.LinkedAppNotebookSelected;
75 | return string.Empty;
76 |
77 | // txtOutput.Text += "\n" + "Access token was received: " + _oauth.Token;
78 | }
79 | catch (Exception exp)
80 | {
81 | // txtOutput.Text += "\nException: " + exp.Message;
82 | return exp.Message;
83 | }
84 | }
85 |
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/samples/CS/SampleApp/SampleApp/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SampleApp
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBoxThumbnail = new System.Windows.Forms.PictureBox();
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.webBrowser1 = new System.Windows.Forms.WebBrowser();
34 | this.label2 = new System.Windows.Forms.Label();
35 | ((System.ComponentModel.ISupportInitialize)(this.pictureBoxThumbnail)).BeginInit();
36 | this.SuspendLayout();
37 | //
38 | // pictureBoxThumbnail
39 | //
40 | this.pictureBoxThumbnail.Location = new System.Drawing.Point(40, 25);
41 | this.pictureBoxThumbnail.Name = "pictureBoxThumbnail";
42 | this.pictureBoxThumbnail.Size = new System.Drawing.Size(120, 120);
43 | this.pictureBoxThumbnail.TabIndex = 0;
44 | this.pictureBoxThumbnail.TabStop = false;
45 | //
46 | // label1
47 | //
48 | this.label1.AutoSize = true;
49 | this.label1.Location = new System.Drawing.Point(44, 159);
50 | this.label1.Name = "label1";
51 | this.label1.Size = new System.Drawing.Size(115, 13);
52 | this.label1.TabIndex = 1;
53 | this.label1.Text = "Downloaded thumbnail";
54 | //
55 | // webBrowser1
56 | //
57 | this.webBrowser1.Location = new System.Drawing.Point(193, 25);
58 | this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
59 | this.webBrowser1.Name = "webBrowser1";
60 | this.webBrowser1.Size = new System.Drawing.Size(490, 370);
61 | this.webBrowser1.TabIndex = 2;
62 | //
63 | // label2
64 | //
65 | this.label2.AutoSize = true;
66 | this.label2.Location = new System.Drawing.Point(375, 414);
67 | this.label2.Name = "label2";
68 | this.label2.Size = new System.Drawing.Size(74, 13);
69 | this.label2.TabIndex = 3;
70 | this.label2.Text = "Note contents";
71 | //
72 | // Form1
73 | //
74 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
75 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
76 | this.ClientSize = new System.Drawing.Size(719, 447);
77 | this.Controls.Add(this.label2);
78 | this.Controls.Add(this.webBrowser1);
79 | this.Controls.Add(this.label1);
80 | this.Controls.Add(this.pictureBoxThumbnail);
81 | this.Name = "Form1";
82 | this.Text = "Form1";
83 | this.Load += new System.EventHandler(this.Form1_Load);
84 | ((System.ComponentModel.ISupportInitialize)(this.pictureBoxThumbnail)).EndInit();
85 | this.ResumeLayout(false);
86 | this.PerformLayout();
87 |
88 | }
89 |
90 | #endregion
91 |
92 | private System.Windows.Forms.PictureBox pictureBoxThumbnail;
93 | private System.Windows.Forms.Label label1;
94 | private System.Windows.Forms.WebBrowser webBrowser1;
95 | private System.Windows.Forms.Label label2;
96 | }
97 | }
98 |
99 |
--------------------------------------------------------------------------------
/samples/CS/SampleApp/SampleApp/SampleApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F6E7F018-2D86-488B-AAC4-11E4AE71457C}
8 | WinExe
9 | Properties
10 | SampleApp
11 | SampleApp
12 | v4.0
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | ..\..\..\..\assemblies\CsQuery.dll
41 |
42 |
43 | ..\..\..\..\assemblies\en-html2enml.dll
44 |
45 |
46 | ..\..\..\..\assemblies\Evernote.dll
47 |
48 |
49 | ..\..\..\..\assemblies\EvernoteOAuthNet.dll
50 |
51 |
52 | False
53 | ..\..\..\..\assemblies\EvernoteSDK.dll
54 |
55 |
56 | ..\..\..\..\assemblies\PreMailer.Net.dll
57 |
58 |
59 | ..\..\..\..\assemblies\SgmlReaderDll.dll
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 | ..\..\..\..\assemblies\Thrift.dll
73 |
74 |
75 |
76 |
77 | Form
78 |
79 |
80 | Form1.cs
81 |
82 |
83 |
84 |
85 | Form1.cs
86 | Designer
87 |
88 |
89 | ResXFileCodeGenerator
90 | Resources.Designer.cs
91 | Designer
92 |
93 |
94 | True
95 | Resources.resx
96 |
97 |
98 | SettingsSingleFileGenerator
99 | Settings.Designer.cs
100 |
101 |
102 | True
103 | Settings.settings
104 | True
105 |
106 |
107 |
108 |
115 |
--------------------------------------------------------------------------------
/samples/VB.NET/SampleApp/SampleApp/Form1.vb:
--------------------------------------------------------------------------------
1 | Imports EvernoteSDK
2 | Imports System.IO
3 |
4 | Public Class Form1
5 |
6 | Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
7 |
8 | ' Be sure to put your own consumer key and consumer secret here.
9 | ENSession.SetSharedSessionConsumerKey("your key", "your secret")
10 |
11 | If ENSession.SharedSession.IsAuthenticated = False Then
12 | ENSession.SharedSession.AuthenticateToEvernote()
13 | End If
14 |
15 | ' Get a list of all notebooks in the user's account.
16 | Dim myNotebookList As List(Of ENNotebook) = ENSession.SharedSession.ListNotebooks()
17 |
18 | ' Create a new note (in the user's default notebook) with some plain text content.
19 | Dim myPlainNote As ENNote = New ENNote()
20 | myPlainNote.Title = "My plain text note"
21 | myPlainNote.Content = ENNoteContent.NoteContentWithString("Hello, world!")
22 | Dim myPlainNoteRef As ENNoteRef = ENSession.SharedSession.UploadNote(myPlainNote, Nothing)
23 |
24 | ' Share this new note publicly. "shareUrl" is the public URL to distribute to access the note.
25 | Dim shareUrl = ENSession.SharedSession.ShareNote(myPlainNoteRef)
26 |
27 | ' Create a new note (in the user's default notebook) with some HTML content.
28 | Dim myFancyNote As ENNote = New ENNote()
29 | myFancyNote.Title = "My plain text note"
30 | myFancyNote.Content = ENNoteContent.NoteContentWithSanitizedHTML("Hello, world - this is a fancy note - and here is a table:
")
31 | Dim myFancyNoteRef As ENNoteRef = ENSession.SharedSession.UploadNote(myFancyNote, Nothing)
32 |
33 | ' Delete the HTML content note we just created.
34 | ENSession.SharedSession.DeleteNote(myFancyNoteRef)
35 |
36 | ' Create a new note with a resource.
37 | Dim myResourceNote As ENNote = New ENNote()
38 | myResourceNote.Title = "My test note with a resource"
39 | myResourceNote.Content = ENNoteContent.NoteContentWithString("Hello, resource!")
40 | Dim myFile As Byte() = StreamFile("") ' Be sure to replace this with a real JPG file
41 | Dim myResource As ENResource = New ENResource(myFile, "image/jpg", "My Best Shot.jpg")
42 | myResourceNote.Resources.Add(myResource)
43 | Dim myResourceRef As ENNoteRef = ENSession.SharedSession.UploadNote(myResourceNote, Nothing)
44 |
45 | ' Search for some text across all notes (i.e. personal, shared, and business).
46 | ' Change the Search Scope parameter to limit the search to only personal, shared, business - or combine flags for some combination.
47 | Dim textToFind = "some text to find*"
48 | Dim myResultsList As List(Of ENSessionFindNotesResult) = ENSession.SharedSession.FindNotes(ENNoteSearch.NoteSearch(textToFind), Nothing, ENSession.SearchScope.All, ENSession.SortOrder.RecentlyUpdated, 500)
49 | Dim personalCount As Integer = 0
50 | Dim sharedCount As Integer = 0
51 | Dim bizCount As Integer = 0
52 | If myResultsList.Count > 0 Then
53 | For Each note As ENSessionFindNotesResult In myResultsList
54 | Select Case note.NoteRef.Type
55 | Case ENNoteRef.ENNoteRefType.TypePersonal
56 | personalCount += 1
57 | Case ENNoteRef.ENNoteRefType.TypeShared
58 | sharedCount += 1
59 | Case ENNoteRef.ENNoteRefType.TypeBusiness
60 | bizCount += 1
61 | End Select
62 | Next
63 | End If
64 |
65 | If myResultsList.Count > 0 Then
66 | ' Given a NoteRef instance, download that note.
67 | Dim myDownloadedNote As ENNote = ENSession.SharedSession.DownloadNote(myResultsList(0).NoteRef)
68 |
69 | ' Serialize a NoteRef.
70 | Dim mySavedRef As Byte() = myResultsList(0).NoteRef.AsData
71 | ' And deserialize it.
72 | Dim newRef As ENNoteRef = ENNoteRef.NoteRefFromData(mySavedRef)
73 |
74 | ' Download the thumbnail for a note; then display it on this app's form.
75 | Dim thumbnail As Byte() = ENSession.SharedSession.DownloadThumbnailForNote(myResultsList(0).NoteRef, 120)
76 | Try
77 | Dim ms As New MemoryStream(thumbnail, 0, thumbnail.Length)
78 | ms.Position = 0
79 | Dim image1 As System.Drawing.Image = System.Drawing.Image.FromStream(ms, False, False)
80 | PictureBoxThumbnail.Image = image1
81 | Catch ex As Exception
82 | Throw New Exception(ex.Message)
83 | End Try
84 |
85 | ' Display a note's content as HTML in a WebBrowser control.
86 | Dim myContent = myDownloadedNote.HtmlContent
87 | WebBrowser1.DocumentText = myContent
88 | End If
89 |
90 | End Sub
91 |
92 |
93 | ' Support routine for displaying a note thumbnail.
94 | Private Function StreamFile(ByVal filename As String) As Byte()
95 | Dim fs As New FileStream(filename, FileMode.Open, FileAccess.Read)
96 |
97 | ' Create a byte array of file stream length
98 | Dim ImageData As Byte() = New Byte(CInt(fs.Length - 1)) {}
99 |
100 | 'Read block of bytes from stream into the byte array
101 | fs.Read(ImageData, 0, System.Convert.ToInt32(fs.Length))
102 |
103 | 'Close the File Stream
104 | fs.Close()
105 | 'return the byte data
106 | Return ImageData
107 | End Function
108 |
109 | End Class
--------------------------------------------------------------------------------
/samples/CS/SampleApp/SampleApp/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/samples/VB.NET/SampleApp/SampleApp/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/samples/VB.NET/SampleAppAdvanced/SampleAppAdvanced/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/src/Evernote OAuth/AuthSample/AuthSample/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/src/Evernote OAuth/EvernoteOAuthNet/EvernoteOAuthNet/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/samples/CS/SampleApp/SampleApp/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/src/EvernoteSDK/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/samples/VB.NET/SampleApp/SampleApp/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/samples/VB.NET/SampleAppAdvanced/SampleAppAdvanced/SampleAppAdvanced.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {DF9487E7-A842-409F-8135-759DB3DEFBA0}
8 | Exe
9 | SampleAppAdvanced.Module1
10 | SampleAppAdvanced
11 | SampleAppAdvanced
12 | 512
13 | Console
14 | v4.0
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | true
21 | true
22 | bin\Debug\
23 | SampleAppAdvanced.xml
24 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | false
30 | true
31 | true
32 | bin\Release\
33 | SampleAppAdvanced.xml
34 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
35 |
36 |
37 | On
38 |
39 |
40 | Binary
41 |
42 |
43 | Off
44 |
45 |
46 | On
47 |
48 |
49 |
50 | ..\..\..\..\assemblies\CsQuery.dll
51 |
52 |
53 | ..\..\..\..\assemblies\en-html2enml.dll
54 |
55 |
56 | ..\..\..\..\assemblies\Evernote.dll
57 |
58 |
59 | ..\..\..\..\assemblies\EvernoteOAuthNet.dll
60 |
61 |
62 | ..\..\..\..\assemblies\EvernoteSDK.dll
63 |
64 |
65 | ..\..\..\..\assemblies\PreMailer.Net.dll
66 |
67 |
68 | ..\..\..\..\assemblies\SgmlReaderDll.dll
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | ..\..\..\..\assemblies\Thrift.dll
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | True
96 | Application.myapp
97 |
98 |
99 | True
100 | True
101 | Resources.resx
102 |
103 |
104 | True
105 | Settings.settings
106 | True
107 |
108 |
109 |
110 |
111 | VbMyResourcesResXFileCodeGenerator
112 | Resources.Designer.vb
113 | My.Resources
114 | Designer
115 |
116 |
117 |
118 |
119 | MyApplicationCodeGenerator
120 | Application.Designer.vb
121 |
122 |
123 | SettingsSingleFileGenerator
124 | My
125 | Settings.Designer.vb
126 |
127 |
128 |
129 |
136 |
--------------------------------------------------------------------------------