Ejemplo n.º 1
0
        private static int XMLFUSRequest(string URL, string xml, out string xmlresponse)
        {
            xmlresponse = null;
            HttpWebRequest wr = FUSRequest.Create(URL);

            wr.CookieContainer = Cookies;
            wr.Method          = "POST";
            byte[] bytes = Encoding.ASCII.GetBytes(Regex.Replace(xml, @"\r\n?|\n|\t", string.Empty));
            wr.ContentLength = bytes.Length;
            using (Stream stream = wr.GetRequestStream())
            {
                stream.Write(bytes, 0, bytes.Length);
            }
            using (HttpWebResponse response = (HttpWebResponse)wr.GetFUSResponse())
            {
                if (response == null)
                {
                    return(0x385);
                }
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    try
                    {
                        xmlresponse = new StreamReader(response.GetResponseStream()).ReadToEnd();
                    }
                    catch (Exception)
                    {
                        return(900);
                    }
                }
                return((int)response.StatusCode);
            }
        }
Ejemplo n.º 2
0
        public static int GenerateNonce()
        {
            HttpWebRequest wr = FUSRequest.Create("https://neofussvr.sslcs.cdngc.net/NF_DownloadGenerateNonce.do");

            wr.Method        = "POST";
            wr.ContentLength = 0L;
            using (HttpWebResponse response = (HttpWebResponse)wr.GetFUSResponse())
            {
                if (response == null)
                {
                    return(0x385);
                }
                return((int)response.StatusCode);
            }
        }
Ejemplo n.º 3
0
        public static int DownloadBinary(string path, string file, string saveTo)
        {
            long           num = 0L;
            HttpWebRequest wr  = FUSRequest.Create("http://cloud-neofussvr.sslcs.cdngc.net/NF_DownloadBinaryForMass.do?file=" + path + file);

            wr.Method           = "GET";
            wr.Timeout          = 0x61a8;
            wr.ReadWriteTimeout = 0x61a8;
            using (HttpWebResponse response = (HttpWebResponse)wr.GetFUSResponse())
            {
                if (response == null)
                {
                    Console.WriteLine("Error DownloadBinary(): response is null.");
                    return(0x385);
                }
                if ((response.StatusCode != HttpStatusCode.OK) && (response.StatusCode != HttpStatusCode.PartialContent))
                {
                    Console.WriteLine("Error DownloadBinary(): " + ((int)response.StatusCode));
                }
                else
                {
                    long   total  = long.Parse(response.GetResponseHeader("content-length")) + num;
                    byte[] buffer = new byte[0x2000];
                    try
                    {
                        File.HandleEncryptedFile(response.GetResponseStream(), saveTo);
                    }
                    catch (Exception exception)
                    {
                        Console.WriteLine("Error DownloadBinary(): ");
                        Console.WriteLine(exception.ToString());
                        return(-1);
                    }
                }
                return(0);
            }
        }