/// 异步装载资源 lua public void LoadAsynAsset(int loadPriority, int type, string filename, int life) { if (AssetService.IsValidate()) { AssetService.GetInstance().LoadAsyn(type, loadPriority, filename, life, this); } }
public void TestBadXmlAssetStoreRequest() { TestHelpers.InMethod(); IConfigSource config = new IniConfigSource(); config.AddConfig("AssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); AssetService assetService = new AssetService(config); AssetServerPostHandler asph = new AssetServerPostHandler(assetService); MemoryStream buffer = new MemoryStream(); byte[] badData = new byte[] { 0x48, 0x65, 0x6c, 0x6c, 0x6f }; buffer.Write(badData, 0, badData.Length); buffer.Position = 0; TestOSHttpResponse response = new TestOSHttpResponse(); asph.Handle(null, buffer, null, response); Assert.That(response.StatusCode, Is.EqualTo((int)HttpStatusCode.BadRequest)); }
public GameInstallViewModel( ConfigService configService, GamePathService gamePathService, VersionService versionService, LibraryService libraryService, AssetService assetService, DownloadStatusViewModel downloadVM, IWindowManager windowManager) { _config = configService.Entries; _gamePathService = gamePathService; _versionService = versionService; _libraryService = libraryService; _assetService = assetService; _versionDownloads = new BindableCollection <VersionDownload>(); VersionDownloads = CollectionViewSource.GetDefaultView(_versionDownloads); VersionDownloads.Filter = obj => { if (_isReleaseOnly) { return((obj as VersionDownload).Type == VersionType.Release); } return(true); }; _windowManager = windowManager; _downloadStatusVM = downloadVM; _isVersionListLoaded = false; _isReleaseOnly = true; }
public ActionResult Edit(Software software) { //if (ModelState.IsValid) //{ // AssetService assetService = new AssetService(); // int result = assetService.UpdateSoftware(software); // if (result > 0) // { // ViewBag.Msg = "Asset updated successfully"; // } //} //return RedirectToAction("Softwares"); if (ModelState.IsValid) { try { AssetService assetService = new AssetService(); int res = assetService.UpdateSoftware(software); if (res > 0) { return(RedirectToAction("Softwares")); } return(View(software)); } catch { } } return(View()); }
public JsonResult GetAssets(int cateId = 0, string key = "", int?deptId = null) { var service = new AssetService(); var param = new AssetSearchParam(); if (cateId > 0) { param.CateId = cateId; } if (deptId.HasValue) { if (deptId > 0) { param.IsContainSubDept = true; param.DeptId = deptId; } else { param.IsContainSubDept = false; param.DeptId = 0; } } if (!string.IsNullOrWhiteSpace(key)) { param.Key = key; } var assets = service.ListDto(param); return(Json(ResultUtil.Success(assets))); }
public void Create_Valid_RedirectsToIndex() { // ARRANGE var mock = new Mock <Repository <Asset> >(); mock.Setup(r => r.Create(It.IsAny <Asset>())). Returns(new Asset { AssetId = 1, Model = "123" }); AssetViewModel avm = new AssetViewModel { AssetId = 1, Model = "123" }; AssetService assetService = new AssetService(string.Empty); assetService.Repository = mock.Object; AssetItemsController controller = new AssetItemsController(); controller.AssetService = assetService; // ACT RedirectToRouteResult result = controller.Create(avm) as RedirectToRouteResult; // ASSERT Assert.AreEqual("action", result.RouteValues.Keys.First()); Assert.AreEqual("Index", result.RouteValues.Values.First()); }
public ActionResult Edit(int id) { AssetService assetService = new AssetService(); Software software = assetService.GetSoftware(id); return(View(software)); }
public ActionResult Index(int?page) { const string assetsPrefix = "finance.index"; const int articlesPerPage = 6; var pageNum = page ?? 1; // *** should be using skip/take collection symantic here ...all the way through to the service *** var startRow = articlesPerPage * (pageNum - 1) + 1; var metadata = MetadataService.GetMetadataForPage(HttpContext); var financeTask = VehicleContentService.GetArticlesByTopicAsync("finance", startRow, articlesPerPage); financeTask.Wait(); var financeArticles = financeTask.Result; var totalNumOfPages = financeArticles.TotalRecords > articlesPerPage ? (int)Math.Ceiling(((decimal)financeArticles.TotalRecords / articlesPerPage)) : 1; var viewModel = new IndexViewModel(assetsPrefix, metadata) { InlineHeadScript = AssetService.GetInlineHeadScript(), InlineHeadStyles = AssetService.GetInlineHeadStyles(assetsPrefix), FinanceArticles = financeArticles.Articles, Paginator = new Paginator("/finance/", totalNumOfPages, pageNum) }; return(View("Index", viewModel)); }
public void HandleAgentAnimation(Message m) { var req = (AgentAnimation)m; SceneInterface scene; AgentCircuit circuit; if (!Circuits.TryGetValue(m.CircuitSceneID, out circuit)) { return; } scene = circuit.Scene; if (scene == null) { return; } AssetServiceInterface sceneAssetService = scene.AssetService; if (sceneAssetService == null) { return; } AssetMetadata metadata; foreach (var e in req.AnimationEntryList) { if (e.StartAnim) { if (!sceneAssetService.Metadata.TryGetValue(e.AnimID, out metadata)) { AssetData data; if (AssetService.TryGetValue(e.AnimID, out data)) { sceneAssetService.Store(data); if (data.Type != AssetType.Animation) { /* ignore non-animation content here */ continue; } } else { /* asset not there so ignore */ continue; } } else if (metadata.Type != AssetType.Animation) { /* ignore non-animation content here */ continue; } PlayAnimation(e.AnimID, UUID.Zero); } else { StopAnimation(e.AnimID, UUID.Zero); } } }
public ActionResult Edit(int id) { AssetService assetService = new AssetService(); Other ot = assetService.GetOther(id); return(View(ot)); }
/// <summary> /// Imports this instance. /// </summary> public async void Import() { try { if (this._currentTask != null) { await this._currentTask; } var text = ClipboardHelper.GetClipboardText(); if (Uri.TryCreate(text, UriKind.Absolute, out Uri url)) { var rawUri = new Uri($"https://pastebin.com/raw{url.AbsolutePath}"); using (var client = new HttpClient()) { var request = new HttpRequestMessage(HttpMethod.Get, rawUri); var response = await client.SendAsync(request); text = await response.Content.ReadAsStringAsync(); } } if (await this.Initialize(text)) { AssetService.Create(FileName, text); } } catch { } }
void Start() { var kittyModel = KittyService.GetSelected(); Sprite sprite = AssetService.GetSprite(kittyModel.thumbAssetAddress); kittyThumbSprite.sprite = sprite; }
/// <summary> /// Initializes a new instance of the <see cref="SettingsViewModel" /> class. /// </summary> /// <param name="windowManager">The window manager.</param> /// <param name="keyboardHelper">The keyboard helper.</param> /// <param name="settingsService">The settings service.</param> /// <param name="hotkeyService">The key code service.</param> /// <param name="soundService">The sound service.</param> /// <param name="githubService">The github service.</param> /// <param name="pushBulletService">The PushBullet service.</param> public SettingsViewModel( IWindowManager windowManager, KeyboardHelper keyboardHelper, SettingsService settingsService, HotkeyService hotkeyService, SoundService soundService, GithubService githubService, PushBulletService pushBulletService) : base(windowManager) { this._keyboardHelper = keyboardHelper; this._settingService = settingsService; this._hotkeyService = hotkeyService; this._soundService = soundService; this.DisplayName = "Settings"; this._excludePropertyNames = this.GetExcludedPropertyNames(); this.PropertyChanged += this.SettingsViewModel_PropertyChanged; if (!AssetService.Exists(LottieFileName)) { AssetService.Create(LottieFileName, GetResourceContent(LottieFileName)); } this.BuildManager = new BuildManagerViewModel(this.ShowMessage, githubService); this.PushBullet = new PushBulletViewModel(pushBulletService); this.SetupHotkeys(); }
public void Constructor_Default_ShouldSetAllVariables() { // Arrange const string assetsDirectoryPath = "SomeDirectoryPath"; const string assetsWebPath = "SomeWebPath"; var sharedSettingsMock = new Mock <ISharedSettings>(); sharedSettingsMock .SetupGet(x => x.AssetsDirectoryPath) .Returns(assetsDirectoryPath); sharedSettingsMock .SetupGet(x => x.AssetsWebPath) .Returns(assetsWebPath); var manifestServiceMock = new Mock <IManifestService>(); var tagBuilderMock = new Mock <ITagBuilder>(); // Act var result = new AssetService(sharedSettingsMock.Object, manifestServiceMock.Object, tagBuilderMock.Object); // Assert result.AssetsDirectoryPath.Should().Be(assetsDirectoryPath); result.AssetsWebPath.Should().Be(assetsWebPath); manifestServiceMock.VerifyNoOtherCalls(); tagBuilderMock.VerifyNoOtherCalls(); }
/// <summary> /// 初始化 /// </summary> public void Initialize(LuaEnv lua) { _onLoadAssetCompleted = lua.Global.GetInPath <OnLoadAssetCompletedDelegate>("AssetService.OnCsLoadAssetCompleted"); _onChangeUIState = lua.Global.GetInPath <OnChangeUIStateDelegate>("MVCService.OnCsChangeUIState"); _onNativeCallBack = lua.Global.GetInPath <NativeServiceBaseDelegate>("NativeService.OnCommonCallback"); _appEnterBackGroundCallBack = lua.Global.GetInPath <System.Action>("AppMoniter.OnCSAppEnterBackGround"); _appEnterForeGroundCallBack = lua.Global.GetInPath <System.Action>("AppMoniter.OnCSAppEnterForeGround"); // _arcadeInputOkCallBack = lua.Global.GetInPath <ArcadeInputPressDelegate>("ArcadeInputService.OnCsOkInput"); _arcadeInputRefreshCallBack = lua.Global.GetInPath <ArcadeInputRefreshDelegate>("ArcadeInputService.OnCsRefreshInput"); _arcadeInputRotateCallBack = lua.Global.GetInPath <ArcadeInputRotateDelegate>("ArcadeInputService.OnCsRotateInput"); _arcadeInputRockerCallBack = lua.Global.GetInPath <ArcadeInputRockerDelegate>("ArcadeInputService.OnCsRockerInput"); // _gcCallBack = lua.Global.GetInPath <System.Action <bool> >("GCService.CollectGarbage"); //挂接 UIStateService.GetInstance().Hook = this.ChangeUIState; AssetService.GetInstance().LuaGCHook = this.OnAssetServiceGC; // NativeService.GetInstance().RegisterBaseHandler(OnNativeBaseCallBackHook); //硬件输入 ArcadeInputService.GetInstance().RockerHandler = this.DealArcadeInputRockerInput; ArcadeInputService.GetInstance().RotateHandler = this.DealArcadeInputRotateInput; ArcadeInputService.GetInstance().RefreshHandler = this.DealArcadeInputRefreshInput; ArcadeInputService.GetInstance().PressHandler = this.DealArcadeInputOkInput; // _uiEventBridge = new LuaUIEventBridge(); _uiEventBridge.Initialize(lua); }
public async Task TestAssetSynchronization() { var code = @"class Test { void Method() { } }"; using (var workspace = await TestWorkspace.CreateCSharpAsync(code)) { var solution = workspace.CurrentSolution; // build checksum await solution.State.GetChecksumAsync(CancellationToken.None); var map = solution.GetAssetMap(); var sessionId = 0; var storage = new AssetStorage(); var source = new TestAssetSource(storage, sessionId, map); var service = new AssetService(sessionId, storage); await service.SynchronizeAssetsAsync(new HashSet<Checksum>(map.Keys), CancellationToken.None); object data; foreach (var kv in map) { Assert.True(storage.TryGetAsset(kv.Key, out data)); } } }
private void GetAsset(string id, AssetReferenceType assetReferenceType) { openTasks++; AssetService.Get(id, assetReferenceType) .SetCompletion(new OnCompletedHandler <Asset>(OnAssetGetComplete)) .Execute(client); }
public void Initialize() { Default = new LuaEnv(); LuaClassCache = new LuaClassCache(); m_newClassCallback = OnLuaNewClass; #if UNITY_EDITOR Default.AddLoader((ref string filename) => LoadFile(ref filename, ".lua")); #else Default.AddLoader((ref string filename) => LoadFile(ref filename, ".lua")); #endif var setupNewCallback = LoadFileAtPath("base.class")[0] as LuaFunction; setupNewCallback.Action(m_newClassCallback); OnVMCreated?.Invoke(); var ret = LoadFileAtPath("PreRequest")[0] as LuaTable; OnInit = ret.Get <LuaFunction>("init"); OnDestroy = ret.Get <LuaFunction>("shutdown"); OnPreRequestLoaded?.Invoke(); #if UNITY_EDITOR if (reportLeakMark) { leakData = Default.StartMemoryLeakCheck(); } #endif AssetService.Get().AddAfterDestroy(this); DestroyedTableMeta = Global.Get <LuaTable>("DestroyedTableMeta"); }
/// <summary> /// Initializes a new instance of the <see cref="SplashscreenViewModel" /> class. /// </summary> /// <param name="settings">The settings.</param> /// <param name="eventAggregator">The event aggregator.</param> public SplashscreenViewModel(SettingsViewModel settings, IEventAggregator eventAggregator) { this._settings = settings; this._eventAggrator = eventAggregator; if (!AssetService.Exists(LottieFileName)) { AssetService.Create(LottieFileName, GetResourceContent(LottieFileName)); } Execute.OnUIThread(async() => { using (var service = new PatreonService()) { var result = await service.IsPledging(); if (result) { return; } this.ShowPatreon = true; this.TrialAvailable = service.TrialAvailable; if (!this.TrialAvailable) { // this.ShowPatreon = true; } } }); }
public async Task TestProjectSynchronization() { var code = @"class Test { void Method() { } }"; using (var workspace = TestWorkspace.CreateCSharp(code)) { var project = workspace.CurrentSolution.Projects.First(); // build checksum await project.State.GetChecksumAsync(CancellationToken.None); var map = project.GetAssetMap(); var sessionId = 0; var storage = new AssetStorage(); var source = new TestAssetSource(storage, map); var service = new AssetService(sessionId, storage); await service.SynchronizeProjectAssetsAsync(SpecializedCollections.SingletonEnumerable(await project.State.GetChecksumAsync(CancellationToken.None)), CancellationToken.None); foreach (var kv in map) { Assert.True(storage.TryGetAsset(kv.Key, out object data)); } } }
public async Task TestSolutionSynchronization() { var code = @"class Test { void Method() { } }"; using (var workspace = TestWorkspace.CreateCSharp(code)) { var solution = workspace.CurrentSolution; // build checksum await solution.State.GetChecksumAsync(CancellationToken.None); var map = solution.GetAssetMap(); var sessionId = 0; var storage = new AssetStorage(); var source = new TestAssetSource(storage, map); var service = new AssetService(sessionId, storage); await service.SynchronizeSolutionAssetsAsync(await solution.State.GetChecksumAsync(CancellationToken.None), CancellationToken.None); foreach (var kv in map) { Assert.True(storage.TryGetAsset(kv.Key, out object data)); } } }
public LexProjectsController(IMapper mapper, IRepository <LexProject> lexProjectRepo, IProjectRepositoryFactory <LexEntry> lexEntryRepoFactory, AssetService assetService) : base(mapper, lexProjectRepo) { _lexEntryRepoFactory = lexEntryRepoFactory; _assetService = assetService; }
public void Initialize() { const string fileName = "SystemSetting"; #if !UNITY_EDITOR var path = Path.Combine(Application.persistentDataPath, fileName + ".ini"); if (!File.Exists(path)) { using (var asset = AssetService.Get().Load($"Config/{fileName}", typeof(TextAsset))) { File.WriteAllText(path, asset.GetTextAsset().text); } } using (var reader = new StreamReader(path)) { SystemSetting = IniRead.Parse(reader); } #else using (var asset = AssetService.Get().Load($"Config/{fileName}", typeof(TextAsset))) { using (var reader = new StringReader(asset.GetTextAsset().text)) { SystemSetting = IniRead.Parse(reader); } } #endif IniRead.SystemSetting = SystemSetting; }
public void Setup() { //Seed test data base.SeedTestAssets(_ctx); repo = new AssetRepository(_ctx); service = new AssetService(repo, _mapper); }
private void ListAssets() { openTasks++; AssetService.List() .SetCompletion(new OnCompletedHandler <ListResponse <Asset> >(OnAssetListComplete)) .Execute(client); }
public async Task TestAssets() { var sessionId = 0; var checksum = Checksum.Create(WellKnownSynchronizationKind.Null, ImmutableArray.CreateRange(Guid.NewGuid().ToByteArray())); var data = new object(); var storage = new AssetStorage(); _ = new SimpleAssetSource(storage, new Dictionary <Checksum, object>() { { checksum, data } }); var service = new AssetService(sessionId, storage, new RemoteWorkspace().Services.GetService <ISerializerService>()); var stored = await service.GetAssetAsync <object>(checksum, CancellationToken.None); Assert.Equal(data, stored); var stored2 = await service.GetAssetsAsync <object>(new[] { checksum }, CancellationToken.None); Assert.Equal(1, stored2.Count); Assert.Equal(checksum, stored2[0].Item1); Assert.Equal(data, stored2[0].Item2); }
/// <summary> /// Uploads the image from the specified <paramref name="url"/>. /// </summary> /// <param name="user">The AdWords user.</param> /// <param name="url">The image URL.</param> /// <returns>ID of the uploaded image.</returns> private static long UploadImageAsset(AdWordsUser user, string url) { using (AssetService assetService = (AssetService)user.GetService(AdWordsService.v201809.AssetService)) { // Create the image asset. ImageAsset imageAsset = new ImageAsset() { // Optional: Provide a unique friendly name to identify your asset. If you // specify the assetName field, then both the asset name and the image being // uploaded should be unique, and should not match another ACTIVE asset in this // customer account. // assetName = "Image asset " + ExampleUtilities.GetRandomString(), imageData = MediaUtilities.GetAssetDataFromUrl(url, user.Config), }; // Create the operation. AssetOperation operation = new AssetOperation() { @operator = Operator.ADD, operand = imageAsset }; // Create the asset and return the ID. return(assetService.mutate(new AssetOperation[] { operation }).value[0].assetId); } }
public ActionResult SaveSummary() { AssetService assetService = new AssetService(); assetService.SaveCurrentSummary(); return(Content("success")); }
public ActionResult ShowChart() { AssetService assetService = new AssetService(); List <AssetSummary> result = assetService.CalcSummary(); return(View(result)); }
public void LoadGlobalReflectionCubeMap(float intensity, string resPath) { if (string.IsNullOrEmpty(resPath)) { JW.Common.Log.LogE("LoadGlobalReflectionCubeMap Error CubeMap"); } RenderSettings.reflectionIntensity = intensity; RenderSettings.defaultReflectionMode = DefaultReflectionMode.Custom; BaseAsset ba = AssetService.GetInstance().LoadPrimitiveAsset(resPath, 4); if (ba == null) { JW.Common.Log.LogE("LoadGlobalReflectionCubeMap Error CubeMap"); } else { if (_curRefectionCubMapAsset != null) { AssetService.GetInstance().Unload(_curRefectionCubMapAsset); _curRefectionCubMapAsset = null; } RenderSettings.customReflection = ba.Resource.Content as Cubemap; _curRefectionCubMapAsset = ba; } }
public JsonResult AssignConfiuredAsset(ConfiguredAssetEmployee configuredAssetEmployee) { int result = 0; string configurationGroupNameId = string.Empty; AssetService assetservice = new AssetService(); EmployeeService employeeService = new EmployeeService(); int configResult = 0; int configAssetAllocation = 0; result = assetservice.ConfiguredAssetAllocation(configuredAssetEmployee); if (result > 0) { configurationGroupNameId = assetservice.ConfigurationGroupNameId(); } if (configurationGroupNameId != string.Empty || configurationGroupNameId != null) { configResult = assetservice.CreateConfiguration(configurationGroupNameId, configuredAssetEmployee.selectedAssets); } if (configResult > 0) { for (int i = 0; i < configuredAssetEmployee.selectedAssets.Count; i++) { configAssetAllocation = assetservice.AssetAllocation(configuredAssetEmployee.srNo, configuredAssetEmployee.selectedAssets[i]); } } if (configAssetAllocation > 0 && result > 0 && configResult > 0) { return(Json(new { success = true, responseText = "Configured Assets allocated successfully." }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, responseText = "Error while configured allocation!!" }, JsonRequestBehavior.AllowGet)); } }
public RoslynServices(int sessionId, AssetStorage storage) { _sessionId = sessionId; AssetService = new AssetService(_sessionId, storage); SolutionService = new SolutionService(AssetService); CompilationService = new CompilationService(SolutionService); }
public async Task TestAssets() { var sessionId = 0; var checksum = new Checksum(Guid.NewGuid().ToByteArray()); var data = new object(); var storage = new AssetStorage(); var source = new TestAssetSource(storage, sessionId, checksum, data); var service = new AssetService(sessionId, storage); var stored = await service.GetAssetAsync<object>(checksum, CancellationToken.None); Assert.Equal(data, stored); var stored2 = await service.GetAssetsAsync<object>(new[] { checksum }, CancellationToken.None); Assert.Equal(1, stored2.Count); Assert.Equal(checksum, stored2[0].Item1); Assert.Equal(data, stored2[0].Item2); }
public SolutionService(AssetService assetService) { _assetService = assetService; }
public void CommitImport(IEnumerable<Asset> assets) { foreach (Asset asset in assets) { AssetService assetService = new AssetService(_userName); ClearLookups(asset); assetService.SaveAsset(asset); } }
public ChecksumSynchronizer(AssetService assetService) { _assetService = assetService; }