InputConfiguration

Namespace: Mars.Interfaces
We found 10 examples in language CSharp for this search. You will see 23 fragments of code.

Other methods


        /// <summary>
        /// If the typefilter section has been omitted in the input configuration,
        /// the filter should return true for any type.
        /// </summary>
        [Fact]
        public void InputConfiguration_EmptyTypeFilter_ReturnsTrue()
        {
            var inputConfiguration = new InputConfiguration(new[] { "Assembly" }, null);

            Assert.True(inputConfiguration.TypeFilter.IsMatch(GetType()));
        }

		
		public static InputConfiguration Duplicate(InputConfiguration source)
		{
			InputConfiguration inputConfig = new InputConfiguration();
			inputConfig.name = source.name;
			
			inputConfig.axes = new List<AxisConfiguration>(source.axes.Count);
			for(int i = 0; i < source.axes.Count; i++)
			{
				inputConfig.axes.Add(AxisConfiguration.Duplicate(source.axes[i]));
			}
			
			return inputConfig;
		}


        [Test]
        public void CreatesViewFolder()
        {
            inputConfigProviderMock.Setup(i => i.Configs).Returns(new List<InputConfiguration>());
            newConfiguration.View = "view";
            cmd = new SaveInputConfiguration(storageProvider, appConfigProvider, inputConfigProvider, newConfiguration);
            cmd.Execute();
            storageProviderMock.Verify(v => v.CreateViewFolder(It.Is<string>(s => s == newConfiguration.View)));
        }


        [SetUp]
        public void Setup()
        {
            storageProviderMock = new Mock<IStorageProvider>();
            storageProviderMock.Setup(s => s.LoadInputConfigurations()).Returns(new List<InputConfiguration>
            {
                new InputConfiguration(),
                new InputConfiguration()
            });
            storageProvider = storageProviderMock.Object;
            provider = new InputConfigProvider(storageProvider);    
        }

        [Test]
        public void Add_NewConfigCanBeAdded()
        {
            var c = new InputConfiguration();
            provider.Add(c);
            Assert.AreEqual(1, provider.Configs.Count());
            Assert.AreEqual(c, provider.Configs.First());
        }

        [Test]
        public void Add_DuplicateConfigsCanNotBeAdded()
        {
            var c = new InputConfiguration();
            provider.Add(c);
            provider.Add(c);
            Assert.AreEqual(1, provider.Configs.Count());
            var c2 = new InputConfiguration();
            provider.Add(c2);
            Assert.AreEqual(2, provider.Configs.Count());
        }

        [Test]
        public void AddOrUpdate_AddsWhenNewInstance()
        {
            var c = new InputConfiguration();
            provider.AddOrUpdate(c);
            Assert.AreEqual(1, provider.Configs.Count());
            Assert.AreEqual(c, provider.Configs.First());
        }

        [Test]
        public void AddOrUpdate_UpdatesWhenInstanceAddedAgain()
        {
            var c = new InputConfiguration {Name = "test"};
            provider.AddOrUpdate(c);
            Assert.AreEqual("test", provider.Configs.First().Name);
            var cc = c;
            cc.Name = "Bananas";
            provider.AddOrUpdate(cc);
            Assert.AreEqual(1, provider.Configs.Count());
            Assert.AreEqual("Bananas", provider.Configs.First().Name);
        }

        [Test]
        public void Remove_RemovesAddedInstance()
        {
            var c = new InputConfiguration();
            provider.AddOrUpdate(c);
            Assert.AreEqual(1, provider.Configs.Count());
            provider.Remove(c);
            Assert.AreEqual(0, provider.Configs.Count());
        }


		public InputConfiguration LoadSelective(string inputConfigName)
		{
			InputConfiguration inputConfig = null;
			using(XmlReader reader = CreateXmlReader())
			{
				while(reader.Read())
				{
					if(reader.IsStartElement("InputConfiguration") && reader["name"] == inputConfigName)
					{
						inputConfig = ReadInputConfiguration(reader);
						break;
					}
				}
			}

			return inputConfig;
		}
		
		private InputConfiguration ReadInputConfiguration(XmlReader reader)
		{
			InputConfiguration inputConfig = new InputConfiguration();
			inputConfig.name = reader["name"];
			
			while(reader.Read())
			{
				if(!reader.IsStartElement("AxisConfiguration"))
					break;
				
				inputConfig.axes.Add(ReadAxisConfiguration(reader));
			}
			
			return inputConfig;
		}


        public void Add(InputConfiguration config)
        {
            lock (configs)
            {
                if (!configs.Contains(config))
                    configs.Add(config);
            }
        }

        public void AddOrUpdate(InputConfiguration config)
        {
            lock (configs)
            {
                var index = configs.IndexOf(config);
                if (index > -1)
                {
                    configs[index] = config;
                    return;
                }
                configs.Add(config);
            }
        }
        public void Remove(InputConfiguration config)
        {
            lock (configs)
            {
                if (configs.Contains(config))
                    configs.Remove(config);
            } 
        }

        public InputConfiguration FindConfigForName(string name)
        {
            lock (configs)
            {
                return configs.FirstOrDefault(c => c.Name.Equals(name));
            }
        }

// Copyright © 2015 Daniel Porrey
//
// This file is part of the Windows.Devices.Sensors.Mcp3008 project.
// 
// Windows.Devices.Sensors.Mcp3008 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
// (at your option) any later version.
// 
// Windows.Devices.Sensors.Mcp3008 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 Windows.Devices.Sensors.Mcp3008. If not, see http://www.gnu.org/licenses/.
//
namespace Windows.Devices.Sensors
{
	/// <summary>
	/// 
	/// </summary>
	public enum InputConfiguration
	{
		/// <summary>
		/// 
		/// </summary>
		SingleEnded = 1,
		/// <summary>
		/// 
		/// </summary>
		Differential = 0
	}

	public class Channel
	{
		internal Channel(InputConfiguration selection, int id)
		{
			this.Id = id;
			this.InputConfiguration = selection;
		}

		public int Id { get; set; }
		public InputConfiguration InputConfiguration { get; set; }
	}
}

		
		public static InputConfiguration Duplicate(InputConfiguration source)
		{
			InputConfiguration inputConfig = new InputConfiguration();
			inputConfig.name = source.name;
			
			inputConfig.axes = new List<AxisConfiguration>(source.axes.Count);
			for(int i = 0; i < source.axes.Count; i++)
			{
				inputConfig.axes.Add(AxisConfiguration.Duplicate(source.axes[i]));
			}
			
			return inputConfig;
		}

// Copyright © 2015-2017 Daniel Porrey. All Rights Reserved.
//
// This file is part of the IoT Devices and Sensors project.
// 
// IoT Devices and Sensors 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
// (at your option) any later version.
// 
// IoT Devices and Sensors 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 IoT Devices and Sensors. If not, 
// see http://www.gnu.org/licenses/.
//
namespace Porrey.Uwp.IoT.Sensors
{
	/// <summary>
	/// 
	/// </summary>
	public enum InputConfiguration
	{
		/// <summary>
		/// 
		/// </summary>
		SingleEnded = 1,
		/// <summary>
		/// 
		/// </summary>
		Differential = 0
	}

	public class Channel : IChannel
	{
		internal Channel(InputConfiguration selection, int id)
		{
			this.Id = id;
			this.InputConfiguration = selection;
		}

		public int Id { get; set; }
		public InputConfiguration InputConfiguration { get; set; }
	}
}

        void SaveInputConfiguration(InputConfiguration c);
        void UpdateInputConfiguration(InputConfiguration n, InputConfiguration o);
        void RemoveInputConfiguration(InputConfiguration c);
        IEnumerable<string> LoadMediaFileNames(InputConfiguration c);
        IEnumerable<InputConfiguration> LoadInputConfigurations();

Mars.Interfaces.Model.Import.InputConfiguration : Object

Constructors :

public InputConfiguration()

Methods :

public Encoding get_Encoding()
public Void set_Encoding(Encoding value = )
public String get_TemporalSourceAttribute()
public Void set_TemporalSourceAttribute(String value = )
public String get_TemporalJoinReference()
public Void set_TemporalJoinReference(String value = )
public String get_ValidTimeAtAttributeName()
public Void set_ValidTimeAtAttributeName(String value = )
public String get_ValidTimeFromAttributeName()
public Void set_ValidTimeFromAttributeName(String value = )
public String get_ValidTimeToAttributeName()
public Void set_ValidTimeToAttributeName(String value = )
public Boolean get_IsTemporalChanging()
public String get_GeometryColumnName()
public Void set_GeometryColumnName(String value = )
public Boolean get_HasHeader()
public Void set_HasHeader(Boolean value = )
public Char get_Delimiter()
public Void set_Delimiter(Char value = )
public Boolean get_IsGridRaster()
public Void set_IsGridRaster(Boolean value = )
public String get_StreamTopicPattern()
public Void set_StreamTopicPattern(String value = )
public String get_BrokerHostName()
public Void set_BrokerHostName(String value = )
public String get_SourcePropertyName()
public Void set_SourcePropertyName(String value = )
public String get_TargetPropertyName()
public Void set_TargetPropertyName(String value = )
public Boolean get_GeometryAsNodesEnabled()
public Void set_GeometryAsNodesEnabled(Boolean value = )
public Nullable<Single> get_NodeTolerance()
public Void set_NodeTolerance(Nullable<Single> value = )
public String get_File()
public Void set_File(String value = )
public ISet<SpatialModalityType> get_Modalities()
public Void set_Modalities(ISet<SpatialModalityType> value = )
public Boolean get_IsBiDirectedImport()
public Void set_IsBiDirectedImport(Boolean value = )
public Type GetType()
public String ToString()
public Boolean Equals(Object obj = )
public Int32 GetHashCode()

Other methods