public Neuron GetCompleteNeuron(int i, bool fromClipboard = false) { if (MainWindow.useServers && !fromClipboard) { Neuron retVal = NeuronClient.GetNeuron(i); //retVal.synapses = NeuronClient.GetSynapses(i); //retVal.synapsesFrom = NeuronClient.GetSynapsesFrom(i); return(retVal); } else { NeuronPartial n = GetPartialNeuron(i); Neuron retVal = new Neuron(); retVal.id = n.id; retVal.currentCharge = n.currentCharge; retVal.lastCharge = n.lastCharge; retVal.lastFired = n.lastFired; retVal.inUse = n.inUse; retVal.leakRate = n.leakRate; retVal.model = n.model; retVal.axonDelay = n.axonDelay; retVal.label = retVal.Label;// GetNeuronLabel(i); if (retVal.ToolTip != "") { retVal.label += Neuron.toolTipSeparator + retVal.ToolTip; } retVal.synapses = GetSynapsesList(i); retVal.synapsesFrom = GetSynapsesFromList(i); return(retVal); } }
public Neuron GetCompleteNeuron(int i) { if (MainWindow.useServers) { Neuron retVal = NeuronClient.GetNeuron(i); //retVal.synapses = NeuronClient.GetSynapses(i); //retVal.synapsesFrom = NeuronClient.GetSynapsesFrom(i); return(retVal); } else { NeuronPartial n = GetPartialNeuron(i); Neuron retVal = new Neuron(); retVal.id = n.id; retVal.currentCharge = n.currentCharge; retVal.lastCharge = n.lastCharge; retVal.lastFired = n.lastFired; retVal.inUse = n.inUse; retVal.leakRate = n.leakRate; retVal.model = n.model; retVal.axonDelay = n.axonDelay; retVal.label = GetNeuronLabel(i); retVal.synapses = GetSynapsesList(i); retVal.synapsesFrom = GetSynapsesFromList(i); return(retVal); } }
NeuronPartial ConvertToNeuron(byte[] input) { NeuronPartial n = new NeuronPartial(); GCHandle handle = GCHandle.Alloc(input, GCHandleType.Pinned); n = (NeuronPartial)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(NeuronPartial)); handle.Free(); return n; }