source: trunk/CrypPlugins/PlayfairAnalysis/PlayfairAnalysisSettings.cs @ 1939

Last change on this file since 1939 was 1939, checked in by Christoph Hartmann, 11 years ago

Playfair Analysis Plugin (basically runs, but not ready yet)

File size: 4.2 KB
Line 
1/*
2   Copyright 2010 Christoph Hartmann, Johannes Gutenberg-Universität Mainz
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*/
16using System;
17using System.Collections.Generic;
18using System.ComponentModel;
19using System.Diagnostics;
20using System.Linq;
21using System.Text;
22using Cryptool.PluginBase;
23using System.Windows;
24
25namespace Cryptool.Plugins.PlayfairAnalysis
26{
27    public class PlayfairAnalysisSettings : ISettings
28    {
29        #region Private Variables
30
31        private enum supportedMatrixSizes {MatrixSize5x5, MatrixSize6x6}
32        private bool hasChanges = false;
33        private int heapSize = 5000;
34        private int matrixSize = (int)supportedMatrixSizes.MatrixSize5x5;
35        private int language;
36       
37        #endregion
38
39        #region Constructor
40
41        public PlayfairAnalysisSettings()
42        {
43
44        }
45
46        #endregion
47
48
49        #region TaskPane Settings
50
51        /// <summary>
52        /// HOWTO: This is an example for a setting entity shown in the settings pane on the right of the CT2 main window.
53        /// This example setting uses a number field input, but there are many more input types available, see ControlType enumeration.
54        /// </summary>
55        [TaskPane("Heap Size", "Number of keys stored in heap", null, 1, false, DisplayLevel.Beginner, ControlType.TextBox, ValidationType.RangeInteger, 1, Int32.MaxValue)]
56        public int HeapSize
57        {
58            get
59            {
60                return heapSize;
61            }
62            set
63            {               
64                if (heapSize != value)
65                {                   
66                    heapSize = value;
67                    hasChanges = true;
68                }
69            }
70        }
71
72        [TaskPane("Matrix Size", "Size of Matrix used for Encryption", null, 1, false, DisplayLevel.Beginner, ControlType.RadioButton, new string[] { "5 x 5", "6 x 6" })]
73        public int MatrixSize
74        {
75            get
76            {
77                return matrixSize;
78            }
79            set
80            {
81                if (matrixSize != value)
82                {
83                    matrixSize = value;
84                    hasChanges = true;                   
85                }
86            }
87        }
88
89        [TaskPane("Language", "Assumed Language of Ciphertext", null, 1, false, DisplayLevel.Beginner, ControlType.RadioButton, new string[] { "German", "English" })]
90        public int Language
91        {
92            get
93            {
94                return language;
95            }
96            set
97            {
98                if (language != value)
99                {
100                    language = value;
101                    hasChanges = true;
102                }
103            }
104        }
105
106
107
108        #endregion
109
110        #region ISettings Members
111
112        /// <summary>
113        /// HOWTO: This flags indicates whether some setting has been changed since the last save.
114        /// If a property was changed, this becomes true, hence CrypTool will ask automatically if you want to save your changes.
115        /// </summary>
116        public bool HasChanges
117        {
118            get
119            {
120                return hasChanges;
121            }
122            set
123            {
124                hasChanges = value;
125            }
126        }
127
128        #endregion
129
130        #region INotifyPropertyChanged Members
131
132        public event PropertyChangedEventHandler PropertyChanged;
133
134        protected void OnPropertyChanged(string name)
135        {
136            if (PropertyChanged != null)
137            {
138                PropertyChanged(this, new PropertyChangedEventArgs(name));
139            }
140        }
141
142        #endregion
143               
144    }
145}
Note: See TracBrowser for help on using the repository browser.