This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text; | |
using System.IO; | |
using System.Reflection; | |
using System.Runtime.InteropServices; | |
using System; | |
namespace AppName | |
{ | |
class IniFile | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data; | |
using System.Linq; | |
using System.Windows.Forms; | |
using Microsoft.Win32; | |
namespace AppName | |
{ | |
public partial class FormGuid : Form | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void buttonHex_Click(object sender, EventArgs e) | |
{ | |
int value32 = 3389; // Порт RDP в формате Int32 | |
short value16 = (short)value32; // Преобразование int в short (он же Int16) | |
var valueHex = IPAddress.NetworkToHostOrder(value16); // Преобразование значения в сетевой байтовый формат | |
var hex = valueHex.ToString("X"); // Количество знаков (если "X8" то восемь символов) | |
textBoxHex.Text = hex; // Полученное значение выводить в textBox | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void WriteRegKey(string keyName, string ipm1, string ipm2, string p1, string p2) | |
{ | |
string value1 = p1; // Преобразование string в int | |
short i1 = Convert.ToInt16(value1); | |
int valueHex1 = IPAddress.NetworkToHostOrder(i1); | |
string h1 = valueHex1.ToString("X2"); | |
string value2 = p2; // Преобразование string в int | |
short i2 = Convert.ToInt16(value2); | |
int valueHex2 = IPAddress.NetworkToHostOrder(i2); |