Archive Browser
Download AdobeSwatchExchangeLoader.zip version 1.0.0.0, last updated 16/10/2015 (52.74 KB)
Download- md5: 2e0a71f47af05c1148c9482cabd54f6d
- sha1: c7ef64dfa777b601edb31105712adafb7d962d6c
- sha256: 0849f24fab4399ebc514d8d4ac3af448985fd323b7ab0133e16650cfefe2177b
using System.Windows.Forms;
// Reading Adobe Swatch Exchange (ase) files using C#
// http://www.cyotek.com/blog/reading-adobe-swatch-exchange-ase-files-using-csharp
namespace AdobeSwatchExchangeLoader
{
internal class AseExplorerTreeView : TreeView
{
#region Fields
private SwatchExchangeData _data;
#endregion
#region Properties
public SwatchExchangeData Data
{
get { return _data; }
set
{
_data = value;
this.Reload();
}
}
#endregion
#region Methods
private void LoadColors(ColorEntryCollection colors, TreeNode root)
{
foreach (ColorEntry color in colors)
{
TreeNode node;
node = new TreeNode
{
Text = $"{color.Name} [RGB({color.R}, {color.G}, {color.B}) {color.Type}]",
ImageKey = "color",
SelectedImageKey = "color"
};
root.Nodes.Add(node);
}
}
private void LoadGlobalColors()
{
if (_data.Colors != null && _data.Colors.Count != 0)
{
TreeNode root;
root = new TreeNode
{
Name = "colors",
Text = "Colors",
ImageKey = "group",
SelectedImageKey = "group"
};
this.LoadColors(_data.Colors, root);
this.Nodes.Add(root);
root.Expand();
}
}
private void LoadGroup(ColorGroup group, TreeNode root)
{
TreeNode groupNode;
groupNode = new TreeNode
{
Text = group.Name,
ImageKey = "group",
SelectedImageKey = "group"
};
this.LoadColors(group.Colors, groupNode);
root.Nodes.Add(groupNode);
}
private void LoadGroups()
{
if (_data.Groups != null && _data.Groups.Count != 0)
{
TreeNode root;
root = new TreeNode
{
Name = "groups",
Text = "Groups",
ImageKey = "groups",
SelectedImageKey = "groups"
};
foreach (ColorGroup group in _data.Groups)
{
this.LoadGroup(group, root);
}
if (root.Nodes.Count != 0)
{
root.Nodes[0].Expand();
}
this.Nodes.Add(root);
root.Expand();
}
}
private void Reload()
{
this.BeginUpdate();
this.Nodes.Clear();
if (_data != null)
{
this.LoadGroups();
this.LoadGlobalColors();
}
this.EndUpdate();
}
#endregion
}
}
Donate
This software may be used free of charge, but as with all free software there are costs involved to develop and maintain.
If this site or its services have saved you time, please consider a donation to help with running costs and timely updates.
Donate