private void HandleFunctionButtons(FunctionID selectFunction) { mCurrentFunction = selectFunction; switch (mCurrentFunction) { case FunctionID.TRANSCRIPT: transcriptbtn.IsEnabled = false; conceptbtn.IsEnabled = true; sentimentbtn.IsEnabled = true; entitybtn.IsEnabled = true; break; case FunctionID.CONCEPTS: transcriptbtn.IsEnabled = true; conceptbtn.IsEnabled = false; sentimentbtn.IsEnabled = true; entitybtn.IsEnabled = true; break; case FunctionID.OPINIONS: transcriptbtn.IsEnabled = true; conceptbtn.IsEnabled = true; sentimentbtn.IsEnabled = false; entitybtn.IsEnabled = true; break; case FunctionID.INTERESTS: transcriptbtn.IsEnabled = true; conceptbtn.IsEnabled = true; sentimentbtn.IsEnabled = true; entitybtn.IsEnabled = false; break; } }
//public static bool OpDeleteBottle(string id, int throwBackType = 0) //{ // DeleteBottle.Builder builder = DeleteBottle.CreateBuilder(); // builder.BottleId = id; // builder.ThrowBackType = throwBackType; // return add(new OpLog(0x20, builder.Build().ToByteArray())); //} public static bool opFunctionSwitch(FunctionID f, bool enable) { FunctionSwitch.Builder builder = FunctionSwitch.CreateBuilder(); builder.FunctionId = (uint)f; builder.SwitchValue = enable ? (uint)1 : (uint)2; return(add(new OpLog(0x17, builder.Build().ToByteArray()))); }
private string ReadString(BinaryReader br) { FunctionID length = br.ReadUInt64(); byte[] abString = new byte[length]; br.Read(abString, 0, (int)length); return(System.Text.ASCIIEncoding.ASCII.GetString(abString, 0, (int)length)); }
public static Function GetFunctionInfo(FunctionMap functions, FunctionID id, Run run, bool reverse) { Function result; if (!functions.TryGetValue(id, out result)) { result = new Function(id, run, reverse); functions[id] = result; } return(result); }
/// <summary> /// Sends the request to the server. /// </summary> protected void SendRequest(DataPacket request) { request.Encode(); netStream.Write(request.Buffer, 0, request.BufferLength); if (CommLog != null) { CommLog.WriteAction(FunctionID.GetName(request.FunctionID)); CommLog.WriteAction(BuildWritingText(request.Buffer, 0, request.BufferLength)); } }
public void MoveTo(FunctionID id) { foreach (TreeNode item in Nodes) { if (((Function)item.Tag).ID == id) { this.SelectedNode = item; Invalidate(); this.Focus(); break; } } }
private void CallersNext() { if (callers.SelectedNode != null) { TreeNode item = callers.SelectedNode; FunctionID id = ((Function)item.Tag).ID; if (item.Parent.Parent == null) { callees.MoveTo(id); } else { callers.MoveTo(id); } item.Collapse(); } }
/// <summary> /// Sends the request to the server. /// </summary> protected void SendRequest(DataPacket request) { try { request.Encode(); netStream.Write(request.Buffer, 0, request.BufferLength); if (CommLog != null) { CommLog.WriteAction(FunctionID.GetName(request.FunctionID)); CommLog.WriteAction(BuildWritingText(request.Buffer, 0, request.BufferLength)); } } catch (IOException) { ClientState = ClientState.Error; throw; } }
private void ReadStackWalks() { signatures[0] = new FunctionInfo(Path.GetFileName(this.executable), ""); using (BinaryReader r = new BinaryReader(File.Open(FileName, FileMode.Open))) { this.end = DateTime.Now; while (true) { //int functionId = r.ReadInt32(); FunctionID functionId = r.ReadUInt64(); if (functionId == FunctionID.MaxValue) { break; } signatures[functionId] = new FunctionInfo( ReadString(r), ReadString(r) ); } while (true) { List <FunctionID> stackWalk = new List <FunctionID>(); while (true) { FunctionID functionId = r.ReadUInt64(); //int functionId = r.ReadInt32(); if (functionId == FunctionID.MaxValue) { break; } else if (functionId == FunctionID.MaxValue - 1) { return; } stackWalk.Add(functionId); } stackWalk.Add(0); stackWalks.Add(stackWalk); } } }
public static bool FunctionEquals(FunctionID fid, FunctionID fid2) { return(RoutineEquals(fid, fid2)); }
public static int GetFunctionHashCode(FunctionID fid) { return(GetRoutineHashCode(fid)); }
/// <summary> /// Processes an incoming request already stored in the client input buffer. /// </summary> protected void ProcessRequest(ConnectedClient client, DataPacket request) { ResponsePacket response = null; // response to send try { // check whether the client is logged in if (!client.IsLoggedIn && FunctionID.RequiresLoggedIn(request.FunctionID)) { throw new ProtocolException(ErrorCode.AccessDenied, Locale.IsRussian ? "Требуется вход в систему." : "Login required."); } // process standard request bool handled = true; // request was handled switch (request.FunctionID) { case FunctionID.GetSessionInfo: GetSessionInfo(client, request, out response); break; case FunctionID.Login: Login(client, request, out response); break; case FunctionID.GetStatus: GetStatus(client, request, out response); break; case FunctionID.TerminateSession: TerminateSession(client, request); break; case FunctionID.GetFileInfo: GetFileInfo(client, request, out response); break; case FunctionID.DownloadFile: DownloadFile(client, request); break; case FunctionID.UploadFile: UploadFile(client, request, out response); break; default: handled = false; break; } // process custom request if (!handled) { ProcessCustomRequest(client, request, out response, out handled); if (!handled) { throw new ProtocolException(ErrorCode.IllegalFunction, Locale.IsRussian ? "Недопустимая функция." : "Illegal function."); } } } catch (Exception ex) { log.WriteException(ex, Locale.IsRussian ? "Ошибка при обработке запроса 0x{0} для клиента {1}" : "Error processing request 0x{0} for the client {1}", request.FunctionID.ToString("X4"), client.Address); response = new ResponsePacket(request, client.OutBuf); response.SetError(ex is ProtocolException pe ? pe.ErrorCode : ErrorCode.InternalServerError); } // send response if (response != null) { client.SendResponse(response); } }
protected override void LaunchPluginFunction(CloudData data) { HashSet <int> selectedpointsSet = data.globalMetaData.SelectedPointsList; HashSet <float> selectedtrajectorySet = data.globalMetaData.SelectedTRajectories; N = 0; List <double> TrajectoriesList = new List <double>(); List <double> Xvalues = new List <double>(); List <double> Yvalues = new List <double>(); List <double> Zvalues = new List <double>(); List <double> Tvalues = new List <double>(); Debug.Log("lowtime " + data.globalMetaData.lowertimeLimit); Debug.Log("uptime " + data.globalMetaData.uppertimeLimit); foreach (float i in selectedtrajectorySet) { foreach (int j in data.pointTrajectoriesTable[i].metadata.selectedpointsIDList) { if (data.pointMetaDataTable[j].isHidden == false) { Debug.Log("time " + data.pointDataTable[j].time); if (data.pointDataTable[j].time >= data.globalMetaData.lowertimeLimit && data.pointDataTable[j].time <= data.globalMetaData.uppertimeLimit) { Debug.Log("check"); N++; TrajectoriesList.Add(i); Xvalues.Add((double)data.pointDataTable[j].position.x); Yvalues.Add((double)data.pointDataTable[j].position.y); Zvalues.Add((double)data.pointDataTable[j].position.z); Tvalues.Add((double)data.pointDataTable[j].time); } } } } //DEBUG /** * N = 25; * for(int i = 0; i < 5; i++) * { * TrajectoriesList.Add(i); * Xvalues.Add((double)Random.Range(0,100)); * Yvalues.Add((double)Random.Range(0, 100)); * Zvalues.Add((double)Random.Range(0, 100)); * Tvalues.Add(0); * TrajectoriesList.Add(i); * Xvalues.Add((double)Random.Range(0, 100)); * Yvalues.Add((double)Random.Range(0, 100)); * Zvalues.Add((double)Random.Range(0, 100)); * Tvalues.Add(1); * TrajectoriesList.Add(i); * Xvalues.Add((double)Random.Range(0, 100)); * Yvalues.Add((double)Random.Range(0, 100)); * Zvalues.Add((double)Random.Range(0, 100)); * Tvalues.Add(2); * TrajectoriesList.Add(i); * Xvalues.Add((double)Random.Range(0, 100)); * Yvalues.Add((double)Random.Range(0, 100)); * Zvalues.Add((double)Random.Range(0, 100)); * Tvalues.Add(3); * TrajectoriesList.Add(i); * Xvalues.Add((double)Random.Range(0, 100)); * Yvalues.Add((double)Random.Range(0, 100)); * Zvalues.Add((double)Random.Range(0, 100)); * Tvalues.Add(4); * } * * Debug.Log(TrajectoriesList.Count); **/ //END DEBUG double[] TrajectoriesArray = TrajectoriesList.ToArray(); double[] XvaluesArray = Xvalues.ToArray(); double[] YvaluesArray = Yvalues.ToArray(); double[] ZvaluesArray = Zvalues.ToArray(); double[] TvaluesArray = Tvalues.ToArray(); fixed(double *Trajectoriespointer = TrajectoriesArray) { fixed(double *xvalues = XvaluesArray) { fixed(double *yvalues = YvaluesArray) { fixed(double *zvalues = ZvaluesArray) { fixed(double *tvalues = TvaluesArray) { this.trajectories = Trajectoriespointer; this.xCoord = xvalues; this.yCoord = yvalues; this.zCoord = zvalues; this.tCoord = tvalues; double diffusion = 145.0; double forceX = 14.0; double forceY = 16.0; double forceZ = 17.0; Diffusion = &diffusion; ForceX = &forceX; ForceY = &forceY; ForceZ = &forceZ; functionID = (FunctionID)dropdown.value; Debug.Log("FunctionID - " + (int)functionID); double.TryParse(SigmaInput.text, out Sigma); double.TryParse(SigmaxyInput.text, out SigmaXY); double.TryParse(SigmazInput.text, out SigmaZ); Debug.Log("fid " + functionID); Debug.Log("Sigma " + Sigma); Debug.Log("Sigmaxy " + SigmaXY); Debug.Log("Sigmaz " + SigmaZ); Infer3D((int)functionID, Sigma, SigmaXY, SigmaZ, N, trajectories, xCoord, yCoord, zCoord, tCoord, Diffusion, ForceX, ForceY, ForceZ); double diffusionres = *Diffusion; double forceXres = *ForceX; double forceYres = *ForceY; double forceZres = *ForceZ; diffusionres = Math.Round(diffusionres, 3); forceXres = Math.Round(forceXres, 3); forceYres = Math.Round(forceYres, 3); forceZres = Math.Round(forceZres, 3); ResultsString = "diffusion : " + diffusionres + "\n" + "forceX : " + forceXres + "\n" + "forceY : " + forceYres + "\n" + "forceZ : " + forceZres + "\n"; Debug.Log("N : " + N); Debug.Log("diffusion : " + *Diffusion); Debug.Log("forceX : " + *ForceX); Debug.Log("forceY : " + *ForceY); Debug.Log("forceZ : " + *ForceZ); } } } } } }
public Function(FunctionID ID, Run run, bool reverse) { this.run = run; this.ID = ID; this.reverse = reverse; }