так просто значения в, допустим, json файл сохраняй, а при импорте кфг их и подставляйНужно помочь с кодом для системы cfg для чита standoff 2 на языке c# windows forms
using System;
using System.IO;
using System.Text.Json;
using System.Windows.Forms;
namespace ConfigExample
{
public partial class Form1 : Form
{
private Config choza1 = new Config();
public Form1()
{
InitializeComponent();
}
private void choza2()
{
choza1.AimBotEnabled = checkBoxAimBotEnabled.Checked;
choza1.AimBotSensitivity = trackBarAimBotSensitivity.Value / 10.0f;
choza1.CustomKeyBind = textBoxCustomKeyBind.Text;
}
private void choza3()
{
checkBoxAimBotEnabled.Checked = choza1.AimBotEnabled;
trackBarAimBotSensitivity.Value = (int)(choza1.AimBotSensitivity * 10);
textBoxCustomKeyBind.Text = choza1.CustomKeyBind;
}
private void choza4(Config config, string filePath)
{
string json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(filePath, json);
}
private Config choza5(string filePath)
{
if (!File.Exists(filePath)) return new Config();
string json = File.ReadAllText(filePath);
return JsonSerializer.Deserialize<Config>(json);
}
private void choza6(object sender, EventArgs e)
{
choza2();
choza4(choza1, "config.json");
MessageBox.Show("Настройки сохранены!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void choza7(object sender, EventArgs e)
{
choza1 = choza5("config.json");
choza3();
MessageBox.Show("Настройки загружены!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
public class Config
{
public bool AimBotEnabled { get; set; } = false;
public float AimBotSensitivity { get; set; } = 1.0f;
public string CustomKeyBind { get; set; } = "F";
}
}
Нужно помочь с кодом для системы cfg для чита standoff 2 на языке c# windows forms
using System;
using System.IO;
using System.Windows.Forms;
namespace Standoff2_CFG
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void btnSave_Click(object sender, EventArgs e)
{
SaveConfig();
}
private void SaveConfig()
{
string configFilePath = "standoff2.cfg";
using (StreamWriter writer = new StreamWriter(configFilePath))
{
writer.WriteLine("Sensitivity=" + txtSensitivity.Text);
writer.WriteLine("Resolution=" + txtResolution.Text);
writer.WriteLine("Volume=" + txtVolume.Text);
}
MessageBox.Show("Конфигурация сохранена в " + configFilePath);
}
}
}
Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: admin@yougame.biz