111 lines
2.5 KiB
C#
Raw Normal View History

// Bellows - bellows fold pattern printer, based on US Patent No 6,054,194,
// Mathematically optimized family of ultra low distortion bellow fold patterns, Nathan R. Kane.
// Copyright (C) 2008, Frank Tkalcevic, www.franksworkshop.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
namespace Bellows
{
public class BellowsCollection : ConfigurationElementCollection
{
public BellowsCollection()
{
//BellowsConfigElement e = (BellowsConfigElement)CreateNewElement();
//Add(e);
}
public override ConfigurationElementCollectionType CollectionType
{
get
{
return ConfigurationElementCollectionType.AddRemoveClearMap;
}
}
protected override ConfigurationElement CreateNewElement()
{
return new BellowsConfigElement();
}
protected override Object GetElementKey(ConfigurationElement element)
{
return ((BellowsConfigElement)element).Name;
}
public BellowsConfigElement this[int index]
{
get
{
return (BellowsConfigElement)BaseGet(index);
}
set
{
if (BaseGet(index) != null)
{
BaseRemoveAt(index);
}
BaseAdd(index, value);
}
}
new public BellowsConfigElement this[string Name]
{
get
{
return (BellowsConfigElement)BaseGet(Name);
}
}
public int IndexOf(BellowsConfigElement e)
{
return BaseIndexOf(e);
}
public void Add(BellowsConfigElement e)
{
BaseAdd(e);
}
protected override void BaseAdd(ConfigurationElement element)
{
BaseAdd(element, false);
}
public void Remove(BellowsConfigElement e)
{
if (BaseIndexOf(e) >= 0)
BaseRemove(e.Name);
}
public void RemoveAt(int index)
{
BaseRemoveAt(index);
}
public void Remove(string name)
{
BaseRemove(name);
}
public void Clear()
{
BaseClear();
}
}
}