///
        ///	 <summary> * return the jmf root of the status jmf that contains all modules, null if no modules are active
        ///	 *
        ///	 * @return </summary>
        ///
        public virtual JDFDoc getStatusResponse()
        {
            if (counters.Count == 0)
            {
                return(null);
            }

            StatusCounter root = counters[0];
            JDFDoc        d    = new JDFDoc("JMF");
            JDFJMF        jmf  = d.getJMFRoot();

            jmf.mergeElement(root.getDocJMFPhaseTime().getJMFRoot(), false);
            JDFDeviceInfo di = jmf.getResponse(0).getDeviceInfo(0);

            for (int i = 1; i < counters.Count; i++)
            {
                StatusCounter counter         = counters[i];
                JDFDoc        docJMFPhaseTime = counter.getDocJMFPhaseTime();
                if (docJMFPhaseTime == null)
                {
                    continue;
                }
                JDFDeviceInfo di2    = docJMFPhaseTime.getJMFRoot().getResponse(0).getDeviceInfo(0);
                VElement      phases = di2.getChildElementVector(ElementName.JOBPHASE, null, null, true, -1, false);
                for (int j = 0; j < phases.Count; j++)
                {
                    di.copyElement(phases[j], null);
                }
                di.setDeviceStatus(getDeviceStatus());
            }
            return(d);
        }
 ///
 ///	 <summary> * remove a statuscounter representing a set of modules to this device status counter
 ///	 *  </summary>
 ///	 * <param name="theStatusCounter"> the statuscounter to add </param>
 ///
 public virtual void removeModule(StatusCounter sc)
 {
     if (sc != null)
     {
         counters.Remove(sc);
     }
 }
Example #3
0
 public MainWindowVM()
 {
     initCommands();
     Servers     = new ObservableCollection <ServerObject>();
     StatCounter = new StatusCounter();
     StatCounter.Refresh(0);
 }
Example #4
0
        public virtual void testExtension()
        {
            hf = new HotFolder(theHF, ".txt,.xml", new MyListener(true));
            StatusCounter.sleep(1000); // time to start up
            FileInfo file  = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f1.txt");
            FileInfo file1 = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f1.xml");
            FileInfo file2 = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f1.foo");

            SupportClass.FileSupport.CreateNewFile(file);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            SupportClass.FileSupport.CreateNewFile(file1);
            file1.Refresh();
            Assert.IsTrue(file1.Exists);
            SupportClass.FileSupport.CreateNewFile(file2);
            file2.Refresh();
            Assert.IsTrue(file2.Exists);
            StatusCounter.sleep(4000);
            file.Refresh();
            file1.Refresh();
            file2.Refresh();
            Assert.IsFalse(file.Exists);
            Assert.IsFalse(file1.Exists);
            Assert.IsTrue(file2.Exists);
        }
Example #5
0
    // Start is called before the first frame updatSe
    void Start()
    {
        var canvas = GameObject.Find("Canvas");

        statusCounter = canvas.GetComponent <StatusCounter>();
        hPBarHolder   = GameObject.Find("HPBarHolder");
    }
Example #6
0
        public virtual void teststopStart()
        {
            MyListener myListener = new MyListener();
            FileInfo   file       = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f1.txt");
            FileInfo   stFile     = new FileInfo(theStorage + Path.DirectorySeparatorChar.ToString() + "f1.txt");

            SupportClass.FileSupport.CreateNewFile(file);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            Assert.IsFalse(stFile.Exists);
            hf = new QueueHotFolder(theHF, theStorage, null, myListener, null);
            hf.stop();
            StatusCounter.sleep(3000);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            stFile.Refresh();
            Assert.IsFalse(stFile.Exists, "FileInfo is still there after stop");
            Assert.AreEqual(0, myListener.vJMF.Count);
            hf.restart();
            StatusCounter.sleep(3000);
            file.Refresh();
            Assert.IsFalse(file.Exists, "FileInfo is gone after stop");
            stFile.Refresh();
            Assert.IsTrue(stFile.Exists);
            Assert.AreEqual(1, myListener.vJMF.Count);
            JDFJMF elementAt = (JDFJMF)myListener.vJMF[0];

            Assert.AreEqual(JDFMessage.EnumType.SubmitQueueEntry, elementAt.getCommand(0).getEnumType());
            Assert.AreEqual(UrlUtil.fileToUrl(stFile, false), elementAt.getCommand(0).getQueueSubmissionParams(0).getURL());
        }
Example #7
0
        public virtual void testBig()
        {
            hf = new HotFolder(theHF, null, new MyListener(true));
            FileInfo file = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f1.txt");

            SupportClass.FileSupport.CreateNewFile(file);
            file.Refresh();
            Assert.IsTrue(file.Exists);

            FileStream fos = new FileStream(file.FullName, FileMode.Open);

            byte[] ba = new byte[1];
            for (int i = 0; i < 20; i++) // incrementally fill file
            {
                ba[0] = (byte)i;
                fos.Write(ba, 0, 1);
                fos.Flush();

                StatusCounter.sleep(10);
            }
            file.Refresh();
            Assert.IsTrue(file.Exists);
            fos.Close();

            StatusCounter.sleep(3000);
            file.Refresh();
            Assert.IsFalse(file.Exists);
        }
Example #8
0
        public virtual void testStopStart()
        {
            hf = new HotFolder(theHF, null, new MyListener(true));
            FileInfo file = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f1.txt");

            SupportClass.FileSupport.CreateNewFile(file);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            StatusCounter.sleep(3000);
            file.Refresh();
            Assert.IsFalse(file.Exists, "First delete attempt.");
            hf.Stop();
            hf.Stop();
            SupportClass.FileSupport.CreateNewFile(file);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            StatusCounter.sleep(3000);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            hf.restart();
            hf.restart();
            hf.restart();
            StatusCounter.sleep(5000);
            file.Refresh();
            Assert.IsFalse(file.Exists, "Second delete attempt.");
        }
 ///
 ///	 <summary> * add a statuscounter representing a set of modules to this device status counter
 ///	 *  </summary>
 ///	 * <param name="theStatusCounter"> the statuscounter to add </param>
 ///
 public virtual void addModule(StatusCounter sc)
 {
     if (sc != null)
     {
         counters.Add(sc);
     }
 }
Example #10
0
    // Start is called before the first frame update
    void Start()
    {
        var canvas = GameObject.Find("Canvas");

        statusCounter = canvas.GetComponent <StatusCounter>();
        iceGageHolder = GameObject.Find("IceGageHolder");
    }
Example #11
0
        public virtual void testWasteAmount()
        {
            VJDFAttributeMap singleMap = new VJDFAttributeMap();

            singleMap.Add(xpMedia.getPartMapVector(false)[0]);

            MISCPGoldenTicket gt = new MISCPGoldenTicket(2, EnumVersion.Version_1_3, 2, 2, false, singleMap);

            gt.good  = 1000;
            gt.waste = 100;
            gt.assign(null);
            n = gt.getNode();
            JDFComponent    c       = (JDFComponent)n.getResource(ElementName.COMPONENT, null, 0);
            JDFMedia        m       = (JDFMedia)n.getResource(ElementName.MEDIA, null, 0);
            JDFResourceLink rl      = n.getLink(c, null);
            JDFResourceLink rlMedia = n.getLink(m, null);
            VElement        vRL     = new VElement();

            vRL.Add(rl);
            vRL.Add(rlMedia);
            sc = new StatusCounter(null, null, null);
            sc.setTrackWaste(rl.getrRef(), true);
            sc.setTrackWaste(rlMedia.getrRef(), true);
            sc.setActiveNode(n, c.getPartMapVector(false), vRL);
            Assert.AreEqual(100, sc.getPlannedWaste(rlMedia.getrRef()), 0);
            Assert.AreEqual(1000, sc.getPlannedAmount(rl.getrRef()), 0);
        }
Example #12
0
 // Start is called before the first frame update
 void Start()
 {
     player           = GameObject.Find("Pickles(Clone)");
     playerController = player.GetComponent <PlayerController>();
     iceGenerator     = GameObject.Find("IceGenerator");
     ice           = iceGenerator.GetComponent <ice>();
     statusCounter = GameObject.Find("Canvas").GetComponent <StatusCounter>();
 }
Example #13
0
 // Start is called before the first frame update
 void Start()
 {
     image         = GetComponent <Image>();
     image.enabled = true;
     image.color   = new Color(0, 0, 0, 1.0f);
     statusCounter = GameObject.Find("Canvas").GetComponent <StatusCounter>();
     isFadeIn      = true;
 }
Example #14
0
 // Start is called before the first frame update
 void Start()
 {
     player           = GameObject.Find("Pickles(Clone)");
     playerController = player.GetComponent <PlayerController>();
     statusCounter    = GameObject.Find("Canvas").GetComponent <StatusCounter>();
     audioSource      = GetComponent <AudioSource>();
     isIcePossession  = false;
 }
Example #15
0
 public void Reset()
 {
     _ticksTimestamp = Stopwatch.GetTimestamp();
     _initTicks      = _ticksTimestamp;
     _lastTapTicks   = _ticksTimestamp;
     _level          = LogLevel.Stats;
     _disposedValue  = false;
     _counter        = null;
 }
Example #16
0
 // Start is called before the first frame update
 void Start()
 {
     script        = GetComponent <camera>();
     statusCounter = GameObject.Find("Canvas").GetComponent <StatusCounter>();
     limitList     = new List <Vector4>()
     {
         stage0Limit, stage1Limit, stage2Limit, stage3Limit, stage4Limit, stage5Limit, stage6Limit, stage7Limit, stage8Limit
     };
 }
Example #17
0
 public LogStatItem(int id, LogLevel level, double globalTicks, double lastTapTicks, string message, string group, StatusCounter counter, int type)
 {
     Id           = id;
     Level        = level;
     GlobalTicks  = globalTicks;
     LastTapTicks = lastTapTicks;
     Message      = message;
     Counter      = counter;
     Type         = type;
     Group        = group;
 }
Example #18
0
    // Start is called before the first frame update
    void Start()
    {
        var canvas = GameObject.Find("Canvas");

        status      = canvas.GetComponent <StatusCounter>();
        respornList = new List <Vector3>()
        {
            respornPos0, respornPos1, respornPos2, respornPos3, respornPos4,
            respornPos5, respornPos6, respornPos7, respornPos8
        };
    }
Example #19
0
        public virtual void testStartNull()
        {
            hf = new HotFolder(theHF, null, new MyListener(false));
            FileInfo file = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f1.txt");

            SupportClass.FileSupport.CreateNewFile(file);
            file.Refresh();
            Assert.IsTrue(file.Exists);
            StatusCounter.sleep(3000);
            file.Refresh();
            Assert.IsTrue(file.Exists);
        }
Example #20
0
 // Start is called before the first frame update
 void Start()
 {
     rb2d          = GetComponent <Rigidbody2D>();
     anim          = GetComponent <Animator>();
     damaged       = knockBackAnim.GetComponent <Damaged>();
     canvas        = GameObject.Find("Canvas");
     statusCounter = canvas.GetComponent <StatusCounter>();
     audioSource   = GetComponent <AudioSource>();
     taglist       = new List <string>()
     {
         "Enemy", "EnemyBullet", "Boss"
     };
 }
Example #21
0
        public virtual void testMultiModule()
        {
            StatusCounter scRIP = new StatusCounter(n,null,null);

            scRIP.addModule("ID_RIP","RIP");
            StatusCounter scSetter = new StatusCounter(n,null,null);

            scSetter.addModule("ID_Setter","Platesetter");

            MultiModuleStatusCounter msc = new MultiModuleStatusCounter();

            msc.addModule(scRIP);
            msc.addModule(scSetter);

            JDFExposedMedia m = (JDFExposedMedia)n.getMatchingResource("ExposedMedia",null,null,0);

            resID = m.getID();
            scRIP.setFirstRefID(resID);
            scRIP.addPhase(resID,200,0,true);
            bool bChanged = scRIP.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");

            Assert.IsTrue(bChanged);
            JDFDoc        docJMF     = scRIP.getDocJMFPhaseTime();
            JDFResponse   sig        = (JDFResponse)docJMF.getJMFRoot().getMessageElement(EnumFamily.Response,EnumType.Status,0);
            JDFDeviceInfo deviceInfo = sig.getDeviceInfo(0);
            JDFJobPhase   jp         = deviceInfo.getJobPhase(0);

            Assert.AreEqual(200,jp.getAmount(),0);
            scRIP.addPhase(resID,0,100,true);
            scRIP.setTrackWaste(m.getID(),true);
            bChanged = scRIP.setPhase(EnumNodeStatus.InProgress,"i",EnumDeviceStatus.Running,"r");
            Assert.IsFalse(bChanged);
            JDFDoc dJMFAll = msc.getStatusResponse();

            Assert.AreEqual(dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count,1);
            scSetter.setPhase(EnumNodeStatus.InProgress,"seti",EnumDeviceStatus.Running,"run");
            scSetter.setFirstRefID(resID);
            scSetter.addPhase(resID,400,0,true);
            dJMFAll = msc.getStatusResponse();
            Assert.AreEqual(2,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count,"1 RIP, 1 setter");

            scRIP.setActiveNode(null,null,null);
            bChanged = scRIP.setPhase(null,null,EnumDeviceStatus.Idle,null);
            dJMFAll  = msc.getStatusResponse();
            Assert.AreEqual(1,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count);

            scSetter.setActiveNode(null,null,null);
            bChanged = scSetter.setPhase(null,null,EnumDeviceStatus.Idle,null);
            dJMFAll  = msc.getStatusResponse();
            Assert.AreEqual(0,dJMFAll.getRoot().getChildrenByTagName(ElementName.JOBPHASE,null,null,false,true,-1).Count);
        }
Example #22
0
        public override void setUp()
        {
            d       = creatXMDoc();
            n       = d.getJDFRoot();
            xpMedia = (JDFExposedMedia)n.getMatchingResource("ExposedMedia", null, null, 0);
            JDFResourceLink rlxp = n.getLink(xpMedia, null);

            rlxp.setAmount(100, null);
            sc       = new StatusCounter(n, null, null);
            deviceID = "Status-counter-TestDevice";
            sc.setDeviceID(deviceID);
            resID = xpMedia.getID();
            sc.setFirstRefID(resID);
            sc.addPhase(resID, 200, 0, true);
            employee = (JDFEmployee) new JDFDoc("Employee").getRoot();
            employee.setPersonalID("P1");
            base.setUp();
        }
Example #23
0
        void changeStatCounter(StatusCounter counters)
        {
            switch (srv.ItemStatus)
            {
            case ServerStatusEnum.Valid:
                counters.Valid++;
                break;

            case ServerStatusEnum.Pending:
                counters.Pending++;
                break;

            case ServerStatusEnum.Failed:
                counters.Failed++;
                break;
            }
            counters.Unknown--;
        }
Example #24
0
 // Update is called once per frame
 void Update()
 {
     timeCount += Time.deltaTime;
     if (timeCount > fadeOutTime)
     {
         var script = GameObject.Find("FadePanel").GetComponent <FadeOutCamera>();
         if (!script.isFadeOut)
         {
             script.isFadeOut    = true;
             script.fadeBack     = true;
             script.intervalTime = 0.25f;
         }
     }
     if (timeCount > animator.GetCurrentAnimatorStateInfo(0).length)
     {
         StatusCounter script = GameObject.Find("Canvas").GetComponent <StatusCounter>();
         script.stageNum = this.stageNum;
         GameObject obj = Instantiate(warpAfter, warpPos.transform.position, Quaternion.identity);
         Destroy(gameObject);
     }
 }
Example #25
0
        public virtual void testDir()
        {
            hf = new HotFolder(theHF, ".txt,.xml", new MyListener(true));
            FileInfo file  = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f1.txt");
            FileInfo file1 = new FileInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f2.xml"
                                          + Path.DirectorySeparatorChar.ToString() + "f1.xml");
            DirectoryInfo file2 = new DirectoryInfo(theHF + Path.DirectorySeparatorChar.ToString() + "f2.xml");

            SupportClass.FileSupport.CreateNewFile(file);
            file.Refresh();
            file2.Create();
            file2.Refresh();
            SupportClass.FileSupport.CreateNewFile(file1);
            file1.Refresh();
            Assert.IsTrue(file.Exists);
            StatusCounter.sleep(5000);
            file.Refresh();
            file1.Refresh();
            file2.Refresh();
            Assert.IsFalse(file.Exists);
            Assert.IsTrue(file1.Exists, "in subdir");
            Assert.IsTrue(file2.Exists);
        }
Example #26
0
 // Start is called before the first frame update
 void Start()
 {
     status      = GameObject.Find("Canvas").GetComponent <StatusCounter>();
     audioSource = GetComponent <AudioSource>();
 }
Example #27
0
 // Start is called before the first frame update
 void Start()
 {
     canvas        = GameObject.Find("Canvas");
     statusCounter = canvas.GetComponent <StatusCounter>();
 }
Example #28
0
        //
        //	 * (non-Javadoc)
        //	 *
        //	 * @see java.lang.Runnable#run()
        //
        public virtual void Run()
        {
            while (!interrupt)
            {
                dir.Refresh();
                DateTime lastMod = dir.LastWriteTime;
                if (lastMod > lastModified || lastFileTime.Count > 0) // has the
                // directory
                // been
                // touched?
                {
                    lastModified = lastMod;
                    FileInfo[] files          = FileUtil.listFilesWithExtension(dir, extension);
                    int        fileListLength = files != null ? files.Length : 0;

                    for (int i = lastFileTime.Count - 1; i >= 0; i--)
                    {
                        bool found = false;
                        for (int j = 0; j < fileListLength; j++)
                        // loop over all matching files in the directory
                        {
                            if (files != null)
                            {
                                FileTime lftAt = lastFileTime[i];
                                if (files[j] != null && files[j].FullName.Equals(lftAt.f.FullName))
                                {
                                    found = true;
                                    if (files[j].LastWriteTime == lftAt.modified)
                                    {
                                        if (files[j].Exists)
                                        {
                                            hfl.hotFile(files[j]); // exists and stabilized - call callback
                                        }
                                        else
                                        {
                                            found = false;
                                        }
                                    }
                                    else
                                    {
                                        lftAt.modified = files[j].LastWriteTime;
                                    }

                                    files[j] = null; // this file has been processed,
                                    // remove from list for performance
                                }
                            }
                        }

                        if (!found)
                        {
                            lastFileTime.Remove(lastFileTime[i]); // not there anymore
                        }
                    }

                    if (files != null)
                    {
                        for (int i = 0; i < fileListLength; i++) // the file is new -
                        // add to list for nextr check
                        {
                            if (files[i] != null)
                            {
                                lastFileTime.Add(new FileTime(files[i]));
                            }
                        }
                    }
                }

                StatusCounter.sleep(stabilizeTime);
            }

            Thread.CurrentThread.Interrupt();
        }