private static void CacheWorkerRole180(string rootPath, RoleInfo cacheRoleInfo) { // Fetch cache role information from service definition and service configuration files. CloudServiceProject cloudServiceProject = new CloudServiceProject(rootPath, null); WorkerRole cacheWorkerRole = cloudServiceProject.Components.GetWorkerRole(cacheRoleInfo.Name); RoleSettings cacheRoleSettings = cloudServiceProject.Components.GetCloudConfigRole(cacheRoleInfo.Name); // Add caching module to the role imports cacheWorkerRole.Imports = GeneralUtilities.ExtendArray<Import>( cacheWorkerRole.Imports, new Import { moduleName = Resources.CachingModuleName }); // Enable caching Diagnostic store. LocalStore diagnosticStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; cacheWorkerRole.LocalResources = GeneralUtilities.InitializeIfNull<LocalResources>(cacheWorkerRole.LocalResources); cacheWorkerRole.LocalResources.LocalStorage = GeneralUtilities.ExtendArray<LocalStore>( cacheWorkerRole.LocalResources.LocalStorage, diagnosticStore); // Remove input endpoints. cacheWorkerRole.Endpoints.InputEndpoint = null; // Add caching configuration settings AddCacheConfiguration(cloudServiceProject.Components.GetCloudConfigRole(cacheRoleInfo.Name)); AddCacheConfiguration( cloudServiceProject.Components.GetLocalConfigRole(cacheRoleInfo.Name), Resources.EmulatorConnectionString); cloudServiceProject.Components.Save(cloudServiceProject.Paths); }
public static void RegisterService() { var keyStore = new LocalStore(); var interval = keyStore.GetString(Constants.Keys.Interval); if (string.IsNullOrEmpty(interval)) interval = "1"; var intervalTime = 60000 * int.Parse(interval); var serviceIntent = new Intent(Constants.GPSServiceIntent); serviceIntent.SetPackage(Application.Context.PackageName); var alarm = (AlarmManager)Application.Context.GetSystemService(Context.AlarmService); var pendingServiceIntent = PendingIntent.GetService(Application.Context, 0, serviceIntent, PendingIntentFlags.CancelCurrent); alarm.SetRepeating(AlarmType.Rtc, 0, intervalTime, pendingServiceIntent); }
public override void Run(object[] args) { Init(args); Urls.Add("http://www.baike.com"); DataStore = new LocalStore<string>(GetRootFolder() + "\\QuestionData.index", GetRootFolder() + "\\ALLQuestionData", 10); while (Urls.Count > 0) { List<Page> pages = new List<Page>(); try { //2.1 爬虫开始运行 Crawler(ref pages); } catch (Exception exception) { Logger.Warn(exception); } //2.2 索引器开始运行 if (pages != null && pages.Count > 0) { try { GetQuestions(ref pages); } catch (Exception exception) { Logger.Warn(exception); } } //2.3 更新url try { Urls.AddRange(GetKeysByValueFromCache(false, 10, true)); } catch (Exception exception) { Logger.Warn(exception); } } }
public static void LocalResourcesLocalStoreExists(LocalStore expected, LocalResources actual) { Assert.IsTrue(Array.Exists<LocalStore>(actual.LocalStorage, l => l.name.Equals(expected.name) && l.cleanOnRoleRecycle.Equals(expected.cleanOnRoleRecycle) && l.sizeInMB.Equals(expected.sizeInMB))); }
// void Update(){ // Debug.LogError (Time.deltaTime); // } void sdk_callback(string value) { Debug.Log("---unity--CALLbACK....." + value); //Log: CALLbACK.....{ "funcId":"share_ok","msg":"0","isJson":0} Dictionary <string, object> dd = new Dictionary <string, object>(); if (value.IndexOf("{") > -1) { string fid = ""; //普通第三方json数据返回 JsonData re = JsonMapper.ToObject(value); if (((int)re ["isJson"]) == 1) { // trace.text += "\n -^-:" + re ["funcId"]; // trace.text += "\n -^-:" + re ["data"].ToJson (); fid = (string)re ["funcId"]; if (fid == FID_LOGIN_QQ_TOKEN) { //QQ 登陆返回 token PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_LOGIN_QQ_TOKEN, value); } else if (fid == FID_LOGIN_QQ_HEAD) { //QQ 登陆返回 头像//figureurl_qq_1//figureurl_qq_2 //{"ret":0,"msg":"","is_lost":0,"nickname":"三叔","gender":"男","province":"北京","city":"朝阳","figureurl":"http:\/\/qzapp.qlogo.cn\/qzapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/30","figureurl_1":"http:\/\/qzapp.qlogo.cn\/qzapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/50","figureurl_2":"http:\/\/qzapp.qlogo.cn\/qzapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/100","figureurl_qq_1":"http:\/\/q.qlogo.cn\/qqapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/40","figureurl_qq_2":"http:\/\/q.qlogo.cn\/qqapp\/101347709\/367F8C9525DC8690EC9DF1578F6714A1\/100","is_yellow_vip":"0","vip":"0","yellow_vip_level":"0","level":"0","is_yellow_year_vip":"0"} string headURL = (string)re["figureurl_qq_2"]; //40 LocalStore.DelLocal(LocalStore.HEADIMG + headURL); //删除缓存 LocalStore.SetLocal(LocalStore.OTHER_HEADIMG, headURL); PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_LOGIN_QQ_HEAD, headURL); // PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_LOGIN_PF,null);//这里可能需要服务器验证 } } else { PlatForm.inst.GetSdk().Dispatch("callback", value); //自定义 json数据 标准格式{isJson:0,function:"",msg:""}; // trace.text += "\n -->" + re ["funcId"] + "\n -->" + re ["other"]; fid = re ["funcId"].ToString(); if (fid == FID_get_photo_end) { string bitmap = (string)re ["msg"]; // byte[] b = System.Convert.FromBase64String (bitmap); PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_OPENPHOTO, bitmap); } else if (fid == FID_share_ok) { string msg = (string)re ["msg"]; // Debug.Log ("-->>lht 001-->>" + msg + " :: >> " + Ex_Local.CALL_FUN); PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_FUN, msg); } else if (fid == FID_LOGIN_WEIXIN_CODE) { //微信 code 返回 PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_LOGIN_WEIXIN_CODE, (string)re ["msg"]); } else if (fid == ERROR_NO_QQ) { // PlatForm.inst.GetSdk().Dispatch(Ex_Local.ERROR_NO_QQ, "0"); } else if (fid == ERROR_NO_WX) { // PlatForm.inst.GetSdk().Dispatch(Ex_Local.ERROR_NO_WX, "0"); } else if (fid == SCHEME_EVENT_JOIN) //有scheme 消息打开游戏 { } else if (fid == SCHEME_EVENT_JOIN_CHECK) { } #if UNITY_IOS else if (fid == FID_touch3d) { // PlatForm.inst.touch3dType = (string)re ["msg"]; PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_RE_TOUCH3D, (string)re ["msg"]); // Ex_Ios.c_test(); } else if (fid == Ex_Local.CALL_RE_TOUCH3D_GET) { PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_RE_TOUCH3D_GET, (string)re ["msg"]); } #endif //if (re["funcId"].ToString() == FID_copy_ok) //{ // dd["name"] = Ex_Local.CALL_COPYTO; // dd["value"] = (string)re["msg"]; // PlatForm.inst.GetSdk().Dispatch(Ex_Local.CALL_COPYTO, dd); //} } } else { // trace.text += "\n" + str; // if (str.IndexOf ("GET_GEO_NELL") > -1) // { // string[] arr = str.Split (new string[]{ "," }, System.StringSplitOptions.None); // la = arr [1]; // lo = arr [2]; // sdk_callback (arr [0] + arr [1] + arr [2]); // } } }
public void EnableAzureMemcacheRoleProcessOnWorkerRoleSuccess() { using (FileSystemHelper files = new FileSystemHelper(this)) { string serviceName = "AzureService"; string rootPath = files.CreateNewService(serviceName); string cacheRoleName = "CacheWorkerRole"; string workerRoleName = "WorkerRole"; string expectedMessage = string.Format(Resources.EnableMemcacheMessage, workerRoleName, cacheRoleName, Resources.MemcacheEndpointPort); addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = workerRoleName }; addNodeWorkerCmdlet.ExecuteCmdlet(); addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath); mockCommandRuntime.ResetPipelines(); enableCacheCmdlet.PassThru = true; enableCacheCmdlet.EnableAzureMemcacheRoleProcess(workerRoleName, cacheRoleName, rootPath); WorkerRole workerRole = Testing.GetWorkerRole(rootPath, workerRoleName); AzureAssert.RuntimeUrlAndIdExists(workerRole.Startup.Task, Resources.CacheRuntimeValue); AzureAssert.ScaffoldingExists(Path.Combine(files.RootPath, serviceName, workerRoleName), Path.Combine(Resources.CacheScaffolding, Resources.WorkerRole)); AzureAssert.StartupTaskExists(workerRole.Startup.Task, Resources.CacheStartupCommand); AzureAssert.InternalEndpointExists(workerRole.Endpoints.InternalEndpoint, new InternalEndpoint { name = Resources.MemcacheEndpointName, protocol = InternalProtocol.tcp, port = Resources.MemcacheEndpointPort }); LocalStore localStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; AzureAssert.LocalResourcesLocalStoreExists(localStore, workerRole.LocalResources); DefinitionConfigurationSetting diagnosticLevel = new DefinitionConfigurationSetting { name = Resources.CacheClientDiagnosticLevelAssemblyName }; AzureAssert.ConfigurationSettingExist(diagnosticLevel, workerRole.ConfigurationSettings); ConfigConfigurationSetting clientDiagnosticLevel = new ConfigConfigurationSetting { name = Resources.ClientDiagnosticLevelName, value = Resources.ClientDiagnosticLevelValue }; AzureAssert.ConfigurationSettingExist(clientDiagnosticLevel, Testing.GetCloudRole(rootPath, workerRoleName).ConfigurationSettings); AzureAssert.ConfigurationSettingExist(clientDiagnosticLevel, Testing.GetLocalRole(rootPath, workerRoleName).ConfigurationSettings); string workerConfigPath = string.Format(@"{0}\{1}\{2}", rootPath, workerRoleName, "web.config"); string workerCloudConfig = File.ReadAllText(workerConfigPath); Assert.IsTrue(workerCloudConfig.Contains("configSections")); Assert.IsTrue(workerCloudConfig.Contains("dataCacheClients")); Assert.AreEqual<string>(expectedMessage, mockCommandRuntime.VerboseStream[0]); Assert.AreEqual<string>(workerRoleName, (mockCommandRuntime.OutputPipeline[0] as PSObject).GetVariableValue<string>(Parameters.RoleName)); } }
private void List_Render(int index, GObject go) { bool isVisible = SetListCSS(go, listData.ToArray(), index); if (isVisible) { Dictionary <string, object> d = (Dictionary <string, object>)(listData[index]); string name = (string)d["name"]; string head_use = (string)d["head_use"]; GTextField lv = go.asCom.GetChild("n4").asCom.GetChild("n2").asTextField; GButton photo = go.asCom.GetChild("n4").asCom.GetChild("n0").asButton; go.asCom.GetChild("n10").asTextField.visible = false; Dictionary <string, object> gift = (Dictionary <string, object>)d["content"]; Dictionary <string, object> cardCfg = DataManager.inst.card; // Debug.LogError("name "+d["name"].ToString()+" || "+"uid "+d["uid"].ToString()+" || "+"head_use "+ d["head_use"].ToString()); GButton head = go.asCom.GetChild("n4").asCom.GetChild("n0").asButton; GButton btn_att = go.asCom.GetChild("n5").asButton; btn_att.text = Tools.GetMessageById("13147"); string giftName = ""; string gifts = ""; //if(index == 0 || index % 2 == 0) { // go.asCom.GetChild("itemBg").visible = false; //} else { // go.asCom.GetChild("itemBg").visible = true; //} lv.text = d["lv"].ToString(); Tools.SetLoaderButtonUrl(photo, ModelUser.GetHeadUrl(head_use)); //contecnt foreach (string s in gift.Keys) { giftName = s; if (giftName == Config.ASSET_CARD) { foreach (string cid in ((Dictionary <string, object>)(gift[Config.ASSET_CARD])).Keys) { Dictionary <string, object> cardidcfg = (Dictionary <string, object>)cardCfg[cid]; if (gifts == "") { gifts += " [" + giftName + (int)cardidcfg["rarity"] + "2]" + " x " + "[color=#f38917]" + (int)(((Dictionary <string, object>)gift[giftName])[cid]) + "[/color]"; } else { gifts += " [" + giftName + (int)cardidcfg["rarity"] + "2]" + " x " + "[color=#f38917]" + (int)(((Dictionary <string, object>)gift[giftName])[cid]) + "[/color]"; } } } else { if (gifts == "") { gifts = "[" + giftName + "2]" + " x " + "[color=#f38917]" + (int)gift[giftName] + "[/color] " + gifts; } else { gifts = "[" + giftName + "2]" + " x " + "[color=#f38917]" + (int)gift[giftName] + "[/color] " + gifts; } } } if (name == null) { name = d["uid"] + ""; } string str = Tools.GetMessageById("12002", new string[] { "[color=#f38917]" + name + "[/color] ", gifts }); go.asCom.GetChild("n0").asRichTextField.text = BaseUbbParser.inst.Parse(str); //AttentionBtn //if(!(bool)d["if_black"] && !(bool)d["if_friend"] && !(bool)d["request_sign"] || d["uid"].ToString() == userModel.uid) { // btn_att.visible = false; //} else { // btn_att.visible = true; //} if ((bool)d["request_sign"]) { if ((bool)d["if_black"] || (bool)d["if_friend"]) { btn_att.visible = false; } else { btn_att.visible = true; } } else { btn_att.visible = false; } if (d["uid"].ToString() == userModel.uid) { btn_att.visible = false; } if ((bool)d["if_friend"]) { btn_att.visible = false; go.asCom.GetChild("n10").asTextField.visible = true; go.asCom.GetChild("n10").asTextField.text = Tools.GetMessageById("13018"); } if (btn_att.visible) { if (LocalStore.GetFriendUID().IndexOf(d["uid"].ToString() + ",") > -1) { btn_att.visible = false; go.asCom.GetChild("n10").asTextField.visible = true; go.asCom.GetChild("n10").asTextField.text = Tools.GetMessageById("13018"); } else { btn_att.visible = true; } } btn_att.onClick.Add(() => { Dictionary <string, object> dataAtt = new Dictionary <string, object>(); dataAtt["fuid"] = d["uid"]; NetHttp.inst.Send(NetBase.HTTP_FOLLOW, dataAtt, (VoHttp vo) => { if ((bool)vo.data == true) { roleModel.AddAttentionFight(d["uid"].ToString()); btn_att.visible = false; go.asCom.GetChild("n10").asTextField.visible = true; go.asCom.GetChild("n10").asTextField.text = Tools.GetMessageById("13018"); LocalStore.SetFriendUID(d["uid"].ToString()); } }); }); } }
private void Send(string uid, string pwd, string type) { // if (pwd == "") // { // ViewManager.inst.ShowText(Tools.GetMessageById("10011")); // } // else // { Type_login = type; // if(type == Ex_Local.LOGIN_TYPE_QQ){ // PlatForm.inst.GetSdk ().Call (Ex_Local.CALL_LOGIN_QQ_HEAD,null,Headimg_get); // PlatForm.inst.GetSdk().Login(type,true); // } // else if(type == Ex_Local.LOGIN_TYPE_WEIXIN){ // PlatForm.inst.GetSdk ().Call (Ex_Local.CALL_AUTH_HEAD_GET_WEIXIN, null, Headimg_get); // PlatForm.inst.GetSdk().Login(type,true); // } // else{ // ViewManager.inst.ShowText(uInfo[1] + " || "+uInfo[0]+" || "+uInfo[2]); // userModel.Login(Ex_Local.LOGIN_TYPE_UID, uInfo[0], uInfo[2], () => // { // if (ulist.Contains(userModel.uid)) // LocalStore.DelUids(userModel.uid); // if (utype.Equals(Ex_Local.LOGIN_TYPE_UNAME)) // { // LocalStore.SetUids(userModel.uid,userModel.uname, userModel.pwd,userModel.type_login,userModel.tel); // } // else // { // LocalStore.SetUids(uname, input_password.text, Ex_Local.LOGIN_TYPE_UID); // } LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_UID); // // LocalStore.SetLocal(LocalStore.LOCAL_TYPE, userModel.type_login); // // ViewManager.inst.CloseView(); // roleModel.otherInfo = null; // alertModel.isOpen = true; // roleModel.uids.Clear(); // ViewManager.inst.CloseScene(); LocalStore.SetLocal(LocalStore.LOCAL_UID, uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, pwd); // DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME)); //this.DispatchGlobalEvent(new MainEvent(MainEvent.SHOW_USER, new object[] { userModel.uid, userModel.uid, roleModel.tab_Role_CurSelect1,roleModel.tab_Role_CurSelect2,roleModel.tab_Role_CurSelect3 })); // Dictionary<string, object> dd = new Dictionary<string, object>(); // dd["fuid"] = userModel.uid; // NetHttp.inst.Send(NetBase.HTTP_FUSERGET, dd, (VoHttp vo) => // { // if (vo.data != null) // { // roleModel.tab_Role_Select1 = roleModel.tab_Role_CurSelect1; // roleModel.tab_Role_Select2 = roleModel.tab_Role_CurSelect2; // roleModel.tab_Role_Select3 = roleModel.tab_Role_CurSelect3; // roleModel.otherInfo = (Dictionary<string, object>)vo.data; // ViewManager.inst.ShowScene<MediatorRoleRoot>(); // } // }); // }); // } }
private void InitItem() { // InitTitle(Tools.GetMessageById("33106")); input_password = this.GetChild("n5").asCom.GetChild("n1").asTextInput; input_password.promptText = ""; input_password.maxLength = (int)DataManager.inst.systemSimple["password_num"]; input_password.restrict = Config.REG_NUMORABC; input_phone = this.GetChild("n3").asCom.GetChild("n1").asTextInput; input_phone.maxLength = 11; input_phone.promptText = ""; input_code = this.GetChild("n4").asCom.GetChild("n1").asTextInput; input_code.maxLength = (int)DataManager.inst.systemSimple["code_num"]; input_code.promptText = ""; btn_send = this.GetChild("n6").asButton; GTextField phone = this.GetChild("n8").asTextField; phone.text = Tools.GetMessageById("13097") + ":"; GTextField passwd = this.GetChild("n9").asTextField; passwd.text = Tools.GetMessageById("13098") + ":"; GTextField code = this.GetChild("n10").asTextField; code.text = Tools.GetMessageById("13084") + ":"; btn_send.text = Tools.GetMessageById("13077"); btn_send.onClick.Add(() => { if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { string param = "tel_num=" + input_phone.text; NetHttp.inst.Send(NetBase.HTTP_VALIDATE, param, (VoHttp v) => { Debug.Log(v.data);//true if ((bool)v.data) { ViewManager.inst.ShowText(Tools.GetMessageById("13049")); timer = ModelManager.inst.gameModel.time; btn_send.touchable = false; btn_send.grayed = true; TimerManager.inst.Add(1f, 0, Timer); } }); } }); btn_ok = this.GetChild("n7").asButton; btn_ok.text = Tools.GetMessageById("13079"); btn_ok.onClick.Add(() => { if (input_password.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("10011")); } else if (input_code.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13034")); } else if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { string param = "sign=" + input_code.text; // param += "|uname=" + userModel.uname; param += "|pwd=" + input_password.text; NetHttp.inst.Send(NetBase.HTTP_REGIST, param, (VoHttp v) => { // Debug.Log(v.data); if ((string)v.data != string.Empty) { ViewManager.inst.ShowText(Tools.GetMessageById("13124")); // LocalStore.SetLocal(LocalStore.LOCAL_UID, userModel.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, (string)v.data); LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_TEL); LocalStore.SetLocal(LocalStore.LOCAL_TEL, input_phone.text); // userModel.tel = Ex_Local.LOGIN_TYPE_TEL + "|" + input_phone.text; otherInfo["tel"] = userModel.tel; // // LocalStore.DelUids(userModel.uid); LocalStore.SetUids(userModel.uid, userModel.uname, (string)v.data, Ex_Local.LOGIN_TYPE_TEL, userModel.tel); // Dictionary <string, object> dc = new Dictionary <string, object>(); dc.Add("value", ""); dc.Add("tag", "account"); DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc)); ViewManager.inst.CloseView(this); } }); } }); }
/// <summary> /// Applies required configuration for enabling cache in SDK 1.8.0 version by: /// * Add MemcacheShim runtime installation. /// * Add startup task to install memcache shim on the client side. /// * Add default memcache internal endpoint. /// * Add cache diagnostic to local resources. /// * Add ClientDiagnosticLevel setting to service configuration. /// * Adjust web.config to enable auto discovery for the caching role. /// </summary> /// <param name="azureService">The azure service instance</param> /// <param name="webRole">The web role to enable caching on</param> /// <param name="isWebRole">Flag indicating if the provided role is web or not</param> /// <param name="cacheWorkerRole">The memcache worker role name</param> /// <param name="startup">The role startup</param> /// <param name="endpoints">The role endpoints</param> /// <param name="localResources">The role local resources</param> /// <param name="configurationSettings">The role configuration settings</param> private void Version180Configuration( AzureService azureService, string roleName, bool isWebRole, string cacheWorkerRole, Startup startup, Endpoints endpoints, LocalResources localResources, ref DefConfigurationSetting[] configurationSettings) { if (isWebRole) { // Generate cache scaffolding for web role azureService.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WebRole.ToString()), roleName, new Dictionary<string, object>()); // Adjust web.config to enable auto discovery for the caching role. string webCloudConfigPath = Path.Combine(azureService.Paths.RootPath, roleName, Resources.WebCloudConfig); string webConfigPath = Path.Combine(azureService.Paths.RootPath, roleName, Resources.WebConfigTemplateFileName); UpdateWebConfig(roleName, cacheWorkerRole, webCloudConfigPath); UpdateWebConfig(roleName, cacheWorkerRole, webConfigPath); } else { // Generate cache scaffolding for worker role Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters[ScaffoldParams.RoleName] = cacheWorkerRole; azureService.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WorkerRole.ToString()), roleName, parameters); } // Add startup task to install memcache shim on the client side. string cacheRuntimeUri = CloudRuntimeCollection.GetRuntimeUrl(Resources.CacheRuntimeValue, CacheRuntimeVersion); Debug.Assert(!string.IsNullOrEmpty(cacheRuntimeUri)); Variable emulated = new Variable { name = Resources.EmulatedKey, RoleInstanceValue = new RoleInstanceValueElement { xpath = "/RoleEnvironment/Deployment/@emulated" } }; Variable[] env = { emulated, new Variable { name = Resources.CacheRuntimeUrl, value = cacheRuntimeUri } }; Task shimStartupTask = new Task { Environment = env, commandLine = Resources.CacheStartupCommand, executionContext = ExecutionContext.elevated }; startup.Task = CloudServiceUtilities.ExtendArray<Task>(startup.Task, shimStartupTask); // Add default memcache internal endpoint. InternalEndpoint memcacheEndpoint = new InternalEndpoint { name = Resources.MemcacheEndpointName, protocol = InternalProtocol.tcp, port = Resources.MemcacheEndpointPort }; endpoints.InternalEndpoint = CloudServiceUtilities.ExtendArray<InternalEndpoint>(endpoints.InternalEndpoint, memcacheEndpoint); // Enable cache diagnostic LocalStore localStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; localResources.LocalStorage = CloudServiceUtilities.ExtendArray<LocalStore>(localResources.LocalStorage, localStore); DefConfigurationSetting diagnosticLevel = new DefConfigurationSetting { name = Resources.CacheClientDiagnosticLevelAssemblyName }; configurationSettings = CloudServiceUtilities.ExtendArray<DefConfigurationSetting>(configurationSettings, diagnosticLevel); // Add ClientDiagnosticLevel setting to service configuration. AddClientDiagnosticLevelToConfig(azureService.Components.GetCloudConfigRole(roleName)); AddClientDiagnosticLevelToConfig(azureService.Components.GetLocalConfigRole(roleName)); }
public static void Headimg_getWX(object re) { // LocalStore.DelUids(LocalStore.GetLocal (LocalStore.LOCAL_UID)); LocalStore.SetUids(LocalStore.GetLocal(LocalStore.LOCAL_UID), LocalStore.GetLocal(LocalStore.LOCAL_UNAME), LocalStore.GetLocal(LocalStore.LOCAL_PWD), Ex_Local.LOGIN_TYPE_WEIXIN, ""); LocalStore.SetLocal(LocalStore.OTHER_HEADIMG + ModelManager.inst.userModel.uid, LocalStore.GetLocal(LocalStore.OTHER_HEADIMG)); DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME)); }
internal async Task EnsureFolders(IObjectStore parentStore, LocalRecordStoreTable recordStoreTable) { IObjectStore root = await parentStore.CreateChildStoreAsync(m_record.ID); IObjectStore child; child = await root.CreateChildStoreAsync("Data"); var itemStore = new LocalItemStore(child, (recordStoreTable != null) ? recordStoreTable.ItemCache : null); m_dataStore = new SynchronizedStore(m_record, itemStore); child = await root.CreateChildStoreAsync("Metadata"); m_metadataStore = new LocalStore(child); child = await root.CreateChildStoreAsync("Blobs"); m_blobs = new LocalStore(child); }
public override void Init() { GRoot.inst.touchable = false; base.Init(); this.Create(Config.VIEW_AD); // fightData = this.GetChild("n0").asImage; ad = this.GetChild("n10").asImage; isFight = (typeAd == ModelShare.SHARE_FIGHT); ad.visible = !isFight; // killAll = this.GetChild("n3").asTextField; killPass = this.GetChild("n4").asTextField; hertAll = this.GetChild("n5").asTextField; score = this.GetChild("n6").asTextField; name = this.GetChild("n7").asTextField; QRcode = this.GetChild("n8").asLoader; // // GameObject cutCamera = new GameObject(); cutCamera.name = "cutCamera"; Vector3 mCa = StageCamera.main.transform.localPosition; camera = cutCamera.AddComponent <Camera> (); camera.clearFlags = CameraClearFlags.SolidColor; camera.farClipPlane = StageCamera.main.farClipPlane; camera.nearClipPlane = StageCamera.main.nearClipPlane; camera.orthographic = true; camera.depth = StageCamera.main.depth - 1; camera.orthographicSize = StageCamera.main.orthographicSize; camera.backgroundColor = Color.white; camera.transform.localPosition = new Vector3(-mCa.x, mCa.y, 0); camera.useOcclusionCulling = false; // float nw = (this.width / this.height) * GRoot.inst.height; this.height = GRoot.inst.height; this.width = nw; // this.group.x = -(GRoot.inst.width * 0.5f) - (this.width * 0.5f); this.group.y = 0; // Debug.LogError(":: >> "+this.view.width+" | "+this.view.actualWidth+" | "+this.view.viewWidth + " | "+GRoot.inst.scale.y.ToString()); // userModel = ModelManager.inst.userModel; shareModel = ModelManager.inst.shareModel; fightModel = ModelManager.inst.fightModel; // if (isFight) { object[] arr = (object[])fightModel.fightData["my_data"]; bool isNotCustom = false; if (arr [0] is object[]) { isNotCustom = true; } // Debug.Log (isNotCustom); if (isNotCustom) { score.text = ((object[])arr [0]) [0] + ""; killAll.text = ((object[])arr [1]) [0] + ""; killPass.text = ((object[])arr [2]) [0] + ""; hertAll.text = ((object[])arr [3]) [0] + ""; } else { score.text = (arr [0]) + ""; killAll.text = (arr [1]) + ""; killPass.text = (arr [2]) + ""; hertAll.text = (arr [3]) + ""; } name.text = userModel.GetUName(); } // shareUrl = DataManager.inst.systemSimple["share_url"] + userModel.uid; // string qr = LocalStore.GetLocal(LocalStore.LOCAL_QRCODE + userModel.uid); if (qr != "" && qr != null && qr.Length > 0) { QRcode.texture = new NTexture(PhoneManager.inst.Base64ToTexter2d(qr, 150, 150)); CutBitmap(); } else { LoaderManager.inst.Load(shareUrl + ".jpg", (object w) => { if (this.group == null || this.parent == null) { GRoot.inst.touchable = true; return; } Texture2D topImage = (Texture2D)w; if (w != null && w != null && QRcode != null) { if (this.group == null) { return; } QRcode.texture = new NTexture(topImage); // Log.debug("topImage:"+topImage); // Log.debug("erBg"+erBg); LocalStore.SetLocal(LocalStore.LOCAL_QRCODE + userModel.uid, Convert.ToBase64String(topImage.EncodeToJPG())); // share_bitmap = ComposeImage(baseImage, topImage); CutBitmap(); } }, (object error) => { GRoot.inst.touchable = true; }); } }
/// <summary> /// The implementation of abstract method DefineTables. /// </summary> protected override void DefineTables() { LocalStore.DefineTable <TodoItem>(); }
private void InitView() { // InitTitle(Tools.GetMessageById("33102")); GTextField text1 = GetChild("n8").asTextField; GTextField text2 = GetChild("n9").asTextField; GTextField text3 = GetChild("n10").asTextField; text1.text = Tools.GetMessageById("13097") + ":"; text2.text = Tools.GetMessageById("13098") + ":"; text3.text = Tools.GetMessageById("13099") + ":"; input_phone = this.GetChild("n2").asCom.GetChild("n1").asTextInput; input_phone.maxLength = 11; //input_phone.promptText = Tools.GetMessageById("13097"); input_code = this.GetChild("n5").asCom.GetChild("n1").asTextInput; input_code.maxLength = (int)DataManager.inst.systemSimple["code_num"]; //input_code.promptText = Tools.GetMessageById("13098"); input_password = this.GetChild("n4").asCom.GetChild("n1").asTextInput; //input_password.promptText = Tools.GetMessageById("13099"); input_password.maxLength = (int)DataManager.inst.systemSimple["password_num"]; input_password.restrict = Config.REG_NUMORABC; btn_send = this.GetChild("n6").asButton; btn_send.text = Tools.GetMessageById("13077"); btn_send.onClick.Add(() => { if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { string param = "tel_num=" + input_phone.text; NetHttp.inst.Send(NetBase.HTTP_GETBACKSIGN, param, (VoHttp v) => { Debug.Log(v.data);//true if ((bool)v.data) { ViewManager.inst.ShowText(Tools.GetMessageById("13049")); timer = ModelManager.inst.gameModel.time; btn_send.touchable = false; btn_send.grayed = true; TimerManager.inst.Add(1f, 0, Timer); } }); } }); btn_ok = this.GetChild("n7").asButton; btn_ok.text = Tools.GetMessageById("13159"); btn_ok.onClick.Add(() => { if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else if (input_password.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("10011")); } else if (input_code.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13034")); } else { string param = "tel_num=" + input_phone.text; param += "|pwd=" + input_password.text; param += "|sign=" + input_code.text; NetHttp.inst.Send(NetBase.HTTP_CHANGEGETBACKPWD, param, (VoHttp v) => { Dictionary <string, object> re = (Dictionary <string, object>)v.data; userModel.SetData(re); // LocalStore.SetLocal(LocalStore.LOCAL_UNAME, re["uname"].ToString()); LocalStore.SetLocal(LocalStore.LOCAL_UID, userModel.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, userModel.pwd); //re["pwd"].ToString() // List<string[]> plist=LocalStore.GetUids(); // List<string> uList = new List<string>(); // foreach(string[] dic in plist) // { // uList.Add(dic[0]); // } // if (uList.Contains(re["uid"].ToString())) // LocalStore.DelUids(userModel.uid); LocalStore.SetUids(userModel.uid, userModel.uname, userModel.pwd, userModel.type_login, userModel.tel); // ViewManager.inst.CloseView(this); // roleModel.uids.Clear(); // ViewManager.inst.ShowScene<MediatorMain>(); DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME)); }); } }); }
private static void CacheClientCommonConfiguration( CloudServiceProject cloudServiceProject, string roleName, bool isWebRole, string cacheWorkerRole, Startup startup, Endpoints endpoints, LocalResources localResources, ref DefinitionConfigurationSetting[] configurationSettings) { if (isWebRole) { // Generate cache scaffolding for web role cloudServiceProject.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WebRole.ToString()), roleName, new Dictionary<string, object>()); // Adjust web.config to enable auto discovery for the caching role. string webCloudConfigPath = Path.Combine(cloudServiceProject.Paths.RootPath, roleName, Resources.WebCloudConfig); string webConfigPath = Path.Combine(cloudServiceProject.Paths.RootPath, roleName, Resources.WebConfigTemplateFileName); UpdateWebConfig(roleName, cacheWorkerRole, webCloudConfigPath); UpdateWebConfig(roleName, cacheWorkerRole, webConfigPath); } else { // Generate cache scaffolding for worker role Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters[ScaffoldParams.RoleName] = cacheWorkerRole; cloudServiceProject.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WorkerRole.ToString()), roleName, parameters); } // Add default memcache internal endpoint. InternalEndpoint memcacheEndpoint = new InternalEndpoint { name = Resources.MemcacheEndpointName, protocol = InternalProtocol.tcp, port = Resources.MemcacheEndpointPort }; endpoints.InternalEndpoint = GeneralUtilities.ExtendArray<InternalEndpoint>(endpoints.InternalEndpoint, memcacheEndpoint); // Enable cache diagnostic LocalStore localStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; localResources.LocalStorage = GeneralUtilities.ExtendArray<LocalStore>(localResources.LocalStorage, localStore); DefinitionConfigurationSetting diagnosticLevel = new DefinitionConfigurationSetting { name = Resources.CacheClientDiagnosticLevelAssemblyName }; configurationSettings = GeneralUtilities.ExtendArray<DefinitionConfigurationSetting>(configurationSettings, diagnosticLevel); // Add ClientDiagnosticLevel setting to service configuration. AddClientDiagnosticLevelToConfig(cloudServiceProject.Components.GetCloudConfigRole(roleName)); AddClientDiagnosticLevelToConfig(cloudServiceProject.Components.GetLocalConfigRole(roleName)); }
public static void QQ_auth_code(object re) { string code = (string)re; // string param = "code=" + code; string param = "pf=" + PlatForm.inst.pf; param += "|utype=" + Ex_Local.LOGIN_TYPE_QQ; param += "|ustr=" + code; // param += "|pwd=" + pwd; PlatForm.inst.GetSdk().Call(Ex_Local.TRACE, new string[] { "QQ_auth_code :: " + param }, null); NetHttp.inst.Send(NetBase.HTTP_LOGIN, param, (VoHttp v) => { Dictionary <string, object> user = (Dictionary <string, object>)v.data; ModelManager.inst.userModel.SetData(user); // LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_QQ); // LocalStore.SetUids(ModelManager.inst.userModel.uid, ModelManager.inst.userModel.uname, ModelManager.inst.userModel.pwd, Ex_Local.LOGIN_TYPE_QQ, headstr); // LocalStore.Set_QQ_Info(ModelManager.inst.userModel.uid, LocalStore.GetLocal(LocalStore.QQ_OPENID), LocalStore.GetLocal(LocalStore.QQ_TOKEN), LocalStore.GetLocal(LocalStore.QQ_DATE)); LocalStore.SetLocal(LocalStore.LOCAL_UID, ModelManager.inst.userModel.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, ModelManager.inst.userModel.pwd); // LocalStore.SetLocal (LocalStore.LOCAL_UNAME,userModel.uname); LocalStore.SetLocal(LocalStore.OTHER_HEADIMG + ModelManager.inst.userModel.uid, LocalStore.GetLocal(LocalStore.OTHER_HEADIMG)); DispatchManager.inst.Dispatch(new MainEvent(MainEvent.RELOGIN_GAME)); }); }
public override void Init() { base.Init(); this.Create(Config.VIEW_ITEMCADRGET); // view.x = view.GetChild("n2").x; // view.y = view.GetChild ("n2").y + 50; user = ModelManager.inst.userModel.records ["daily_box"] as Dictionary <string, object>; if (user ["refresh_time"] != null) { DateTime date = (DateTime)user ["refresh_time"]; if ((date.Ticks / 10000) < Tools.GetSystemSecond()) { LocalStore.SetLocal(LocalStore.LOCAL_SHOPRED, "1"); NetHttp.inst.Send(NetBase.HTTP_REFRESH_DAILY_BOX, "", OnRefreshBox); } else { TimerManager.inst.Add(1f, 0, Time_Tick); } } else { LocalStore.SetLocal(LocalStore.LOCAL_SHOPRED, "1"); NetHttp.inst.Send(NetBase.HTTP_REFRESH_DAILY_BOX, "", OnRefreshBox); } con = (Dictionary <string, object>)cfg ["box"]; listData = new Dictionary <string, object> (); listData ["0"] = (Dictionary <string, object>)cfg ["daily_box"]; int listIndex = 1; Dictionary <string, object> effcfg = (Dictionary <string, object>)DataManager.inst.effort ["effort_cond"]; for (int i = con.Keys.Count; i >= 1; i--) { if (i >= effcfg.Count + 2) { continue; } Dictionary <string, object> data = (Dictionary <string, object>)con ["Lv" + i]; if (ModelManager.inst.userModel.effort_lv >= (int)data ["effort_lv"]) { listData [listIndex + ""] = con ["Lv" + i]; (listData [listIndex + ""] as Dictionary <string, object>) ["id"] = i; listIndex++; } else { haveSuo = i; } } if (haveSuo != 0) { listData [listIndex + ""] = con ["Lv" + haveSuo]; } list1 = this.GetChild("n0").asList; List <object> list = new List <object> (listData.Values); // list1.width = MediatorShop.thiswidth; list1.itemRenderer = List_Render1; // list1.SetVirtual (); ViewManager.inst.ShowViewCallLaterRequest(() => { list1.numItems = list.Count + 2; }); if (list.Count < 4) { list1.scrollPane.touchEffect = false; } DispatchManager.inst.Register(MainEvent.DAY_BOX_BUY, OnBoxBuyFun); }
public void SetLove(bool love) { LocalStore.SetLocal(LocalStore.GUIDE_LOVE, "1"); }
/// <summary> /// Configure the worker role for caching by: /// * Add caching module to the role imports. /// * Enable caching Diagnostic store. /// * Remove input endpoints. /// * Add caching configuration settings. /// </summary> /// <param name="rootPath"></param> /// <param name="nodeWorkerRole"></param> /// <returns></returns> private AzureService Version180Configuration(string rootPath, RoleInfo nodeWorkerRole) { // Fetch cache role information from service definition and service configuration files. AzureService azureService = new AzureService(rootPath, null); WorkerRole cacheWorkerRole = azureService.Components.GetWorkerRole(nodeWorkerRole.Name); RoleSettings cacheRoleSettings = azureService.Components.GetCloudConfigRole(nodeWorkerRole.Name); // Add caching module to the role imports cacheWorkerRole.Imports = General.ExtendArray<Import>(cacheWorkerRole.Imports, new Import { moduleName = Resources.CachingModuleName }); // Enable caching Diagnostic store. LocalStore diagnosticStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; cacheWorkerRole.LocalResources = General.InitializeIfNull<LocalResources>(cacheWorkerRole.LocalResources); cacheWorkerRole.LocalResources.LocalStorage = General.ExtendArray<LocalStore>(cacheWorkerRole.LocalResources.LocalStorage, diagnosticStore); // Remove input endpoints. cacheWorkerRole.Endpoints.InputEndpoint = null; // Add caching configuration settings List<ConfigConfigurationSetting> cachingConfigSettings = new List<ConfigConfigurationSetting>(); cachingConfigSettings.Add(new ConfigConfigurationSetting { name = Resources.NamedCacheSettingName, value = Resources.NamedCacheSettingValue }); cachingConfigSettings.Add(new ConfigConfigurationSetting { name = Resources.DiagnosticLevelName, value = Resources.DiagnosticLevelValue}); cachingConfigSettings.Add(new ConfigConfigurationSetting { name = Resources.CachingCacheSizePercentageSettingName, value = string.Empty }); cachingConfigSettings.Add(new ConfigConfigurationSetting { name = Resources.CachingConfigStoreConnectionStringSettingName, value = string.Empty }); cacheRoleSettings.ConfigurationSettings = General.ExtendArray<ConfigConfigurationSetting>(cacheRoleSettings.ConfigurationSettings, cachingConfigSettings); return azureService; }
// private void OnSendHandler (VoHttp vo) // { // int addExp = (int)(((Dictionary<string,object>)vo.data) ["add_exp"]); // Dictionary<string,object> d = new Dictionary<string, object> (); // d.Add (Config.ASSET_EXP, addExp); // ViewManager.inst.ShowIcon (d,()=>{ // ModelManager.inst.userModel.UpdateData (vo.data); // DispatchManager.inst.Dispatch (new MainEvent (MainEvent.RED_UPDATE)); // }); // } public void Login(string type, string uid, string pwd, Action fun, bool isChange = false) { string param = "pf=" + PlatForm.inst.pf; string loginType = type; if (loginType == "") { // LocalStore.SetLocal (LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_UID);// } else { if (type == Ex_Local.LOGIN_TYPE_TEL || type == Ex_Local.LOGIN_TYPE_QQ || type == Ex_Local.LOGIN_TYPE_WEIXIN) { if (!isChange) { loginType = Ex_Local.LOGIN_TYPE_UID; } } param += "|utype=" + loginType; param += "|ustr=" + uid; param += "|pwd=" + pwd; } string idn; // if (ModelManager.inst.gameModel.loginDoubel) // { // param = "pf=" + PlatForm.inst.pf; // idn = LocalStore.GetLocal (LocalStore.LOCAL_IDNUM); // string[] ids; // if (idn == "") // { // idn = "0"; // } // else // { // idn = idn == "0" ? "1" : "0"; // } // LocalStore.SetLocal (LocalStore.LOCAL_IDNUM, idn); // string idse = LocalStore.GetLocal (LocalStore.LOCAL_IDS + idn); // if (idse != "") // { // ids = idse.Split (','); // uid = ids [0].ToString (); // pwd = ids [1].ToString (); // param += "|utype="+Ex_Local.LOGIN_TYPE_UID; // param += "|ustr=" + uid; // param += "|pwd=" + pwd; // } // else // { // uid = ""; // pwd = ""; // } // } // ViewManager.inst.ShowAlert (type+ " - Login Params - " + param); // Debug.LogError ("Login-----"); NetHttp.inst.Send(NetBase.HTTP_LOGIN, param, (VoHttp v) => { Dictionary <string, object> re = (Dictionary <string, object>)v.data; this.SetData(re); //Debug.LogError("start" + ModelManager.inst.userModel.season["start_time"] + "%%%%%%%%%% end" + ModelManager.inst.userModel.season["end_time"]); if (this.country == 0) { PhoneManager.inst.GetGps(GetGps); } // if (type != "") { LocalStore.SetLocal(LocalStore.LOCAL_TYPE, type); } else { LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_UID); // } LocalStore.SetUids(this.uid, this.uname, this.pwd, Ex_Local.LOGIN_TYPE_UID, this.tel); // LocalStore.SetLocal(LocalStore.LOCAL_UID, this.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, this.pwd); if (ModelManager.inst.gameModel.loginDoubel) { LocalStore.SetLocal(LocalStore.LOCAL_IDS + LocalStore.GetLocal(LocalStore.LOCAL_IDNUM), this.uid + "," + this.pwd); } if (!isChange) { Main.inst.Socket_Close(); Main.inst.Socket_Start(); ModelManager.inst.Clear(); } if (fun != null) { fun(); } }, '|', (VoHttp vo) => { // if (vo.return_code.Equals ("10001") || vo.return_code.Equals ("10002") || vo.return_code.Equals ("10003")) // { // List<string[]> pList = new List<string[]> (); // List<string> uList = new List<string> (); // foreach (string[] v in pList) // { // uList.Add (v [0]); // } // if (uList.Contains (uid)) // LocalStore.DelUids (uid); if (!isChange) { LocalStore.SetLocal(LocalStore.LOCAL_UID, ""); LocalStore.SetLocal(LocalStore.LOCAL_TYPE, ""); LocalStore.SetLocal(LocalStore.LOCAL_PWD, ""); } // } // //检测头像是否不合格 // Tools.checkHead(); }); }
private ILocalStore CreateUnmockedStore() { var local = new LocalStore("Forex.Test.Manifest"); return(local); }
/// <summary> /// 主程序入口 /// </summary> /// <param name="args"></param> public override void Run(object[] args) { //1. 初始化 Init(args); DataStore = new LocalStore<Template.Question>(GetRootFolder() + "\\QuestionData.index", GetRootFolder() + "\\QuestionData", 100); //1.1 文本索引文件 _textIndexFile = GetRootFolder() + "\\InvertFragment.part"; if (File.Exists(_textIndexFile)) TextFragment = Serializer.DeserializeFromFile<InvertFragment>(_textIndexFile); if (TextFragment == null) { TextFragment = new InvertFragment(GetRootFolder()); } //1.2 相关索引文件 _relativeIndexFile = GetRootFolder() + "\\RelativeFragment.part"; if (File.Exists(_relativeIndexFile)) RelativeTable = Serializer.DeserializeFromFile<DimensionTable<string, string, double>>(_relativeIndexFile); if (RelativeTable == null) { RelativeTable = new DimensionTable<string, string, double>(); } Urls.Add("http://www.baike.com"); //StartSearcher(); Thread searchThread = new Thread(StartSearcher); searchThread.Start(); Thread.Sleep(10000); //2. 循环数据采集 while (Urls.Count > 0) { List<Page> pages = new List<Page>(); try { //2.1 爬虫开始运行 Crawler(ref pages); } catch (Exception exception) { Logger.Warn(exception); } //2.2 索引器开始运行 if (pages != null && pages.Count > 0) { try { Indexer(ref pages); } catch (Exception exception) { Logger.Warn(exception); } } //2.3 更新url try { Urls.AddRange(GetKeysByValueFromCache(false, 10, true)); } catch (Exception exception) { Logger.Warn(exception); } } }
private void InitItem() { // InitTitle(Tools.GetMessageById("33101")); group1 = GetChild("n9").asGroup; group2 = GetChild("n10").asGroup; textTitle = GetChild("n6").asTextField; textTitle.text = Tools.GetMessageById("13128"); btnOk = GetChild("n7").asButton; btnOk.text = Tools.GetMessageById("13079"); btnCancel = GetChild("n8").asButton; btnCancel.text = Tools.GetMessageById("14025"); group2.visible = true; userName = this.GetChild("n5").asComboBox; // userName.onChanged.Add (() => // { // uname = userName.text; // }); //GObject obj= this.GetChild("n3"); //obj.visible = false; // input_password = obj.asCom.GetChild ("n1").asTextInput; // input_password.promptText = Tools.GetMessageById ("13084"); // input_password.maxLength = (int)DataManager.inst.systemSimple["password_num"]; // input_password.restrict = Config.REG_NUMORABC; // input_password.displayAsPassword = true; List <string[]> pList = LocalStore.GetUids(); string[] myItem = new string[] { }; foreach (string[] dic in pList) { if (dic[0] == userModel.uid) { myItem = dic; pList.Remove(dic); break; } } // string[] tempItem= pList[0]; // pList[pList.IndexOf(myItem)] = tempItem; // pList[0] = myItem; // if (pList.Count != 0) // { foreach (string[] dic in pList) { ulist.Add(dic[1]); // if (dic [0] != userModel.uid) { // ulist.Add (dic [1]); //} } ulist.Add(Tools.GetMessageById("13066")); userName.items = ulist.ToArray(); // uid = ((object[])pList[0])[0].ToString(); // uname = ((object[])pList[0])[1].ToString(); // pwd = myItem[2]; // utype = ((object[])pList[0])[3].ToString(); uInfo = myItem; userName.onChanged.Add(() => { if (userName.selectedIndex == ulist.Count - 1) { ViewManager.inst.CloseView(); ViewManager.inst.ShowView <MediatorChangeAccountIcon>(); } else { uInfo = (string[])pList[userName.selectedIndex]; if (uInfo[0].ToString() == userModel.uid) { ViewManager.inst.CloseView(this); } else { group1.visible = true; group2.visible = false; // pwd = uInfo[2].ToString(); // utype = uInfo[3].ToString(); } } }); // } // else // { // //userName.text = Tools.GetMessageById ("13102"); userName.text = userModel.uname; // } btn_ok = this.GetChild("n0").asButton; btn_ok.text = Tools.GetMessageById("13076"); btnCancel.onClick.Add(() => { ViewManager.inst.CloseView(); }); btnOk.onClick.Add(() => { if (userName.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13033")); } else { if (uInfo != null && uInfo.Length > 0) { Send(uInfo[0], uInfo[2], uInfo[3]); } } }); btn_ok.onClick.Add(() => { if (userName.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13033")); } else { if (uInfo != null && uInfo.Length > 0) { Send(uInfo[0], uInfo[2], uInfo[3]); } } }); }
private void InitItem() { // InitTitle(Tools.GetMessageById("33105")); input_phone = this.GetChild("n4").asCom.GetChild("n1").asTextInput; input_phone.maxLength = 11; //input_phone.promptText = Tools.GetMessageById("13086")+":"; input_code = this.GetChild("n5").asCom.GetChild("n1").asTextInput; input_code.maxLength = (int)DataManager.inst.systemSimple["code_num"]; //input_code.promptText = Tools.GetMessageById("13098"); GetChild("n8").asTextField.text = Tools.GetMessageById("13140") + ":"; GetChild("n9").asTextField.text = Tools.GetMessageById("13098") + ":"; btn_send = this.GetChild("n6").asButton; btn_send.text = Tools.GetMessageById("13077"); btn_send.onClick.Add(() => { if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { if (input_phone.text.Equals(Tools.GetUserTel(userModel.tel)[1])) { ViewManager.inst.ShowText(Tools.GetMessageById("13142")); } else { string param = "tel_num=" + input_phone.text; NetHttp.inst.Send(NetBase.HTTP_VALIDATE, param, (VoHttp v) => { // Debug.Log(v.data);//true // if ((bool)v.data) // { ViewManager.inst.ShowText(Tools.GetMessageById("13049")); timer = ModelManager.inst.gameModel.time; btn_send.touchable = false; btn_send.grayed = true; TimerManager.inst.Add(1f, 0, Timer); // } }); } } }); btn_ok = this.GetChild("n7").asButton; btn_ok.text = Tools.GetMessageById("13079"); btn_ok.onClick.Add(() => { if (input_code.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13034")); } else if (input_phone.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { string param = "sign=" + input_code.text; NetHttp.inst.Send(NetBase.HTTP_REGIST, param, (VoHttp v) => { // Debug.Log(v.data); // if ((bool)v.data) // { LocalStore.SetLocal(LocalStore.LOCAL_UID, userModel.uid); LocalStore.SetLocal(LocalStore.LOCAL_PWD, (string)v.data); LocalStore.SetLocal(LocalStore.LOCAL_TYPE, Ex_Local.LOGIN_TYPE_TEL); LocalStore.SetLocal(LocalStore.LOCAL_TEL, input_phone.text); // userModel.tel = Ex_Local.LOGIN_TYPE_TEL + "|" + input_phone.text; // LocalStore.DelUids(userModel.uid); LocalStore.SetUids(userModel.uid, userModel.uname, (string)v.data, Ex_Local.LOGIN_TYPE_TEL, userModel.tel); // Dictionary <string, object> dc = new Dictionary <string, object>(); dc.Add("value", ""); dc.Add("tag", "chphone"); DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc)); ViewManager.inst.CloseView(this); // } }); } }); }
private void AssertCachingEnabled( FileSystemHelper files, string serviceName, string rootPath, string webRoleName, string expectedMessage) { WebRole webRole = Testing.GetWebRole(rootPath, webRoleName); RoleSettings roleSettings = Testing.GetCloudRole(rootPath, webRoleName); AzureAssert.RuntimeUrlAndIdExists(webRole.Startup.Task, Resources.CacheRuntimeValue); Assert.AreEqual<string>(Resources.CacheRuntimeVersionKey, webRole.Startup.Task[0].Environment[0].name); Assert.AreEqual<string>(enableCacheCmdlet.CacheRuntimeVersion, webRole.Startup.Task[0].Environment[0].value); Assert.AreEqual<string>(Resources.EmulatedKey, webRole.Startup.Task[2].Environment[0].name); Assert.AreEqual<string>("/RoleEnvironment/Deployment/@emulated", webRole.Startup.Task[2].Environment[0].RoleInstanceValue.xpath); Assert.AreEqual<string>(Resources.CacheRuntimeUrl, webRole.Startup.Task[2].Environment[1].name); Assert.AreEqual<string>(TestResources.CacheRuntimeUrl, webRole.Startup.Task[2].Environment[1].value); Assert.AreEqual(1, webRole.Startup.Task.Count(t => t.commandLine.Equals(Resources.CacheStartupCommand))); AzureAssert.ScaffoldingExists(Path.Combine(files.RootPath, serviceName, webRoleName), Path.Combine(Resources.CacheScaffolding, Resources.WebRole)); AzureAssert.StartupTaskExists(webRole.Startup.Task, Resources.CacheStartupCommand); AzureAssert.InternalEndpointExists(webRole.Endpoints.InternalEndpoint, new InternalEndpoint { name = Resources.MemcacheEndpointName, protocol = InternalProtocol.tcp, port = Resources.MemcacheEndpointPort }); LocalStore localStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; AzureAssert.LocalResourcesLocalStoreExists(localStore, webRole.LocalResources); DefinitionConfigurationSetting diagnosticLevel = new DefinitionConfigurationSetting { name = Resources.CacheClientDiagnosticLevelAssemblyName }; AzureAssert.ConfigurationSettingExist(diagnosticLevel, webRole.ConfigurationSettings); ConfigConfigurationSetting clientDiagnosticLevel = new ConfigConfigurationSetting { name = Resources.ClientDiagnosticLevelName, value = Resources.ClientDiagnosticLevelValue }; AzureAssert.ConfigurationSettingExist(clientDiagnosticLevel, roleSettings.ConfigurationSettings); AssertWebConfig(string.Format(@"{0}\{1}\{2}", rootPath, webRoleName, Resources.WebCloudConfig)); AssertWebConfig(string.Format(@"{0}\{1}\{2}", rootPath, webRoleName, Resources.WebConfigTemplateFileName)); Assert.AreEqual<string>(expectedMessage, mockCommandRuntime.VerboseStream[0]); Assert.AreEqual<string>(webRoleName, (mockCommandRuntime.OutputPipeline[0] as PSObject).GetVariableValue<string>(Parameters.RoleName)); }
/// <summary> /// Applies required configuration for enabling cache in SDK 1.8.0 version by: /// * Add MemcacheShim runtime installation. /// * Add startup task to install memcache shim on the client side. /// * Add default memcache internal endpoint. /// * Add cache diagnostic to local resources. /// * Add ClientDiagnosticLevel setting to service configuration. /// * Adjust web.config to enable auto discovery for the caching role. /// </summary> /// <param name="cloudServiceProject">The azure service instance</param> /// <param name="webRole">The web role to enable caching on</param> /// <param name="isWebRole">Flag indicating if the provided role is web or not</param> /// <param name="cacheWorkerRole">The memcache worker role name</param> /// <param name="startup">The role startup</param> /// <param name="endpoints">The role endpoints</param> /// <param name="localResources">The role local resources</param> /// <param name="configurationSettings">The role configuration settings</param> private void Version180Configuration( CloudServiceProject cloudServiceProject, string roleName, bool isWebRole, string cacheWorkerRole, Startup startup, Endpoints endpoints, LocalResources localResources, ref DefinitionConfigurationSetting[] configurationSettings) { if (isWebRole) { // Generate cache scaffolding for web role cloudServiceProject.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WebRole.ToString()), roleName, new Dictionary <string, object>()); // Adjust web.config to enable auto discovery for the caching role. string webCloudConfigPath = Path.Combine(cloudServiceProject.Paths.RootPath, roleName, Resources.WebCloudConfig); string webConfigPath = Path.Combine(cloudServiceProject.Paths.RootPath, roleName, Resources.WebConfigTemplateFileName); UpdateWebConfig(roleName, cacheWorkerRole, webCloudConfigPath); UpdateWebConfig(roleName, cacheWorkerRole, webConfigPath); } else { // Generate cache scaffolding for worker role Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters[ScaffoldParams.RoleName] = cacheWorkerRole; cloudServiceProject.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WorkerRole.ToString()), roleName, parameters); } // Add default memcache internal endpoint. InternalEndpoint memcacheEndpoint = new InternalEndpoint { name = Resources.MemcacheEndpointName, protocol = InternalProtocol.tcp, port = Resources.MemcacheEndpointPort }; endpoints.InternalEndpoint = General.ExtendArray <InternalEndpoint>(endpoints.InternalEndpoint, memcacheEndpoint); // Enable cache diagnostic LocalStore localStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; localResources.LocalStorage = General.ExtendArray <LocalStore>(localResources.LocalStorage, localStore); DefinitionConfigurationSetting diagnosticLevel = new DefinitionConfigurationSetting { name = Resources.CacheClientDiagnosticLevelAssemblyName }; configurationSettings = General.ExtendArray <DefinitionConfigurationSetting>(configurationSettings, diagnosticLevel); // Add ClientDiagnosticLevel setting to service configuration. AddClientDiagnosticLevelToConfig(cloudServiceProject.Components.GetCloudConfigRole(roleName)); AddClientDiagnosticLevelToConfig(cloudServiceProject.Components.GetLocalConfigRole(roleName)); }
private void InitView() { // InitTitle(Tools.GetMessageById("33104")); userModel = ModelManager.inst.userModel; input_pwd = this.GetChild("n4").asCom.GetChild("n1").asTextInput; //input_pwd.promptText = Tools.GetMessageById("13101"); input_pwd.maxLength = (int)DataManager.inst.systemSimple["password_num"]; input_pwd.restrict = Config.REG_NUMORABC; input_newpwd = this.GetChild("n3").asCom.GetChild("n1").asTextInput; //input_newpwd.promptText = Tools.GetMessageById("13099"); input_newpwd.maxLength = (int)DataManager.inst.systemSimple["password_num"]; input_newpwd.restrict = Config.REG_NUMORABC; GetChild("n8").asTextField.text = Tools.GetMessageById("13101") + ":"; GetChild("n9").asTextField.text = Tools.GetMessageById("13099") + ":"; btn_ok = this.GetChild("n0").asButton; btn_ok.text = Tools.GetMessageById("13079"); btn_ok.onClick.Add(() => { if (input_newpwd.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13037")); } else if (input_pwd.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13036")); } else { string pwd_ = Tools.MD5(input_pwd.text); if (!pwd_.Equals(userModel.pwd)) { ViewManager.inst.ShowText(Tools.GetMessageById("13143")); } else { // if (input_pwd.text.Equals(LocalStore.GetLocal(LocalStore.LOCAL_PWD))) // { string param = "old_pwd=" + input_pwd.text; param += "|pwd=" + input_newpwd.text; NetHttp.inst.Send(NetBase.HTTP_CHANGEPWD, param, (VoHttp v) => { //"25f9e794323b453885f5181f1b624d0b" if ((string)v.data != string.Empty) { string pwd = (string)v.data; LocalStore.SetLocal(LocalStore.LOCAL_PWD, pwd); userModel.pwd = v.data.ToString(); // LocalStore.DelUids(userModel.uid); LocalStore.SetUids(userModel.uid, userModel.uname, pwd, userModel.type_login, userModel.tel); Dictionary <string, object> dc = new Dictionary <string, object>(); dc.Add("value", ""); dc.Add("tag", "password"); DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc)); ViewManager.inst.CloseView(this); } }); // } // else // { // ViewManager.inst.ShowText(Tools.GetMessageById("13067")); // } } } }); }
public T GetUploadedObject <T>(string alias) { using (var streamReader = new StreamReader(LocalStore.OpenRead(alias))) { return(XmlProvider.Read <T>(streamReader)); } }
public GameStateConsumer(LocalStore localStore) { _localStore = localStore; }
private void FindObject() { input_name = this.GetChild("n5").asCom.GetChild("n1").asTextInput; //input_name.maxLength = (int)DataManager.inst.systemSimple ["name_num"]; input_name.onChanged.Add(() => { input_name.text = Tools.GetStringByLength(input_name.text, (int)DataManager.inst.systemSimple["name_num"]); input_name.text = Tools.StrReplace(input_name.text); }); GetChild("n8").asTextField.text = Tools.GetMessageById("13100") + ":"; btn_ok = this.GetChild("n0").asButton; btn_ok.text = Tools.GetMessageById("13079"); btn_ok.onClick.Add(() => { if (input_name.text == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13033")); } //else if (input_code.text == "") //{ // ViewManager.inst.ShowText (Tools.GetMessageById ("13034")); //} else if (userModel.tel == "") { ViewManager.inst.ShowText(Tools.GetMessageById("13035")); } else { input_name.text = input_name.text.Trim(); if (FilterManager.inst.Exec(input_name.text).IndexOf('*') != -1) { ViewManager.inst.ShowText(Tools.GetMessageById("13139")); } else { input_name.text = input_name.text; Dictionary <string, object> dic = new Dictionary <string, object>(); dic["uname"] = input_name.text; dic["sex"] = ModelManager.inst.userModel.sex; //dic ["sign"] = input_code.text; NetHttp.inst.Send(NetBase.HTTP_CHANGE_NAME, dic, (VoHttp v) => { if ((bool)v.data) { ViewManager.inst.ShowText(Tools.GetMessageById("13144")); // string passWord = ""; // List<string[]> list = LocalStore.GetUids (); // foreach (string[] arr in list) // { // if (arr [0].ToString ()==userModel.uid) // { // passWord = arr [2].ToString (); // break; // } // } userModel.uname = userModel.unameTrue = input_name.text; otherInfo["uname"] = input_name.text; // LocalStore.DelUids (userModel.uid); // if (!Tools.IsNullEmpty (passWord)) // { LocalStore.SetUids(userModel.uid, input_name.text, userModel.pwd, userModel.type_login, userModel.tel); // } // LocalStore.SetLocal (LocalStore.LOCAL_UNAME, input_name.text); Dictionary <string, object> dc = new Dictionary <string, object>(); dc.Add("value", ""); dc.Add("tag", "uname"); DispatchGlobalEvent(new MainEvent(MainEvent.ROLE_UPDATE, dc)); ViewManager.inst.CloseView(this); } }); } } }); }
public static void LocalResourcesLocalStoreExists(LocalStore expected, LocalResources actual) { Assert.IsTrue(Array.Exists <LocalStore>(actual.LocalStorage, l => l.name.Equals(expected.name) && l.cleanOnRoleRecycle.Equals(expected.cleanOnRoleRecycle) && l.sizeInMB.Equals(expected.sizeInMB))); }
public void Clear() { LocalStore.Delete(_tableName); }
public virtual void Dispose() { LocalStore.Dispose(); }
private void List_Render1(int _index, GObject go) { GGraph btn_get = go.asCom.GetChild("n10").asGraph; int index = _index - 1; if (_index == 0 || _index == list1.numItems - 1) { go.width = 10; go.alpha = 0; return; } else { go.width = 190; go.alpha = 1; } go.name = index + ""; GButton btn = go.asButton; btn.RemoveEventListeners(); btn.onClick.Add(() => { if (index == (listData.Keys.Count - 1) && haveSuo != 0) { ViewManager.inst.ShowText(Tools.GetMessageById("17014", new string[] { Tools.GetEffortName(index) })); } else { this.onListItemClick(index); } }); GLoader img_coin = go.asCom.GetChild("n6").asLoader; GTextField l_coin = go.asCom.GetChild("n7").asTextField; GTextField l_time = go.asCom.GetChild("n2").asTextField; GTextField l_level = go.asCom.GetChild("n4").asTextField; GImage img2 = go.asCom.GetChild("n1").asImage; // GLoader l_imag = go.asCom.GetChild ("n9").asLoader; btn.enabled = true; btn_get.visible = false; GameObject asd; if (index == 0) { item0 = go.asCom; Time_Tick(0f); // l_imag.url = Tools.GetResourceUrl ("Image:bg_baoxiang"); Dictionary <string, object> cfg1 = (Dictionary <string, object>)cfg ["daily_box"]; img_coin.url = Tools.GetResourceUrl("Image2:n_icon_xm"); l_level.text = Tools.GetMessageById(cfg1 ["name"].ToString()); if (LocalStore.GetLocal(LocalStore.LOCAL_SHOPRED) == "1") { ModelManager.inst.userModel.Add_Notice(go.asCom, new Vector2(155, 5)); } else { ModelManager.inst.userModel.Remove_Notice(go.asCom); } object[] price = (object[])cfg1 ["price"]; int len = price.GetLength(0) - 3; int axb = ((int)price [len + 1]) * (int)user ["num"] + ((int)price [len + 2]); int pri = (int)user ["num"] > len ? axb : (int)price [(int)user ["num"]]; l_coin.text = pri + ""; // img_coin.y = 363; // img_coin.x = 69; img2.visible = true; go.asCom.GetChild("n13").visible = true; asd = EffectManager.inst.AddEffect(Tools.GetExploreBoxID(cfg1 ["picture"].ToString()), "stand", btn_get); GameObjectScaler.Scale(asd, 0.7f); // asd.transform.localScale *= 0.7f; } else { Dictionary <string, object> dic = (Dictionary <string, object>)listData [index + ""]; if (index == (listData.Keys.Count - 1) && haveSuo != 0) { go.grayed = true; btn_get.grayed = true; asd = EffectManager.inst.AddEffect(Tools.GetEggName(dic ["picture"].ToString()), "end", btn_get, null, true); EffectManager.inst.SetShaderSaturation(asd, -1); GameObjectScaler.ScaleParticles(asd, 0); EffectManager.inst.StopAnimation(asd); // Tools.StopAnimation (asd); } else { asd = EffectManager.inst.AddEffect(Tools.GetEggName(dic ["picture"].ToString()), "stand", btn_get); } // l_imag.url = Tools.GetResourceUrl ("Image:bg_baoxiang2"); img_coin.url = Tools.GetResourceUrl("Image2:n_icon_zs"); // img_coin.y = 363 - 25; // img_coin.x = 69 - 50; l_coin.text = (int)dic ["price"] + ""; l_time.text = ""; img2.visible = false; go.asCom.GetChild("n13").visible = false; l_level.text = Tools.GetMessageById(dic ["name"].ToString()); } GoWrapperCheck goc = go.displayObject.gameObject.AddComponent <GoWrapperCheck>(); goc.setItem(go, Tools.offectSetX(160f), Tools.offectSetX(160f + 720f), asd, GRoot.inst.scale.x); btn_get.visible = true; }
public Manifest() { LocalStore = new LocalStore(string.Format("Forex.Manifest")); _tableName = "default"; }
public void RegisterFile(string alias, bool compressed) { LocalStore.RegisterFile(alias); _compressedRegistry[alias] = compressed; }
public EnterNameControl(LocalStore localStore) { _localStore = localStore; InitializeComponent(); }
public void SendFilePart(string alias, byte[] filePart) { LocalStore.AppendAllBytes(alias, filePart); }
/// <summary> /// Applies required configuration for enabling cache in SDK 1.8.0 version by: /// * Add MemcacheShim runtime installation. /// * Add startup task to install memcache shim on the client side. /// * Add default memcache internal endpoint. /// * Add cache diagnostic to local resources. /// * Add ClientDiagnosticLevel setting to service configuration. /// * Adjust web.config to enable auto discovery for the caching role. /// </summary> /// <param name="azureService">The azure service instance</param> /// <param name="webRole">The web role to enable caching on</param> /// <param name="isWebRole">Flag indicating if the provided role is web or not</param> /// <param name="cacheWorkerRole">The memcache worker role name</param> /// <param name="startup">The role startup</param> /// <param name="endpoints">The role endpoints</param> /// <param name="localResources">The role local resources</param> /// <param name="configurationSettings">The role configuration settings</param> private void Version180Configuration( AzureService azureService, string roleName, bool isWebRole, string cacheWorkerRole, Startup startup, Endpoints endpoints, LocalResources localResources, ref DefinitionConfigurationSetting[] configurationSettings) { if (isWebRole) { // Generate cache scaffolding for web role azureService.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WebRole.ToString()), roleName, new Dictionary <string, object>()); // Adjust web.config to enable auto discovery for the caching role. string webCloudConfigPath = Path.Combine(azureService.Paths.RootPath, roleName, Resources.WebCloudConfig); string webConfigPath = Path.Combine(azureService.Paths.RootPath, roleName, Resources.WebConfigTemplateFileName); UpdateWebConfig(roleName, cacheWorkerRole, webCloudConfigPath); UpdateWebConfig(roleName, cacheWorkerRole, webConfigPath); } else { // Generate cache scaffolding for worker role Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters[ScaffoldParams.RoleName] = cacheWorkerRole; azureService.GenerateScaffolding(Path.Combine(Resources.CacheScaffolding, RoleType.WorkerRole.ToString()), roleName, parameters); } // Add startup task to install memcache shim on the client side. string cacheRuntimeUri = CloudRuntimeCollection.GetRuntimeUrl(Resources.CacheRuntimeValue, CacheRuntimeVersion); Debug.Assert(!string.IsNullOrEmpty(cacheRuntimeUri)); Variable emulated = new Variable { name = Resources.EmulatedKey, RoleInstanceValue = new RoleInstanceValueElement { xpath = "/RoleEnvironment/Deployment/@emulated" } }; Variable[] env = { emulated, new Variable { name = Resources.CacheRuntimeUrl,value = cacheRuntimeUri } }; Task shimStartupTask = new Task { Environment = env, commandLine = Resources.CacheStartupCommand, executionContext = ExecutionContext.elevated }; startup.Task = General.ExtendArray <Task>(startup.Task, shimStartupTask); // Add default memcache internal endpoint. InternalEndpoint memcacheEndpoint = new InternalEndpoint { name = Resources.MemcacheEndpointName, protocol = InternalProtocol.tcp, port = Resources.MemcacheEndpointPort }; endpoints.InternalEndpoint = General.ExtendArray <InternalEndpoint>(endpoints.InternalEndpoint, memcacheEndpoint); // Enable cache diagnostic LocalStore localStore = new LocalStore { name = Resources.CacheDiagnosticStoreName, cleanOnRoleRecycle = false }; localResources.LocalStorage = General.ExtendArray <LocalStore>(localResources.LocalStorage, localStore); DefinitionConfigurationSetting diagnosticLevel = new DefinitionConfigurationSetting { name = Resources.CacheClientDiagnosticLevelAssemblyName }; configurationSettings = General.ExtendArray <DefinitionConfigurationSetting>(configurationSettings, diagnosticLevel); // Add ClientDiagnosticLevel setting to service configuration. AddClientDiagnosticLevelToConfig(azureService.Components.GetCloudConfigRole(roleName)); AddClientDiagnosticLevelToConfig(azureService.Components.GetLocalConfigRole(roleName)); }
public long GetFileSize(string alias) { return(Tools.FileSystem.GetFileSize(LocalStore.GetFilePath(alias))); }