public bool AddBundle(string gameName, string bundleName, byte[] bytes, AssetBundle bundle = null) { if (bundle == null) { bundle = AssetBundle.LoadFromMemory(bytes); if (bundle == null) { Debug.LogErrorFormat("Error while loading bundle {0} for {1} game", bundleName, gameName); return(false); } } if (!Bundles.ContainsKey(gameName)) { Bundles.Add(gameName, new Dictionary <string, AssetBundle>()); Cache.Add(gameName, new Dictionary <string, string>()); } if (Bundles[gameName].ContainsKey(bundleName)) { RemoveBundle(gameName, bundleName); } Bundles[gameName].Add(bundleName, bundle); Cache[gameName].Add(bundleName, bytes.Base64GetString()); UpdateAssetBundlesCache(); return(true); }
public void RemoveBundle(string gameName, string bundleName) { if (!Bundles.ContainsKey(gameName)) { return; } if (!Bundles[gameName].ContainsKey(bundleName)) { return; } AssetBundle assetBundle = GetBundle(gameName, bundleName); assetBundle.Unload(false); Bundles[gameName].Remove(bundleName); Cache[gameName].Remove(bundleName); if (Bundles[gameName].Count == 0) { Bundles.Remove(gameName); Cache.Remove(gameName); } UpdateAssetBundlesCache(); }
public BaseItem GetItemFromCashID(long cashId, int itemid = 0) { if (itemid == 0) { var possibleItem = GetLockerItemFromCashID(cashId); if (possibleItem == null) { return(null); } itemid = possibleItem.ItemId; } if (Constants.isEquip(itemid)) { return(Equips.FirstOrDefault(x => x.CashId == cashId)); } else if (Constants.isPet(itemid)) { return(Pets.FirstOrDefault(x => x.CashId == cashId)); } else { return(Bundles.FirstOrDefault(x => x.CashId == cashId)); } }
async Task HandleRepo() { await Handler.UpdateRepository(WorkingDirectory, RepositoryDirectory).ConfigureAwait(false); Bundles.ProcessBundles(); Packages.ProcessPackages(); }
/// <summary> /// GetNotePosition() throws FatalEngineExecutionError when patched. /// Mimics ShouldNoteAppearInArea() using a static position in place of GetNotePosition(). /// </summary> public static bool ShouldNoteAppearInArea_Prefix(CommunityCenter __instance, ref bool __result, int area) { try { if (Bundles.IsCommunityCentreComplete() && Bundles.IsAbandonedJojaMartBundleAvailable() && (Game1.netWorldState.Value.BundleData.Keys.Any(key => key.StartsWith(Bundles.CommunityCentreAreaName)))) { Log.D($"ShouldNoteAppearInArea removing custom bundle data.", ModEntry.Instance.Config.DebugMode); Bundles.SaveAndUnloadBundleData(); } if (area != Bundles.CommunityCentreAreaNumber) { return(true); } __result = !Bundles.IsCommunityCentreKitchenComplete() && __instance.numberOfCompleteBundles() > (ModEntry.Instance.Config.DebugMode ? 0 : 2); return(false); } catch (ArgumentOutOfRangeException e) { Log.D($"Error in {nameof(ShouldNoteAppearInArea_Prefix)}, may be non-critical:\n{e}", ModEntry.Instance.Config.DebugMode); return(false); } catch (Exception e) { Log.E($"Error in {nameof(ShouldNoteAppearInArea_Prefix)}:\n{e}"); } return(true); }
/// <summary> /// JS脚本资源分组绑定 /// </summary> /// <param name="name">JS脚本资源绑定名称</param> /// <param name="groupName">分组名称</param> /// <param name="scripts">JS脚本路径数组 如果为空就绑定分组,如果有知道资源就重新生成资源绑定</param> public static void BundlesGroup(string name, string groupName, params string[] scripts) { if (BundleScripts.ContainsKey(name)) { return; } //获取绑定分组对象 Bundles gb = null; if (BundleScripts.ContainsKey(groupName)) { gb = BundleScripts[groupName]; } if (scripts.Count() == 0) { //未设置其他资源 if (gb != null) { BundleScripts.Add(name, gb); } } else { //重新生成资源绑定 if (gb != null) { //获取分组的资源 scripts = gb.item.Concat(scripts).ToArray(); } BundlesAdd(name, scripts); } }
/// <summary> /// Adds an extra Junimo to the goodbye dance, as the number of Junimos added is otherwise hardcoded. /// </summary> public static bool StartGoodbyeDance_Prefix(CommunityCenter __instance) { try { if (!Bundles.IsCommunityCentreKitchenEnabledByHost()) { return(true); } Bundles.DrawStarInCommunityCentre(__instance); var junimo = __instance.getJunimoForArea(Bundles.CommunityCentreAreaNumber); junimo.Position = new Vector2(22f, 12f) * 64f; junimo.stayStill(); junimo.faceDirection(1); junimo.fadeBack(); junimo.IsInvisible = false; junimo.setAlpha(1f); junimo.sayGoodbye(); } catch (Exception e) { Log.E($"Error in {nameof(StartGoodbyeDance_Prefix)}: {e}"); } return(true); }
protected override void PostDialogOpened(IDialogParameters pms) { entryVM = pms.GetValue <EntryViewModel>("Entry"); RaisePropertyChanged("FileVisibility"); RaisePropertyChanged("FolderVisibility"); RaisePropertyChanged("Name"); RaisePropertyChanged("Icon"); RaisePropertyChanged("Type"); RaisePropertyChanged("Size"); RaisePropertyChanged("EntryPath"); RaisePropertyChanged("HashedName"); RaisePropertyChanged("FolderContains"); IEntry entry = entryVM.Owner; if (entry is FileEntry) { var bundles = (entry as FileEntry).BundleEntries; foreach (var pair in bundles) { var e = new PackageFileViewModel(pair.Value); Bundles.Add(e); } } }
protected void Application_Start() { // Enables and configures selected Kentico ASP.NET MVC integration features ApplicationConfig.RegisterFeatures(ApplicationBuilder.Current); // Registers routes including system routes for enabled features RouteConfig.RegisterRoutes(RouteTable.Routes); // Custom Bundles Bundles.RegisterBundles(BundleTable.Bundles); // Clear cache on application start. CacheHelper.ClearCache(); #region "AutoFac Cache and other dependency injections" // Register AutoFac Items var builder = new ContainerBuilder(); // Register Dependencies for Cache DependencyResolverConfig.Register(builder); // Register AutoMapper AutoMapper.Resolver.AutoMapperDependencyResolverConfig.Register(builder); // Set Autofac Dependency resolver to the builder DependencyResolver.SetResolver(new AutofacDependencyResolver(builder.Build())); #endregion RegisterPageTemplateFilters(); // SECURITY: Remove MVC Response powered by MvcHandler.DisableMvcResponseHeader = true; }
void InvokeCallBack(string name, bool isSuccess, AssetBundle ab = null) { for (int i = m_LoadingAssets.Count - 1; i >= 0; i--) { Bundles bundle = m_LoadingAssets[i]; if (bundle.name.Equals(name)) { if (isSuccess) { if (bundle.onSuccess != null) { bundle.onSuccess(ab); } } else { if (bundle.onFailed != null) { bundle.onFailed(); } } m_LoadingAssets.RemoveAt(i); } } }
private void Update() { bool removed = false; for (int i = 0; i < assets.Count; i++) { var asset = assets[i]; if (!asset.IsDone && !asset.useful) { asset.UnLoad(); asset = null; assets.RemoveAt(i); i--; removed = true; } } if (removed) { if (gc != null) { Game.instance.StopCoroutine(gc); } gc = GC(); Game.instance.StartCoroutine(gc); } Bundles.ClearUnUseBundles(); }
void ReferencePageBundles() { Bundles.Reference("~/cassette.web.jasmine"); var spec = routeData.GetRequiredString("specbundle"); Bundles.Reference(spec); }
private bool InitializeBundle() { if (!Bundles.Init(InitPath)) { throw new FileNotFoundException("bundle manifest not exist."); } var bundle = Bundles.LoadSync(ABTool.MainAssetBundleBuildName); if (bundle == null) { throw new FileNotFoundException("assets manifest not exist."); } TextAsset xml = bundle.LoadAsset <TextAsset>(ABTool.ManifestPath.GetFileName()); if (xml == null) { throw new FileNotFoundException("assets manifest not exist."); } using (var reader = new StringReader(xml.text)) { Instance.manifestXML.Load(reader.ReadToEnd()); reader.Close(); } bundle.Release(); Resources.UnloadAsset(xml); xml = null; return(true); }
public static void InitAsync(Action onComplete) { Game.instance.StartCoroutine(Bundles.InitAsync(Instance.InitPath, bundle => { if (bundle == null) { if (onComplete != null) { onComplete(); } return; } var asset = bundle.LoadAsset <TextAsset>(ABTool.ManifestPath.GetFileName()); if (asset != null) { using (var reader = new StringReader(asset.text)) { Instance.manifestXML.Load(reader.ReadToEnd()); reader.Close(); } bundle.Release(); Resources.UnloadAsset(asset); asset = null; } if (onComplete != null) { onComplete(); } })); }
public NewDatabase() { LicensingStatus = new Observable <LicensingStatus>(); InitializeComponent(); var req = ApplicationModel.DatabaseCommands.ForDefaultDatabase().CreateRequest("/license/status", "GET"); req.ReadResponseJsonAsync().ContinueOnSuccessInTheUIThread(doc => { LicensingStatus.Value = ((RavenJObject)doc).Deserialize <LicensingStatus>(new DocumentConvention()); var hasPeriodic = (bool)new BundleNameToActiveConverter().Convert(LicensingStatus.Value, typeof(bool), "PeriodicBackup", CultureInfo.InvariantCulture); if (hasPeriodic) { Bundles.Add("PeriodicBackup"); } }); Bundles = new List <string>(); KeyDown += (sender, args) => { if (args.Key == Key.Escape) { DialogResult = false; } }; }
protected override void OnSingletonInit() { _manifestXML = new Manifest(); bundles = new Bundles(); Framework.BindEnvUpdate(Update, EnvironmentType.Ev1); Framework.BindEnvDispose(Dispose, EnvironmentType.Ev1); }
protected IHtmlString RenderScripts() { IHtmlString scripts = Bundles.RenderScripts(); string result = scripts.ToHtmlString() + Bundles.RenderScripts("inline").ToHtmlString(); return(new HtmlString(result)); }
protected void Application_Start() { // Get the settings from the web.config ConfigReaderWriter configReader = new FullTrustConfigReaderWriter(""); ApplicationSettings applicationSettings = configReader.GetApplicationSettings(); // Configure StructureMap dependencies DependencyManager iocSetup = new DependencyManager(applicationSettings); iocSetup.Configure(); iocSetup.ConfigureMvc(); // Logging Log.ConfigureLogging(applicationSettings); // Filters GlobalFilters.Filters.Add(new HandleErrorAttribute()); // Areas are used for: // - Site settings (for a cleaner view structure) // - Webapi help. // This should be called before the other routes, for some reason. AreaRegistration.RegisterAllAreas(); // Register routes and JS/CSS bundles Routing.RegisterApi(GlobalConfiguration.Configuration); Routing.Register(RouteTable.Routes); Bundles.Register(); // Custom view engine registration (to add new search paths) ExtendedRazorViewEngine.Register(); Log.Information("Application started"); }
public SpecificVersion GetBundle(Dependency bundle) { lock (Bundles) { if (!Bundles.ContainsKey(bundle.Name)) { return(null); } var bundles = Bundles[bundle.Name]; if (!bundles.Any()) { return(null); } if ((bundle.Version == null) && (bundle.Branch == null)) { return(new SpecificVersion(bundle.Name, Dependency.FindLatestPreferNonBranched(bundles))); } if (bundles.Contains(bundle.VersionData)) { return(new SpecificVersion(bundle.GetFullName())); } var m = _dependencyVersionMatcher.MatchesConstraints(bundles, bundle.Version, bundle.Branch); return(m == null ? null : new SpecificVersion(bundle.Name, m)); } }
public void ProcessRequest() { var response = requestContext.HttpContext.Response; var request = requestContext.HttpContext.Request; if (!CanAccessHud(request)) { response.StatusCode = (int)HttpStatusCode.NotFound; throw new HttpException((int)HttpStatusCode.NotFound, "Not found"); } if (request.HttpMethod.Equals("post", StringComparison.OrdinalIgnoreCase)) { ProcessPost(); return; } Bundles.AddPageData("data", PageData()); Bundles.Reference("~/Cassette.Aspnet.Resources"); var html = Properties.Resources.hud; html = html.Replace("$scripts$", Bundles.RenderScripts().ToHtmlString()); response.ContentType = "text/html"; response.Write(html); }
protected IHtmlString JsInline(Func <dynamic, HelperResult> jsFragmentRenderer) { string html = jsFragmentRenderer(null).ToHtmlString(); Bundles.AddInlineScript(html, "inline"); return(MvcHtmlString.Empty); }
/// <summary> /// Determines if the virtual path corresponds to a bundle. /// </summary> /// <param name="virtualPath">The virtual path requested.</param> /// <returns>A boolean value indicating whether the virtual path corresponds to a bundle.</returns> public bool IsBundleVirtualPath(string virtualPath) { if (ExceptionUtil.ValidateVirtualPath(virtualPath, "virtualPath") != null) { return(false); } return(Bundles.GetBundleFor(virtualPath) != null); }
public void VerifyBundleRules() { var myBundles = new Bundles(); var response = myBundles.GetBundles(); Assert.AreEqual(200, response.StatusCode); Assert.AreEqual("9", response.Response[0].Bundle_Rule[0].Rule_Id); }
public void VerifyNactCode() { var myBundles = new Bundles(); var response = myBundles.GetBundles(); Assert.AreEqual(200, response.StatusCode); Assert.AreEqual("NACT_SWZ_Data_855", response.Response[0].Bundle_Nact_Code); }
public void VerifyBundles() { var myBundles = new Bundles(); var response = myBundles.GetBundles(); Assert.AreEqual(200, response.StatusCode); Assert.AreEqual("Daily Facebook 30MB", response.Response[0].Bundle_Name); }
/// <summary> /// Restores state of player's inventory after game loading. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Arguments</param> private void GameLoop_SaveLoaded(object sender, SaveLoadedEventArgs e) { bundles = new Bundles(); bundles.Startup(); inventory = new Inventory(Game1.player.items); todolist = new TodoList(); }
protected IHtmlString Css([PathReference] params string[] uriStrings) { foreach (string uriString in uriStrings) { Bundles.Reference(uriString); } return(MvcHtmlString.Empty); }
/// <summary> /// Gets the url for a bundle. /// </summary> /// <param name="virtualPath">The virtual path requested.</param> /// <returns>The versioned bundle url or the unmodified virtual path if it does not correspond to a bundle.</returns> public string GetBundleUrl(string virtualPath) { if (ExceptionUtil.ValidateVirtualPath(virtualPath, "virtualPath") != null) { return(null); } return(Bundles.ResolveBundleUrl(virtualPath)); }
protected IHtmlString Template([PathReference] params string[] paths) { foreach (string path in paths) { Bundles.Reference <HtmlTemplateBundle>(path); } return(MvcHtmlString.Empty); }
public void GetBundlesHighesValueFirst_ShouldReturnBundlesInDescendingOrder() { Bundles sut = new Bundles(); List <Bundle> bundles = sut.GetBundlesHighesValueFirst(); List <Bundle> reorderedBundles = bundles.OrderByDescending(b => b.Value).ToList(); CollectionAssert.AreEqual(reorderedBundles, bundles); }