├── pic1.jpg
├── presentation.jpg
├── App.config
├── Modules.vb
├── .github
└── FUNDING.yml
├── README.md
├── LICENSE
├── GUI
├── About.vb
├── About.resx
├── Calculator.resx
├── About.Designer.vb
├── Calculator.vb
└── Calculator.Designer.vb
├── My Project
└── AssemblyInfo.vb
├── x16Calc.sln
├── Program.vb
├── x16Calc.vbproj
├── Calculator.resx
├── Calculator.vb
└── Calculator.Designer.vb
/pic1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DosX-dev/x16Calc/HEAD/pic1.jpg
--------------------------------------------------------------------------------
/presentation.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DosX-dev/x16Calc/HEAD/presentation.jpg
--------------------------------------------------------------------------------
/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Modules.vb:
--------------------------------------------------------------------------------
1 | Imports System.Runtime.CompilerServices
2 | Imports System.Runtime.InteropServices
3 |
4 | Module TextBoxWatermarkExtensionMethod
5 | Private Const ECM_FIRST As UInteger = &H1500
6 | Private Const EM_SETCUEBANNER As UInteger = ECM_FIRST + 1
7 |
8 | Private Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As UInteger,
9 | ByVal lParam As String) As IntPtr
10 | End Function
11 |
12 | Sub SetWatermark(ByVal TXT As System.Windows.Forms.TextBox, ByVal WaterMarkTextString As String)
13 | SendMessage(TXT.Handle, EM_SETCUEBANNER, 0, WaterMarkTextString)
14 | End Sub
15 | End Module
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: ['https://kay-software.ru/content/donate'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/DosX-dev/x16Calc/releases)
2 | [](https://github.com/DosX-dev/x16Calc/releases)
3 |
4 | # 💾 x16Calc — the best tool for system programmers
5 |
6 | ✨ **A simple program for working with hexadecimal numbers.**
7 |
8 | Also supports command line arguments:
9 | * **--help** — get this list
10 | * **--about** — show program information
11 | * **--int {NUM}** — insert number into INT field
12 | * **--hex {HEX}** — insert hex value into HEX field
13 |
14 | > #### Did you like _x16Calc_ ? Put a 🌟! :)
15 |
16 | * ### [Download stable](https://github.com/DosX-dev/x16Calc/releases/tag/stable)
17 |
18 | 
19 | 
20 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 DosX
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/GUI/About.vb:
--------------------------------------------------------------------------------
1 | Imports System.Windows.Forms
2 |
3 | Public Class AboutWin
4 | Private Sub CloseBtn_Click(sender As Object, e As EventArgs) Handles CloseBtn.Click
5 | Me.Close()
6 | End Sub
7 |
8 | Private Sub AboutWin_Load(sender As Object, e As EventArgs) Handles MyBase.Load
9 | Ver.Text = $"v{Application.ProductVersion}.0 (2023)"
10 | End Sub
11 |
12 | Private Sub AuthorSite_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles AuthorSite.LinkClicked
13 | Try
14 | Dim URL = "https://kay-software.ru/dosx"
15 | If MsgBox($"Open ""{URL}""?", &H4, URL) = MsgBoxResult.Yes Then
16 | Diagnostics.Process.Start("explorer.exe", URL)
17 | End If
18 | Catch ex As Exception : End Try
19 | End Sub
20 |
21 | Private Sub AuthorSite_FocusCloseBtn(sender As Object, e As EventArgs) Handles AuthorSite.GotFocus,
22 | AuthorSite.MouseDown
23 | CloseBtn.Focus()
24 |
25 | End Sub
26 |
27 | Private Sub Ver_Click(sender As Object, e As EventArgs) Handles Ver.Click
28 | Me.Hide()
29 | HelpMsg()
30 | End Sub
31 | End Class
--------------------------------------------------------------------------------
/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' Общими сведениями о сборке управляет следующий
6 | ' набором атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
7 | ' связанные с этой сборкой.
8 |
9 | ' Проверьте значения атрибутов сборки
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'Указанный ниже идентификатор GUID предназначен для идентификации библиотеки типов, если этот проект будет видимым для COM-объектов
21 |
22 |
23 | ' Сведения о версии сборки состоят из следующих четырех значений:
24 | '
25 | ' Основной номер версии
26 | ' Дополнительный номер версии
27 | ' Номер сборки
28 | ' Редакция
29 | '
30 | ' Можно задать все значения или принять номера сборки и редакции по умолчанию
31 | ' используя "*", как показано ниже:
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/x16Calc.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.3.32922.545
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "x16Calc", "x16Calc.vbproj", "{FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Main|Any CPU = Main|Any CPU
14 | Main|x64 = Main|x64
15 | Main|x86 = Main|x86
16 | Release|Any CPU = Release|Any CPU
17 | Release|x64 = Release|x64
18 | Release|x86 = Release|x86
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Debug|x64.ActiveCfg = Debug|Any CPU
24 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Debug|x86.ActiveCfg = Debug|x86
25 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Debug|x86.Build.0 = Debug|x86
26 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Main|Any CPU.ActiveCfg = Debug|Any CPU
27 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Main|x64.ActiveCfg = Debug|Any CPU
28 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Main|x86.ActiveCfg = Debug|x86
29 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Release|Any CPU.ActiveCfg = Debug|Any CPU
30 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Release|x64.ActiveCfg = Debug|Any CPU
31 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}.Release|x86.ActiveCfg = Debug|x86
32 | EndGlobalSection
33 | GlobalSection(SolutionProperties) = preSolution
34 | HideSolutionNode = FALSE
35 | EndGlobalSection
36 | GlobalSection(ExtensibilityGlobals) = postSolution
37 | SolutionGuid = {AFB321FF-134F-4F1A-8B46-74AA017ECB80}
38 | EndGlobalSection
39 | EndGlobal
40 |
--------------------------------------------------------------------------------
/Program.vb:
--------------------------------------------------------------------------------
1 | Imports System.Runtime.CompilerServices
2 | Imports System.Windows.Forms
3 |
4 | Module Program
5 | Dim MainWindow As New Calculator
6 |
7 | Public Sub Main()
8 | Try
9 |
10 | ' При подключении системных визуальных стилей после объявления формы
11 | ' все элементы управления сохраняют свой первоначальный "сырой" вид.
12 | ' Но при этом, текстовые поля стилизуются только при открытии окна,
13 | ' а потому стили активируются сразу, без надобности перезапускать
14 | ' приложение. Остальные части интерфейса останутся нетронутыми
15 | '
16 | ' [Использование Watermark в текстовых полях
17 | ' возможно только с визуальными стилями]
18 | Application.EnableVisualStyles()
19 |
20 | ' Именно ради этих строчек кода и следовало тянуть рендеринг
21 | ' системных стилей
22 | MainWindow.Src.SetWatermark("Decimal")
23 | MainWindow.Out.SetWatermark("Hexadecimal")
24 |
25 | Call Command.API
26 |
27 | Catch ex As Exception
28 | MsgBox("Invalid data.", &H10) : End
29 | End Try
30 |
31 | Application.Run(MainWindow)
32 | End Sub
33 | Public Sub HelpMsg()
34 | MsgBox($"Arguments:{vbLf}--about — show program information{vbLf}--int {{NUM}} — insert number into INT32 field{vbLf}--hex {{HEX}} — insert hex value into HEX field{vbLf & vbLf}Examples:{vbLf}x16Calc --int 2147483647{vbLf}x16Calc --hex 0x7FFFFFFF", &H0, $"{Application.ProductName} [ --help ]")
35 | End Sub
36 |
37 |
38 | Sub API(Cmd As String)
39 | Dim HelpTag = "--help",
40 | AboutTag = "--about",
41 | HexTag = "--hex",
42 | IntTag = "--int"
43 |
44 | If Cmd.Contains(HelpTag) Then
45 | HelpMsg() : End
46 | End If
47 |
48 | If Cmd.Contains(AboutTag) Then ' [About]
49 | Dim AboutMessage As New AboutWin
50 | AboutMessage.StartPosition = FormStartPosition.CenterScreen
51 | AboutMessage.ShowDialog()
52 | End
53 | End If
54 |
55 | If Cmd.Contains(HexTag) Then ' [Insert HEX]
56 | Cmd = Cmd.Replace(HexTag, String.Empty)
57 | Try
58 | MainWindow.Out.Text = Cmd.Trim.Split(" ")(0)
59 | Catch ex As Exception
60 | Exit Sub
61 | End Try
62 | MainWindow.DoCalc_ToInt()
63 | Exit Sub
64 | End If
65 |
66 | If Cmd.Contains(IntTag) Then ' [Insert DEC]
67 | Cmd = Cmd.Replace(IntTag, String.Empty)
68 | Try
69 | MainWindow.Src.Text = CInt(Cmd.Trim.Split(" ")(0))
70 | Catch ex As Exception
71 | Exit Sub
72 | End Try
73 | MainWindow.DoCalc_ToHex()
74 | Exit Sub
75 | End If
76 | End Sub
77 | End Module
78 |
--------------------------------------------------------------------------------
/x16Calc.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {FBC5CBA8-EE1F-4CED-AFCC-E657426226F9}
8 | WinExe
9 | x16Calc
10 | x16Calc
11 | 512
12 | Empty
13 | v4.7.2
14 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
15 | true
16 | true
17 |
18 |
19 | AnyCPU
20 | false
21 | none
22 | true
23 | false
24 | bin\Release\
25 |
26 |
27 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
28 |
29 |
30 | true
31 |
32 |
33 | On
34 |
35 |
36 | Binary
37 |
38 |
39 | Off
40 |
41 |
42 | On
43 |
44 |
45 | x16Calc.Program
46 |
47 |
48 | true
49 | true
50 | true
51 | bin\x86\Debug\
52 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
53 | full
54 | x86
55 | true
56 |
57 |
58 |
59 |
60 | false
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | About.vb
80 |
81 |
82 | Form
83 |
84 |
85 | Calculator.vb
86 |
87 |
88 | Form
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | About.vb
103 |
104 |
105 | Calculator.vb
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/Calculator.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/GUI/About.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/GUI/Calculator.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/GUI/About.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class AboutWin
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Форма переопределяет dispose для очистки списка компонентов.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Является обязательной для конструктора форм Windows Forms
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'Примечание: следующая процедура является обязательной для конструктора форм Windows Forms
21 | 'Для ее изменения используйте конструктор форм Windows Form.
22 | 'Не изменяйте ее в редакторе исходного кода.
23 |
24 | Private Sub InitializeComponent()
25 | Me.AboutCaption = New System.Windows.Forms.Label()
26 | Me.AboutTitle = New System.Windows.Forms.Label()
27 | Me.CloseBtn = New System.Windows.Forms.Button()
28 | Me.Ver = New System.Windows.Forms.Label()
29 | Me.AuthorSite = New System.Windows.Forms.LinkLabel()
30 | Me.AboutPanel = New System.Windows.Forms.Panel()
31 | Me.AboutPanel.SuspendLayout()
32 | Me.SuspendLayout()
33 | '
34 | 'AboutCaption
35 | '
36 | Me.AboutCaption.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
37 | Or System.Windows.Forms.AnchorStyles.Left) _
38 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
39 | Me.AboutCaption.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
40 | Me.AboutCaption.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
41 | Me.AboutCaption.Location = New System.Drawing.Point(7, 28)
42 | Me.AboutCaption.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
43 | Me.AboutCaption.Name = "AboutCaption"
44 | Me.AboutCaption.Size = New System.Drawing.Size(249, 45)
45 | Me.AboutCaption.TabIndex = 0
46 | Me.AboutCaption.Text = "A portable program for working with HEX numbers"
47 | Me.AboutCaption.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
48 | '
49 | 'AboutTitle
50 | '
51 | Me.AboutTitle.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
52 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
53 | Me.AboutTitle.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
54 | Me.AboutTitle.Location = New System.Drawing.Point(7, 5)
55 | Me.AboutTitle.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
56 | Me.AboutTitle.Name = "AboutTitle"
57 | Me.AboutTitle.Size = New System.Drawing.Size(249, 18)
58 | Me.AboutTitle.TabIndex = 1
59 | Me.AboutTitle.Text = "x16Calc"
60 | Me.AboutTitle.TextAlign = System.Drawing.ContentAlignment.BottomCenter
61 | '
62 | 'CloseBtn
63 | '
64 | Me.CloseBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
65 | Me.CloseBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel
66 | Me.CloseBtn.Location = New System.Drawing.Point(156, 15)
67 | Me.CloseBtn.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
68 | Me.CloseBtn.Name = "CloseBtn"
69 | Me.CloseBtn.Size = New System.Drawing.Size(100, 28)
70 | Me.CloseBtn.TabIndex = 2
71 | Me.CloseBtn.Text = "Close"
72 | Me.CloseBtn.UseVisualStyleBackColor = True
73 | '
74 | 'Ver
75 | '
76 | Me.Ver.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
77 | Me.Ver.AutoSize = True
78 | Me.Ver.Cursor = System.Windows.Forms.Cursors.Help
79 | Me.Ver.ForeColor = System.Drawing.Color.Gray
80 | Me.Ver.Location = New System.Drawing.Point(5, 25)
81 | Me.Ver.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
82 | Me.Ver.Name = "Ver"
83 | Me.Ver.Size = New System.Drawing.Size(91, 16)
84 | Me.Ver.TabIndex = 3
85 | Me.Ver.Text = "%VERSION%"
86 | '
87 | 'AuthorSite
88 | '
89 | Me.AuthorSite.ActiveLinkColor = System.Drawing.Color.DarkCyan
90 | Me.AuthorSite.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
91 | Me.AuthorSite.AutoSize = True
92 | Me.AuthorSite.LinkColor = System.Drawing.Color.CadetBlue
93 | Me.AuthorSite.Location = New System.Drawing.Point(4, 5)
94 | Me.AuthorSite.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
95 | Me.AuthorSite.Name = "AuthorSite"
96 | Me.AuthorSite.Size = New System.Drawing.Size(102, 16)
97 | Me.AuthorSite.TabIndex = 4
98 | Me.AuthorSite.TabStop = True
99 | Me.AuthorSite.Text = "Coded by DosX"
100 | '
101 | 'AboutPanel
102 | '
103 | Me.AboutPanel.Controls.Add(Me.AuthorSite)
104 | Me.AboutPanel.Controls.Add(Me.CloseBtn)
105 | Me.AboutPanel.Controls.Add(Me.Ver)
106 | Me.AboutPanel.Dock = System.Windows.Forms.DockStyle.Bottom
107 | Me.AboutPanel.Location = New System.Drawing.Point(0, 76)
108 | Me.AboutPanel.Name = "AboutPanel"
109 | Me.AboutPanel.Size = New System.Drawing.Size(261, 48)
110 | Me.AboutPanel.TabIndex = 5
111 | '
112 | 'AboutWin
113 | '
114 | Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
115 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
116 | Me.BackColor = System.Drawing.Color.White
117 | Me.CancelButton = Me.CloseBtn
118 | Me.ClientSize = New System.Drawing.Size(261, 124)
119 | Me.Controls.Add(Me.AboutPanel)
120 | Me.Controls.Add(Me.AboutCaption)
121 | Me.Controls.Add(Me.AboutTitle)
122 | Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
123 | Me.MaximizeBox = False
124 | Me.MaximumSize = New System.Drawing.Size(558, 342)
125 | Me.MinimizeBox = False
126 | Me.MinimumSize = New System.Drawing.Size(279, 171)
127 | Me.Name = "AboutWin"
128 | Me.ShowIcon = False
129 | Me.ShowInTaskbar = False
130 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
131 | Me.Text = "About"
132 | Me.AboutPanel.ResumeLayout(False)
133 | Me.AboutPanel.PerformLayout()
134 | Me.ResumeLayout(False)
135 |
136 | End Sub
137 |
138 | Friend WithEvents AboutCaption As Windows.Forms.Label
139 | Friend WithEvents AboutTitle As Windows.Forms.Label
140 | Friend WithEvents CloseBtn As Windows.Forms.Button
141 | Friend WithEvents Ver As Windows.Forms.Label
142 | Friend WithEvents AuthorSite As Windows.Forms.LinkLabel
143 | Friend WithEvents AboutPanel As Windows.Forms.Panel
144 | End Class
145 |
--------------------------------------------------------------------------------
/Calculator.vb:
--------------------------------------------------------------------------------
1 | Imports System.ComponentModel
2 | Imports System.Diagnostics
3 | Imports System.Drawing
4 | Imports System.Text
5 | Imports System.Text.RegularExpressions
6 | Imports System.Threading
7 | Imports System.Windows.Forms
8 | Imports Microsoft.Win32
9 |
10 | Public Class Calculator
11 | Dim ErrWarning As Thread,
12 | ErrMutex As Boolean
13 | Dim HexVar = "{*}"
14 | Private Sub Src_TextChanged(sender As Object, e As EventArgs) Handles Src.TextChanged
15 | For Each Rpl In "!@#$%^&*()_~QWERTYUIOPASDFGHJKLZXCVBNM "
16 | Src.Text = Replace(Src.Text.ToUpper, Rpl, String.Empty)
17 | Next
18 |
19 | If Src.Focused Then
20 | If Not Mask.Text.Contains(HexVar) Then
21 | Mask.Text &= HexVar
22 | End If
23 | DoCalc_ToHex()
24 | End If
25 | End Sub
26 |
27 | Private Sub DoCalc_ToHex()
28 | Try
29 | If Src.Text = String.Empty OrElse Src.Text = "-" Then
30 | Out.Text = String.Empty
31 | Exit Sub
32 | End If
33 | Out.Text = Mask.Text.Replace(HexVar,
34 | IIf(UpperMode.Checked,
35 | ToX16(Src.Text).ToUpper,
36 | ToX16(Src.Text)))
37 |
38 | Catch ex As Exception
39 | VisualError()
40 | Out.Text = String.Empty
41 | End Try
42 | End Sub
43 |
44 | Function ToX16(Num As Integer)
45 | Dim Result As String = Num.ToString("x16")
46 | If ShortFormat.Checked Then
47 |
48 | For Each MIN In Result '0x001 => 0x1 [&H..]
49 | If MIN = "0" AndAlso Result.Length > 1 Then
50 | Result = Result.Substring(1) ' 0x..1 => 0x1
51 | Else
52 | Exit For
53 | End If
54 | Next
55 |
56 | End If
57 | Return Result
58 | End Function
59 |
60 | Private Sub Out_TextChanged(sender As Object, e As EventArgs) Handles Out.TextChanged
61 | If Out.Focused Then
62 | Try
63 | If Out.Text = String.Empty Then
64 | Src.Text = String.Empty
65 | Exit Sub
66 | End If
67 | Dim Calc = Out.Text
68 | For Each Rpl In "!@#$%^&*()QWRTYUIOPSGHJKLZXVBNM\/?|[]{}~"
69 | Calc = Replace(Calc.ToUpper, Rpl, "")
70 | Next
71 |
72 | Src.Text = Convert.ToInt32(Calc, 16)
73 | Catch ex As Exception
74 | VisualError()
75 | Src.Text = String.Empty
76 | End Try
77 | End If
78 | End Sub
79 |
80 | Private Sub Mask_TextChanged(sender As Object, e As EventArgs) Handles Mask.TextChanged
81 | DoCalc_ToHex()
82 | _0x.Enabled = True
83 | _AMPH.Enabled = True
84 | _H.Enabled = True
85 | Cls.Enabled = True
86 | If Mask.Text = $"0x{HexVar}" Then
87 | _0x.Enabled = False
88 | ElseIf Mask.Text = $"&H{HexVar}" Then
89 | _AMPH.Enabled = False
90 | ElseIf Mask.Text = $"{HexVar}H" Then
91 | _H.Enabled = False
92 | ElseIf Mask.Text = HexVar Then
93 | Cls.Enabled = False
94 | End If
95 |
96 | If Not Mask.Text.Contains(HexVar) Then
97 | Mask.BackColor = Color.Red
98 | Mask.ForeColor = Color.White
99 | Else
100 | Mask.BackColor = Color.White
101 | Mask.ForeColor = Color.Black
102 | End If
103 | End Sub
104 |
105 | Private Sub _0x_Click(sender As Object, e As EventArgs) Handles _0x.Click
106 | Mask.Text = $"0x{HexVar}"
107 | UpperMode.Checked = False
108 | ShortFormat.Checked = True
109 | Src.Focus()
110 | End Sub
111 | Private Sub _AMPH_Click(sender As Object, e As EventArgs) Handles _AMPH.Click
112 | Mask.Text = $"&H{HexVar}"
113 | UpperMode.Checked = True
114 | ShortFormat.Checked = True
115 | Src.Focus()
116 | End Sub
117 | Private Sub _H_Click(sender As Object, e As EventArgs) Handles _H.Click
118 | Mask.Text = $"{HexVar}H"
119 | UpperMode.Checked = True
120 | ShortFormat.Checked = True
121 | Src.Focus()
122 | End Sub
123 |
124 | Private Sub Cls_Click(sender As Object, e As EventArgs) Handles Cls.Click
125 | Mask.Text = HexVar
126 | ShortFormat.Checked = False
127 | UpperMode.Checked = False
128 | Src.Focus()
129 | End Sub
130 |
131 | Private Sub CheckedChanged_1(sender As Object, e As EventArgs) Handles UpperMode.CheckedChanged, ShortFormat.CheckedChanged
132 | DoCalc_ToHex()
133 | End Sub
134 |
135 | Private Sub Src_KeyPress(sender As Object, e As Windows.Forms.KeyPressEventArgs) Handles Src.KeyPress
136 | e.Handled = Not e.KeyChar Like $"[-,0-9,{ChrW(8)}]"
137 | End Sub
138 |
139 | Private Sub Mask_KeyPress(sender As Object, e As Windows.Forms.KeyPressEventArgs) Handles Mask.KeyPress
140 | If "EADFC".Contains(CStr(e.KeyChar).ToUpper) Then
141 | VisualError()
142 | e.Handled = True
143 | Else
144 | e.Handled = False
145 | End If
146 | End Sub
147 |
148 | Private Sub Out_KeyPress(sender As Object, e As Windows.Forms.KeyPressEventArgs) Handles Out.KeyPress
149 | If Convert.ToInt32(e.KeyChar) = 22 Then
150 | Out.Text = String.Empty
151 | Exit Sub ' Ctrl V ?=> replace all text
152 | ElseIf Convert.ToInt32(e.KeyChar) = 3 Then
153 | If Not Out.Text = String.Empty Then Clipboard.SetText(Out.Text) ' Ctrl C ?=> copy all text
154 | Exit Sub
155 | End If
156 |
157 | If Not $"!@#$%^&*()/\|~EADFC1234567890-_{ChrW(8)}".Contains(CStr(e.KeyChar).ToUpper) AndAlso
158 | Not Mask.Text.Contains(e.KeyChar) Then ' If KEYCHAR does not contain a character from the mask
159 | VisualError()
160 | e.Handled = True
161 | Else
162 | e.Handled = False
163 | End If
164 | End Sub
165 |
166 | Private Sub VisualError()
167 | ErrLbl.Visible = True
168 | If ErrMutex Then
169 | Exit Sub
170 | End If
171 | ErrMutex = True
172 | ErrWarning = New Thread(Sub()
173 | For fErr = 0 To 2
174 | ErrLbl.ForeColor = Color.White
175 | ErrLbl.BackColor = Color.Red
176 | Thread.Sleep(100)
177 | ErrLbl.ForeColor = Color.Red
178 | ErrLbl.BackColor = Color.White
179 | Thread.Sleep(100)
180 | Next
181 | ErrLbl.Visible = False
182 | ErrMutex = False
183 | End Sub)
184 | ErrWarning.Start()
185 | End Sub
186 |
187 | Private Sub Calculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load
188 | Text &= $" (v{Application.ProductVersion})"
189 | End Sub
190 |
191 | Private Sub Src_KeyDown(sender As Object, e As KeyEventArgs) Handles Src.KeyDown
192 | If e.Control AndAlso e.KeyCode = Keys.V Then
193 | Src.Text = Clipboard.GetText
194 | ElseIf e.Control AndAlso e.KeyCode = Keys.C Then
195 | If Not Src.Text = String.Empty Then Clipboard.SetText(Src.Text)
196 | End If
197 | End Sub
198 |
199 | Private Sub Calculator_FormClosing(sender As Object, e As Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
200 | Process.GetCurrentProcess().Kill()
201 | End Sub
202 | End Class
--------------------------------------------------------------------------------
/GUI/Calculator.vb:
--------------------------------------------------------------------------------
1 | Imports System.ComponentModel
2 | Imports System.Diagnostics
3 | Imports System.Drawing
4 | Imports System
5 | Imports System.Text
6 | Imports System.Runtime.InteropServices
7 | Imports System.Threading
8 | Imports System.Windows.Forms
9 | Imports Microsoft.Win32
10 | Imports System.Numerics
11 |
12 | Public Class Calculator
13 | Dim ErrWarning As Thread,
14 | ErrMutex As Boolean
15 | Dim HexVar = "{*}"
16 | Private Sub Src_TextChanged(sender As Object, e As EventArgs) Handles Src.TextChanged
17 | For Each Rpl In "!@#$%^&*()_~QWERTYUIOPASDFGHJKLZXCVNM "
18 | Src.Text = Replace(Src.Text.ToUpper, Rpl, String.Empty)
19 | Next
20 |
21 | If Src.Focused Then
22 | If Not Mask.Text.Contains(HexVar) Then
23 | Mask.Text &= HexVar
24 | End If
25 | DoCalc_ToHex()
26 | End If
27 | End Sub
28 |
29 | Public Sub DoCalc_ToHex()
30 | Try
31 | If Src.Text = String.Empty OrElse Src.Text = "-" Then
32 | Out.Text = String.Empty
33 | Exit Sub
34 | End If
35 | Out.Text = Mask.Text.Replace(HexVar,
36 | IIf(UpperMode.Checked,
37 | ToX16(Src.Text).ToUpper,
38 | ToX16(Src.Text)))
39 |
40 | Catch ex As Exception
41 | VisualError()
42 | Out.Text = String.Empty
43 | End Try
44 | End Sub
45 |
46 | Public Sub DoCalc_ToInt()
47 | If Out.Text = String.Empty Then
48 | Src.Text = String.Empty
49 | Exit Sub
50 | End If
51 | Dim Calc As String = Out.Text
52 | For Each Rpl In "!@#$%^&*()QWRTYUIOPSGHJKLZXVNM\/?|[]{}~"
53 | Calc = Replace(Calc.ToUpper, Rpl, "")
54 | Next
55 |
56 | Src.Text = BigInteger.Parse(Calc, System.Globalization.NumberStyles.HexNumber).ToString
57 |
58 | End Sub
59 |
60 | Function ToX16(num As String)
61 | 'Dim Result As String = Num.ToString("x16")
62 | 'If ShortFormat.Checked Then
63 | '
64 | ' For Each MIN In Result '0x001 => 0x1 [&H..]
65 | ' If MIN = "0" AndAlso Result.Length > 1 Then
66 | ' Result = Result.Substring(1) ' 0x..1 => 0x1
67 | ' Else
68 | ' Exit For
69 | ' End If
70 | ' Next
71 | '
72 | 'End If
73 | 'Return Result
74 | Return BigInteger.Parse(num).ToString(If(ShortFormat.Checked, "x", "x16"))
75 | End Function
76 |
77 | Private Sub Out_TextChanged(sender As Object, e As EventArgs) Handles Out.TextChanged
78 |
79 | If Out.Focused Then
80 | Try
81 | DoCalc_ToInt()
82 | Catch ex As Exception
83 | VisualError()
84 | Src.Text = String.Empty
85 | End Try
86 | End If
87 | End Sub
88 | Private Sub Mask_TextChanged(sender As Object, e As EventArgs) Handles Mask.TextChanged
89 | DoCalc_ToHex()
90 | _0x.Enabled = True
91 | _AMPH.Enabled = True
92 | _H.Enabled = True
93 | Cls.Enabled = True
94 | If Mask.Text = $"0x{HexVar}" Then
95 | _0x.Enabled = False
96 | ElseIf Mask.Text = $"&H{HexVar}" Then
97 | _AMPH.Enabled = False
98 | ElseIf Mask.Text = $"{HexVar}H" Then
99 | _H.Enabled = False
100 | ElseIf Mask.Text = HexVar Then
101 | Cls.Enabled = False
102 | End If
103 |
104 | If Not Mask.Text.Contains(HexVar) Then
105 | Mask.BackColor = Color.Red
106 | Mask.ForeColor = Color.White
107 | Else
108 | Mask.BackColor = Color.White
109 | Mask.ForeColor = Color.Black
110 | End If
111 | End Sub
112 |
113 | Private Sub _0x_Click(sender As Object, e As EventArgs) Handles _0x.Click
114 | Mask.Text = $"0x{HexVar}"
115 | UpperMode.Checked = False
116 | ShortFormat.Checked = True
117 | Src.Focus()
118 | End Sub
119 | Private Sub _AMPH_Click(sender As Object, e As EventArgs) Handles _AMPH.Click
120 | Mask.Text = $"&H{HexVar}"
121 | UpperMode.Checked = True
122 | ShortFormat.Checked = True
123 | Src.Focus()
124 | End Sub
125 | Private Sub _H_Click(sender As Object, e As EventArgs) Handles _H.Click
126 | Mask.Text = $"{HexVar}H"
127 | UpperMode.Checked = True
128 | ShortFormat.Checked = True
129 | Src.Focus()
130 | End Sub
131 |
132 | Private Sub Cls_Click(sender As Object, e As EventArgs) Handles Cls.Click
133 | Mask.Text = HexVar
134 | ShortFormat.Checked = False
135 | UpperMode.Checked = False
136 | Src.Focus()
137 | End Sub
138 |
139 | Private Sub CheckedChanged_1(sender As Object, e As EventArgs) Handles UpperMode.CheckedChanged, ShortFormat.CheckedChanged
140 | DoCalc_ToHex()
141 | End Sub
142 |
143 | Private Sub Src_KeyPress(sender As Object, e As Windows.Forms.KeyPressEventArgs) Handles Src.KeyPress
144 | e.Handled = Not e.KeyChar Like $"[-,0-9,{ChrW(8)}]"
145 | End Sub
146 |
147 | Private Sub Mask_KeyPress(sender As Object, e As Windows.Forms.KeyPressEventArgs) Handles Mask.KeyPress
148 | If "EADFCB".Contains(CStr(e.KeyChar).ToUpper) Then
149 | VisualError()
150 | e.Handled = True
151 | Else
152 | e.Handled = False
153 | End If
154 | End Sub
155 |
156 | Private Sub Out_KeyPress(sender As Object, e As Windows.Forms.KeyPressEventArgs) Handles Out.KeyPress
157 | If Convert.ToInt32(e.KeyChar) = 22 Then
158 | Out.Text = String.Empty
159 | Exit Sub ' Ctrl V ?=> replace all text
160 | ElseIf Convert.ToInt32(e.KeyChar) = 3 Then
161 | If Not Out.Text = String.Empty Then Clipboard.SetText(Out.Text) ' Ctrl C ?=> copy all text
162 | Exit Sub
163 | End If
164 |
165 | If Not $"!@#$%^&*()/\|~EADFCB1234567890-_{ChrW(8)}".Contains(CStr(e.KeyChar).ToUpper) AndAlso
166 | Not Mask.Text.Contains(e.KeyChar) Then ' If KEYCHAR does not contain a character from the mask
167 | VisualError()
168 | e.Handled = True
169 | Else
170 | e.Handled = False
171 | End If
172 | End Sub
173 |
174 | Private Sub VisualError()
175 | ErrLbl.Visible = True
176 | If ErrMutex Then
177 | Exit Sub
178 | End If
179 | ErrMutex = True
180 | ErrWarning = New Thread(Sub()
181 | For fErr = 0 To 2
182 | ErrLbl.ForeColor = Color.White
183 | ErrLbl.BackColor = Color.Red
184 | Thread.Sleep(100)
185 | ErrLbl.ForeColor = Color.Red
186 | ErrLbl.BackColor = Color.White
187 | Thread.Sleep(100)
188 | Next
189 | ErrLbl.Visible = False
190 | ErrMutex = False
191 | End Sub)
192 | ErrWarning.Start()
193 | End Sub
194 |
195 | Private Sub Calculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load
196 | Text &= $" (v{Application.ProductVersion})"
197 | End Sub
198 |
199 | Private Sub Src_KeyDown(sender As Object, e As KeyEventArgs) Handles Src.KeyDown
200 | If e.Control AndAlso e.KeyCode = Keys.V Then
201 | Src.Text = Clipboard.GetText
202 | ElseIf e.Control AndAlso e.KeyCode = Keys.C Then
203 | If Not Src.Text = String.Empty Then Clipboard.SetText(Src.Text)
204 | End If
205 | End Sub
206 |
207 | Private Sub Calculator_HelpButtonClicked(sender As Object, e As CancelEventArgs) Handles MyBase.HelpButtonClicked
208 | Dim AboutMessage As New AboutWin
209 | AboutMessage.ShowDialog(Me)
210 | e.Cancel = True
211 | End Sub
212 | Private Sub Calculator_FormClosing(sender As Object, e As Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
213 | Process.GetCurrentProcess().Kill()
214 | End Sub
215 |
216 | Private Sub Calculator_Shown(sender As Object, e As EventArgs) Handles Me.Shown ' AutoFocus (Args mode)
217 | If Command.Contains("--hex") Then
218 | Out.Focus()
219 | Out.Select(Out.Text.Length, &H0)
220 | Else
221 | Src.Select(Src.Text.Length, &H0)
222 | End If
223 | End Sub
224 | End Class
--------------------------------------------------------------------------------
/Calculator.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class Calculator
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Форма переопределяет dispose для очистки списка компонентов.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Является обязательной для конструктора форм Windows Forms
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'Примечание: следующая процедура является обязательной для конструктора форм Windows Forms
21 | 'Для ее изменения используйте конструктор форм Windows Form.
22 | 'Не изменяйте ее в редакторе исходного кода.
23 |
24 | Private Sub InitializeComponent()
25 | Me.Src = New System.Windows.Forms.TextBox()
26 | Me.Out = New System.Windows.Forms.TextBox()
27 | Me.Lbl1 = New System.Windows.Forms.Label()
28 | Me.Lbl2 = New System.Windows.Forms.Label()
29 | Me.Lbl3 = New System.Windows.Forms.Label()
30 | Me.Mask = New System.Windows.Forms.TextBox()
31 | Me._0x = New System.Windows.Forms.Button()
32 | Me._AMPH = New System.Windows.Forms.Button()
33 | Me._H = New System.Windows.Forms.Button()
34 | Me.Cls = New System.Windows.Forms.Button()
35 | Me.UpperMode = New System.Windows.Forms.CheckBox()
36 | Me.ShortFormat = New System.Windows.Forms.CheckBox()
37 | Me.ErrLbl = New System.Windows.Forms.Label()
38 | Me.SuspendLayout()
39 | '
40 | 'Src
41 | '
42 | Me.Src.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
43 | Me.Src.Location = New System.Drawing.Point(111, 7)
44 | Me.Src.MaxLength = 20
45 | Me.Src.Name = "Src"
46 | Me.Src.Size = New System.Drawing.Size(124, 20)
47 | Me.Src.TabIndex = 1
48 | '
49 | 'Out
50 | '
51 | Me.Out.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
52 | Me.Out.Location = New System.Drawing.Point(111, 29)
53 | Me.Out.MaxLength = 70
54 | Me.Out.Name = "Out"
55 | Me.Out.Size = New System.Drawing.Size(124, 20)
56 | Me.Out.TabIndex = 2
57 | '
58 | 'Lbl1
59 | '
60 | Me.Lbl1.Anchor = System.Windows.Forms.AnchorStyles.Left
61 | Me.Lbl1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
62 | Me.Lbl1.Location = New System.Drawing.Point(8, 7)
63 | Me.Lbl1.Name = "Lbl1"
64 | Me.Lbl1.Size = New System.Drawing.Size(100, 20)
65 | Me.Lbl1.TabIndex = 3
66 | Me.Lbl1.Text = "INT32"
67 | Me.Lbl1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
68 | '
69 | 'Lbl2
70 | '
71 | Me.Lbl2.Anchor = System.Windows.Forms.AnchorStyles.Left
72 | Me.Lbl2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
73 | Me.Lbl2.Location = New System.Drawing.Point(8, 29)
74 | Me.Lbl2.Name = "Lbl2"
75 | Me.Lbl2.Size = New System.Drawing.Size(100, 20)
76 | Me.Lbl2.TabIndex = 4
77 | Me.Lbl2.Text = "[X16] HEX"
78 | Me.Lbl2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
79 | '
80 | 'Lbl3
81 | '
82 | Me.Lbl3.Anchor = System.Windows.Forms.AnchorStyles.Left
83 | Me.Lbl3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
84 | Me.Lbl3.Location = New System.Drawing.Point(8, 51)
85 | Me.Lbl3.Name = "Lbl3"
86 | Me.Lbl3.Size = New System.Drawing.Size(100, 20)
87 | Me.Lbl3.TabIndex = 6
88 | Me.Lbl3.Text = "Format mask"
89 | Me.Lbl3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
90 | '
91 | 'Mask
92 | '
93 | Me.Mask.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
94 | Me.Mask.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
95 | Me.Mask.Location = New System.Drawing.Point(111, 51)
96 | Me.Mask.MaxLength = 70
97 | Me.Mask.Name = "Mask"
98 | Me.Mask.Size = New System.Drawing.Size(124, 20)
99 | Me.Mask.TabIndex = 5
100 | Me.Mask.Text = "0x{*}"
101 | '
102 | '_0x
103 | '
104 | Me._0x.Anchor = System.Windows.Forms.AnchorStyles.Left
105 | Me._0x.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
106 | Me._0x.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
107 | Me._0x.Location = New System.Drawing.Point(8, 75)
108 | Me._0x.Name = "_0x"
109 | Me._0x.Size = New System.Drawing.Size(50, 20)
110 | Me._0x.TabIndex = 7
111 | Me._0x.Text = "0x*"
112 | Me._0x.UseMnemonic = False
113 | Me._0x.UseVisualStyleBackColor = False
114 | '
115 | '_AMPH
116 | '
117 | Me._AMPH.Anchor = System.Windows.Forms.AnchorStyles.Left
118 | Me._AMPH.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
119 | Me._AMPH.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
120 | Me._AMPH.Location = New System.Drawing.Point(57, 75)
121 | Me._AMPH.Name = "_AMPH"
122 | Me._AMPH.Size = New System.Drawing.Size(50, 20)
123 | Me._AMPH.TabIndex = 8
124 | Me._AMPH.Text = "&H*"
125 | Me._AMPH.UseMnemonic = False
126 | Me._AMPH.UseVisualStyleBackColor = False
127 | '
128 | '_H
129 | '
130 | Me._H.Anchor = System.Windows.Forms.AnchorStyles.Left
131 | Me._H.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
132 | Me._H.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
133 | Me._H.Location = New System.Drawing.Point(8, 94)
134 | Me._H.Name = "_H"
135 | Me._H.Size = New System.Drawing.Size(50, 20)
136 | Me._H.TabIndex = 9
137 | Me._H.Text = "*H"
138 | Me._H.UseMnemonic = False
139 | Me._H.UseVisualStyleBackColor = False
140 | '
141 | 'Cls
142 | '
143 | Me.Cls.Anchor = System.Windows.Forms.AnchorStyles.Left
144 | Me.Cls.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(222, Byte), Integer), CType(CType(222, Byte), Integer))
145 | Me.Cls.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
146 | Me.Cls.Location = New System.Drawing.Point(57, 94)
147 | Me.Cls.Name = "Cls"
148 | Me.Cls.Size = New System.Drawing.Size(50, 20)
149 | Me.Cls.TabIndex = 10
150 | Me.Cls.Text = "CLS"
151 | Me.Cls.UseMnemonic = False
152 | Me.Cls.UseVisualStyleBackColor = False
153 | '
154 | 'UpperMode
155 | '
156 | Me.UpperMode.Anchor = System.Windows.Forms.AnchorStyles.Left
157 | Me.UpperMode.AutoSize = True
158 | Me.UpperMode.Location = New System.Drawing.Point(113, 96)
159 | Me.UpperMode.Name = "UpperMode"
160 | Me.UpperMode.Size = New System.Drawing.Size(41, 17)
161 | Me.UpperMode.TabIndex = 11
162 | Me.UpperMode.Text = "UP"
163 | Me.UpperMode.UseVisualStyleBackColor = True
164 | '
165 | 'ShortFormat
166 | '
167 | Me.ShortFormat.Anchor = System.Windows.Forms.AnchorStyles.Left
168 | Me.ShortFormat.AutoSize = True
169 | Me.ShortFormat.Checked = True
170 | Me.ShortFormat.CheckState = System.Windows.Forms.CheckState.Checked
171 | Me.ShortFormat.Location = New System.Drawing.Point(113, 77)
172 | Me.ShortFormat.Name = "ShortFormat"
173 | Me.ShortFormat.Size = New System.Drawing.Size(64, 17)
174 | Me.ShortFormat.TabIndex = 12
175 | Me.ShortFormat.Text = "SHORT"
176 | Me.ShortFormat.UseVisualStyleBackColor = True
177 | '
178 | 'ErrLbl
179 | '
180 | Me.ErrLbl.Anchor = System.Windows.Forms.AnchorStyles.Left
181 | Me.ErrLbl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
182 | Me.ErrLbl.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
183 | Me.ErrLbl.ForeColor = System.Drawing.Color.Red
184 | Me.ErrLbl.Location = New System.Drawing.Point(183, 77)
185 | Me.ErrLbl.Name = "ErrLbl"
186 | Me.ErrLbl.Size = New System.Drawing.Size(52, 34)
187 | Me.ErrLbl.TabIndex = 13
188 | Me.ErrLbl.Text = "ERR"
189 | Me.ErrLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
190 | Me.ErrLbl.Visible = False
191 | '
192 | 'Calculator
193 | '
194 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
195 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
196 | Me.BackColor = System.Drawing.Color.White
197 | Me.ClientSize = New System.Drawing.Size(247, 118)
198 | Me.Controls.Add(Me.ErrLbl)
199 | Me.Controls.Add(Me.ShortFormat)
200 | Me.Controls.Add(Me.UpperMode)
201 | Me.Controls.Add(Me.Cls)
202 | Me.Controls.Add(Me._H)
203 | Me.Controls.Add(Me._AMPH)
204 | Me.Controls.Add(Me._0x)
205 | Me.Controls.Add(Me.Lbl3)
206 | Me.Controls.Add(Me.Mask)
207 | Me.Controls.Add(Me.Lbl2)
208 | Me.Controls.Add(Me.Lbl1)
209 | Me.Controls.Add(Me.Out)
210 | Me.Controls.Add(Me.Src)
211 | Me.Margin = New System.Windows.Forms.Padding(2)
212 | Me.MinimumSize = New System.Drawing.Size(263, 157)
213 | Me.Name = "Calculator"
214 | Me.ShowIcon = False
215 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
216 | Me.Text = "x16Calc"
217 | Me.ResumeLayout(False)
218 | Me.PerformLayout()
219 |
220 | End Sub
221 | Friend WithEvents Src As Windows.Forms.TextBox
222 | Friend WithEvents Out As Windows.Forms.TextBox
223 | Friend WithEvents Lbl1 As Windows.Forms.Label
224 | Friend WithEvents Lbl2 As Windows.Forms.Label
225 | Friend WithEvents Lbl3 As Windows.Forms.Label
226 | Friend WithEvents Mask As Windows.Forms.TextBox
227 | Friend WithEvents _0x As Windows.Forms.Button
228 | Friend WithEvents _AMPH As Windows.Forms.Button
229 | Friend WithEvents _H As Windows.Forms.Button
230 | Friend WithEvents Cls As Windows.Forms.Button
231 | Friend WithEvents UpperMode As Windows.Forms.CheckBox
232 | Friend WithEvents ShortFormat As Windows.Forms.CheckBox
233 | Friend WithEvents ErrLbl As Windows.Forms.Label
234 | End Class
235 |
--------------------------------------------------------------------------------
/GUI/Calculator.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class Calculator
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Форма переопределяет dispose для очистки списка компонентов.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Является обязательной для конструктора форм Windows Forms
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'Примечание: следующая процедура является обязательной для конструктора форм Windows Forms
21 | 'Для ее изменения используйте конструктор форм Windows Form.
22 | 'Не изменяйте ее в редакторе исходного кода.
23 |
24 | Private Sub InitializeComponent()
25 | Me.Src = New System.Windows.Forms.TextBox()
26 | Me.Out = New System.Windows.Forms.TextBox()
27 | Me.Lbl1 = New System.Windows.Forms.Label()
28 | Me.Lbl2 = New System.Windows.Forms.Label()
29 | Me.Lbl3 = New System.Windows.Forms.Label()
30 | Me.Mask = New System.Windows.Forms.TextBox()
31 | Me._0x = New System.Windows.Forms.Button()
32 | Me._AMPH = New System.Windows.Forms.Button()
33 | Me._H = New System.Windows.Forms.Button()
34 | Me.Cls = New System.Windows.Forms.Button()
35 | Me.UpperMode = New System.Windows.Forms.CheckBox()
36 | Me.ShortFormat = New System.Windows.Forms.CheckBox()
37 | Me.ErrLbl = New System.Windows.Forms.Label()
38 | Me.SuspendLayout()
39 | '
40 | 'Src
41 | '
42 | Me.Src.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
43 | Me.Src.Cursor = System.Windows.Forms.Cursors.Default
44 | Me.Src.Font = New System.Drawing.Font("Lucida Console", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
45 | Me.Src.Location = New System.Drawing.Point(112, 6)
46 | Me.Src.MaxLength = 150
47 | Me.Src.Name = "Src"
48 | Me.Src.Size = New System.Drawing.Size(140, 19)
49 | Me.Src.TabIndex = 1
50 | '
51 | 'Out
52 | '
53 | Me.Out.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
54 | Me.Out.Cursor = System.Windows.Forms.Cursors.Default
55 | Me.Out.Font = New System.Drawing.Font("Lucida Console", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
56 | Me.Out.Location = New System.Drawing.Point(112, 27)
57 | Me.Out.MaxLength = 150
58 | Me.Out.Name = "Out"
59 | Me.Out.Size = New System.Drawing.Size(140, 19)
60 | Me.Out.TabIndex = 2
61 | '
62 | 'Lbl1
63 | '
64 | Me.Lbl1.Anchor = System.Windows.Forms.AnchorStyles.Left
65 | Me.Lbl1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
66 | Me.Lbl1.Location = New System.Drawing.Point(9, 6)
67 | Me.Lbl1.Name = "Lbl1"
68 | Me.Lbl1.Size = New System.Drawing.Size(100, 19)
69 | Me.Lbl1.TabIndex = 3
70 | Me.Lbl1.Text = "INTEGER"
71 | Me.Lbl1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
72 | '
73 | 'Lbl2
74 | '
75 | Me.Lbl2.Anchor = System.Windows.Forms.AnchorStyles.Left
76 | Me.Lbl2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
77 | Me.Lbl2.Location = New System.Drawing.Point(9, 27)
78 | Me.Lbl2.Name = "Lbl2"
79 | Me.Lbl2.Size = New System.Drawing.Size(100, 19)
80 | Me.Lbl2.TabIndex = 4
81 | Me.Lbl2.Text = "[X16] HEX"
82 | Me.Lbl2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
83 | '
84 | 'Lbl3
85 | '
86 | Me.Lbl3.Anchor = System.Windows.Forms.AnchorStyles.Left
87 | Me.Lbl3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
88 | Me.Lbl3.Location = New System.Drawing.Point(9, 48)
89 | Me.Lbl3.Name = "Lbl3"
90 | Me.Lbl3.Size = New System.Drawing.Size(100, 19)
91 | Me.Lbl3.TabIndex = 6
92 | Me.Lbl3.Text = "Format mask"
93 | Me.Lbl3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
94 | '
95 | 'Mask
96 | '
97 | Me.Mask.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
98 | Me.Mask.Cursor = System.Windows.Forms.Cursors.Default
99 | Me.Mask.Font = New System.Drawing.Font("Lucida Console", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
100 | Me.Mask.Location = New System.Drawing.Point(112, 48)
101 | Me.Mask.MaxLength = 70
102 | Me.Mask.Name = "Mask"
103 | Me.Mask.Size = New System.Drawing.Size(140, 19)
104 | Me.Mask.TabIndex = 5
105 | Me.Mask.Text = "0x{*}"
106 | '
107 | '_0x
108 | '
109 | Me._0x.Anchor = System.Windows.Forms.AnchorStyles.Left
110 | Me._0x.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
111 | Me._0x.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
112 | Me._0x.Location = New System.Drawing.Point(9, 71)
113 | Me._0x.Name = "_0x"
114 | Me._0x.Size = New System.Drawing.Size(50, 20)
115 | Me._0x.TabIndex = 7
116 | Me._0x.Text = "0x*"
117 | Me._0x.UseMnemonic = False
118 | Me._0x.UseVisualStyleBackColor = False
119 | '
120 | '_AMPH
121 | '
122 | Me._AMPH.Anchor = System.Windows.Forms.AnchorStyles.Left
123 | Me._AMPH.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
124 | Me._AMPH.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
125 | Me._AMPH.Location = New System.Drawing.Point(58, 71)
126 | Me._AMPH.Name = "_AMPH"
127 | Me._AMPH.Size = New System.Drawing.Size(50, 20)
128 | Me._AMPH.TabIndex = 8
129 | Me._AMPH.Text = "&H*"
130 | Me._AMPH.UseMnemonic = False
131 | Me._AMPH.UseVisualStyleBackColor = False
132 | '
133 | '_H
134 | '
135 | Me._H.Anchor = System.Windows.Forms.AnchorStyles.Left
136 | Me._H.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
137 | Me._H.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
138 | Me._H.Location = New System.Drawing.Point(9, 90)
139 | Me._H.Name = "_H"
140 | Me._H.Size = New System.Drawing.Size(50, 20)
141 | Me._H.TabIndex = 9
142 | Me._H.Text = "*H"
143 | Me._H.UseMnemonic = False
144 | Me._H.UseVisualStyleBackColor = False
145 | '
146 | 'Cls
147 | '
148 | Me.Cls.Anchor = System.Windows.Forms.AnchorStyles.Left
149 | Me.Cls.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(222, Byte), Integer), CType(CType(222, Byte), Integer))
150 | Me.Cls.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
151 | Me.Cls.Location = New System.Drawing.Point(58, 90)
152 | Me.Cls.Name = "Cls"
153 | Me.Cls.Size = New System.Drawing.Size(50, 20)
154 | Me.Cls.TabIndex = 10
155 | Me.Cls.Text = "CLS"
156 | Me.Cls.UseMnemonic = False
157 | Me.Cls.UseVisualStyleBackColor = False
158 | '
159 | 'UpperMode
160 | '
161 | Me.UpperMode.Anchor = System.Windows.Forms.AnchorStyles.Left
162 | Me.UpperMode.AutoSize = True
163 | Me.UpperMode.Location = New System.Drawing.Point(114, 92)
164 | Me.UpperMode.Name = "UpperMode"
165 | Me.UpperMode.Size = New System.Drawing.Size(41, 17)
166 | Me.UpperMode.TabIndex = 11
167 | Me.UpperMode.Text = "UP"
168 | Me.UpperMode.UseVisualStyleBackColor = True
169 | '
170 | 'ShortFormat
171 | '
172 | Me.ShortFormat.Anchor = System.Windows.Forms.AnchorStyles.Left
173 | Me.ShortFormat.AutoSize = True
174 | Me.ShortFormat.Checked = True
175 | Me.ShortFormat.CheckState = System.Windows.Forms.CheckState.Checked
176 | Me.ShortFormat.Location = New System.Drawing.Point(114, 73)
177 | Me.ShortFormat.Name = "ShortFormat"
178 | Me.ShortFormat.Size = New System.Drawing.Size(64, 17)
179 | Me.ShortFormat.TabIndex = 12
180 | Me.ShortFormat.Text = "SHORT"
181 | Me.ShortFormat.UseVisualStyleBackColor = True
182 | '
183 | 'ErrLbl
184 | '
185 | Me.ErrLbl.Anchor = System.Windows.Forms.AnchorStyles.Right
186 | Me.ErrLbl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
187 | Me.ErrLbl.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
188 | Me.ErrLbl.ForeColor = System.Drawing.Color.Red
189 | Me.ErrLbl.Location = New System.Drawing.Point(197, 73)
190 | Me.ErrLbl.Name = "ErrLbl"
191 | Me.ErrLbl.Size = New System.Drawing.Size(52, 34)
192 | Me.ErrLbl.TabIndex = 13
193 | Me.ErrLbl.Text = "ERR"
194 | Me.ErrLbl.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
195 | Me.ErrLbl.Visible = False
196 | '
197 | 'Calculator
198 | '
199 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
200 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
201 | Me.BackColor = System.Drawing.Color.White
202 | Me.ClientSize = New System.Drawing.Size(260, 121)
203 | Me.Controls.Add(Me.ErrLbl)
204 | Me.Controls.Add(Me.ShortFormat)
205 | Me.Controls.Add(Me.UpperMode)
206 | Me.Controls.Add(Me.Cls)
207 | Me.Controls.Add(Me._H)
208 | Me.Controls.Add(Me._AMPH)
209 | Me.Controls.Add(Me._0x)
210 | Me.Controls.Add(Me.Lbl3)
211 | Me.Controls.Add(Me.Mask)
212 | Me.Controls.Add(Me.Lbl2)
213 | Me.Controls.Add(Me.Lbl1)
214 | Me.Controls.Add(Me.Out)
215 | Me.Controls.Add(Me.Src)
216 | Me.HelpButton = True
217 | Me.Margin = New System.Windows.Forms.Padding(2, 2, 2, 2)
218 | Me.MaximizeBox = False
219 | Me.MinimizeBox = False
220 | Me.MinimumSize = New System.Drawing.Size(276, 160)
221 | Me.Name = "Calculator"
222 | Me.ShowIcon = False
223 | Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
224 | Me.Text = "x16Calc"
225 | Me.ResumeLayout(False)
226 | Me.PerformLayout()
227 |
228 | End Sub
229 | Friend WithEvents Src As Windows.Forms.TextBox
230 | Friend WithEvents Out As Windows.Forms.TextBox
231 | Friend WithEvents Lbl1 As Windows.Forms.Label
232 | Friend WithEvents Lbl2 As Windows.Forms.Label
233 | Friend WithEvents Lbl3 As Windows.Forms.Label
234 | Friend WithEvents Mask As Windows.Forms.TextBox
235 | Friend WithEvents _0x As Windows.Forms.Button
236 | Friend WithEvents _AMPH As Windows.Forms.Button
237 | Friend WithEvents _H As Windows.Forms.Button
238 | Friend WithEvents Cls As Windows.Forms.Button
239 | Friend WithEvents UpperMode As Windows.Forms.CheckBox
240 | Friend WithEvents ShortFormat As Windows.Forms.CheckBox
241 | Friend WithEvents ErrLbl As Windows.Forms.Label
242 | End Class
243 |
--------------------------------------------------------------------------------