ThєSαvícs ↝ darKSaviC
ThєSαvícs ↝ darKSaviC
CC#
Created by ThєSαvícs ↝ darKSaviC on 4/14/2024 in #help
How do i make .txt file watcher with VS
i was trying to make .txt file watcher and i just added these functions;
private FileSystemWatcher watcher;


public Form1()
{
InitializeComponent();
InitializeFileSystemWatcher();
}

private void InitializeFileSystemWatcher()
{
watcher = new FileSystemWatcher();
watcher.Path = Settings1.Default.settingsFolderPath; // İzlenecek dizin
watcher.Filter = "veriler.txt"; // İzlenecek dosyanın adı

// Değişiklikleri izleme özelliklerini ayarla
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.Changed += OnFileChanged;

// İzlemeyi başlat
watcher.EnableRaisingEvents = true;
}

private void OnFileChanged(object sender, FileSystemEventArgs e)
{
// Dosya değiştiğinde çağrılacak metot
// Listenin yenilenmesi işlemlerini burada gerçekleştirin
RefreshList();
}

private void RefreshList()
{
table.Rows.Clear();

string filePath = Path.Combine(Settings1.Default.settingsFolderPath, "veriler.txt");
if (File.Exists(filePath))
{
string[] lines = File.ReadAllLines(filePath);
foreach (string line in lines)
{
string[] values = line.Split('|');

// Her bir değerin başındaki ve sonundaki boşlukları kırp
for (int i = 0; i < values.Length; i++)
{
values[i] = values[i].Trim();
}

// Yeni satır oluştur ve değerleri tabloya ekle
table.Rows.Add(values);
}
}
else
{
MessageBox.Show("Veriler.txt not found.");
}
}
private FileSystemWatcher watcher;


public Form1()
{
InitializeComponent();
InitializeFileSystemWatcher();
}

private void InitializeFileSystemWatcher()
{
watcher = new FileSystemWatcher();
watcher.Path = Settings1.Default.settingsFolderPath; // İzlenecek dizin
watcher.Filter = "veriler.txt"; // İzlenecek dosyanın adı

// Değişiklikleri izleme özelliklerini ayarla
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.Changed += OnFileChanged;

// İzlemeyi başlat
watcher.EnableRaisingEvents = true;
}

private void OnFileChanged(object sender, FileSystemEventArgs e)
{
// Dosya değiştiğinde çağrılacak metot
// Listenin yenilenmesi işlemlerini burada gerçekleştirin
RefreshList();
}

private void RefreshList()
{
table.Rows.Clear();

string filePath = Path.Combine(Settings1.Default.settingsFolderPath, "veriler.txt");
if (File.Exists(filePath))
{
string[] lines = File.ReadAllLines(filePath);
foreach (string line in lines)
{
string[] values = line.Split('|');

// Her bir değerin başındaki ve sonundaki boşlukları kırp
for (int i = 0; i < values.Length; i++)
{
values[i] = values[i].Trim();
}

// Yeni satır oluştur ve değerleri tabloya ekle
table.Rows.Add(values);
}
}
else
{
MessageBox.Show("Veriler.txt not found.");
}
}
but this RefreshList() code is too broken, my veriler.txt datas filled like this texts;
8 replies
CC#
Created by ThєSαvícs ↝ darKSaviC on 4/10/2024 in #help
✅ I cant combine folder paths
I was trying to combine folder path with strings with that code
c#
string ilce = duzenleIlce.Text;
string mahalle = duzenleMah.Text;
string ada = duzenleAda.Text;
string parsel = duzenleParsel.Text;
string islem = duzenleIslemCombo.Text;
string klasorAdi = string.IsNullOrEmpty(ada) ? parsel : ada + "_" + parsel;
string baseFolderPath = Settings1.Default.settingsFolderPath + "\\LIHKAB_3100-800\\";

string folderPath = Path.Combine(baseFolderPath, ilce, mahalle, klasorAdi);
c#
string ilce = duzenleIlce.Text;
string mahalle = duzenleMah.Text;
string ada = duzenleAda.Text;
string parsel = duzenleParsel.Text;
string islem = duzenleIslemCombo.Text;
string klasorAdi = string.IsNullOrEmpty(ada) ? parsel : ada + "_" + parsel;
string baseFolderPath = Settings1.Default.settingsFolderPath + "\\LIHKAB_3100-800\\";

string folderPath = Path.Combine(baseFolderPath, ilce, mahalle, klasorAdi);
But when i click the button, baseFolderPath is still use same path, i need to combine "ilce, mahalle,klasorAdi" strings to reach my folder path. How can i make?
11 replies
CC#
Created by ThєSαvícs ↝ darKSaviC on 11/10/2023 in #help
❔ Form goes fully transparent please help
No description
8 replies
CC#
Created by ThєSαvícs ↝ darKSaviC on 9/25/2023 in #help
❔ how can i save flow layout panel
im doing a simple video game library with C# but the problem is i cant save them when i add new panel in flow layout we can do with .json or .txt but actually i dont know how can i save in .json or .txt also in video game library you can add images for the game and if u dont want to add its ur decision, can someone help me to fix my saving problem. we have 3 variable 1- Name of the game 2- The location of the game 3- Logo of the game
5 replies
CC#
Created by ThєSαvícs ↝ darKSaviC on 8/13/2023 in #help
❔ maximized form and draging problem in C# Winforms
im trying to fix this problem and it has to be FormBorderStyle = None
5 replies
CC#
Created by ThєSαvícs ↝ darKSaviC on 7/19/2023 in #help
✅ How can i make clean tranparency
20 replies
CC#
Created by ThєSαvícs ↝ darKSaviC on 6/29/2023 in #help
❔ Im making a Game Menu like a steam library but not online
76 replies
CC#
Created by ThєSαvícs ↝ darKSaviC on 6/26/2023 in #help
❔ How can i make daily log system
Hi! Im working on a customers data saving application and in my application we are writing in a textbox to save customers data and i want to make save textbox's text in the log but the problem is i need to make daily log like this today is 06.26.2023 this is folder name, in this folder has a log.txt file and in application need to change folder when the date has passed soo someone can help me for this?
7 replies
CC#
Created by ThєSαvícs ↝ darKSaviC on 6/25/2023 in #help
✅ How can i disable maximizing the form
Hi! I am using C# .netframework 4.7.2 and i was trying to disable maximizing and my FormBorderStyle is None, im using my own buttons but actual problem is when i press Win + Up it maximizes again how can i disable this?
128 replies