Exemplo n.º 1
0
        public static int Download(
            string path,
            string file,
            string version,
            string region,
            string model_type,
            string saveTo,
            string size,
            bool GUI = true)
        {
            int nonce = Web.GenerateNonce();

            if (nonce != 200)
            {
                Logger.WriteLog("Error: Could not generate Nonce. Status code " + (object)nonce, false);
                return(-1);
            }
            string xmlresponse;
            int    htmlstatus = Web.DownloadBinaryInit(Xml.GetXmlBinaryInit(file, version, region, model_type), out xmlresponse);

            if (htmlstatus == 200 && Utility.GetXMLStatusCode(xmlresponse) == 200)
            {
                return(Web.DownloadBinary(path, file, saveTo, size, GUI));
            }
            Logger.WriteLog("Error: Could not send BinaryInform. Status code " + (object)htmlstatus + "/" + (object)Utility.GetXMLStatusCode(xmlresponse), false);
            Utility.CheckHTMLXMLStatus(htmlstatus, Utility.GetXMLStatusCode(xmlresponse));
            return(-1);
        }
Exemplo n.º 2
0
        public static int Download(string path, string file, string version, string region, string model_type, string saveTo, string size)
        {
            int htmlstatus = Web.GenerateNonce();

            if (htmlstatus != 200)
            {
                Logger.WriteLine("Error Download(): Could not generate Nonce. Status code (" + htmlstatus + ")");
                return(-1);
            }
            htmlstatus = Web.DownloadBinaryInit(Xml.GetXmlBinaryInit(file, version, region, model_type), out string str);
            if ((htmlstatus != 200) || (Utility.GetXmlStatusCode(str) != 200))
            {
                Logger.WriteLine("Error Download(): Could not send BinaryInform. Status code (" + htmlstatus + "/" + Utility.GetXmlStatusCode(str) + ")");
                Utility.CheckHtmlXmlStatus(htmlstatus, Utility.GetXmlStatusCode(str));
                return(-1);
            }
            return(Web.DownloadBinary(path, file, saveTo, size));
        }
Exemplo n.º 3
0
        public static int Download(string path, string file, string version, string region, string model_type, string saveTo, string size, bool GUI = true)
        {
            string str;
            int    htmlstatus = Web.GenerateNonce();

            if (htmlstatus != 200)
            {
                Logger.WriteLog("Error: Could not generate Nonce. Status code " + htmlstatus, false);
                return(-1);
            }
            htmlstatus = Web.DownloadBinaryInit(Xml.GetXmlBinaryInit(file, version, region, model_type), out str);
            if ((htmlstatus == 200) && (Utility.GetXMLStatusCode(str) == 200))
            {
                return(Web.DownloadBinary(path, file, saveTo, size, GUI));
            }
            Logger.WriteLog(string.Concat(new object[] { "Error: Could not send BinaryInform. Status code ", htmlstatus, "/", Utility.GetXMLStatusCode(str) }), false);
            Utility.CheckHTMLXMLStatus(htmlstatus, Utility.GetXMLStatusCode(str));
            return(-1);
        }