TheSnowOwl
TheSnowOwl
CC#
Created by TheSnowOwl on 6/19/2024 in #help
✅ I need help with compiling an console application exe with the Roslyn compiler
No description
12 replies
CC#
Created by TheSnowOwl on 5/13/2024 in #help
Anyone interested in trying to break an encryption i have written?
i have created an encryption system, idk if i could call it an algorithm, but i want to see if it is breakable, and this is the first place i could think of to find people like this. basically, i have attached a text file with the encrypted text. anyone willing to take on the task to test the security of this encryption method?
43 replies
CC#
Created by TheSnowOwl on 1/3/2024 in #help
Trying to compile a script at runtime
im trying to compile a script at runtime using CSharpCompilation.Emit this is the script i want to compile
namespace WinterRose.Generated.Serializer_WinterRose_Vectors_Vector2
{
using System;
using WinterRose.Vectors;
using WinterRose.Serialization.Workers;
using WinterRose.Serialization;
using System.Collections.Generic;
using System.Text;

public class GeneratedSerializer_Vector2
{
public StringBuilder Serialize(WinterRose.Vectors.Vector2 obj, SerializerSettings settings, Int32 depth)
{
StringBuilder builder = new();
builder.Append("@0VmVjdG9yMi0tV2ludGVyUm9zZS5WZWN0b3JzLS1XaW50ZXJSb3NlLCBWZXJzaW9uPTEuMy4zLjEsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbA==");
builder.Append($"#0x|0{SnowSerializerWorkers.SerializeField(obj.x, "x", typeof(Single), depth, settings)}");
builder.Append($"#0y|0{SnowSerializerWorkers.SerializeField(obj.y, "y", typeof(Single), depth, settings)}");
return builder;
}

public Vector2 Deserialize(string data, SerializerSettings settings, Int32 depth)
{
Vector2 result = new();
Dictionary<string, string?> values = new();
string[] splits = data.Split($"#{depth}");
foreach (string item in splits)
{
string[] split = item.Split("|{depth}");
values.Add(split[0], split[1] ?? null);
}
foreach (var item in values)
{
switch (item.Key)
{
case "x":
result.x = SnowSerializerWorkers.DeserializeField<Single>(values["x"], typeof(Single), depth);
break;
case "y":
result.y = SnowSerializerWorkers.DeserializeField<Single>(values["y"], typeof(Single), depth);
break;
}
}
return result;
}
}
}
namespace WinterRose.Generated.Serializer_WinterRose_Vectors_Vector2
{
using System;
using WinterRose.Vectors;
using WinterRose.Serialization.Workers;
using WinterRose.Serialization;
using System.Collections.Generic;
using System.Text;

public class GeneratedSerializer_Vector2
{
public StringBuilder Serialize(WinterRose.Vectors.Vector2 obj, SerializerSettings settings, Int32 depth)
{
StringBuilder builder = new();
builder.Append("@0VmVjdG9yMi0tV2ludGVyUm9zZS5WZWN0b3JzLS1XaW50ZXJSb3NlLCBWZXJzaW9uPTEuMy4zLjEsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbA==");
builder.Append($"#0x|0{SnowSerializerWorkers.SerializeField(obj.x, "x", typeof(Single), depth, settings)}");
builder.Append($"#0y|0{SnowSerializerWorkers.SerializeField(obj.y, "y", typeof(Single), depth, settings)}");
return builder;
}

public Vector2 Deserialize(string data, SerializerSettings settings, Int32 depth)
{
Vector2 result = new();
Dictionary<string, string?> values = new();
string[] splits = data.Split($"#{depth}");
foreach (string item in splits)
{
string[] split = item.Split("|{depth}");
values.Add(split[0], split[1] ?? null);
}
foreach (var item in values)
{
switch (item.Key)
{
case "x":
result.x = SnowSerializerWorkers.DeserializeField<Single>(values["x"], typeof(Single), depth);
break;
case "y":
result.y = SnowSerializerWorkers.DeserializeField<Single>(values["y"], typeof(Single), depth);
break;
}
}
return result;
}
}
}
certainly it would be a lot better to actually use source generators, however my project requires the ability to generate code from scripts that are also compiled at runtime. however this specific script is causing me errors that i cant seem to find. errors like switch statments missing, commas missing, semicolons missing, and like 200 of these, so i really have no idea i hope someone here has some ideas of what i could do. i already tried restarting visual studio, that didnt work
4 replies
CC#
Created by TheSnowOwl on 12/14/2023 in #help
What is a good way of loading and unloading an assembly at runtime?
im making a system that should be able to load an assembly, run code from it, and then be able to unload it. currently im using AssemblyLoadContext, however that requires all references to be destroyed before it can unload. is there a better way of loading it? and if not, how do i completely destroy a reference to an object given i am 100% sure i have just one place where i have the instance?
14 replies
CC#
Created by TheSnowOwl on 5/30/2023 in #help
❔ Need help with code analyzers
i have just written a little code analyzer using chatGPT, and eventually got no write-time errors and wanted to test, and found that i should add "<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRuless>" to my project's property group. however this does not exist when i try to, and when i manually type it out the project becomes invalid and unable to load until i remove that line again using something like notepad. what should i do to enable my analyzer to be used?
2 replies
CC#
Created by TheSnowOwl on 4/4/2023 in #help
❔ Base64 invalid string error while the input is valid
4 replies
CC#
Created by TheSnowOwl on 3/16/2023 in #help
❔ Visual studio randomly decides to wait 40 seconds before actually starting my application
i was happily developing my application, writing code that i have before, and code that does not block any threads. i run the application multiple times to test, and then suddenly it takes 40 seconds for even the first line in program.cs to be executed. i tried removing the code i had edited but it still does it. i thought perhaps a visual studio restart would do it? unfortunately, it didnt. neither did a full PC restart. i dont know what could be wrong :/
3 replies
CC#
Created by TheSnowOwl on 2/25/2023 in #help
❔ How can i calculate a rotation float from a direction vector?
i know this might not be the correct place to ask such a question, but i figured such a large number of capable minds, surely there is someone who can explain it to me :> anyway, as i said in the title, i want to calculate a rotation based on a directional vector. i suck at math, and i cant find my answer on google, so im trying this place >.< thanks in advance <3
18 replies
CC#
Created by TheSnowOwl on 1/17/2023 in #help
Give a function with any number of arguments as parameter to another function.
i know how to pass a function with 0 to 16 arguments as parameter, however having this constraint by the Action or Func types, as far as i know, does not allow me to pass in a function with no arguments and later one with 2 arguments. is there perhaps any way that i could do this?
17 replies
CC#
Created by TheSnowOwl on 11/15/2022 in #help
need help with properties and their setters
16 replies
CC#
Created by TheSnowOwl on 11/8/2022 in #help
Winforms DataGridView issue when setting column header text
1 replies
CC#
Created by TheSnowOwl on 11/7/2022 in #help
I need directions.
i wish to learn and understand how to create and use a application window without using Winforms, WPF, or any existing tool that creates a window for you. meaning i want to write the code that initializes and tells windows to create the application window. however i have not been able to find any good sources as to how to go about this in C#. perhaps it cant be done in C#, i dont know. therefore ive come here to ask for directions.
3 replies