منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : محتاح احول كود بسيط من c# الي فيجوال بيسك
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
محتاح احول كود بسيط من c# الي فيجوال بيسك
كود :
        private string GetToken(string User, string pass)
        {
            string result;
            try
            {
                string str = "https://api.facebook.com/restserver.php";
                string str2 = "62f8ce9f74b12f84c1231cc223437a4a32";
                Dictionary<string, string> dictionary = new Dictionary<string, string>();
                dictionary.Add("api_key", "882a84903612da987032bf97a021ddc14d");
                dictionary.Add("credentials_type", "password");
                dictionary.Add("email", User);
                dictionary.Add("format", "JSON");
                dictionary.Add("generate_machine_id", "1");
                dictionary.Add("generate_session_cookies", "1");
                dictionary.Add("locale", "en_CA");
                dictionary.Add("method", "auth.login");
                dictionary.Add("password", pass);
                dictionary.Add("return_ssl_resources", "0");
                dictionary.Add("v", "1.0");
                string text = string.Empty;
                foreach (KeyValuePair<string, string> keyValuePair in dictionary)
                {
                    text = text + keyValuePair.Key + "=" + keyValuePair.Value;
                }
                text += str2;
                text = Form1.PHPMd5Hash(text).ToLower();
                dictionary.Add("sig", text);
                string url = str + "?" + QueryStringBuilder.BuildQueryString(dictionary, "&");
                result = (string)JObject.Parse(this.GET(url))["access_token"];
            }
            catch
            {
                result = null;
            }
            return result;
        }
كود :
Private Function GetToken(ByVal User As String, ByVal pass As String) As String
   Dim result As String

   Try
       Dim str As String = "https://api.facebook.com/restserver.php"
       Dim str2 As String = "62f8ce9f74b12f84c1231cc223437a4a32"
       Dim dictionary As Dictionary(Of String, String) = New Dictionary(Of String, String)()
       dictionary.Add("api_key", "882a84903612da987032bf97a021ddc14d")
       dictionary.Add("credentials_type", "password")
       dictionary.Add("email", User)
       dictionary.Add("format", "JSON")
       dictionary.Add("generate_machine_id", "1")
       dictionary.Add("generate_session_cookies", "1")
       dictionary.Add("locale", "en_CA")
       dictionary.Add("method", "auth.login")
       dictionary.Add("password", pass)
       dictionary.Add("return_ssl_resources", "0")
       dictionary.Add("v", "1.0")
       Dim text As String = String.Empty

       For Each keyValuePair As KeyValuePair(Of String, String) In dictionary
           text = text & keyValuePair.Key & "=" + keyValuePair.Value
       Next

       text += str2
       text = Form1.PHPMd5Hash(text).ToLower()
       dictionary.Add("sig", text)
       Dim url As String = str & "?" & QueryStringBuilder.BuildQueryString(dictionary, "&")
       result = CStr(JObject.Parse(Me.[GET](url))("access_token"))
   Catch
       result = Nothing
   End Try

   Return result
End Function



المحول : http://converter.telerik.com/