/// <summary> /// Helper function to return properly sized images based on user preferences</summary> /// <param name="imageName">Image name</param> /// <returns>Image of given name</returns> public Image GetProperlySizedImage(string imageName) { Image image = null; if (!string.IsNullOrEmpty(imageName)) { if (m_imageSize == ImageSizes.Size16x16) { image = ResourceUtil.GetImage16(imageName); } else if (m_imageSize == ImageSizes.Size24x24) { image = ResourceUtil.GetImage24(imageName); } else if (m_imageSize == ImageSizes.Size32x32) { image = ResourceUtil.GetImage32(imageName); } } return(image); }
public DomExplorer(IControlHostService controlHostService) { m_controlHostService = controlHostService; m_treeControl = new TreeControl(); m_treeControl.Dock = DockStyle.Fill; m_treeControl.AllowDrop = true; m_treeControl.SelectionMode = SelectionMode.MultiExtended; m_treeControl.ImageList = ResourceUtil.GetImageList16(); m_treeControl.NodeSelectedChanged += treeControl_NodeSelectedChanged; m_treeControlAdapter = new TreeControlAdapter(m_treeControl); m_treeView = new TreeView(); m_propertyGrid = new Sce.Atf.Controls.PropertyEditing.PropertyGrid(); m_propertyGrid.Dock = DockStyle.Fill; m_splitContainer = new SplitContainer(); m_splitContainer.Text = "Dom Explorer"; m_splitContainer.Panel1.Controls.Add(m_treeControl); m_splitContainer.Panel2.Controls.Add(m_propertyGrid); }
private void loadEnemyCharacterCsv(string csvFilePath) { string[,] strArray = CsvUtils.Deserialize(ResourceUtil.LoadSafe <TextAsset>(csvFilePath, false).text); for (int i = 0; i < strArray.GetLength(1); i++) { if (strArray[0, i] != null) { Character e = new Character(); int num2 = 0; e.Id = strArray[num2++, i]; e.Name = _.L(strArray[num2++, i], null, false); num2++; e.Type = base.parseEnumType <GameLogic.CharacterType>(strArray[num2++, i]); e.Prefab = base.parseEnumType <CharacterPrefab>(strArray[num2++, i]); e.Rarity = base.parseInt(strArray[num2++, i]); e.CoreAiBehaviour = base.parseEnumType <AiBehaviourType>(strArray[num2++, i]); e.BossAiBehaviour = base.parseEnumType <AiBehaviourType>(strArray[num2++, i]); e.BossAiParameters = new string[] { strArray[num2++, i], strArray[num2++, i], strArray[num2++, i] }; e.BossPerk = base.parseEnumType <PerkType>(strArray[num2++, i]); e.RangedProjectileType = base.parseEnumType <ProjectileType>(strArray[num2++, i]); e.AttackContactTimeNormalized = base.parseFloat(strArray[num2++, i]); e.BaseStats = new Dictionary <string, double>(); e.BaseStats.Add(BaseStatProperty.Life.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.AttacksPerSecond.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.AttackRange.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.DamagePerHit.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.CriticalHitChancePct.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.CriticalHitMultiplier.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.CleaveDamagePct.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.CleaveRange.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.MovementSpeed.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.Threat.ToString(), base.parseDouble(strArray[num2++, i])); e.BaseStats.Add(BaseStatProperty.UniversalArmorBonus.ToString(), 0.0); e.BaseStats.Add(BaseStatProperty.SkillDamage.ToString(), 0.0); e.BaseStats.Add(BaseStatProperty.UniversalXpBonus.ToString(), 0.0); this.postProcess(e); } } }
private static void LoadRegistry() { Stream resource = ResourceUtil.GetResourceStream(FontResources.CMAPS + "cjk_registry.properties"); Properties p = new Properties(); p.Load(resource); resource.Dispose(); foreach (Object key in p.Keys) { String value = p.GetProperty((String)key); String[] sp = iText.IO.Util.StringUtil.Split(value, " "); ICollection <String> hs = new HashSet <String>(); foreach (String s in sp) { if (s.Length > 0) { hs.Add(s); } } registryNames.Put((String)key, hs); } }
/// <summary> /// Constructor</summary> public StringSearchInputUI() { m_patternTextRegex = string.Empty; Visible = true; GripStyle = ToolStripGripStyle.Hidden; RenderMode = ToolStripRenderMode.System; ToolStripDropDownButton dropDownButton = new ToolStripDropDownButton(); dropDownButton.DisplayStyle = ToolStripItemDisplayStyle.Image; dropDownButton.Image = ResourceUtil.GetImage16(Resources.SearchImage); dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; dropDownButton.Name = "SearchButton"; dropDownButton.Size = new System.Drawing.Size(29, 22); dropDownButton.Text = "Search".Localize("'Search' is a verb"); ToolStripButton clearSearchButton = new ToolStripButton(); clearSearchButton.DisplayStyle = ToolStripItemDisplayStyle.Image; clearSearchButton.Image = ResourceUtil.GetImage16(Resources.DeleteImage); dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; clearSearchButton.Name = "ClearSearchButton"; clearSearchButton.Size = new System.Drawing.Size(29, 22); clearSearchButton.Text = "Clear Search".Localize("'Clear' is a verb"); clearSearchButton.Click += clearSearchButton_Click; m_patternTextBox = new ToolStripAutoFitTextBox(); m_patternTextBox.KeyUp += patternTextBox_KeyUp; m_patternTextBox.TextChanged += patternTextBox_TextChanged; m_patternTextBox.TextBox.PreviewKeyDown += textBox_PreviewKeyDown; m_patternTextBox.MaximumWidth = 1080; Items.AddRange(new ToolStripItem[] { dropDownButton, m_patternTextBox, clearSearchButton }); }
public static AddmlInfo ReadFromFile(string fileName) { string addmlXsd = ResourceUtil.ReadResource(ArkadeConstants.AddmlXsdResource); try { string fileContent = File.ReadAllText(fileName); addml addml = ReadFromString(fileContent); Validate(fileContent, addmlXsd); return(new AddmlInfo(addml, new FileInfo(fileName))); } catch (FileNotFoundException e) { throw new ArkadeException(string.Format(Resources.ExceptionMessages.FileNotFound, fileName), e); } catch (Exception e) { throw new ArkadeException(string.Format(Resources.Messages.ExceptionReadingAddmlFile, e.Message), e); } }
private void UpdateAllTabs() { for (var index = 0; index < _formsTabs.Children.Count; index++) { var androidTab = _bottomNavigationView.Menu.GetItem(index); int iconId; if (_formsTabs.Children[index] is ITabPageIcons tabPage) { if (_formsTabs.Children[index] == _formsTabs.CurrentPage) { iconId = ResourceUtil.GetDrawableIdByFileName(tabPage.GetSelectedIcon(), Context); androidTab.SetIcon(iconId); continue; } iconId = ResourceUtil.GetDrawableIdByFileName(tabPage.GetIcon(), Context); androidTab.SetIcon(iconId); continue; } } }
public BookmarkLister(ICommandService commandService) : base(commandService) { Configure(out m_controlInfo); m_commandService = commandService; m_contextMenuStrip = new ContextMenuStrip(); m_contextMenuStrip.AutoClose = true; m_addBookmark = new ToolStripMenuItem(m_addBookMark); m_addBookmark.Click += (sender, e) => AddBookmark(); m_addBookmark.ToolTipText = "Adds a new bookmark".Localize(); m_deleteBookmark = new ToolStripMenuItem("Delete".Localize()); m_deleteBookmark.Click += (sender, e) => Delete(); m_deleteBookmark.ShortcutKeys = Keys.Delete; m_deleteBookmark.ShortcutKeyDisplayString = KeysUtil.KeysToString(Keys.Delete, true); m_deleteBookmark.Image = ResourceUtil.GetImage16(CommandInfo.EditDelete.ImageName); m_contextMenuStrip.Items.Add(m_addBookmark); m_contextMenuStrip.Items.Add(m_deleteBookmark); }
private static void LoadImageResources() { lock (_imagesLock) { if (_background == null) { _background = (Bitmap)ResourceUtil.LoadBitmapFromEmbeddedResource(IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + NOZ_BACKGROUND_IMAGE_FILENAME); } if (_background2 == null) { _background2 = (Bitmap)ResourceUtil.LoadBitmapFromEmbeddedResource(IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + NOZ_BACKGROUND2_IMAGE_FILENAME); } if (_needle == null) { _needle = ResourceUtil.CreateImageMaskPairFromEmbeddedResources( IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + NOZ_NEEDLE_IMAGE_FILENAME, IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + NOZ_NEEDLE_MASK_FILENAME); _needle.Use1BitAlpha = true; } } _imagesLoaded = true; }
protected override void RenderContents(HtmlTextWriter output) { if (string.IsNullOrEmpty(ServiceUri)) { throw new ArgumentNullException("CIAPI.AspNet.Controls.Authentication.ServiceUri", "You must set the ServiceUri property to the Uri of the CityIndex Trading Api (e.g: https://ciapi.cityindex.com/TradingAPI )"); } var content = ResourceUtil.ReadText(GetType(), "AuthenticationWidget.html") .ReplaceWebControlTemplateVars(this); content = LocaliseControl(content); content = content .Replace("<%=afterLogOn%>", GetAfterLogOnScript()) .Replace("<%=afterLogOn%>", GetAfterLogOnScript()) .Replace("<%=afterLogOff%>", GetAfterLogOffScript()) .Replace("<%=LaunchPlatformUri%>", LaunchPlatformUri) .Replace("<%=serviceUri%>", ServiceUri); output.Write(content); }
private void DefineCircuitType( DomNodeType type, string elementTypeName, string imageName, ICircuitPin[] inputs, ICircuitPin[] outputs) { // create an element type and add it to the type metadata // For now, let all circuit elements be used as 'connectors' which means // that their pins will be used to create the pins on a master instance. bool isConnector = true; //(inputs.Length + outputs.Length) == 1; var image = string.IsNullOrEmpty(imageName) ? null : ResourceUtil.GetImage32(imageName); type.SetTag <ICircuitElementType>( new ElementType( elementTypeName, isConnector, new Size(), image, inputs, outputs)); }
private static void LoadExternalMods() { int i = AvailableMods.Count; string[] terms = { ".patch" }; List <string> searchresults = ResourceUtil.directorySearchRecursive(Settings.Default.PatchPath, terms); if (searchresults == null) { Trace.WriteLine("No External Mods found"); } else { foreach (string modpath in searchresults) { if (!modpath.ContainsCI("debug") && !modpath.ContainsCI("currentbuild")) { AvailableMods.Add(new Mod(modpath)); } } } }
public void Read(BinaryReader br) { // Full Structure of rage::pgDictionary // rage::datBase VTable = br.ReadUInt32(); // rage::pgBase BlockMapOffset = ResourceUtil.ReadOffset(br); ParentDictionary = br.ReadUInt32(); UsageCount = br.ReadUInt32(); // CSimpleCollection<DWORD> HashTableOffset = ResourceUtil.ReadOffset(br); TextureCount = br.ReadInt16(); br.ReadInt16(); // CPtrCollection<T> TextureListOffset = ResourceUtil.ReadOffset(br); br.ReadInt16(); br.ReadInt16(); }
public void SetCustomData(byte[] data) { if (data == null) { CustomData = null; } else { Size = data.Length; SizeInArchive = data.Length; IsCompressed = false; if ((data.Length % BlockSize) != 0) { int fullDataLength = data.Length + (BlockSize - data.Length % BlockSize); var newData = new byte[fullDataLength]; data.CopyTo(newData, 0); data = newData; } CustomData = data; if (IsResourceFile) { var ms = new MemoryStream(data, false); uint flags; ResourceType resType; ResourceUtil.GetResourceData(ms, out flags, out resType); RSCFlags = flags; ResourceType = resType; ms.Close(); } } }
protected void BuildSqlMap(ResourceType resourceType, string path) { switch (resourceType) { case ResourceType.Embedded: case ResourceType.File: { var sqlMapXml = ResourceUtil.LoadAsXml(resourceType, path); BuildSqlMap(sqlMapXml); break; } case ResourceType.Directory: case ResourceType.DirectoryWithAllSub: { SearchOption searchOption = SearchOption.TopDirectoryOnly; if (resourceType == ResourceType.DirectoryWithAllSub) { searchOption = SearchOption.AllDirectories; } var dicPath = Path.Combine(AppContext.BaseDirectory, path); var childSqlMapSources = Directory.EnumerateFiles(dicPath, "*.xml", searchOption); foreach (var sqlMapPath in childSqlMapSources) { if (Logger.IsEnabled(LogLevel.Debug)) { Logger.LogDebug($"BuildSqlMap.Child ->> Path :[{sqlMapPath}]."); } var sqlMapXml = ResourceUtil.LoadFileAsXml(sqlMapPath); BuildSqlMap(sqlMapXml); } break; } } }
/// <summary> /// Creates a new <see cref="FdoRow"/> from a <see cref="FdoFeature"/> instance /// </summary> /// <param name="feat">The <see cref="FdoFeature"/> instance</param> /// <returns>A new <see cref="FdoRow"/> instance</returns> public static FdoRow FromFeatureRow(FdoFeature feat) { if (feat.Table == null) { throw new InvalidOperationException(ResourceUtil.GetString("ERR_FEATURE_ROW_HAS_NO_PARENT_TABLE")); } FdoRow row = new FdoRow(); foreach (DataColumn dc in feat.Table.Columns) { if (feat[dc] != null && feat[dc] != DBNull.Value) { FdoGeometry geom = feat[dc] as FdoGeometry; if (geom != null) { if (feat.Table.GeometryColumn == dc.ColumnName) { row.AddGeometry(dc.ColumnName, geom.InternalInstance); row.DefaultGeometryProperty = dc.ColumnName; } else { row.AddGeometry(dc.ColumnName, geom.InternalInstance); } } else { row[dc.ColumnName] = feat[dc]; } if (dc.ReadOnly) { row.MarkReadOnly(dc.ColumnName); } } } return(row); }
public async Task CanDowloadAttachment() { var fileData = ResourceUtil.GetResource(ResourceName); var res = await api.Attachments.UploadAttachmentAsync(new ZenFile() { ContentType = "text/plain", FileName = "testupload.txt", FileData = fileData }); var ticket = new Ticket() { Subject = "testing attachments", Priority = TicketPriorities.Normal, Comment = new Comment() { Body = "comments are required for attachments", Public = true, Uploads = new List <string>() { res.Token } }, }; var t1 = await api.Tickets.CreateTicketAsync(ticket); Assert.Equal(t1.Audit.Events.First().Attachments.Count, 1); var test = t1.Audit.Events.First().Attachments.First(); var file = await api.Attachments.DownloadAttachmentAsync(test); Assert.NotNull(file.FileData); Assert.True(api.Tickets.Delete(t1.Ticket.Id.Value)); Assert.True(api.Attachments.DeleteUpload(res)); }
/// <exception cref="System.IO.IOException"/> private static IDictionary <String, Object> ReadFontProperties(String name) { Stream resource = ResourceUtil.GetResourceStream(FontConstants.CMAP_RESOURCE_PATH + name + ".properties"); try { Properties p = new Properties(); p.Load(resource); IDictionary <String, Object> fontProperties = new Dictionary <String, Object>(); foreach (KeyValuePair <Object, Object> entry in p) { fontProperties[(String)entry.Key] = entry.Value; } fontProperties[W_PROP] = CreateMetric((String)fontProperties.Get(W_PROP)); fontProperties[W2_PROP] = CreateMetric((String)fontProperties.Get(W2_PROP)); return(fontProperties); } finally { if (resource != null) { resource.Close(); } } }
/// <summary> /// Should be called only from <see cref="ICUBinary.GetData(Assembly, string, string, bool)"/> or from convenience overloads here. /// </summary> internal static Stream GetStream(Assembly loader, string localeID, string resourceName, bool required) { string cultureName = localeID == "root" || localeID == "any" ? string.Empty : localeID.Replace('_', '-'); //var culture = string.IsNullOrWhiteSpace(cultureName) ? CultureInfo.InvariantCulture : new ResourceCultureInfo(cultureName); Stream i = null; Assembly satelliteAssembly; // Skip the lookup if the wrong satellite assembly was loaded. In most cases, if the resource assembly doesn't exist, // we will have the neutral resource (invariant) assembly. So, we do a check to make sure we have the right one, // and fallback if we do not. if ((satelliteAssembly = GetSatelliteAssemblyOrDefault(loader, cultureName)) != null) { i = satelliteAssembly.GetManifestResourceStream(ResourceUtil.ConvertResourceName(resourceName)); } if (i == null && required) { throw new MissingManifestResourceException("could not locate data " + loader.ToString() + " Resource: " + resourceName); } CheckStreamForBinaryData(i, resourceName); return(i); }
private void UpdateResourceView(GameObject holder, ResourceStorage storage) { // Delete all children foreach (Transform child in holder.transform) { Destroy(child.gameObject); } var resources = new int[] { storage.wood, storage.stone, storage.clay, storage.wheat, storage.wool }; for (int i = 0; i < resources.Length; i++) { if (resources[i] <= 0) { continue; } var resourceType = ResourceUtil.IntToType(i); var resourceItem = GameObject.Instantiate(resourceItemPrefab); resourceItem.transform.SetParent(holder.transform); resourceItem.GetComponentInChildren <Image>().sprite = TypeToSprite(resourceType); resourceItem.GetComponentInChildren <Text>().text = $"{resources[i]}x"; } }
/// <exception cref="System.IO.IOException"/> private static void LoadRegistry() { Stream resource = ResourceUtil.GetResourceStream(FontConstants.CMAP_RESOURCE_PATH + "cjk_registry.properties" ); Properties p = new Properties(); p.Load(resource); resource.Close(); foreach (Object key in p.Keys) { String value = p.GetProperty((String)key); String[] sp = value.Split(" "); ICollection <String> hs = new HashSet <String>(); foreach (String s in sp) { if (s.Length > 0) { hs.Add(s); } } registryNames[(String)key] = hs; } }
private static void LoadImageResources() { if (_background == null) { _background = ResourceUtil.CreateImageMaskPairFromEmbeddedResources( IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + VVI_BACKGROUND_IMAGE_FILENAME, IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + VVI_BACKGROUND_MASK_FILENAME); } if (_offFlag == null) { _offFlag = ResourceUtil.CreateImageMaskPairFromEmbeddedResources( IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + VVI_OFF_FLAG_IMAGE_FILENAME, IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + VVI_OFF_FLAG_MASK_FILENAME); } if (_indicatorLine == null) { _indicatorLine = ResourceUtil.CreateImageMaskPairFromEmbeddedResources( IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + VVI_INDICATOR_LINE_IMAGE_FILENAME, IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + VVI_INDICATOR_LINE_MASK_FILENAME); } if (_numberTape == null) { _numberTape = (Bitmap)ResourceUtil.LoadBitmapFromEmbeddedResource(IMAGES_FOLDER_NAME + Path.DirectorySeparatorChar + VVI_NUMBER_TAPE_IMAGE_FILENAME); } _imagesLoaded = true; }
public new void Read(BinaryReader br) { base.Read(br); Geometries = new PtrCollection <Geometry>(br); var unknownVectorOffsets = ResourceUtil.ReadOffset(br); var materialMappingOffset = ResourceUtil.ReadOffset(br); Unknown1 = br.ReadUInt16(); Unknown2 = br.ReadUInt16(); Unknown3 = br.ReadUInt16(); Unknown4 = br.ReadUInt16(); // br.BaseStream.Seek(unknownVectorOffsets, SeekOrigin.Begin); UnknownVectors = new SimpleArray <Vector4>(br, 4, reader => new Vector4(reader)); br.BaseStream.Seek(materialMappingOffset, SeekOrigin.Begin); ShaderMappings = new SimpleArray <ushort>(br, Geometries.Count, reader => reader.ReadUInt16()); }
private static IDictionary <String, Object> ReadFontProperties(String name) { Stream resource = ResourceUtil.GetResourceStream(FontResources.CMAPS + name + ".properties"); try { Properties p = new Properties(); p.Load(resource); IDictionary <String, Object> fontProperties = new Dictionary <String, Object>(); foreach (KeyValuePair <Object, Object> entry in p) { fontProperties.Put((String)entry.Key, entry.Value); } fontProperties.Put(W_PROP, CreateMetric((String)fontProperties.Get(W_PROP))); fontProperties.Put(W2_PROP, CreateMetric((String)fontProperties.Get(W2_PROP))); return(fontProperties); } finally { if (resource != null) { resource.Dispose(); } } }
static void CreateSharedMain() { // Create a type catalog with the types of components we want in the application TypeCatalog catalog = new TypeCatalog( typeof(SettingsService), // persistent settings and user preferences dialog typeof(UnhandledExceptionService), // catches unhandled exceptions, displays info, and gives user a chance to save typeof(FileDialogService), // standard Windows file dialogs typeof(ErrorDialogService) // displays errors to the user in a message box ); StandardEditCommands.UseSystemClipboard = true; CompositionContainer sharedContainer = new CompositionContainer(catalog); // Configure the main Form var batch = new CompositionBatch(); m_toolMainForm = new ToolMainForm() { Text = "Diagram Editor Main".Localize(), Icon = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage)) }; // Add the main Form instance to the container batch.AddPart(m_toolMainForm); sharedContainer.Compose(batch); sharedContainer.InitializeAll(); m_SharedComponents.Add(sharedContainer.GetExportedValue <SettingsService>()); m_SharedComponents.Add(sharedContainer.GetExportedValue <UnhandledExceptionService>()); m_SharedComponents.Add(sharedContainer.GetExportedValue <IFileDialogService>()); m_SharedComponents.Add(sharedContainer.GetExportedValue <ErrorDialogService>()); m_SharedContainer = sharedContainer; }
public void OnSelected(GameController controller) { Player player = controller.GetLocalPlayer().player; // Show UI action panel controller.uiController.EnableActionButtons( ResourceUtil.CanAffordPath(player.resources) && controller.mapController.GetAdjecentPaths(workerController.worker.location, true).Length > 0, ResourceUtil.CanAffordHouse(player.resources) && workerController.worker.location.type == LocationType.Available && controller.mapController.GetConnectedLocations(workerController.worker.location, player).Where(l => l.type != LocationType.Available).Count() > 0, ResourceUtil.CanAffordCity(player.resources) && workerController.worker.location.type == LocationType.House && controller.GetLocalPlayer().player.id.Equals(workerController.worker.location.occupiedBy), ResourceUtil.CanAffordCard(player.resources)); controller.uiController.EnableActionPanel( true, () => EnableRoadPlacement(controller), () => BuildHouse(controller), () => BuildCity(controller), () => BuyCard(controller) ); // Initialize moves to show if (workerController.state == WorkerController.WorkerState.Movable) { currentAvailableMoves = controller.mapController.GetReachableLocations(workerController.worker.location, player); foreach (var lc in currentAvailableMoves) { lc.SetSelectable(true); } shouldTryOverride = true; controller.GetLocalPlayer().SetState(PlayerController.State.WorkerMovement); } // Play sound effect workerController.PlayRandomSound(); }
/****************************************************************************** * Implementation Details ******************************************************************************/ /// <summary> /// Create the window components we'll be using /// </summary> private void Awake() { Log.Verbose("Customizing DraggableWindow"); DraggableWindow.CloseTexture = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnClose.png"); DraggableWindow.LockTexture = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnLock.png"); DraggableWindow.UnlockTexture = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnUnlock.png"); DraggableWindow.ButtonHoverBackground = ResourceUtil.LocateTexture("ScienceAlert.Resources.btnBackground.png"); DraggableWindow.ButtonSound = "click1"; scienceAlert = GetComponent <ScienceAlert>(); // note to self: these are on separate gameobjects because they use a UIButton to catch // clickthrough, parented to the window's GO. It's simpler to simply disable the window rather than // also disable the UIButton every time Log.Normal("Creating options window"); optionsWindow = new GameObject("ScienceAlert.OptionsWindow").AddComponent <Implementations.DraggableOptionsWindow>(); optionsWindow.scienceAlert = GetComponent <ScienceAlert>(); optionsWindow.manager = GetComponent <Experiments.ExperimentManager>(); Log.Normal("Creating experiment window"); experimentList = new GameObject("ScienceAlert.ExperimentList").AddComponent <Implementations.DraggableExperimentList>(); experimentList.biomeFilter = GetComponent <BiomeFilter>(); experimentList.manager = GetComponent <Experiments.ExperimentManager>(); Log.Normal("Creating debug window"); debugWindow = new GameObject("ScienceAlert.DebugWindow").AddComponent <Implementations.DraggableDebugWindow>(); // initially hide windows optionsWindow.Visible = experimentList.Visible = debugWindow.Visible = false; }
private static IDictionary <String, Object> ReadFontProperties(String name) { name += ".properties"; Stream resource = ResourceUtil.GetResourceStream(FontResources.CMAPS + name); Properties p = new Properties(); p.Load(resource); resource.Dispose(); IntHashtable W = CreateMetric(p.GetProperty("W")); p.Remove("W"); IntHashtable W2 = CreateMetric(p.GetProperty("W2")); p.Remove("W2"); IDictionary <String, Object> map = new Dictionary <String, Object>(); foreach (Object obj in p.Keys) { map.Put((String)obj, p.GetProperty((String)obj)); } map.Put("W", W); map.Put("W2", W2); return(map); }
public async Task StartInvokesOnFailureAndThrowsIfTaskCancelled() { var fakeConnection = new FakeConnection { TotalTransportConnectTimeout = new TimeSpan(0, 0, 10) }; var fakeWebSocketTransport = new FakeWebSocketTransport(); var cancellationTokenSource = new CancellationTokenSource(); fakeWebSocketTransport.Setup <Task>("OpenWebSocket", () => { cancellationTokenSource.Cancel(); var tcs = new TaskCompletionSource <object>(); tcs.TrySetResult(null); return(tcs.Task); }); Assert.Equal( ResourceUtil.GetResource("Error_ConnectionCancelled"), (await Assert.ThrowsAsync <OperationCanceledException>( async() => await fakeWebSocketTransport.Start(fakeConnection, null, cancellationTokenSource.Token))).Message); Assert.Equal(1, fakeWebSocketTransport.GetInvocations("OnStartFailed").Count()); }
public new void Read(BinaryReader br) { base.Read(br); VertexCount = br.ReadUInt16(); Unknown1 = br.ReadUInt16(); DataOffset = ResourceUtil.ReadDataOffset(br); StrideSize = br.ReadUInt32(); var vertexDeclOffset = ResourceUtil.ReadOffset(br); Unknown2 = br.ReadUInt32(); DataOffset2 = ResourceUtil.ReadDataOffset(br); var p2Offset = ResourceUtil.ReadOffset(br); // null // br.BaseStream.Seek(vertexDeclOffset, SeekOrigin.Begin); VertexDeclaration = new VertexDeclaration(br); }