예제 #1
0
        public String[] test(String filename)
        {
            var file1 = filename;

            var yourUrl  = "http://scan4you.net/remote.php";
            var httpForm = new HttpForm(yourUrl);

            httpForm.AttachFile("file1", file1);
            httpForm.SetValue("id", "34681").SetValue("token", "fe8f7ffa233eb2e6f189");
            HttpWebResponse response = httpForm.Submit();

            return(parseResponse(response));
        }
        public bool TryExport(string deviceId, string userName)
        {
            try {
                System.Net.ServicePointManager.DnsRefreshTimeout = 0;
                var client = new HttpForm(AppSettings.ApiEndpoint);
                client.AttachFile(userName, _filesystem.Combine($"{AccountFolder}/{userName}.json"));
                client.AttachFile($"{userName}_data", _filesystem.Combine($"{AccountDataFolder}/{userName}_data.json"));
                client.SetValue("deviceId", deviceId);

                var response = client.Submit();
                return(response.StatusCode == System.Net.HttpStatusCode.OK);
            } catch (Exception) {
                return(false);
            }
        }