source: trunk/CrypPlugins/StringToStreamConvertor/StringToStreamConverterSettings.cs @ 1597

Last change on this file since 1597 was 1259, checked in by Matthäus Wander, 12 years ago

shortened license text to boilerplate notice in all source files

File size: 3.8 KB
Line 
1/*
2   Copyright 2008 Dr. Arno Wacker, University of Duisburg-Essen
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17using System;
18using System.Collections.Generic;
19using System.Linq;
20using System.Text;
21using Cryptool.PluginBase;
22using System.ComponentModel;
23
24namespace Cryptool.Plugins.Convertor
25{
26    public class StringToStreamConverterSettings : ISettings
27    {
28        #region Public StringToStreamConverter specific properties
29
30        public enum EncodingTypes { Default = 0, Base64Binary = 1, HexStringBinary = 2, OctalStringBinary = 3, Unicode = 4, UTF7 = 5, UTF8 = 6, UTF32 = 7, ASCII = 8, BigEndianUnicode = 9 };
31
32        /// <summary>
33        /// Retrieves the current used encoding, or sets it.
34        /// </summary>
35        public EncodingTypes Encoding
36        { 
37            get { return this.encoding; }
38            set 
39            {
40                if (this.Encoding != value) hasChanges = true;
41                this.encoding = value; 
42                OnPropertyChanged("EncodingSetting"); 
43            }
44        }
45
46
47        /// <summary>
48        /// Returns true if some properties where changed.
49        /// </summary>
50        public bool HasChanges
51        {
52            get { return hasChanges; }
53            set { hasChanges = value; }
54        }
55
56        #endregion
57
58
59        #region Algorithm settings properties (visible in the Settings pane)
60
61        /// <summary>
62        /// Encoding property used in the Settings pane.
63        /// </summary>
64        [ContextMenu("Output stream encoding", "Choose the encoding of the output stream. (Byte encoding)", 1, DisplayLevel.Experienced, ContextMenuControlType.ComboBox, null, new string[] { "Default", "Binary data (convert from base64)", "Binary data (convert from hex-string)", "Binary data (convert from octal-string)", "Unicode", "UTF-7", "UTF-8", "UTF-32", "ASCII", "Big endian unicode" })]
65        [TaskPane("Output stream encoding", "Choose the encoding of the output stream. (Byte encoding)", "", 1, false, DisplayLevel.Experienced, ControlType.ComboBox, new string[] { "Default", "Binary data (convert from base64)", "Binary data (convert from hex-string)", "Binary data (convert from octal-string)", "Unicode", "UTF-7", "UTF-8", "UTF-32", "ASCII", "Big endian unicode" })]
66        public int EncodingSetting
67        {
68            get
69            {
70                return (int)this.encoding;
71            }
72            set
73            {
74                if (this.encoding != (EncodingTypes)value) hasChanges = true;
75                this.encoding = (EncodingTypes)value;
76                OnPropertyChanged("EncodingSetting");
77            }
78        }
79
80        #endregion
81
82        #region Private variables
83        private EncodingTypes encoding = EncodingTypes.Default;
84        private bool hasChanges = false;
85        #endregion
86
87        #region Private methods
88        // nothing here
89        #endregion
90
91        #region INotifyPropertyChanged Members
92
93        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
94
95        public void OnPropertyChanged(string name)
96        {
97            if (PropertyChanged != null)
98            {
99                PropertyChanged(this, new PropertyChangedEventArgs(name));
100            }
101        }
102
103        #endregion
104
105    }
106}
Note: See TracBrowser for help on using the repository browser.