Example #1
0
        /// <summary>
        /// this method is called back in real-time testing and will load a .vdat file
        /// </summary>
        /// <param name="ar"></param>
        public void loadRawDataMultiRun_Pipe(int x, int y, int z, byte[] data, int current, int total)
        {
            if (shouldStop)
            {
                return;
            }

            if (data.Length > 0)
            {
                if (Preferences.Instance.ProblemOriginal.samples == null)
                {
                    Preferences.Instance.ProblemOriginal = new libSVM_ExtendedProblem();
                    GC.Collect();
                    GuiPreferences.Instance.ProgressBarMax = total;
                    Preferences.Instance.ProblemOriginal.PrepareSamplesLabelsSize(total);
                }


                if (current <= Preferences.Instance.events.EventListLastTr)
                {
                    bool corrupted = false;
                    GuiPreferences.Instance.ProgressBarValue = current;
                    ProcessRawBuffer(x, y, z, data, current);
                    RealTimeProcessing.RealTimeProcess();
                    GuiPreferences.Instance.setLog("Processing Vector " + current.ToString());
                }
                else
                {
                    shouldStop = true;
                }
            }

            if (!shouldStop)
            {
                Preferences.Instance.udp.BeginReceive();
            }
        }
Example #2
0
        /// <summary>
        /// this method is called back in real-time testing and will load a .vdat file
        /// </summary>
        /// <param name="ar"></param>
        public void loadRawDataMultiRun_UDP(IAsyncResult ar)
        {
            if (shouldStop)
            {
                return;
            }

            byte[] data = Preferences.Instance.udp.EndReceive(ar);

            if (data.Length > 0)
            {
                string text = Encoding.ASCII.GetString(data);
                int    loc1 = text.LastIndexOf("\\");
                int    loc2 = text.LastIndexOf(".");
                int    loc3 = text.LastIndexOf("-");
                int    loc4 = text.LastIndexOf(",");

                if (Preferences.Instance.ProblemOriginal.samples == null)
                {
                    Preferences.Instance.ProblemOriginal = new libSVM_ExtendedProblem();
                    GC.Collect();
                    int totalToProcess = Int32.Parse(text.Substring(loc4 + 1, text.Length - (loc4 + 1)));
                    GuiPreferences.Instance.ProgressBarMax = totalToProcess;
                    //loading just the amount of data we need, so we assign accordingly, not this>Program.mainForm.getMaxAvailableTrs()
                    Preferences.Instance.ProblemOriginal.PrepareSamplesLabelsSize(totalToProcess);
                }

                string path = text.Substring(0, loc1 + 1);
                fileName   = text.Substring(loc1 + 1, loc2 - loc1 - 1);
                last_index = Int32.Parse(text.Substring(loc3 + 1, loc2 - loc3 - 1));

                if (last_index <= Preferences.Instance.events.EventListLastTr)
                {
                    //report progress
                    // DLL GUI Seperation
                    //Program.mainForm.progressBar1.Value = i - GuiPreferences.Instance.FromTR + 1 ;
                    GuiPreferences.Instance.ProgressBarValue = last_index;
                    fileName = GuiPreferences.Instance.WorkDirectory + GuiPreferences.Instance.FileName + last_index.ToString() + ".vdat";
                    loadRawFileName(fileName);
                    //PublicMethods.ProcessMultiRuns(null);
                    RealTimeProcessing.RealTimeProcess();
                    //Preferences.Instance.pipeClient.Send(fileName);
                    GuiPreferences.Instance.setLog("Sending Vector " + last_index.ToString());
                    last_index++;
                }
                else
                {
                    shouldStop = true;
                }


                //updategui();
                // shoot event
                //send the recieved data somewhere
            }

            if (!shouldStop)
            {
                Preferences.Instance.udp.BeginReceive();
            }
        }