private void btnSignin_Click(object sender, RoutedEventArgs e) { userName = txtUserName.Text; var request = new BReq(); JObject json = (JObject)JsonConvert.DeserializeObject <object>(request.HttpPost("http://enterprise.appmobi.com/vs/VisualStudioService.asmx/SignIn", "{\"userName\":\"" + txtUserName.Text + "\",\"password\":\"" + txtPassword.Password + "\"}")); JObject jObject = JObject.FromObject(json); JObject d = (JObject)jObject.SelectToken("d"); if (jObject["d"]["Status"].Value <string>() == "SUCCESS") { userToken = jObject["d"]["Token"].Value <string>(); grpSignin.Visibility = System.Windows.Visibility.Hidden; grpWelcome.Visibility = System.Windows.Visibility.Visible; btnWindowsLive.Visibility = System.Windows.Visibility.Hidden; lblUserName.Content = userName; string response = request.HttpGet("http://services.appmobi.com/external/sdkservices.aspx?cmd=getapplist&userid=" + userToken + "&rnd=95570673"); string[] jsons = response.Split('='); string[] theend = jsons[1].Split(';'); json = (JObject)JsonConvert.DeserializeObject <object>(theend[0]); if (json["rtn"].Value <string>().Equals("ok")) { IList <AppmobiApp> appMobiApps = new List <AppmobiApp>(); JArray results = (JArray)json.SelectToken("appmobiapps"); foreach (var result in results) { AppmobiApp aa = new AppmobiApp { Name = result["name"].Value <string>(), Password = result["password"].Value <string>(), Release = result["releases"][0]["name"].Value <string>() }; appMobiApps.Add(aa); } _appMobiApps = new CollectionView(appMobiApps); cboAppMobiApps.DataContext = AppMobiApps; } } else { lblMessage.Content = jObject["d"]["Message"].Value <string>(); } }
private void btnDownloadPackage_Click(object sender, RoutedEventArgs e) { AppmobiApp cboValue = (AppmobiApp)cboAppMobiApps.SelectedItem; var request = new BReq(); string response = request.HttpGet("http://services.appmobi.com/external/clientservices.aspx?feed=getappconfig&app=" + cboValue.Name + "&pkg=QA&pw=&rel=" + cboValue.Release + "&redirect=1"); XmlDocument doc = new XmlDocument(); doc.LoadXml(response); string jsonText = JsonConvert.SerializeXmlNode(doc); JObject json = (JObject)JsonConvert.DeserializeObject <object>(jsonText); string bundleUrl = json["XML"]["CONFIG"]["BUNDLE"]["@base"].Value <string>() + "/" + json["XML"]["CONFIG"]["BUNDLE"]["@file"].Value <string>(); /*byte[] compressed; * * using (MemoryStream outStream = new MemoryStream()) * { * using (GZipStream tinyStream = new GZipStream(outStream, CompressionMode.Compress)) * using (MemoryStream mStream = new MemoryStream(getFileFromUrl(bundleUrl))) * mStream.CopyTo(tinyStream); * compressed = outStream.ToArray(); * }*/ Solution dte = new Solution(); string fullname = dte.FullName; string curdir = Directory.GetCurrentDirectory(); using (MemoryStream mStream2 = new MemoryStream(getFileFromUrl(bundleUrl))) using (ZipFile zip = ZipFile.Read(mStream2)) { foreach (ZipEntry e1 in zip) { e1.Extract("c:\\temp\\ryan", ExtractExistingFileAction.OverwriteSilently); } } }
private void btnSignin_Click(object sender, RoutedEventArgs e) { userName = txtUserName.Text; var request = new BReq(); JObject json = (JObject)JsonConvert.DeserializeObject<object>(request.HttpPost("http://enterprise.appmobi.com/vs/VisualStudioService.asmx/SignIn", "{\"userName\":\"" + txtUserName.Text + "\",\"password\":\"" + txtPassword.Password + "\"}")); JObject jObject = JObject.FromObject(json); JObject d = (JObject)jObject.SelectToken("d"); if (jObject["d"]["Status"].Value<string>() == "SUCCESS") { userToken = jObject["d"]["Token"].Value<string>(); grpSignin.Visibility = System.Windows.Visibility.Hidden; grpWelcome.Visibility = System.Windows.Visibility.Visible; btnWindowsLive.Visibility = System.Windows.Visibility.Hidden; lblUserName.Content = userName; string response = request.HttpGet("http://services.appmobi.com/external/sdkservices.aspx?cmd=getapplist&userid=" + userToken + "&rnd=95570673"); string[] jsons = response.Split('='); string[] theend = jsons[1].Split(';'); json = (JObject)JsonConvert.DeserializeObject<object>(theend[0]); if (json["rtn"].Value<string>().Equals("ok")) { IList<AppmobiApp> appMobiApps = new List<AppmobiApp>(); JArray results = (JArray)json.SelectToken("appmobiapps"); foreach (var result in results) { AppmobiApp aa = new AppmobiApp { Name = result["name"].Value<string>(), Password = result["password"].Value<string>(), Release = result["releases"][0]["name"].Value<string>() }; appMobiApps.Add(aa); } _appMobiApps = new CollectionView(appMobiApps); cboAppMobiApps.DataContext = AppMobiApps; } } else { lblMessage.Content = jObject["d"]["Message"].Value<string>(); } }