-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Css parameter follow up #1110
Css parameter follow up #1110
Conversation
The question is if there should be made an Open overload with an options object like this. |
@H1Gdev - please have a look! |
As mentioned in #1107, I am negative to add more arguments to @inforithmics |
I thought about it and I think it is the better solution providing an external function that applies a css. So I can apply an css without again loading the document I will change this pull request accordingly |
The |
The thought on options is to include properties using System;
using System.Collections;
using System.Collections.Generic;
#if NETCORE
using System.Diagnostics.CodeAnalysis;
#endif
namespace Svg
{
public class SvgOptions : IDictionary<string, string>, ICloneable
{
private readonly IDictionary<string, string> _properties;
public SvgOptions()
{
_properties = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
public string this[string key]
{
get
{
if (_properties.TryGetValue(key, out string value))
return value;
return string.Empty;
}
set
{
if (key != null)
{
_properties[key] = value;
}
}
}
public ICollection<string> Keys => _properties.Keys;
public ICollection<string> Values => _properties.Values;
public int Count => _properties.Count;
public bool IsReadOnly => _properties.IsReadOnly;
public void Add(string key, string value)
{
if (key != null)
{
_properties.Add(key, value);
}
}
public void Add(KeyValuePair<string, string> item)
{
this.Add(item.Key, item.Value);
}
public void Clear()
{
_properties.Clear();
}
public bool Contains(KeyValuePair<string, string> item)
{
return _properties.Contains(item);
}
public bool ContainsKey(string key)
{
return _properties.ContainsKey(key);
}
public void CopyTo(KeyValuePair<string, string>[] array, int arrayIndex)
{
_properties.CopyTo(array, arrayIndex);
}
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
{
return _properties.GetEnumerator();
}
public bool Remove(string key)
{
return _properties.Remove(key);
}
public bool Remove(KeyValuePair<string, string> item)
{
return _properties.Remove(item);
}
#if NETCORE
public bool TryGetValue(string key, [MaybeNullWhen(false)] out string value)
{
return _properties.TryGetValue(key, out value);
}
#else
public bool TryGetValue(string key, out string value)
{
return _properties.TryGetValue(key, out value);
}
#endif
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable)_properties).GetEnumerator();
}
object ICloneable.Clone()
{
return this.Clone();
}
public SvgOptions Clone()
{
SvgOptions options = new SvgOptions();
foreach (KeyValuePair<string, string> item in _properties)
{
options.Add(item);
}
return options;
}
}
} |
@inforithmics Thanks for the updates.
|
…Samples Source Svg.Custom Tests doc docfx.json index.md license.txt make adding string css parameter binary compatible CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt added release notes CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt introduce svgoptions for css paramater CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt added obsolete to unnecessary overloads CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt added more svgoptions overloads CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt fixing build CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt Improved release notes
…DME.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt make adding string css parameter binary compatible CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt added release notes CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt introduce svgoptions for css paramater CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt added obsolete to unnecessary overloads CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt added more svgoptions overloads CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt fixing build CONTRIBUTING.md Generators README.md Samples Source Svg.Custom Tests doc docfx.json index.md license.txt Improved release notes
Reference Issue
Follow Up of following Pull request
#1107
What does this implement/fix? Explain your changes.
Made the pull request binary compatible.
Added Release notes