public static void Create() { string authToken = System.Configuration.ConfigurationManager.AppSettings["authToken"]; EvernoteReadOnlyTagsException.Assert(!string.IsNullOrEmpty(authToken), "No auth token configured."); string url = System.Configuration.ConfigurationManager.AppSettings["URL"]; EvernoteReadOnlyTagsException.Assert(!string.IsNullOrEmpty(url), "No URL configured."); ENSessionAdvanced.SetSharedSessionDeveloperToken(authToken, url); if (ENSession.SharedSession.IsAuthenticated == false) { ENSession.SharedSession.AuthenticateToEvernote(); } // BUG: this will always be true in the current Evernote SDK :( EvernoteReadOnlyTagsException.Assert(ENSession.SharedSession.IsAuthenticated, "Authentication failed"); session = ENSession.SharedSession; }
static void Main(string[] args) { EvernoteReadOnlyTagsException.Assert(!string.IsNullOrEmpty(READONLY_CONTENT_CLASS), "No contentClass configured."); EvernoteReadOnlyTagsException.Assert(!string.IsNullOrEmpty(READONLY_TAG), "No readonly tag configured."); var options = new Options(); if (!CommandLine.Parser.Default.ParseArguments(args, options)) { options.GetUsage(); return; } EvernoteConnection.Create(); if (options.CreateSampleReadOnlyNote) { SampleData.CreateSampleNote(true, READONLY_TAG); } // lock newly-tagged notes SetTaggedNotesToReadOnly(); if (options.Interactive) { // unset - let user remove tags to reset notes to r/w InteractiveRemoveReadOnlyTags(); } // sweep and reset to read-write ResetUntaggedNotesToReadWrite(); if (options.Interactive) { Console.WriteLine("Press Enter to close."); Console.ReadLine(); } }