LoneWolf78
New member
- Joined
- Aug 4, 2017
- Messages
- 4
- Programming Experience
- Beginner
I'm having some problems trying to move some code for better structure and reading so everything doesnt get clutterd.
But for some reasong I can not find the correct way to split this one.
The first part (piece of much more) need to be cut away from the second part (also just a piece of much more)
but as soon as I put it in a seprated class everything breaks. I can no longer call GetIdentiy()
I also tried to put it in a namespace but that gave me the error "A namespace cannot directly contain members such as fields or methods"
or I get "GetIdentity does not exist in the curent context"
this can not be so hard. I'm probably overlooking the obvious here.
(I just posted one problem line and what i'm trying to call. the code is working if its in the same file)
But for some reasong I can not find the correct way to split this one.
The first part (piece of much more) need to be cut away from the second part (also just a piece of much more)
but as soon as I put it in a seprated class everything breaks. I can no longer call GetIdentiy()
I also tried to put it in a namespace but that gave me the error "A namespace cannot directly contain members such as fields or methods"
or I get "GetIdentity does not exist in the curent context"
this can not be so hard. I'm probably overlooking the obvious here.
(I just posted one problem line and what i'm trying to call. the code is working if its in the same file)
C#:
void Update() {
GW2_Mumble.Identity.FoV = GetIdentity().Fov; // <---- this line breaks
}
// This piece needs to go in a sperate file. the code is getting to big to be good to read/manipulate
public GW2Identity GetIdentity()
{
var link = new MumbleLink();
MumbleLinkedMemory MumbleData = link.Read();
var identity = MumbleData.Identity;
var stop = Array.IndexOf(MumbleData.Identity, '\0');
unsafe
{
fixed (char* addr = identity)
{
return JsonConvert.DeserializeObject<GW2Identity>(new String(addr));
}
}
}