Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using FireSharp.Config;
- using FireSharp.Response;
- using FireSharp.Interfaces;
- using Newtonsoft.Json.Linq;
- using FireSharp;
- namespace AuthMatrix
- {
- public partial class Form1 : Form
- {
- IFirebaseClient client;
- IFirebaseConfig config = new FirebaseConfig
- {
- AuthSecret = "XxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXx",
- BasePath = "https://a935099486553.firebaseio.com/"
- };
- List<string> DName = new List<string>();
- List<string> DValue = new List<string>();
- List<string> DPath = new List<string>();
- public Form1()
- {
- InitializeComponent();
- }
- private async void button1_Click(object sender, EventArgs e)
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- IFirebaseClient client = new FirebaseClient(config);
- FirebaseResponse response = client.Get("");
- JObject o = JObject.Parse(response.Body);
- AddValtoList(o);
- string checkdata = "";
- for (int i = 0; i < DName.Count; i++)
- {
- checkdata += String.Format("{0}. {1} : {2} ({3})\n", i + 1, DName[i], DValue[i], DPath[i]);
- }
- MessageBox.Show(checkdata);
- }
- private void AddVal(string n, string v, string p)
- {
- DName.Add(n);
- DValue.Add(v);
- DPath.Add(p);
- }
- private void AddValtoList(JObject o)
- {
- List<string> l1 = o.Properties().Select(p => p.Name).ToList();
- foreach (var n1 in l1)
- {
- //List<string> l3 = ((JObject)o[n1]["Task"]).Properties().Select(p => p.Name).ToList();
- foreach (JProperty n3 in o[n1])
- {
- foreach (JProperty n4 in o[n1]["Task"])
- {
- foreach (JProperty n5 in o[n1]["Task"][n3.Name][n4.Name])
- {
- if (n5.Value.Type.ToString() != "String")
- {
- foreach (JProperty n6 in o[n1]["Task"][n3.Name][n4.Name][n5.Name])
- {
- if (n6.Value.Type.ToString() != "String")
- {
- foreach (JProperty n7 in o[n1]["Task"][n3.Name][n4.Name][n5.Name][n6.Name])
- {
- AddVal(n7.Name, (string)n7.Value, n7.Path);
- }
- }
- else
- {
- AddVal(n6.Name, (string)n6.Value, n6.Path);
- }
- }
- }
- else
- {
- AddVal(n5.Name, (string)n5.Value, n5.Path);
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment