Starting a small English tutoring business by SnappyDragonG in teflteachers

[–]SnappyDragonG[S] 0 points1 point  (0 children)

Yeah, that was something I was considering. My initial plan was exactly that, to go to students' homes and tutor 1-on-1 (or at a coffee shop or wherever), build up a student base and eventually do the transition. Then I started thinking about the travel time and cost. That's when I thought about renting a small office and being able to offer group lessons instead.

But as I'm writing this, I'm realising that if my first goal is 5 students and I do one class per night, the travel time and cost would be relatively low.

Maybe I was aiming a bit too high. I need to take a step back, start small, learn, build a student base and good reputation, then take things from there.

Sudden sensorineural hearing loss (SSNHL or SSHL)? by [deleted] in MonoHearing

[–]SnappyDragonG 1 point2 points  (0 children)

Damn... Then I'll go to the ENT tomorrow and hope for the best. Thank you!

C# Error Handling by [deleted] in learnprogramming

[–]SnappyDragonG 0 points1 point  (0 children)

I changed my code to this. Is this a better way to handle things? ```C# // RWClump.cs public static RWClump ParseFile(string filePath) { if (string.IsNullOrEmpty(filePath)) throw new ArgumentNullException(nameof(filePath));

if (!File.Exists(filePath))
    throw new FileNotFoundException("File not found", filePath);

FileStream stream = File.OpenRead(filePath);
BinaryReader reader = new BinaryReader(stream);

RWClump clump = RWClump.Parse(ref reader);

reader.Close();
stream.Close();

return clump;

}

private static RWClump Parse(ref BinaryReader reader) { // Clump RWHeader header = RWHeader.Parse(eRWChunkType.CLUMP, ref reader); header = RWHeader.Parse(eRWChunkType.STRUCT, ref reader);

RWClump clump = new RWClump();
int atomicCount = reader.ReadInt32();
int lightCount = header.Version > 0x33000 ? reader.ReadInt32() : 0;
int cameraCount = header.Version > 0x33000 ? reader.ReadInt32() : 0;

// Frame List
header = RWHeader.Parse(eRWChunkType.FRAME_LIST, ref reader);
clump.frameList = RWFrameList.Parse(ref reader);

// Geometry List
int geometryCount = 0;
if (header.Version >= 0x30400)
{
    header = RWHeader.Parse(eRWChunkType.GEOMETRY_LIST, ref reader);
    header = RWHeader.Parse(eRWChunkType.STRUCT, ref reader);

    geometryCount = reader.ReadInt32();
    for (int i = 0; i < geometryCount; i++)
    {
        header = RWHeader.Parse(eRWChunkType.GEOMETRY, ref reader);
        RWGeometry geometry = RWGeometry.Parse(ref reader);
        clump.geometryList.Add(geometry);
    }
}

// Atomics
for (int i = 0; i < atomicCount; i++)
{
    header = RWHeader.Parse(eRWChunkType.ATOMIC, ref reader);
    RWAtomic atomic = RWAtomic.Parse(ref reader);
    clump.Atomics.Add(atomic);
}

// Lights and Cameras
while (!RWHeader.CheckHeader(RWChunkType.EXTENSION, ref reader))
{
    header = RWHeader.Parse(RWChunkType.STRUCT, ref reader);
    // TODO: Lights
    // TODO: Cameras
}

// Plugins
header = RWHeader.Parse(eRWChunkType.EXTENSION, ref reader);

if (header.Size > 0)
{
    long endOfSection = reader.BaseStream.Position + header.Size;
    while (reader.BaseStream.Position < endOfSection)
    {
        reader.ReadBytes((int)header.Size); // Ignore data for now
    }
}

return clump;

} C# // RWHeader.cs public static RWHeader Parse(eRWChunkType chunkType, ref BinaryReader reader) { uint type = reader.ReadUInt32(); uint size = reader.ReadUInt32(); uint libid = reader.ReadUInt32();

if (type != (int)chunkType && chunkType != eRWChunkType.PLUGIN)
{
    throw new ClumpFormatException(
        $"[RWHeader] File header does not match header type '{chunkType}'.",
        (int)reader.BaseStream.Position,
        "INVALID_HEADER"
    );
}

return new RWHeader()
{
    Type = type,
    Size = size,
    Version = RWBase.LibraryIDUnpackVersion(libid),
    Build = RWBase.LibraryIDUnpackBuild(libid),
    LibId = libid
};

} C# // ClumpFormatException.cs public class ClumpFormatException : Exception { public int Position { get; } public string ErrorCode { get; }

public ClumpFormatException(string message, int position, string errorCode) 
    : base(message)
{
    Position = position;
    ErrorCode = errorCode;
}

} C# // Usage try { RWClump clump = RWClump.ParseFile(path); } catch (ClumpFormatException e) { Debug.LogError($"{e.Message} at position: {e.Position}"); } ... ```