Mazranel
Mazranel
CC#
Created by Mazranel on 9/12/2024 in #help
FileSystemWatcher causes user limit exceptions on Kubuntu Linux
Using the following code results in the exception The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached.:
public static void Init(string ProjectPath, List <ProjectFile> ProjectFileList, List <ProjectDirectory> ProjectDirList, List <Icon> IconList)
{
ProjectFiles = ProjectFileList;
ProjectDirs = ProjectDirList;
Icons = IconList;

FSWatcher.BeginInit();
FindItemsInProjectDirectory(null, null);

FSWatcher.IncludeSubdirectories = true;
FSWatcher.EnableRaisingEvents = true;
FSWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
FSWatcher.Changed += new FileSystemEventHandler(FindItemsInProjectDirectory);
FSWatcher.Created += new FileSystemEventHandler(FindItemsInProjectDirectory);
FSWatcher.Deleted += new FileSystemEventHandler(FindItemsInProjectDirectory);
FSWatcher.Renamed += new RenamedEventHandler(FindItemsInProjectDirectory);
FSWatcher.Path = ProjectPath;
FSWatcher.EndInit();
}
public static void Init(string ProjectPath, List <ProjectFile> ProjectFileList, List <ProjectDirectory> ProjectDirList, List <Icon> IconList)
{
ProjectFiles = ProjectFileList;
ProjectDirs = ProjectDirList;
Icons = IconList;

FSWatcher.BeginInit();
FindItemsInProjectDirectory(null, null);

FSWatcher.IncludeSubdirectories = true;
FSWatcher.EnableRaisingEvents = true;
FSWatcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
FSWatcher.Changed += new FileSystemEventHandler(FindItemsInProjectDirectory);
FSWatcher.Created += new FileSystemEventHandler(FindItemsInProjectDirectory);
FSWatcher.Deleted += new FileSystemEventHandler(FindItemsInProjectDirectory);
FSWatcher.Renamed += new RenamedEventHandler(FindItemsInProjectDirectory);
FSWatcher.Path = ProjectPath;
FSWatcher.EndInit();
}
FindItemsInProjectDirectory does not do anything with the fs watcher object.
28 replies
CC#
Created by Mazranel on 9/11/2024 in #help
Application fails to find DLL that is in the same directory
No description
78 replies
CC#
Created by Mazranel on 8/6/2024 in #help
StreamWriter writing some lines multiple times
I'm using StreamWriter to write project data into a file, but more often than not I'll get some lines written twice and maybe even three times. Is this a bug with my code or something else? Code:
// Write the project data into the file
using (StreamWriter PFWriter = new StreamWriter(ProjectConfigFilePath, false))
{
PFWriter.WriteLine("[PROJECT_INFO]");
PFWriter.WriteLine(ProjectName);

if (OpenScene.Contains(Path.GetDirectoryName(ProjectConfigFilePath)))
{
PFWriter.WriteLine($"INSIDE_PROJECT_DIR -> {OpenScene.Replace(Path.GetDirectoryName(ProjectConfigFilePath), "")}");
}
else
{
PFWriter.WriteLine(OpenScene);
}

PFWriter.WriteLine("[END_PROJECT_INFO]");
PFWriter.WriteLine("\n[SCENES]");

ConsoleUtils.StatusWrite(string.Join(", ", SceneList));

foreach (string Scene in SceneList)
{

if (Scene.Contains(Path.GetDirectoryName(ProjectConfigFilePath)))
{
PFWriter.WriteLine($"INSIDE_PROJECT_DIR -> {Scene.Replace(Path.GetDirectoryName(ProjectConfigFilePath), "")}");
}
else
{
PFWriter.WriteLine(Scene);
}
}

PFWriter.WriteLine("[END_SCENES]");
PFWriter.Flush();
}
// Write the project data into the file
using (StreamWriter PFWriter = new StreamWriter(ProjectConfigFilePath, false))
{
PFWriter.WriteLine("[PROJECT_INFO]");
PFWriter.WriteLine(ProjectName);

if (OpenScene.Contains(Path.GetDirectoryName(ProjectConfigFilePath)))
{
PFWriter.WriteLine($"INSIDE_PROJECT_DIR -> {OpenScene.Replace(Path.GetDirectoryName(ProjectConfigFilePath), "")}");
}
else
{
PFWriter.WriteLine(OpenScene);
}

PFWriter.WriteLine("[END_PROJECT_INFO]");
PFWriter.WriteLine("\n[SCENES]");

ConsoleUtils.StatusWrite(string.Join(", ", SceneList));

foreach (string Scene in SceneList)
{

if (Scene.Contains(Path.GetDirectoryName(ProjectConfigFilePath)))
{
PFWriter.WriteLine($"INSIDE_PROJECT_DIR -> {Scene.Replace(Path.GetDirectoryName(ProjectConfigFilePath), "")}");
}
else
{
PFWriter.WriteLine(Scene);
}
}

PFWriter.WriteLine("[END_SCENES]");
PFWriter.Flush();
}
22 replies
CC#
Created by Mazranel on 8/2/2024 in #help
Implementing scripting in a game engine
What would be the best way to implement scripting in a game engine? I've been looking at reflection and runtime code compilation but I wasn't sure if they would give the user access to the engine's libraries. I was also thinking of implementing my own custom language like what Godot does, but my engine is so simple that I think it would be overkill. I'd like to do something similar to how big engines like Unity and Godot do it (attaching scripts to objects), is there an effective way to do that?
41 replies
CC#
Created by Mazranel on 6/16/2024 in #help
Using Screen.FromPoint(Cursor.Position) always returns `Display 0`
No description
26 replies
CC#
Created by Mazranel on 6/5/2024 in #help
Memory leaks with OpenFileDIalog, SaveFIleDialog, and DataGridView in WinForms
No description
28 replies