Exemplo n.º 1
0
        private string GetRunAsAccounts(ITemplateContext templateContext)
        {
            var folderItems = SDKHelper.GetFolderItems <ManagementPackSecureReferenceOverride>(this, templateContext.OutputFolder);

            foreach (var @override in folderItems)
            {
                if (@override.Name.StartsWith(AccountOverrideNamePrefix, StringComparison.OrdinalIgnoreCase))
                {
                    return(@override.Value);
                }
            }
            return(String.Empty);
        }
Exemplo n.º 2
0
            //--------------------------------------------------------
            //  构造函数
            //--------------------------------------------------------
            public UIQuickLoginWindow()
            {
                // 根据sdkname来选择配置信息
                //SDKConfig sdkConfig = SDKHelper.GetSDKConfig();
                //if (sdkConfig != null)
                //{
                //    mPrefabName = sdkConfig.LoginPrefab;
                //}
                //else
                //    mPrefabName = "UIQuickLoginWindow";

                mPrefabName = SDKHelper.GetPrefabName("UIQuickLoginWindow", false);
            }
Exemplo n.º 3
0
    /// <summary>
    /// 创建角色
    /// </summary>
    /// <param name="index"></param>
    private void CreateActor(int index)
    {
        string bodyweaponstring = string.Empty;

        if (index >= 0 && index < mRoleData.Count)
        {
            // 获取配置的初始武器和装备信息
            //bodyweaponstring = GameConstHelper.GetString(string.Format("GAME_BORN_ROLE{0}", mRoleData[index].rid));

            string[]    splits    = bodyweaponstring.Split('[', ',', ']');
            List <uint> modelList = new List <uint>();
            if (splits.Length > 3)
            {
                uint bodyId = uint.Parse(splits[1]);
                modelList.Add(bodyId);
                uint weaponId = uint.Parse(splits[2]);
                modelList.Add(weaponId);
            }
            modelList = ActorManager.ReplaceModelList(modelList, (Actor.EVocationType)mRoleData[index].rid, false);

            UnitID actor_uid = null;
            if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetFashion() != 0)
            {
                //List<uint> npc_id = SDKHelper.GetRoleList();
                //actor_uid = ClientModel.CreateClientModelByActorIdForLua(ActorHelper.RoleIdToCreateTypeId(npc_id[index]), OnActorLoaded);


                uint        type_idx     = ActorHelper.RoleIdToTypeId(mRoleData[index].rid);
                List <uint> model_list   = new List <uint>();
                List <uint> fashion_list = new List <uint>();
                ActorHelper.GetModelFashionList(mRoleData[index].shows, model_list, fashion_list);
                fashion_list.Add(SDKHelper.GetFashion());
                var         model_id_list = ActorManager.ReplaceModelList(model_list, (Actor.EVocationType)mRoleData[index].rid, true);
                ClientModel actor         = ClientModel.CreateClientModel(type_idx, mRoleData[index].uuid, model_id_list, fashion_list, mRoleData[index].effects, OnActorLoaded);
                mActors.Add(actor);
            }
            else
            {
                actor_uid = ClientModel.CreateClientModelByActorIdForLua(ActorHelper.RoleIdToCreateTypeId(mRoleData[index].rid), OnActorLoaded);
            }



            var client_model = ActorManager.Instance.GetActor(actor_uid) as ClientModel;
            if (client_model != null)
            {
                client_model.AttackSpeed = 1.0f;// 攻速必须为1,不然出场特效与动作匹配不上
                mActors.Add(client_model);
            }
        }
    }
        /// <summary>
        /// Gets valid group memberships for a record.
        /// </summary>
        ///
        /// <remarks>
        /// Group membership thing types allow an application to signify that the
        /// record belongs to an application defined group.  A record in the group may be
        /// eligible for special programs offered by other applications, for example.
        /// Applications then need a away to query for valid group memberships.
        /// <br/>
        /// Valid group memberships are those memberships which are not expired, and whose
        /// last updating application is authorized by the last updating person to
        /// read and delete the membership.
        /// </remarks>
        /// <param name="connection">
        /// The connection to use to access the data.
        /// </param>
        /// <param name="accessor">
        /// The record to use.
        /// </param>
        /// <param name="applicationIds">
        /// A collection of unique application identifiers for which to
        /// search for group memberships.  For a null or empty application identifier
        /// list, return all valid group memberships for the record.  Otherwise,
        /// return only those group memberships last updated by one of the
        /// supplied application identifiers.
        /// </param>
        /// <returns>
        /// A List of things representing the valid group memberships.
        /// </returns>
        /// <exception cref="HealthServiceException">
        /// If an error occurs while contacting the HealthVault service.
        /// </exception>
        public virtual async Task <Collection <ThingBase> > GetValidGroupMembershipAsync(
            IHealthVaultConnection connection,
            HealthRecordAccessor accessor,
            IList <Guid> applicationIds)
        {
            StringBuilder parameters = new StringBuilder(128);

            if (applicationIds != null)
            {
                XmlWriterSettings settings = SDKHelper.XmlUnicodeWriterSettings;
                using (XmlWriter writer = XmlWriter.Create(parameters, settings))
                {
                    foreach (Guid guid in applicationIds)
                    {
                        writer.WriteElementString(
                            "application-id",
                            guid.ToString());
                    }
                }
            }

            var thingDeserializer = Ioc.Container.Locate <IThingDeserializer>(
                new
            {
                connection         = connection,
                thingTypeRegistrar = Ioc.Get <IThingTypeRegistrar>()
            });

            HealthServiceResponseData responseData = await connection.ExecuteAsync(HealthVaultMethods.GetValidGroupMembership, 1, parameters.ToString()).ConfigureAwait(false);

            XPathExpression infoPath =
                SDKHelper.GetInfoXPathExpressionForMethod(
                    responseData.InfoNavigator,
                    "GetValidGroupMembership");

            XPathNavigator infoNav = responseData.InfoNavigator.SelectSingleNode(infoPath);

            Collection <ThingBase> memberships = new Collection <ThingBase>();

            XPathNodeIterator membershipIterator = infoNav.Select("thing");

            if (membershipIterator != null)
            {
                foreach (XPathNavigator membershipNav in membershipIterator)
                {
                    memberships.Add(thingDeserializer.Deserialize(membershipNav.OuterXml));
                }
            }

            return(memberships);
        }
Exemplo n.º 5
0
        internal static ServiceInfo CreateServiceInfo(XPathNavigator nav)
        {
            Uri    platformUrl     = null;
            string platformVersion = null;
            Dictionary <string, string> configValues;
            XPathNavigator platformNav = nav.SelectSingleNode("platform");

            if (platformNav != null)
            {
                platformUrl     = new Uri(platformNav.SelectSingleNode("url").Value);
                platformVersion = platformNav.SelectSingleNode("version").Value;
                configValues    = GetConfigurationValues(platformNav.Select("configuration"));
            }
            else
            {
                configValues = new Dictionary <string, string>();
            }

            HealthServiceShellInfo shellInfo = null;
            XPathNavigator         shellNav  = nav.SelectSingleNode("shell");

            if (shellNav != null)
            {
                shellInfo = HealthServiceShellInfo.CreateShellInfo(
                    nav.SelectSingleNode("shell"));
            }

            Collection <HealthServiceMethodInfo> methods = GetMethods(nav);
            Collection <Uri> includes = GetIncludes(nav);

            string currentInstanceId;
            Dictionary <string, HealthServiceInstance> instances =
                GetServiceInstances(nav, out currentInstanceId);

            Instant lastUpdated = SDKHelper.InstantFromUnmarkedXml(nav.SelectSingleNode("updated-date").Value);

            ServiceInfo serviceInfo =
                new ServiceInfo(
                    platformUrl,
                    platformVersion,
                    shellInfo,
                    methods,
                    includes,
                    configValues,
                    instances,
                    currentInstanceId,
                    lastUpdated);

            return(serviceInfo);
        }
Exemplo n.º 6
0
        private static string CreateServiceDefinitionRequestParameters(
            ServiceInfoSections responseSections,
            Instant?lastUpdatedTime)
        {
            StringBuilder requestBuilder = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(requestBuilder, SDKHelper.XmlUnicodeWriterSettings))
            {
                if (lastUpdatedTime != null)
                {
                    writer.WriteElementString(
                        "updated-date",
                        SDKHelper.XmlFromInstant(lastUpdatedTime.Value));
                }

                writer.WriteStartElement("response-sections");

                if ((responseSections & ServiceInfoSections.Platform) == ServiceInfoSections.Platform)
                {
                    writer.WriteElementString("section", "platform");
                }

                if ((responseSections & ServiceInfoSections.Shell) == ServiceInfoSections.Shell)
                {
                    writer.WriteElementString("section", "shell");
                }

                if ((responseSections & ServiceInfoSections.Topology) == ServiceInfoSections.Topology)
                {
                    writer.WriteElementString("section", "topology");
                }

                if ((responseSections & ServiceInfoSections.XmlOverHttpMethods) == ServiceInfoSections.XmlOverHttpMethods)
                {
                    writer.WriteElementString("section", "xml-over-http-methods");
                }

                if ((responseSections & ServiceInfoSections.MeaningfulUse) == ServiceInfoSections.MeaningfulUse)
                {
                    writer.WriteElementString("section", "meaningful-use");
                }

                writer.WriteEndElement();

                writer.Flush();
            }

            return(requestBuilder.ToString());
        }
        /// <summary>
        /// Retrieves lists of vocabulary items for the specified
        /// vocabularies and culture.
        /// </summary>
        ///
        /// <param name="connection">
        /// The connection to use for this operation. The connection
        /// must have application capability.
        /// </param>
        ///
        /// <param name="vocabularyKeys">
        /// A list of keys identifying the requested vocabularies.
        /// </param>
        ///
        /// <param name="cultureIsFixed">
        /// HealthVault looks for the vocabulary items for the culture info
        /// specified using <see cref="HealthServiceConnection.Culture"/>.
        /// If <paramref name="cultureIsFixed"/> is set to <b>false</b> and if
        /// items are not found for the specified culture, items for the
        /// default fallback culture are returned. If
        /// <paramref name="cultureIsFixed"/> is set to <b>true</b>,
        /// fallback will not occur, and if items are not found for the
        /// specified culture, empty strings are returned.
        /// </param>
        ///
        /// <returns>
        /// The specified vocabularies and their items, or empty strings.
        /// </returns>
        ///
        /// <exception cref="ArgumentException">
        /// The <paramref name="vocabularyKeys"/> list is empty.
        /// </exception>
        ///
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="vocabularyKeys"/> list is <b>null</b>
        /// or contains a <b>null</b> entry.
        /// </exception>
        ///
        /// <exception cref="HealthServiceException">
        /// There is an error in the server request.
        /// <br></br>
        /// -Or-
        /// <br></br>
        /// One of the requested vocabularies is not found on the server.
        /// <br></br>
        /// -Or-
        /// <br></br>
        /// One of the requested vocabularies does not contain representations
        /// for its items for the specified culture when
        /// <paramref name="cultureIsFixed"/> is <b>true</b>.
        /// <br></br>
        /// -Or-
        /// <br></br>
        /// There is an error loading the vocabulary.
        /// </exception>
        ///
        public virtual async Task <ReadOnlyCollection <Vocabulary> > GetVocabularyAsync(
            IHealthVaultConnection connection,
            IList <VocabularyKey> vocabularyKeys,
            bool cultureIsFixed)
        {
            Validator.ThrowIfArgumentNull(vocabularyKeys, nameof(vocabularyKeys), Resources.VocabularyKeysNullOrEmpty);

            if (vocabularyKeys.Count == 0)
            {
                throw new ArgumentException(Resources.VocabularyKeysNullOrEmpty, nameof(vocabularyKeys));
            }

            var method        = HealthVaultMethods.GetVocabulary;
            int methodVersion = 2;

            StringBuilder     requestParameters = new StringBuilder(256);
            XmlWriterSettings settings          = SDKHelper.XmlUnicodeWriterSettings;

            settings.OmitXmlDeclaration = true;
            settings.ConformanceLevel   = ConformanceLevel.Fragment;

            using (XmlWriter writer = XmlWriter.Create(requestParameters, settings))
            {
                writer.WriteStartElement("vocabulary-parameters");

                for (int i = 0; i < vocabularyKeys.Count; i++)
                {
                    Validator.ThrowIfArgumentNull(vocabularyKeys[i], "vocabularyKeys[i]", Resources.VocabularyKeysNullOrEmpty);

                    vocabularyKeys[i].WriteXml(writer);
                }

                writer.WriteElementString(
                    "fixed-culture",
                    SDKHelper.XmlFromBool(cultureIsFixed));

                writer.WriteEndElement();
                writer.Flush();
            }

            string parameters = requestParameters.ToString();

            HealthServiceResponseData responseData = await connection.ExecuteAsync(method, methodVersion, parameters).ConfigureAwait(false);

            ReadOnlyCollection <Vocabulary> vocabularies
                = CreateVocabulariesFromResponse(method.ToString(), responseData);

            return(vocabularies);
        }
Exemplo n.º 8
0
        private static Dictionary <string, object> BuildParamWebService(string method, string param, string ApplyUser)
        {
            string version = "1.0";
            string token   = Guid.NewGuid().ToString();

            //将appCode,action,method,param(序列化后的dicParam)添加到dicParamWebService中调用WebService
            return(SDKHelper.BuildParamWebService("ProcessMaintenance", method, token, Newtonsoft.Json.JsonConvert.SerializeObject(
                                                      new
            {
                Version = version,
                Param = param,
                CurrentUserLoginID = ApplyUser,
                BizAppCode = AppSettingInfo.ApplicationCode
            }), ""));
        }
Exemplo n.º 9
0
 private string GetTemplateIdString(ITemplateContext templateContext)
 {
     if (templateContext == null)
     {
         throw new ArgumentNullException("templateContext");
     }
     foreach (ManagementPackClass class2 in SDKHelper.GetFolderItems <ManagementPackClass>(this, templateContext.OutputFolder))
     {
         if (class2.Name.StartsWith(ClassNamePrefix, StringComparison.OrdinalIgnoreCase))
         {
             return(class2.Name.Remove(0, ClassNamePrefix.Length));
         }
     }
     throw new ObjectNotFoundException();
 }
Exemplo n.º 10
0
        private void ShowNoticePanel(LoginNoticeData data, bool isFromServer = false)
        {
            if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel())
            {
                return;
            }

            GameDebug.Log("弹出游戏公告窗口");
            UIManager.Instance.ShowWindow("UILoginNoticeWindow", data, isFromServer);

            //if (string.IsNullOrEmpty(data.content) == false)
            //{

            //}
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GraphService" /> class
        /// </summary>
        public GraphService(AzureConfiguration azureConfig, string jwtToken)
        {
            _graphClient = SDKHelper.GetAuthenticatedClient(azureConfig, jwtToken);

            AccessToken = SDKHelper.GetAccessToken(azureConfig, jwtToken);

            JWTToken = jwtToken;

            if (_graphClient != null)
            {
                GraphUrlVersion      = azureConfig.UrlVersion;
                NotificationUri      = azureConfig.NotificationUri;
                GraphUrl             = azureConfig.BaseUrl + GraphUrlVersion;
                _graphClient.BaseUrl = GraphUrl;
            }
        }
Exemplo n.º 12
0
        public static void Getdata(filter filter, ref DataTable dt, List <KTX0050> list)
        {
            SDKHelper SDK = new SDKHelper();

            if (filter.startdate == null || filter.enddate == null)
            {
                return;
            }
            string lbSysOutputInfo = "";
            int    ret             = SDK.sta_ConnectTCP(ref lbSysOutputInfo, filter.ip, filter.port, filter.commkey);

            if (ret == 1)
            {
                SDK.sta_readLogByPeriod(ref lbSysOutputInfo, ref dt, filter.startdate, filter.enddate, filter.ip, list);
                SDK.sta_ConnectTCP(ref lbSysOutputInfo, filter.ip, filter.port, filter.commkey);
            }
        }
        /// <summary>
        /// Writes the XML representation of the address into
        /// the specified XML writer.
        /// </summary>
        ///
        /// <param name="nodeName">
        /// The name of the outer node for the address.
        /// </param>
        ///
        /// <param name="writer">
        /// The XML writer into which the address should be
        /// written.
        /// </param>
        ///
        /// <exception cref="ArgumentException">
        /// The <paramref name="nodeName"/> parameter is <b>null</b> or empty.
        /// </exception>
        ///
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="writer"/> parameter is <b>null</b>.
        /// </exception>
        ///
        /// <exception cref="ThingSerializationException">
        /// The <see cref="Street"/> property is empty or <see cref="City"/>,
        /// <see cref="Country"/>, or <see cref="PostalCode"/> property has not been set.
        /// </exception>
        ///
        public override void WriteXml(string nodeName, XmlWriter writer)
        {
            Validator.ThrowIfStringNullOrEmpty(nodeName, nameof(nodeName));
            Validator.ThrowIfArgumentNull(writer, nameof(writer), Resources.WriteXmlNullWriter);

            if (_street.Count == 0)
            {
                throw new ThingSerializationException(Resources.AddressStreetNotSet);
            }

            Validator.ThrowSerializationIfNull(_city, Resources.AddressCityNotSet);
            Validator.ThrowSerializationIfNull(_country, Resources.AddressCountryNotSet);
            Validator.ThrowSerializationIfNull(_postalCode, Resources.AddressPostalCodeNotSet);

            writer.WriteStartElement(nodeName);

            if (!string.IsNullOrEmpty(_description))
            {
                writer.WriteElementString("description", _description);
            }

            if (_isPrimary != null)
            {
                writer.WriteElementString(
                    "is-primary",
                    SDKHelper.XmlFromBool((bool)_isPrimary));
            }

            foreach (string street in _street)
            {
                writer.WriteElementString("street", street);
            }

            writer.WriteElementString("city", _city);
            if (!string.IsNullOrEmpty(_state))
            {
                writer.WriteElementString("state", _state);
            }

            writer.WriteElementString("postcode", _postalCode);
            writer.WriteElementString("country", _country);

            XmlWriterHelper.WriteOptString(writer, "county", _county);

            writer.WriteEndElement();
        }
Exemplo n.º 14
0
        private static async Task <ServiceInfo> GetServiceDefinitionAsync(IHealthVaultConnection connection, string parameters)
        {
            HealthServiceResponseData responseData = await connection.ExecuteAsync(HealthVaultMethods.GetServiceDefinition, 2, parameters).ConfigureAwait(false);

            if (responseData.InfoNavigator.HasChildren)
            {
                XPathExpression infoPath = SDKHelper.GetInfoXPathExpressionForMethod(
                    responseData.InfoNavigator,
                    "GetServiceDefinition2");

                XPathNavigator infoNav = responseData.InfoNavigator.SelectSingleNode(infoPath);

                return(ServiceInfo.CreateServiceInfo(infoNav));
            }

            return(null);
        }
        /// <summary>
        /// <see cref="IHealthServiceResponseParser.ParseResponseAsync"/>
        /// </summary>
        public async Task <HealthServiceResponseData> ParseResponseAsync(HttpResponseMessage response)
        {
            using (Stream responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
            {
                using (var reader = new StreamReader(responseStream, Encoding.UTF8, false, 1024))
                {
                    HealthServiceResponseData result =
                        new HealthServiceResponseData {
                        ResponseHeaders = response.Headers
                    };

                    XmlReaderSettings settings = SDKHelper.XmlReaderSettings;
                    settings.CloseInput       = false;
                    settings.IgnoreWhitespace = false;

                    XmlReader xmlReader = XmlReader.Create(reader, settings);
                    xmlReader.NameTable.Add("wc");

                    if (!SDKHelper.ReadUntil(xmlReader, "code"))
                    {
                        throw new MissingFieldException("code");
                    }

                    result.CodeId = xmlReader.ReadElementContentAsInt();

                    if (result.Code == HealthServiceStatusCode.Ok)
                    {
                        if (xmlReader.ReadToFollowing("wc:info"))
                        {
                            result.InfoNavigator = new XPathDocument(xmlReader).CreateNavigator();
                            result.InfoNavigator.MoveToFirstChild();
                        }

                        return(result);
                    }

                    result.Error = HandleErrorResponse(xmlReader);

                    HealthServiceException healthServiceException =
                        HealthServiceExceptionHelper.GetHealthServiceException(result);

                    throw healthServiceException;
                }
            }
        }
Exemplo n.º 16
0
        // Get the current user's email address from their profile.
        public async Task <ActionResult> GetMyEmailAddress()
        {
            try
            {
                // Initialize the GraphServiceClient.
                GraphServiceClient graphClient = SDKHelper.GetAuthenticatedClient();

                // Get the current user's email address.
                ViewBag.Email = await graphService.GetMyEmailAddress(graphClient);

                return(View("Graph"));
            }
            catch (ServiceException se)
            {
                //if (se.Error.Message == Resource.Error_AuthChallengeNeeded) return new EmptyResult();
                return(RedirectToAction("Index", "Error", new { message = Resource.Error_Message + Request.RawUrl + ": " + se.Error.Message }));
            }
        }
Exemplo n.º 17
0
        public async Task <ActionResult> MessageView()
        {
            GraphServiceClient graphClient = SDKHelper.GetAuthenticatedClient();
            User fac = await eventsService.GetMyDetails(graphClient);

            OfficeHoursContext    officeHoursContext     = new OfficeHoursContext();
            List <StudentMessage> studentMessages        = officeHoursContext.messages.ToList();
            List <WebApp.Models.StudentMessage> messages = new List <StudentMessage>();

            foreach (var st in studentMessages)
            {
                if (st.student_id.Equals(fac.Mail))
                {
                    messages.Add(st);
                }
            }
            return(View(messages));
        }
Exemplo n.º 18
0
        private void UpsertHistoryRecord(IOrganizationService service, bool isCreate, Entity historyTBC, Entity target)
        {
            var latestHistoryId = GetLatestHistoryId(service, target.LogicalName, target.Id);
            var addedGuid       = new Guid();

            if (!target.Contains("statecode") || isCreate)
            {
                addedGuid = SDKHelper.Create(service, historyTBC);
            }

            if (!isCreate && addedGuid != default(Guid))
            {
                if (latestHistoryId != default(Guid))
                {
                    UpdateLatestHistory(service, latestHistoryId);
                }
            }
        }
Exemplo n.º 19
0
        // Here we just clear the token cache, sign out the GraphServiceClient, and end the session with the web app.
        public void SignOut()
        {
            if (Request.IsAuthenticated)
            {
                // Get the user's token cache and clear it.
                string userObjectId = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;

                SessionTokenCache tokenCache = new SessionTokenCache(userObjectId, HttpContext);
                tokenCache.Clear(userObjectId);
            }

            SDKHelper.SignOutClient();

            // Send an OpenID Connect sign-out request.
            HttpContext.GetOwinContext().Authentication.SignOut(
                CookieAuthenticationDefaults.AuthenticationType);
            Response.Redirect("/");
        }
        /// <summary>
        /// Calls the BeginPutBlob HealthVault method.
        /// </summary>
        ///
        /// <returns>
        /// The result of the BeginPutBlob method call as a BlobPutParameters instance.
        /// </returns>
        ///
        /// <exception cref="HealthServiceException">
        /// If the call to HealthVault fails in some way.
        /// </exception>
        ///
        private async Task <BlobPutParameters> BeginPutBlobAsync()
        {
            HealthServiceResponseData responseData = await _record.Connection.ExecuteAsync(HealthVaultMethods.BeginPutBlob, 1).ConfigureAwait(false);

            XPathExpression infoPath =
                SDKHelper.GetInfoXPathExpressionForMethod(
                    responseData.InfoNavigator,
                    "BeginPutBlob");

            XPathNavigator infoNav =
                responseData.InfoNavigator.SelectSingleNode(infoPath);

            Uri               blobReferenceUrl  = new Uri(infoNav.SelectSingleNode("blob-ref-url").Value);
            int               chunkSize         = infoNav.SelectSingleNode("blob-chunk-size").ValueAsInt;
            long              maxBlobSize       = infoNav.SelectSingleNode("max-blob-size").ValueAsLong;
            string            blobHashAlgString = infoNav.SelectSingleNode("blob-hash-algorithm").Value;
            BlobHashAlgorithm blobHashAlg;

            try
            {
                blobHashAlg =
                    (BlobHashAlgorithm)Enum.Parse(
                        typeof(BlobHashAlgorithm), blobHashAlgString);
            }
            catch (ArgumentException)
            {
                blobHashAlg = BlobHashAlgorithm.Unknown;
            }

            int            blocksize = 0;
            XPathNavigator blockNav  = infoNav.SelectSingleNode("blob-hash-parameters/block-size");

            if (blockNav != null)
            {
                blocksize = blockNav.ValueAsInt;
            }

            return(new BlobPutParameters(
                       blobReferenceUrl,
                       chunkSize,
                       maxBlobSize,
                       blobHashAlg,
                       blocksize));
        }
Exemplo n.º 21
0
        private static void OnGetLoginNoticeInfo(string url, string error, string reply, object userData)
        {
            bool fromServerList = (bool)userData;

            if (string.IsNullOrEmpty(error) == false)
            {
                UIManager.Instance.ShowWaitScreen(false);

                GameDebug.LogError("获取游戏公告失败: " + error);
                string err = DBConstText.GetText("GET_LOGIN_NOTICE_INFO_FAIL");
#if UNITY_EDITOR
                err += error;
#endif
                UIWidgetHelp.GetInstance().ShowNoticeDlg(err);

                return;
            }

            LoginNoticeData data;
            if (!CheckData(reply, out data))
            {
                UIManager.Instance.ShowWaitScreen(false);

                GameDebug.LogError("获取游戏公告失败: " + error);
                string err = DBConstText.GetText("GET_LOGIN_NOTICE_INFO_FAIL");

                UIWidgetHelp.GetInstance().ShowNoticeDlg(err);

                return;
            }

            if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel())
            {
                return;
            }

            //获取成功解析成功

            UIManager.Instance.ShowWindow("UILoginNoticeWindow", data, false);

            //if (string.IsNullOrEmpty(data.content) == false)
            //{
            //}
        }
Exemplo n.º 22
0
            protected override void ResetUI()
            {
                base.ResetUI();

                if (xc.Const.Region == xc.RegionType.SEASIA)
                {
                    if (xc.Const.Language == xc.LanguageType.VIETNAMESE)
                    {
                        mHealthTips.SetActive(true);
                    }
                }

                ui.ugui.UIManager.GetInstance().ShowLoadingBK(true);
                ui.ugui.UIManager.GetInstance().SetLoadingTip(xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_89"));

                // 删除加载的角色
                for (int i = 0; i < mActorGameObjects.Count; ++i)
                {
                    ClientModel actor = mActorGameObjects [i];
                    if (actor != null)
                    {
                        actor.mVisibleCtrl.SetActorVisible(true, VisiblePriority.EXCEPT);
                        ActorManager.Instance.DestroyActor(actor.UID);
                        mActorGameObjects [i] = null;
                    }
                }

                // 设置角色列表的数据
                SetData(Game.GetInstance().CharacterList);

                UpdateServerName();

                if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel())
                {
                    MainGame.HeartBehavior.StartCoroutine(DelayShowWindow());
                }
                else
                {
                    MainGame.HeartBehavior.StartCoroutine(WaitForSelectAcotor());
                }

                // 进入选角场景
                ControlServerLogHelper.Instance.PostPlayerFollowRecord(PlayerFollowRecordSceneId.EnterSelectActorScene);
            }
Exemplo n.º 23
0
 public void ShowActorPic(uint roleId)
 {
     if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel())
     {
         for (int i = 0; i < mActorPic.Count; i++)
         {
             if (mActorPic[i] != null)
             {
                 // 需要判断image.texture是否已加载成功;
                 // gameObject.SetActive(false)会把已启动的协程停止,导致图片不会加载
                 RawImage image = mActorPic[i].GetComponent <RawImage>();
                 if (image != null && image.texture != null)
                 {
                     mActorPic[i].gameObject.SetActive(i == roleId);
                 }
             }
         }
     }
 }
        public void SetRequestHeader(
            HealthVaultMethods method,
            int methodVersion,
            bool isAnonymous,
            Guid?recordId,
            Guid?appId,
            string infoXml,
            Request request)
        {
            request.Header = new RequestHeader
            {
                Method        = method.ToString(),
                MethodVersion = methodVersion
            };

            if (recordId != null)
            {
                request.Header.RecordId = recordId.Value.ToString();
            }

            // in case the method is anonymous - set app id, else set auth session
            if (isAnonymous)
            {
                request.Header.AppId = appId.HasValue
                    ? appId.Value.ToString()
                    : _healthVaultConfiguration.MasterApplicationId.ToString();
            }
            else
            {
                request.Header.AuthSession = _connectionInternal.GetAuthSessionHeader();
            }

            request.Header.MessageTime = SDKHelper.XmlFromNow();
            request.Header.MessageTtl  = (int)_healthVaultConfiguration.RequestTimeToLiveDuration.TotalSeconds;

            request.Header.Version =
                $"{_telemetryInformation.Category}/{_telemetryInformation.FileVersion} {_telemetryInformation.OsInformation}";

            request.Header.InfoHash = new InfoHash
            {
                HashData = _cryptographer.Hash(Encoding.UTF8.GetBytes(infoXml))
            };
        }
        /// <summary>
        /// Writes the language to the specified XML writer.
        /// </summary>
        ///
        /// <param name="nodeName">
        /// The name of the outer element for the language.
        /// </param>
        ///
        /// <param name="writer">
        /// The XmlWriter to write the language to.
        /// </param>
        ///
        /// <exception cref="ArgumentException">
        /// The <paramref name="nodeName"/> parameter is <b>null</b> or empty.
        /// </exception>
        ///
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="writer"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void WriteXml(string nodeName, XmlWriter writer)
        {
            Validator.ThrowIfStringNullOrEmpty(nodeName, "nodeName");
            Validator.ThrowIfWriterNull(writer);

            // null indicates uninitialized
            if (_language.Text != null)
            {
                writer.WriteStartElement(nodeName);

                _language.WriteXml("language", writer);

                writer.WriteElementString(
                    "is-primary",
                    SDKHelper.XmlFromBool(_isPrimary));

                writer.WriteEndElement();
            }
        }
Exemplo n.º 26
0
        private static string CallWebService(string method, string param, string ApplyUser)
        {
            var dicParamWebService = BuildParamWebService(method, param, ApplyUser);

            try
            {
                string url = AppSettingInfo.WorkflowServerUrl;
                string workFlowServerFullURL = SDKHelper.GetWorkflowServerUrlFullPath(url);
                var    result = SDKHelper.QueryPostWebService(workFlowServerFullURL, "CommonHandler", dicParamWebService);
                return(result);
            }
            catch (Exception ex)
            {
                SDKSystemSupportException newEX = new SDKSystemSupportException(ClientConstDefine.WORKFLOW_SERVICE_ERRORCODE_USERSELECT_SERVERWEBSERVICEERROR
                                                                                , ClientConstDefine.WORKFLOW_SERVICE_ERRORCONTENT_USERSELECT_SERVERWEBSERVICEERROR
                                                                                );
                throw (Exception)ex;
            }
        }
Exemplo n.º 27
0
        private void GetDiscoveryConfig(ITemplateContext templateContext, ref TemplateInputConfig templateConfig)
        {
            if (templateContext == null)
            {
                throw new ArgumentNullException("templateContext");
            }
            foreach (ManagementPackDiscovery discovery in SDKHelper.GetFolderItems <ManagementPackDiscovery>(this, templateContext.OutputFolder))
            {
                if (discovery.Name.StartsWith(DiscoveryNamePrefix, StringComparison.OrdinalIgnoreCase))
                {
                    MatchCollection matchs = new Regex(ValueNodeRegex, RegexOptions.CultureInvariant | RegexOptions.Compiled).Matches(discovery.DataSource.Configuration);

                    templateConfig.ASBNamespaceName = matchs[0].Groups[1].Value;
                    templateConfig.ProxyAgentComputerPrincipalName = matchs[2].Groups[1].Value;
                    return;
                }
            }
            throw new ObjectNotFoundException("my message");
        }
Exemplo n.º 28
0
        /// <summary>
        /// 窗口资源加载完毕后调用
        /// </summary>
        public virtual void InitData()
        {
            IsLoadDone = true;
            WinState   = WinowState.ResLoadDone;

            canvas = mUIObject.GetComponent <Canvas>();

            if (firstShow)
            {
                ///第一次显示在这里计算层级
                CaculateLayer();
            }

            InitUI();

            var all_shield_widget = DBWidgetShield.Instance.GetAllWidget(this.mWndName);

            if (all_shield_widget != null)
            {
                foreach (var info in all_shield_widget)
                {
                    var widget = mUIObject.transform.Find(info.path);
                    if (widget != null)
                    {
                        if (AuditManager.Instance.AuditAndIOS() && SDKHelper.GetSwitchModel())
                        {
                            if ((info.is_audit && AuditManager.Instance.ContainShieldWId((uint)info.id)) ||
                                !info.is_audit)
                            {
                                widget.gameObject.SetActive(false);
                            }
                        }
                        else
                        {
                            if (!info.is_audit)
                            {
                                widget.gameObject.SetActive(false);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// Gets information about the HealthVault service only if it has been updated since
        /// the specified update time.
        /// </summary>
        ///
        /// <param name="connection">The connection to use to perform the operation.</param>
        ///
        /// <param name="lastUpdatedTime">
        /// The time of the last update to an existing cached copy of <see cref="ServiceInfo"/>.
        /// </param>
        ///
        /// <remarks>
        /// Gets the latest information about the HealthVault service, if there were updates
        /// since the specified <paramref name="lastUpdatedTime"/>.  If there were no updates
        /// the method returns <b>null</b>.
        /// This includes:<br/>
        /// - The version of the service.<br/>
        /// - The SDK assembly URLs.<br/>
        /// - The SDK assembly versions.<br/>
        /// - The SDK documentation URL.<br/>
        /// - The URL to the HealthVault Shell.<br/>
        /// - The schema definition for the HealthVault method's request and
        ///   response.<br/>
        /// - The common schema definitions for types that the HealthVault methods
        ///   use.<br/>
        /// - Information about all available HealthVault instances.<br/>
        /// </remarks>
        ///
        /// <returns>
        /// If there were updates to the service information since the specified <paramref name="lastUpdatedTime"/>,
        /// a <see cref="ServiceInfo"/> instance that contains the service version, SDK
        /// assemblies versions and URLs, method information, and so on.  Otherwise, if there were no updates,
        /// returns <b>null</b>.
        /// </returns>
        ///
        /// <exception cref="ArgumentNullException">
        /// <paramref name="connection"/> is <b>null</b>.
        /// </exception>
        ///
        /// <exception cref="HealthServiceException">
        /// The HealthVault service returned an error.
        /// </exception>
        ///
        /// <exception cref="UriFormatException">
        /// One or more URL strings returned by HealthVault is invalid.
        /// </exception>
        ///
        public virtual async Task <ServiceInfo> GetServiceDefinitionAsync(IHealthVaultConnection connection, Instant lastUpdatedTime)
        {
            Validator.ThrowIfArgumentNull(connection, nameof(connection), Resources.ConnectionNull);

            StringBuilder requestBuilder = new StringBuilder();

            using (XmlWriter writer = XmlWriter.Create(requestBuilder, SDKHelper.XmlUnicodeWriterSettings))
            {
                writer.WriteElementString(
                    "updated-date",
                    SDKHelper.XmlFromInstant(lastUpdatedTime));

                writer.Flush();
            }

            string requestParams = requestBuilder.ToString();

            return(await GetServiceDefinitionAsync(connection, requestParams).ConfigureAwait(false));
        }
Exemplo n.º 30
0
        // Get events.
        public async Task <ActionResult> Index()
        {
            List <EventsItem> results         = new List <EventsItem>();
            List <EventsItem> filteredResults = new List <EventsItem>();

            if (Session["facultyMail"] != null)
            {
                try
                {
                    // Initialize the GraphServiceClient.
                    GraphServiceClient graphClient = SDKHelper.GetAuthenticatedClient();

                    // Get events.
                    results = await eventsService.GetMyAppointments(graphClient);

                    if (results != null && results.Any())
                    {
                        foreach (EventsItem item in results)
                        {
                            foreach (Attendee attendee in item.Attendees)
                            {
                                if (attendee.EmailAddress.Address.Equals(Session["facultyMail"].ToString()))
                                {
                                    filteredResults.Add(item);
                                }
                            }
                        }
                    }
                }
                catch (ServiceException se)
                {
                    if (se.Error.Message == Resource.Error_AuthChallengeNeeded)
                    {
                        return(new EmptyResult());
                    }

                    // Personal accounts that aren't enabled for the Outlook REST API get a "MailboxNotEnabledForRESTAPI" or "MailboxNotSupportedForRESTAPI" error.
                    return(RedirectToAction("Index", "Error", new { message = string.Format(Resource.Error_Message, Request.RawUrl, se.Error.Code, se.Error.Message) }));
                }
                return(View("Index", filteredResults));
            }
            return(RedirectToAction("Home", "Home"));
        }