public void loadIcons() { foreach (LocationDailyWeather ldw in ForecastDict.Values) { ldw.Icon = IconHandler.LoadImage(ldw.StringIcon); } }
private static void AddMmcCommands(SpecialCommandConfigurationElementCollection cmdList) { Icon[] IconsList = IconHandler.IconsFromFile(Path.Combine(SystemRoot.FullName, "mmc.exe"), IconSize.Small); Random rnd = new Random(); foreach (FileInfo file in SystemRoot.GetFiles("*.msc")) { MMCFile fileMMC = new MMCFile(file); SpecialCommandConfigurationElement elm1 = new SpecialCommandConfigurationElement(file.Name); if (IconsList != null && IconsList.Length > 0) { if (fileMMC.SmallIcon != null) { elm1.Thumbnail = fileMMC.SmallIcon.ToBitmap().ImageToBase64(System.Drawing.Imaging.ImageFormat.Png); } else { elm1.Thumbnail = IconsList[rnd.Next(IconsList.Length - 1)].ToBitmap().ImageToBase64(System.Drawing.Imaging.ImageFormat.Png); } elm1.Name = fileMMC.Parsed ? fileMMC.Name : file.Name.Replace(file.Extension, ""); } elm1.Executable = @"%systemroot%\system32\" + file.Name; cmdList.Add(elm1); } }
private void drawBirthdayIcon(object sender, EventArgs e) { if (Game1.eventUp) { return; } // Calculate and draw birthday icon foreach (GameLocation location in Game1.locations) { foreach (NPC npc in location.characters) { if (npc.isBirthday(Game1.currentSeason, Game1.dayOfMonth)) { // draw headshot of npc whos birthday it is Rectangle rect = LocationOfTownsfolk.getHeadShot(npc); int iconPositionX = IconHandler.getIconXPosition(); int iconPositionY = 256; float scale = 2.9f; Game1.spriteBatch.Draw(Game1.mouseCursors, new Vector2(iconPositionX, iconPositionY), new Rectangle(913 / 4, 1638 / 4, 16, 16), Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, 1); var npcMugShot = new ClickableTextureComponent(npc.name, new Rectangle(iconPositionX - 7, iconPositionY - 2, (int)(16 * scale), (int)(16 * scale)), null, npc.name, npc.sprite.Texture, rect, 2f, false); npcMugShot.draw(Game1.spriteBatch); if (npcMugShot.containsPoint(Game1.getMouseX(), Game1.getMouseY())) { string tooltip = $"{npc.name}'s Birthday"; IClickableMenu.drawHoverText(Game1.spriteBatch, tooltip, Game1.dialogueFont); } } } } }
// Use this for initialization void Start() { //get the scripts necessary iconHandlerScript = iconHandler.GetComponent <IconHandler>(); // initial shown text is blank (aka no text shown) displayText.text = ""; shadowText.text = ""; }
public void ChooseImageLocation() { string path = FileSelectHandler.ChooseImageLocation(); if (path != null) { Game.ImageLocation = IconHandler.SaveImageToLocalStorage(path); DisplayImage = null; } }
// set the object to not be destroyed on new scene loading void Awake() { //Debug.Log("created new grid"); //if we don't have an [_instance] set yet if (!_instance) _instance = this; //otherwise, if we do, kill this thing else Destroy(this.gameObject); DontDestroyOnLoad(this.gameObject); //DontDestroyOnLoad(transform.gameObject); }
private static void AddRegEditCommand(SpecialCommandConfigurationElementCollection cmdList) { string regEditFile = Path.Combine(SystemRoot.FullName, "regedt32.exe"); Icon[] regeditIcons = IconHandler.IconsFromFile(regEditFile, IconSize.Small); SpecialCommandConfigurationElement regEditElm = new SpecialCommandConfigurationElement("Registry Editor"); if (regeditIcons != null && regeditIcons.Length > 0) { regEditElm.Thumbnail = regeditIcons[0].ToBitmap().ImageToBase64(System.Drawing.Imaging.ImageFormat.Png); } regEditElm.Executable = regEditFile; cmdList.Add(regEditElm); }
private static void AddControlPanelApplets(SpecialCommandConfigurationElementCollection cmdList) { foreach (FileInfo file in SystemRoot.GetFiles("*.cpl")) { SpecialCommandConfigurationElement elm1 = new SpecialCommandConfigurationElement(file.Name); Icon[] fileIcons = IconHandler.IconsFromFile(file.FullName, IconSize.Small); if (fileIcons != null && fileIcons.Length > 0) { elm1.Thumbnail = fileIcons[0].ToBitmap().ImageToBase64(System.Drawing.Imaging.ImageFormat.Png); elm1.Name = file.Name; elm1.Executable = @"%systemroot%\system32\" + file.Name; cmdList.Add(elm1); } } }
private void Parse() { try { using (FileStream fs = new FileStream(this.mmcFileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite & FileShare.Delete)) { using (StreamReader stream = new StreamReader(fs)) { this.rawContents = stream.ReadToEnd(); } } if (this.rawContents != null && this.rawContents.Trim() != "" && this.rawContents.StartsWith("<?xml")) { XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(this.rawContents); XmlNode node = xDoc.SelectSingleNode("/MMC_ConsoleFile/StringTables/StringTable/Strings"); foreach (XmlNode cNode in node.ChildNodes) { string name = cNode.InnerText; if (name != "Favorites" && name != "Console Root") { this.Name = name; this.Parsed = true; break; } } XmlNode visual = xDoc.SelectSingleNode("/MMC_ConsoleFile/VisualAttributes/Icon"); if (visual != null) { string iconFile = visual.Attributes["File"].Value; int index = Convert.ToInt32(visual.Attributes["Index"].Value); Icon[] icons = IconHandler.IconsFromFile(iconFile, IconSize.Small); if (icons != null && icons.Length > 0) { this.SmallIcon = icons.Length > index ? icons[index] : icons[0]; } } } } catch (Exception exc) { Log.Error("Error parsing MMC File", exc); } }
void ObservableGrepSearchResults_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { List <IGrepResult> toRemove = new List <IGrepResult>(); foreach (var node in SelectedNodes) { FormattedGrepResult item = node as FormattedGrepResult; FormattedGrepLine line = node as FormattedGrepLine; if (item != null && !this.Contains(item)) { toRemove.Add(item); } if (line != null && !this.Contains(line.Parent)) { toRemove.Add(line); } } foreach (var item in toRemove) { SelectedNodes.Remove(item); } if (e.NewItems != null) { foreach (FormattedGrepResult newEntry in e.NewItems.Cast <FormattedGrepResult>()) { string extension = Path.GetExtension(newEntry.GrepResult.FileNameDisplayed); if (extension.Length <= 1) { extension = ".na"; } if (!icons.ContainsKey(extension)) { System.Drawing.Bitmap bitmapIcon = IconHandler.IconFromExtensionShell(extension, IconSize.Small); if (bitmapIcon == null) { bitmapIcon = dnGREP.Common.Properties.Resources.na_icon; } icons[extension] = GetBitmapSource(bitmapIcon); } newEntry.Icon = icons[extension]; } } }
// set the object to not be destroyed on new scene loading void Awake() { //Debug.Log("created new grid"); //if we don't have an [_instance] set yet if (!_instance) { _instance = this; } //otherwise, if we do, kill this thing else { Destroy(this.gameObject); } DontDestroyOnLoad(this.gameObject); //DontDestroyOnLoad(transform.gameObject); }
public void GenerateOSMObjects(MapGenerator mapGenerator, string mapName) { mapData = mapGenerator.mapData; trailDisplay = this.GetComponent <TrailDisplay> (); poiDisplay = this.GetComponent <POIDisplay> (); iconHandler = this.GetComponent <IconHandler>(); areaDisplay = this.GetComponent <AreaDisplay>(); OSMData osmData = DataImporter.GetOSMData(mapName); trailDisplay.mapData = mapData; poiDisplay.mapData = mapData; iconHandler.generateIconDictionary(); GenerateTrails(osmData); GeneratePoiNodes(osmData); GenerateAreas(osmData); GenerateRivers(osmData); areaDisplay.displayAreas(); }
protected virtual void SetAppIcon(IntPtr window, string filename) { try { filename = IconHandler.IconFullPath(filename); if (!string.IsNullOrWhiteSpace(filename)) { IntPtr error = IntPtr.Zero; gtk_window_set_icon_from_file(window, filename, out error); if (error != IntPtr.Zero) { Logger.Instance.Log.LogError("Icon handle not successfully freed."); } } } catch (Exception exception) { Logger.Instance.Log.LogError(exception); } }
/// <summary> /// Draws the dice icon /// </summary> internal void drawDiceIcon(object sender, EventArgs e) { if (Game1.eventUp) { return; } //TODO refactor this into new day var color = new Color(Color.White.ToVector4()); if (Game1.dailyLuck > 0.04d) { hoverText = "You're feelin' lucky!!"; color.B = 155; color.R = 155; } else if (Game1.dailyLuck < -0.04d) { hoverText = "Maybe you should stay home today..."; color.B = 155; color.G = 155; } else if (-0.04d <= Game1.dailyLuck && Game1.dailyLuck < 0) { hoverText = "You're not feeling lucky at all today..."; color.B = 165; color.G = 165; color.R = 165; color *= 0.8f; } else { hoverText = "Feelin' lucky... but not too lucky"; } // Set icon position icon.bounds.X = IconHandler.getIconXPosition(); icon.draw(Game1.spriteBatch, color, 1); }
private void SetIcon(bool overwrite = false) { if (string.IsNullOrEmpty(this.txtGenericExecutablePath.Text)) { return; } Icon icon = IconHandler.IconFromFile(this.txtGenericExecutablePath.Text, IconSize.Large, 0); if (icon == null) { return; } Bitmap bitmap = icon.ToBitmap(); if (bitmap == null) { return; } if (this.ParentForm == null || this.ParentForm.GetType() != typeof(FavoriteEditor)) { return; } ((FavoriteEditor)this.ParentForm).SetToolBarIcon(bitmap, System.IO.Path.GetFileNameWithoutExtension(this.txtGenericExecutablePath.Text), overwrite); if (bitmap != null) { bitmap.Dispose(); bitmap = null; } if (icon != null) { icon.Dispose(); icon = null; } }
private void OnConnected(MessageEventArgs_200 message) { Server.SetInfo(message); var ui = ConnectionManager.CurrentBookmark.UserInformation; var ih = new IconHandler(); var c = ConnectionManager.Commands; c.Nick(ui.Nick); //Required c.Icon(1, ih.UserImage); //Optional //STATUS //Optional TODO: Set status c.Client(); //Optional but highly recomended c.User(ui.UserName); c.Pass(ui.Password); if (Connected != null) { Connected(Server); } }
private void LoadIconsFromExe() { try { Icon[] IconsList = IconHandler.IconsFromFile(this.executableTextBox.Text, IconSize.Small); if (IconsList != null && IconsList.Length > 0) { this.iconPicturebox.Image = IconsList[0].ToBitmap(); this.IconImageList.Images.Clear(); this.toolStrip1.Items.Clear(); foreach (Icon TmpIcon in IconsList) { this.IconImageList.Images.Add(TmpIcon); this.toolStrip1.Items.Add(TmpIcon.ToBitmap()); } } } catch (Exception exc) { Log.Error("LoadIconsFromExe", exc); } }
void ObservableGrepSearchResults_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { foreach (FormattedGrepResult newEntry in e.NewItems.Cast <FormattedGrepResult>()) { string extension = Path.GetExtension(newEntry.GrepResult.FileNameDisplayed); if (extension.Length <= 1) { extension = ".na"; } if (!icons.ContainsKey(extension)) { System.Drawing.Bitmap bitmapIcon = IconHandler.IconFromExtensionShell(extension, IconSize.Small); if (bitmapIcon == null) { bitmapIcon = dnGREP.Common.Properties.Resources.na_icon; } icons[extension] = GetBitmapSource(bitmapIcon); } newEntry.Icon = icons[extension]; } } }
// Use this for initialization void Start() { //get the scripts necessary iconHandlerScript = iconHandler.GetComponent<IconHandler>(); // initial shown text is blank (aka no text shown) displayText.text = ""; shadowText.text = ""; }
// Use this for initialization void Start() { // set the script objects objectPropertiesScript = this.GetComponent <ObjectProperties>(); iconHandlerScript = GameObject.Find("IconHandler").GetComponent <IconHandler>(); }
private void showNextIcon() { if (this.InvokeRequired) { IconHandler h = new IconHandler(showNextIcon); this.Invoke(h, new object[] { }); } else this.notifyIcon.Icon = GetNextIcon(this.notifyIcon.Icon); ; }
/// <summary> /// Draw it! /// </summary> private void drawTravelingMerchant(object sender, EventArgs e) { if (daysMerchantVisits.Contains(Game1.dayOfMonth) && Game1.eventUp == false) { var clickableTextureComponent = new ClickableTextureComponent(new Rectangle(IconHandler.getIconXPosition(), 260, 40, 40), Game1.content.Load <Texture2D>("LooseSprites\\Cursors"), new Rectangle(192, 1411, 20, 20), 2); clickableTextureComponent.draw(Game1.spriteBatch); if (clickableTextureComponent.containsPoint(Game1.getMouseX(), Game1.getMouseY())) { string tooltip = $"Traveling merchant is in town!"; IClickableMenu.drawHoverText(Game1.spriteBatch, tooltip, Game1.dialogueFont); } } }
private void Parse() { try { using (FileStream fs = new FileStream(this.mmcFileInfo.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite & FileShare.Delete)) { using (StreamReader stream = new StreamReader(fs)) { this.rawContents = stream.ReadToEnd(); } } if (this.rawContents != null && this.rawContents.Trim() != "" && this.rawContents.StartsWith("<?xml")) { XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(this.rawContents); XmlNode node = xDoc.SelectSingleNode("/MMC_ConsoleFile/StringTables/StringTable/Strings"); foreach (XmlNode cNode in node.ChildNodes) { string name = cNode.InnerText; if (name != "Favorites" && name != "Console Root") { this.Name = name; this.Parsed = true; break; } } //System.Xml.XmlNode binarynode = xDoc.SelectSingleNode("/MMC_ConsoleFile/BinaryStorage"); //foreach (System.Xml.XmlNode child in binarynode.ChildNodes) //{ // string childname = child.Attributes["Name"].Value; // if (childname.ToLower().Contains("small")) // { // string image = child.InnerText; // byte[] buff = System.Convert.FromBase64String(child.InnerText.Trim()); // System.IO.MemoryStream stm = new System.IO.MemoryStream(buff); // if (stm.Position > 0 && stm.CanSeek) stm.Seek(0, System.IO.SeekOrigin.Begin); // System.IO.File.WriteAllBytes(@"C:\Users\Administrator\Desktop\foo.ico", buff); // System.Drawing.Icon ico = new System.Drawing.Icon(stm); // } //} XmlNode visual = xDoc.SelectSingleNode("/MMC_ConsoleFile/VisualAttributes/Icon"); if (visual != null) { string iconFile = visual.Attributes["File"].Value; int index = Convert.ToInt32(visual.Attributes["Index"].Value); Icon[] icons = IconHandler.IconsFromFile(iconFile, IconSize.Small); if (icons != null && icons.Length > 0) { this.SmallIcon = icons.Length > index ? icons[index] : icons[0]; } } } } catch (Exception exc) { Log.Error("Error parsing MMC File", exc); } }
// Use this for initialization void Start() { // set the script objects objectPropertiesScript = this.GetComponent<ObjectProperties>(); iconHandlerScript = GameObject.Find("IconHandler").GetComponent<IconHandler>(); }
public void loadIcon() { Icon = IconHandler.LoadImage(StringIcon); }
public Image getIcon() { return(IconHandler.LoadImage(icon)); }