Exemplo n.º 1
0
        internal DotabuffMappingController(JsonPaths jsonPaths)
        {
            JsonController jsonReader = new JsonController();
            GistClient     gistClient = new GistClient();


            var gistFiles = gistClient.GetGist("ebaba232180a83083cd1d9a2d7db65da");

            //dotabuffXPaths = jsonReader.ReadFromFile(jsonPaths.XPathsUri);
            dotabuffXPaths = jsonReader.ReadFromString(gistFiles["XPaths"].Content);


            //dotabuffQueryStrings = jsonReader.ReadFromFile(jsonPaths.QueryStringsUri);
            dotabuffQueryStrings = jsonReader.ReadFromString(gistFiles["QueryStrings"].Content);

            //dotabuffEnums = jsonReader.ReadFromFile(jsonPaths.EnumsUri);
            dotabuffEnums = jsonReader.ReadFromString(gistFiles["Enums"].Content);

            //dotabuffSelectors = jsonReader.ReadFromFile(jsonPaths.SelectorsUri);
            dotabuffSelectors = jsonReader.ReadFromString(gistFiles["Selectors"].Content);

            //dotabuffHtmlAttributes = jsonReader.ReadFromFile(jsonPaths.HtmlAttributesUri);
            dotabuffHtmlAttributes = jsonReader.ReadFromString(gistFiles["HtmlAttributes"].Content);

            //dotabuffUrls = jsonReader.ReadFromFile(jsonPaths.UrlsUri);
            dotabuffUrls = jsonReader.ReadFromString(gistFiles["Urls"].Content);
        }
Exemplo n.º 2
0
        public GistRepository(GistClient client)
        {
            if (client == null)
            {
                throw new ArgumentException("No client provided");
            }

            this.client = client;
        }
        public void GetGistListForUserTest()
        {
            var gistList = GistClient.ListGistsForUser("rickstrahl");

            Assert.IsNotNull(gistList);
            Assert.IsTrue(gistList.Count > 0);

            Console.WriteLine(JsonSerializationUtils.Serialize(gistList, formatJsonOutput: true));
        }
        public void GetMissingGistTest()
        {
            var gistId = "bogus";

            var gist = GistClient.GetGistFromServer(gistId);

            Assert.IsTrue(gist.hasError);

            Console.WriteLine(JsonSerializationUtils.Serialize(gist, formatJsonOutput: true));
        }
        public void GetGistTest()
        {
            var gistId = "ef851ce1597b97ee0c2dba06a858db07";

            var gist = GistClient.GetGistFromServer(gistId);

            Assert.IsFalse(gist.hasError);

            Console.WriteLine(JsonSerializationUtils.Serialize(gist, formatJsonOutput: true));
        }
Exemplo n.º 6
0
        public async Task GetGistListForUserTest()
        {
            var gistList = await GistClient.ListGistsForUserAsync("rickstrahl");

            Assert.IsNotNull(gistList);
            Assert.IsTrue(gistList.Count > 0);

            Console.WriteLine("Count: " + gistList.Count);
            Console.WriteLine(JsonSerializationUtils.Serialize(gistList, formatJsonOutput: true));
        }
Exemplo n.º 7
0
        internal dynamic ReadFromFile(string filePath)
        {
            var gist = new GistClient();

            gist.GetGist("ebaba232180a83083cd1d9a2d7db65da");
            var    path       = Path.Combine(HostingEnvironment.MapPath("~/"), filePath);
            string jsonString = File.ReadAllText(path);

            return(ReadFromString(jsonString));
        }
Exemplo n.º 8
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (sender == ButtonCancel)
            {
                DialogResult = false;
            }
            else
            {
                Gist = GistClient.PostGist(Gist);

                Cancelled    = false;
                DialogResult = true;
            }

            Close();
        }
Exemplo n.º 9
0
        public PowerGistPanel()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;


            GitApiConfig.AlertIfConfigRequired();

            gistClient        = new GistClient(GitApiConfig.ClientId, GitApiConfig.ClientSecret, "powershellISEAddin");
            viewModel         = new MainViewModel();
            viewModel.Loading = Visibility.Collapsed;

            //navigate to "https://github.com/login/oauth/authorize"
            webBrowser.Visibility = Visibility.Visible;
            webBrowser.Navigate(gistClient.AuthorizeUrl);
        }
        public void PostJsonTest()
        {
            var addin = new GistIntegration.PasteCodeAsGistAddin();

            var gist = new GistItem
            {
                code        = "int x = 11102;",
                description = "Test addin code",
                filename    = "test.cs",
                isPublic    = true
            };
            var result = GistClient.PostGist(gist, PasteCodeAsGistConfiguration.Current.GithubUserToken);

            Assert.IsNotNull(result, "Gist is null");

            Console.WriteLine(result.htmlUrl);
            Console.WriteLine(result.id);
            Console.Write(result.embedUrl);

            ShellUtils.GoUrl(result.htmlUrl);
        }
Exemplo n.º 11
0
 public GistsWindowViewModel(string clientId, string clientSecret)
 {
     this._gistClient = new GistClient(clientId, clientSecret, "WpfGists/0.5");
     this.ListItems   = new ObservableCollection <GistListItem>();
     this.ShowPreview = true;
 }