示例#1
0
    public static void SetBindFlagIsTrue()
    {
        Cookie cookie = CookieData.GetInstance().Load();

        cookie.IsBind = true;
        CookieData.GetInstance().Save(cookie);
    }
    public Cookie(CookieData cookieData, int cookieSize, Light red, Light green, Light blue, bool forcePixelByPixel, Texture imageToProject = null, int borderSize = 1, bool colour = false, bool enableLiveUpdate = false)
    {
        // fallback to pixel by pixel if keystoning used
        pixelByPixel = (cookieData.keystone_h != 0 || cookieData.keystone_v != 0) || forcePixelByPixel;

        blackBorderSize = borderSize;

        textureSize      = cookieSize;
        projectedImage   = imageToProject;
        projectedImage2D = projectedImage as Texture2D;
        if (projectedImage2D != null && pixelByPixel)
        {
            imageColours = projectedImage2D.GetPixels32();
        }
        else
        {
            imageColours = null;
        }

        CreateTexture();

        if (colour)
        {
            imageType = ImageType.Colour;
        }

        redLight          = red;
        greenLight        = green;
        blueLight         = blue;
        data              = cookieData;
        supportLiveUpdate = enableLiveUpdate;
        Initialise();
    }
示例#3
0
 public void Init()
 {
     if (Application.platform == RuntimePlatform.IPhonePlayer)
     {
         sdkCode = SDKCode.DEVICE_IOS;
         //1、keychain中查找imei.2、找到返回imei.3、没找到生成imei,存入keychain,返回imei
         openid = _GetUUID();
     }
     else if (Application.platform == RuntimePlatform.Android)
     {
         sdkCode = SDKCode.DEVICE_ANDROID;
         openid  = SystemInfo.deviceUniqueIdentifier;
     }
     else if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
     {
         sdkCode = SDKCode.DEVICE_PC;
         openid  = (appCfg.TestPlayerIMEI == null || "".Equals(appCfg.TestPlayerIMEI))? SystemInfo.deviceUniqueIdentifier: appCfg.TestPlayerIMEI;
         Cookie cookie = CookieData.GetInstance().Load();
         if (cookie != null)
         {
             if (cookie.SdkCode == SDKCode.DEVICE_PC)
             {
                 string IMEINew = appCfg.TestPlayerIMEI == null ? "" : appCfg.TestPlayerIMEI;
                 string IMEIOld = PlayerPrefs.GetString(CodeMap.Filed.Filed_IMEI.ToString(), "") == null ? "" : PlayerPrefs.GetString(CodeMap.Filed.Filed_IMEI.ToString(), "");
                 if (!IMEINew.Equals(IMEIOld))
                 {
                     CookieData.GetInstance().Clear();
                     PlayerPrefs.SetString(CodeMap.Filed.Filed_IMEI.ToString(), IMEINew);
                     PlayerPrefs.Save();
                 }
             }
         }
     }
 }
        private void SetCampaignTrackingCookie(string email, string recipientListId)
        {
            // Use the cookie helper to drop the Campaign tracking cookie
            var datasourceId   = _campaignConnector.GetDataSources().First().Id.ToString();
            var trackingCookie = _cookieHelper.GetTrackingCookie(_campaignConnector.Id.ToString(),
                                                                 _campaignConnector.InstanceId.ToString());
            var data = trackingCookie.FirstOrDefault(cd => cd.DatasourceId == datasourceId);

            if (data != null)
            {
                data.EntityId     = email;
                data.DatasourceId = recipientListId;
            }
            else
            {
                var item = new CookieData
                {
                    DatasourceId = recipientListId,
                    EntityId     = email
                };
                trackingCookie.Add(item);
            }
            _cookieHelper.UpsertTrackingCookie(
                _campaignConnector.Id.ToString(),
                _campaignConnector.InstanceId.ToString(),
                trackingCookie);
        }
示例#5
0
    private void OnSocketLoginReturn(Msg msg)
    {
        int rsCode = (int)msg.GetParam(BaseCodeMap.BaseParam.RS_CODE);

        switch (rsCode)
        {
        case BaseCodeMap.BaseRsCode.SUCCESS:
            playerid       = (string)msg.GetParam(GameSrvCodeMap.Param.PLAYER_ID);
            testLoginTimes = DEFAULT_TEST_LOGIN_TIME;
            isLogined      = true;
            GameSrvConnectSuccess();
            logReport.OnLogReport("loginSuccess->pid:" + playerid + ",uid:" + msg.GetParam(GameSrvCodeMap.Param.UID) + ",srvid:" + msg.GetParam(GameSrvCodeMap.Param.SRVID));
            break;

        case GameSrvCodeMap.RsCode.ERRO_CODE_FORCE_UPDATE_VERSION:
            logReport.OnWarningReport("versionNeedUpdate");
            Close();
            break;

        case GameSrvCodeMap.RsCode.ERRO_CODE_TOKEN_EXPIRED:
            logReport.OnWarningReport("loginTokenExpiredAndRelogin.");
            testLoginTimes--;
            CookieData.clear();
            if (testLoginTimes > 0)
            {
                login(ConnectSocketComplete, this.accountSrvComplete);
            }
            Close();
            break;

        case GameSrvCodeMap.RsCode.ERRO_CODE_INVALIDE_TOKEN:
            logReport.OnWarningReport("login token invalid,relogin.");
            CookieData.clear();
            Close();
            break;

        case GameSrvCodeMap.RsCode.ERR_CODE_SRV_ERRO:
            logReport.OnWarningReport("login fail.srv erro");
            Close();
            break;

        case BaseCodeMap.BaseRsCode.TIME_OUT:
            logReport.OnWarningReport("login fail.time out");
            Close();
            onClosed();
            break;

        default:
            logReport.OnWarningReport("login fail,code:" + rsCode);
            Close();
            break;
        }
        ;
        if (ConnectSocketComplete != null)
        {
            ConnectSocketComplete(Check(), msg);
            ConnectSocketComplete = null;
        }
    }
示例#6
0
 public void accountAuthLogin(String userName, String pwd, ConnectInternetResultHandler SocketComplete, ConnectInternetResultHandler accountSrvComplete)
 {
     CookieData.clear();
     PlayerPrefs.SetString(CodeMap.Filed.Filed_IMEI.ToString(), userName);
     PlayerPrefs.SetInt(CodeMap.Filed.Filed_SDK_CODE.ToString(), AccountSrvCodeMap.SDKCode.ACCOUNT_AUTH);
     PlayerPrefs.SetString(CodeMap.Filed.FIELDE_EXT1.ToString(), pwd);
     login(SocketComplete, accountSrvComplete);
 }
        public static void ExtractCookieCreationDate_InvalidCreationDateString_ReturnsNull()
        {
            var cookieData = new CookieData {
                CookieValue = true, CreationDate = null
            };

            var actual = JsonConvert.SerializeObject(cookieData).ExtractCookieCreationDate();

            actual.Should().Be(DateTime.MinValue);
        }
示例#8
0
    public override void DoInWraper(Msg msg)
    {
        int rsCode = (int)msg.GetParam(AccountSrvCodeMap.Param.RS_CODE);

        if (rsCode == AccountSrvCodeMap.RsCode.ERRO_ACCOUNT_OP_BIND_SUCCESS || rsCode == AccountSrvCodeMap.RsCode.SUCCESS)
        {
            Cookie cookie = CookieData.GetInstance().Load();
            cookie.IsBind = true;
            CookieData.GetInstance().Save(cookie);
        }
        CmdCallback(msg);
    }
示例#9
0
    public void login(ConnectInternetResultHandler SocketComplete, ConnectInternetResultHandler accountSrvComplete)
    {
        this.ConnectSocketComplete = SocketComplete;
        this.accountSrvComplete    = accountSrvComplete;
        Msg msg = new Msg(AccountSrvCodeMap.Cmd.CMD_ACCOUNT_LOGIN);

        msg.AddParam(AccountSrvCodeMap.Param.ACCOUNT_SRV_VERSION, appCfg.Version);
        testLoginTimes = DEFAULT_TEST_LOGIN_TIME;
        Cookie cookie = CookieData.Load();

        LoginWithCookie(cookie, msg);
    }
示例#10
0
    public void OpenSoketConnect(Msg msg)//openSoket
    {
        Cookie cookie = new Cookie();

        cookie.Accountid      = (string)msg.GetParam(AccountSrvCodeMap.Param.ACCOUNT_UID);
        cookie.AccountToken   = (string)msg.GetParam(AccountSrvCodeMap.Param.ACCOUNT_TOKEN);
        cookie.SrvId          = (int)msg.GetParam(AccountSrvCodeMap.Param.ACCOUNT_SRV_ID);
        cookie.TokenTimestamp = (long)msg.GetParam(AccountSrvCodeMap.Param.ACCOUNT_TOKEN_TIMESTAMP);
        cookie.IsBind         = (bool)msg.GetParam(AccountSrvCodeMap.Param.ACCOUNT_IS_BIND);
        CookieData.Save(cookie);

        OpenSoketConnect(cookie);
    }
示例#11
0
    public void OnSdkLoginReturn(int sdkCode, string openid, string ext1)
    {
        this.sdkCode = sdkCode;
        this.openid  = openid;
        this.ext1    = ext1;
        Cookie cookie = CookieData.GetInstance().Load();

        if (cookie != null)
        {
            if (cookie.SdkCode != sdkCode || cookie.Openid != openid)
            {
                CookieData.GetInstance().Clear();
            }
        }
    }
示例#12
0
    public static bool IsBind()
    {
        Cookie cookie = CookieData.GetInstance().Load();

        if (cookie == null)
        {
            return(false);
        }
        int sdkCode = cookie.SdkCode;

        if (sdkCode != SDKCode.DEVICE_ANDROID && sdkCode != SDKCode.DEVICE_IOS && sdkCode != SDKCode.DEVICE_PC)
        {
            return(true);
        }
        return(cookie.IsBind);
    }
示例#13
0
    public void srvInfoReturn(Msg msg)
    {
        int rscode = ( int )msg.GetParam(AccountSrvCodeMap.Param.RS_CODE);

        if (rscode == AccountSrvCodeMap.RsCode.SUCCESS)
        {
            srvIp   = ( string )msg.GetParam(AccountSrvCodeMap.Param.ACCOUNT_SRV_IP);
            srvPort = ( int )msg.GetParam(AccountSrvCodeMap.Param.ACCOUNT_SRV_PORT);
            Cookie cookie = CookieData.Load();
            OpenSoketConnect(cookie);
        }
        else
        {
            OnSocketLoginReturn(msg);
        }
    }
示例#14
0
    private void LoginWithCookie(Msg loginMsg)
    {
        Cookie cookie = CookieData.GetInstance().Load();

        if (cookie == null)
        {
            logReport.OnDebugReport("cookie is null");
            openid  = LoginIniter.getInst().Openid;
            sdkCode = LoginIniter.getInst().SdkCode;
            string pwd = LoginIniter.getInst().Ext1;
            if (openid == null || "".Equals(openid) || 0 == sdkCode)
            {
                logReport.OnWarningReport("openid and sdkid error!");
                return;
            }
            loginMsg.AddParam(AccountSrvCodeMap.Param.ACCOUNT_OPEN_ID, openid);              //设备号
            loginMsg.AddParam(AccountSrvCodeMap.Param.ACCOUNT_SDK_CODE, sdkCode);
            if (!"".Equals(pwd))
            {
                loginMsg.AddParam(AccountSrvCodeMap.Param.ACCOUNT_PWD, pwd);
            }
            loginMsg.AddParam(AccountSrvCodeMap.Param.ACCOUNT_SRV_VERSION, appCfg.PkgVersion);
            sendHttpMessage(appCfg.LoginUrl, loginMsg, OnhttpLoginReturn, AccountSrvTimeOut);
        }
        else
        {
            uid            = cookie.Uid;
            token          = cookie.Token;
            srvid          = cookie.Srvid;
            tokenTimestamp = cookie.TokenTimestamp;
            isBind         = cookie.IsBind;
            openid         = cookie.Openid;
            sdkCode        = cookie.SdkCode;
            string loginfo = "save cookie info(accountid:" + this.uid + ","
                             + "accountToken:" + token + ","
                             + "srvid:" + srvid + ","
                             + "tokenTimestamp:" + tokenTimestamp + ")";
            logReport.OnLogReport(loginfo);
            Msg msg = new Msg(AccountSrvCodeMap.Cmd.CMD_ACCOUNT_GET_SERVER_INFO);
            msg.AddParam(AccountSrvCodeMap.Param.ACCOUNT_SRV_VERSION, appCfg.Version);
            msg.AddParam(AccountSrvCodeMap.Param.ACCOUNT_SRV_ID, srvid);
            msg.AddParam(AccountSrvCodeMap.Param.ACCOUNT_SRV_VERSION, appCfg.PkgVersion);
            sendHttpMessage(appCfg.LoginUrl, msg, srvInfoReturn, AccountSrvTimeOut);
        }
    }
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            Avatar     avatar = filterContext.HttpContext.Session[SessionKey.AvatarKey] as Avatar;
            IIdentity  iden   = filterContext.HttpContext.User.Identity;
            CookieData cookie = iden.ToUserCookie();

            if (avatar == null || !iden.IsAuthenticated || avatar.UserID != cookie.UserID)
            {
                object        data         = null;
                var           obj          = new { Code = ErrorCode.LoginError, Message = ErrorCode.LoginError.ToDescription(), Data = data };
                ContentResult result       = new ContentResult();
                string        json         = JsonConvert.SerializeObject(obj);
                string        jsonp        = filterContext.HttpContext.Request["jsonpcallback"];
                string        returnString = jsonp + "(" + json + ")";
                result.Content       = returnString;
                filterContext.Result = result;
            }
        }
示例#16
0
    public void init()
    {
        int    sdkcode;
        string IMEI = PlayerPrefs.GetString(CodeMap.Filed.Filed_IMEI.ToString(), "");

        if (!"".Equals(IMEI))
        {
            sdkcode = PlayerPrefs.GetInt(CodeMap.Filed.Filed_SDK_CODE.ToString(), AccountSrvCodeMap.SDKCode.DEVICE_PC);
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            sdkcode = AccountSrvCodeMap.SDKCode.DEVICE_IOS;
            //1、keychain中查找imei.2、找到返回imei.3、没找到生成imei,存入keychain,返回imei
            IMEI = _GetUUID();
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            sdkcode = AccountSrvCodeMap.SDKCode.DEVICE_ANDROID;
            IMEI    = SystemInfo.deviceUniqueIdentifier;
        }
        else
        {
            sdkcode = AccountSrvCodeMap.SDKCode.DEVICE_PC;
        }


        PlayerPrefs.SetString(CodeMap.Filed.Filed_IMEI.ToString(), IMEI);
        PlayerPrefs.SetInt(CodeMap.Filed.Filed_SDK_CODE.ToString(), sdkcode);

        //测试模式
        string IMEItest = appCfg.TestPlayerIMEI;

        if (IMEItest != null && !IMEItest.Equals(""))
        {
            if (!IMEI.Equals(IMEItest))//不同设备清除cookie
            {
                logReport.OnLogReport("change device,clear cookie.");
                CookieData.clear();
                PlayerPrefs.SetString(CodeMap.Filed.Filed_IMEI.ToString(), IMEItest);
                PlayerPrefs.SetInt(CodeMap.Filed.Filed_SDK_CODE.ToString(), AccountSrvCodeMap.SDKCode.DEVICE_PC);
            }
            return;
        }
    }
        /// <summary>
        /// 获取某 URL 的 Cookie 返回字符串
        /// </summary>
        /// <param name="Url"></param>
        /// <returns></returns>
        private static string GetCookieString(string Url)
        {
            uint          Datasize   = 1024;
            StringBuilder CookieData = new StringBuilder((int)Datasize);

            if (!InternetGetCookieEx(Url, null, CookieData, ref Datasize, 0x2000, IntPtr.Zero))
            {
                if (Datasize < 0)
                {
                    return(null);
                }
                CookieData = new StringBuilder((int)Datasize);
                if (!InternetGetCookieEx(Url, null, CookieData, ref Datasize, 0x00002000, IntPtr.Zero))
                {
                    return(null);
                }
            }
            return(CookieData.ToString());
        }
示例#18
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            var    userType           = UtilFactory.GetEncryptProvider(EncryptType.DES).Decrypt(UtilFactory.Helpers.CookieHelper.Get(UtilFactory.GetEncryptProvider(EncryptType.DES).Encrypt("UserType")));
            var    expireDate         = UtilFactory.Helpers.CookieHelper.Get(UtilFactory.GetEncryptProvider(EncryptType.DES).Encrypt("ExpireTime"));
            var    userId             = UtilFactory.Helpers.CookieHelper.Get(UtilFactory.GetEncryptProvider(EncryptType.DES).Encrypt("LoginUserID"));
            var    utcTimeStampString = UtilFactory.Helpers.CookieHelper.Get(UtilFactory.GetEncryptProvider(EncryptType.DES).Encrypt("UtcTimeStamp"));
            double utcTimeStamp       = 0;

            double.TryParse(utcTimeStampString, out utcTimeStamp);

            var cookieData = new CookieData
            {
                UserType       = userType,
                ExpireDate     = string.IsNullOrEmpty(expireDate)?  (DateTime?)null:Convert.ToDateTime(expireDate),
                UserId         = userId,
                IntervaSeconds = GetIntervaSeconds(utcTimeStamp)
            };

            context.Response.Write(JsonConvert.SerializeObject(cookieData));
        }
        /// <summary>
        /// Get cookie data
        /// </summary>
        /// <param name="loginData">the login data (user/password)</param>
        /// <returns>cookie data</returns>
        private CookieData GetCookieDataFromLoginData(LoginData loginData)
        {
            const string url             = SratimBaseUrl + SraitmLoginPath;
            var          postData        = loginData.ToString();
            var          cookieContainer = new CookieContainer();

            // ReSharper disable once UnusedVariable
            var response = DoWebRequest(url, postData, cookieContainer);

            if (cookieContainer.Count > 0)
            {
                var cookieData = CookieData.CreateFromCookieContainer(cookieContainer);
                if (cookieData != null)
                {
                    // Save _sratimCookieContainer object
                    _sratimCookieContainer = cookieContainer;

                    // Return the cookieData
                    return(cookieData);
                }
            }
            return(null);
        }
        public async Task <SyncResult> syncVersion(CookieData cookie, bool useMSAToken)
        {
            string request = buildSyncRequest(cookie, useMSAToken);
            string ret     = await doHttpRequest(PRIMARY_URL, request);

            XDocument doc = XDocument.Parse(ret);

            try
            {
                var        envelope   = Xml.first_node_or_throw(doc.Root, NAMESPACE_SOAP + "Envelope");
                var        body       = Xml.first_node_or_throw(envelope, NAMESPACE_SOAP + "Body");
                var        resp       = Xml.first_node_or_throw(body, NAMESPACE_WU_SERVICE + "SyncUpdatesResponse");
                var        res        = Xml.first_node_or_throw(resp, NAMESPACE_WU_SERVICE + "SyncUpdatesResult");
                var        newUpdates = Xml.first_node_or_throw(res, NAMESPACE_WU_SERVICE + "NewUpdates");
                SyncResult data       = new SyncResult();
                for (var it = Xml.first_node(newUpdates, NAMESPACE_WU_SERVICE + "UpdateInfo"); it != null; it = Xml.next_sibling(it, NAMESPACE_WU_SERVICE + "UpdateInfo"))
                {
                    UpdateInfo info = new UpdateInfo();
                    info.serverId = Xml.first_node_or_throw(it, NAMESPACE_WU_SERVICE + "ID").Value;
                    info.addXmlInfo(Xml.first_node_or_throw(it, NAMESPACE_WU_SERVICE + "Xml").Value);
                    data.newUpdates.Add(info);
                }

                var newCookie = Xml.first_node(res, NAMESPACE_WU_SERVICE + "NewCookie");
                if (newCookie != null)
                {
                    data.newCookie.encryptedData = Xml.first_node_or_throw(newCookie, NAMESPACE_WU_SERVICE + "EncryptedData").Value;
                    data.newCookie.expiration    = Xml.first_node_or_throw(newCookie, NAMESPACE_WU_SERVICE + "Expiration").Value;
                }
                return(data);
            }
            catch (Exception e)
            {
                maybeThrowSOAPFault(doc);
                throw e;
            }
        }
示例#21
0
 public void VistorLogin(ConnectInternetResultHandler SocketComplete, ConnectInternetResultHandler accountSrvComplete)
 {
     CookieData.GetInstance().Clear();
     LoginIniter.getInst().Init();
     login(SocketComplete, accountSrvComplete);
 }
示例#22
0
 public void accountAuthLogin(int sdkCode, String userName, String pwd, ConnectInternetResultHandler SocketComplete, ConnectInternetResultHandler accountSrvComplete)
 {
     CookieData.GetInstance().Clear();
     LoginIniter.getInst().OnSdkLoginReturn(sdkCode, userName, pwd);
     login(SocketComplete, accountSrvComplete);
 }
示例#23
0
 public void LogOutAndClearCookie()
 {
     CookieData.GetInstance().Clear();
     Close();
 }
 /// <summary>
 /// Called when image size/pos is changed and the image shape in the cookie will change
 /// </summary>
 /// <param name="cookieData"></param>
 public void Reinitialise(CookieData cookieData)
 {
     data = cookieData;
     Initialise();
 }
示例#25
0
        public ActionResult LoginVenture(FormCollection frmCollection)
        {
            Debug.WriteLine("* * * AccountController.Venture LoginVenture  * * *");

            try
            {
                UAS.DataDTO.LoginInfo loginInfo = new UAS.DataDTO.LoginInfo();
                loginInfo.RememberMe = false;

                CookieData cookieData = UAS.Business.HttpFunctions.GetUserCookie();
                if (cookieData.LoginID != null)
                {
                    loginInfo.LoginID    = cookieData.LoginID;
                    loginInfo.RememberMe = true;
                }

                // * * * Need to use Cookie data if available.
                loginInfo.LoginID  = frmCollection["userName"];
                loginInfo.Password = frmCollection["pwrd"];

                LoginStatus loginStatus = null;
                loginStatus = LoginVentureLogic(loginInfo);
                Debug.WriteLine("* * * AccountController LoginVenture  next * * *");

                string userName = String.Empty;
                if (loginStatus != null)
                {
                    Debug.WriteLine("LoginStatus ErrorMessage: " + loginStatus.ErrorMessage);
                    Debug.WriteLine("LoginStatus Status: " + loginStatus.Status);
                    userName = loginStatus.FirstName + " " + loginStatus.LastName;
                    Debug.WriteLine("LoginStatus Name: " + userName);
                    // Debug.WriteLine("LoginStatus Permissions: " + loginStatus.PermissionSet);
                }
                else
                {
                    Debug.WriteLine("loginStatus is NULL !!!");
                    throw new Exception("Invalid username or password.");
                }

                loginInfo.SessionData = Session.SessionID;

                if ((loginStatus.Status == 'A') &&
                    (loginStatus.UserID > 0) &&
                    // !string.IsNullOrEmpty(loginStatus.PermissionSet)
                    (loginStatus.appGroupPermissions.Count > 0)
                    )
                {
                    loginInfo.IsLoggedIn         = true;
                    SessionHelper.IsUserLoggedIn = true;
                    SessionHelper.LoginInfo      = loginInfo;
                    SessionHelper.LoginStatus    = loginStatus;
                }

                if (loginInfo.IsLoggedIn)
                {
                    SessionHelper.SessionTotalTimeoutMinutes = Business.Timeout.GetTotalTimeoutMinutes(SessionHelper.LoginStatus.EnterpriseID);
                    // return RedirectToAction("Index", "Home");
                    SessionHelper.Write("justLoggedIn", true);
                    Assessments assmnts = new Assessments(formsRepo);
                    assmnts.DeleteOldUploadedAssessments();

                    if (SessionHelper.Read <bool>("NoServer") == true)
                    {
                        return(RedirectToAction("Index", "Search"));
                    }
                    return(RedirectToAction("Index", "DataSync"));
                }

                SessionHelper.IsUserLoggedIn = false;
                ViewBag.ErrorMessage         = loginStatus.ErrorMessage;
            }
            catch (Exception xcptn)
            {
                Debug.WriteLine("LoginVenture exception: " + xcptn.Message);
                ViewBag.ErrorMessage = xcptn.Message;
            }

            return(View("loginVenture"));
        }
        public string buildSyncRequest(CookieData cookieData, bool useMSAToken)
        {
            XDocument doc      = new XDocument();
            var       envelope = Xml.CreateElement(NAMESPACE_SOAP + "Envelope");

            doc.Add(envelope);

            var header = Xml.CreateElement(NAMESPACE_SOAP + "Header");

            envelope.Add(header);

            buildCommonHeader(ref doc, ref header, PRIMARY_URL, "http://www.microsoft.com/SoftwareDistribution/Server/ClientWebService/SyncUpdates", useMSAToken);

            var body = Xml.CreateElement(NAMESPACE_SOAP + "Body");

            envelope.Add(body);

            var request = Xml.CreateElement(NAMESPACE_WU_SERVICE + "SyncUpdates");

            body.Add(request);

            var cookie = Xml.CreateElement(NAMESPACE_WU_SERVICE + "cookie");

            request.Add(cookie);
            cookie.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "Expiration", cookieData.expiration.ToString()));
            cookie.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "EncryptedData", cookieData.encryptedData.ToString()));

            var parameters = Xml.CreateElement(NAMESPACE_WU_SERVICE + "parameters");

            request.Add(parameters);

            parameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "ExpressQuery", "false"));
            buildInstalledNonLeafUpdateIDs(ref doc, ref parameters);
            parameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "SkipSoftwareSync", "false"));
            parameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "NeedTwoGroupOutOfScopeUpdates", "true"));
            var filterAppCategoryIds = Xml.CreateElement(NAMESPACE_WU_SERVICE + "FilterAppCategoryIds");

            parameters.Add(filterAppCategoryIds);
            var filterAppCatId = Xml.CreateElement(NAMESPACE_WU_SERVICE + "CategoryIdentifier");

            filterAppCategoryIds.Add(filterAppCatId);
            filterAppCatId.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "Id", MINECRAFT_APP_ID));
            parameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "TreatAppCategoryIdsAsInstalled", "true"));
            parameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "AlsoPerformRegularSync", "false"));
            parameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "ComputerSpec", ""));
            var extendedUpdateInfoParams = Xml.CreateElement(NAMESPACE_WU_SERVICE + "ExtendedUpdateInfoParameters");

            parameters.Add(extendedUpdateInfoParams);
            var xmlUpdateFragmentTypes = Xml.CreateElement(NAMESPACE_WU_SERVICE + "XmlUpdateFragmentTypes");

            extendedUpdateInfoParams.Add(xmlUpdateFragmentTypes);
            xmlUpdateFragmentTypes.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "XmlUpdateFragmentType", "Extended"));
            xmlUpdateFragmentTypes.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "XmlUpdateFragmentType", "LocalizedProperties"));
            xmlUpdateFragmentTypes.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "XmlUpdateFragmentType", "Eula"));
            var extendedUpdateLocales = Xml.CreateElement(NAMESPACE_WU_SERVICE + "Locales");

            extendedUpdateInfoParams.Add(extendedUpdateLocales);
            extendedUpdateLocales.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "string", "en-US"));
            extendedUpdateLocales.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "string", "en"));

            var clientPreferredLanguages = Xml.CreateElement(NAMESPACE_WU_SERVICE + "ClientPreferredLanguages");

            parameters.Add(clientPreferredLanguages);
            clientPreferredLanguages.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "string", "en-US"));

            var productsParameters = Xml.CreateElement(NAMESPACE_WU_SERVICE + "ProductsParameters");

            parameters.Add(productsParameters);
            productsParameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "SyncCurrentVersionOnly", "false"));
            productsParameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "DeviceAttributes", "E:BranchReadinessLevel=CBB&DchuNvidiaGrfxExists=1&ProcessorIdentifier=Intel64%20Family%206%20Model%2063%20Stepping%202&CurrentBranch=rs4_release&DataVer_RS5=1942&FlightRing=Retail&AttrDataVer=57&InstallLanguage=en-US&DchuAmdGrfxExists=1&OSUILocale=en-US&InstallationType=Client&FlightingBranchName=&Version_RS5=10&UpgEx_RS5=Green&GStatus_RS5=2&OSSkuId=48&App=WU&InstallDate=1529700913&ProcessorManufacturer=GenuineIntel&AppVer=10.0.17134.471&OSArchitecture=AMD64&UpdateManagementGroup=2&IsDeviceRetailDemo=0&HidOverGattReg=C%3A%5CWINDOWS%5CSystem32%5CDriverStore%5CFileRepository%5Chidbthle.inf_amd64_467f181075371c89%5CMicrosoft.Bluetooth.Profiles.HidOverGatt.dll&IsFlightingEnabled=0&DchuIntelGrfxExists=1&TelemetryLevel=1&DefaultUserRegion=244&DeferFeatureUpdatePeriodInDays=365&Bios=Unknown&WuClientVer=10.0.17134.471&PausedFeatureStatus=1&Steam=URL%3Asteam%20protocol&Free=8to16&OSVersion=10.0.17134.472&DeviceFamily=Windows.Desktop"));
            productsParameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "CallerAttributes", "E:Interactive=1&IsSeeker=1&Acquisition=1&SheddingAware=1&Id=Acquisition%3BMicrosoft.WindowsStore_8wekyb3d8bbwe&"));
            productsParameters.Add(Xml.CreateElement(NAMESPACE_WU_SERVICE + "Products"));

            return(doc.ToString());
        }
 public SyncResult()
 {
     newUpdates = new List <UpdateInfo>();
     newCookie  = new CookieData();
 }