Exemplo n.º 1
0
        public static int timeInSeconds(string time)
        {
            int hour = Convert.ToInt32(LeftRightMid.Left(time, 2));
            int mins = Convert.ToInt32(LeftRightMid.Right(time, 2));
            int secs = (hour * secsInHour) + (mins * secsInMinute);

            return(secs);
        }
Exemplo n.º 2
0
        private void schedule_Load(object sender, EventArgs e)
        {
            lblTitle.Text        = fromString + " Schedule";
            numericUpDown6.Value = Convert.ToDecimal(LeftRightMid.Left(p_start, 2));
            numericUpDown5.Value = Convert.ToDecimal(LeftRightMid.Right(p_start, 2));
            numericUpDown8.Value = Convert.ToDecimal(LeftRightMid.Left(p_stop, 2));
            numericUpDown7.Value = Convert.ToDecimal(LeftRightMid.Right(p_stop, 2));

            toolTip1.Active = toolTip;
        }
Exemplo n.º 3
0
        public static int secondsSinceMidnight(DateTime dt)
        {
            string tmpStr            = dt.ToString("HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
            int    hour              = Convert.ToInt32(LeftRightMid.Left(tmpStr, 2));
            int    mins              = Convert.ToInt32(LeftRightMid.Mid(tmpStr, 3, 2));
            int    secs              = Convert.ToInt32(LeftRightMid.Right(tmpStr, 2));
            int    secsSinceMidnight = (hour * secsInHour) + (mins * secsInMinute) + secs;

            return(secsSinceMidnight);
        }
Exemplo n.º 4
0
        public static int millisecondsSinceMidnight()
        {
            string tmpStr    = DateTime.Now.ToString("HH:mm:ss:fff", System.Globalization.CultureInfo.InvariantCulture);
            int    hour      = Convert.ToInt32(LeftRightMid.Left(tmpStr, 2));
            int    mins      = Convert.ToInt32(LeftRightMid.Mid(tmpStr, 3, 2));
            int    secs      = Convert.ToInt32(LeftRightMid.Mid(tmpStr, 6, 2));
            int    millisecs = Convert.ToInt32(LeftRightMid.Right(tmpStr, 3));
            int    millisecsSinceMidnight = (hour * millisecsInHour) + (mins * millisecsInMinute) + (secs * millisecsInSecond) + millisecs;

            return(millisecsSinceMidnight);
        }
Exemplo n.º 5
0
        private static void clearFtpWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                bubble.logAddLine("Getting list of web files.");
                ArrayList ftpFiles = ftp.GetFileList();

                bubble.logAddLine("Starting delete of web files via ftp.");
                int tmpInt = 0;
                foreach (string img in ftpFiles)
                {
                    if (img.Length > config.getProfile(bubble.profileInUse).filenamePrefix.Length + bubble.ImgSuffix.Length)
                    {
                        if (LeftRightMid.Left(img, config.getProfile(bubble.profileInUse).filenamePrefix.Length) == config.getProfile(bubble.profileInUse).filenamePrefix&& LeftRightMid.Right(img, bubble.ImgSuffix.Length) == bubble.ImgSuffix)
                        {
                            tmpInt++;
                        }
                    }
                }
                bubble.logAddLine(tmpInt.ToString() + " web files to delete via ftp.");


                //List of all files on ftp site
                foreach (string img in ftpFiles)
                {
                    //if the prefix and suffix correspond to TeboCam image files then delete this file
                    if (img.Length > config.getProfile(bubble.profileInUse).filenamePrefix.Length + bubble.ImgSuffix.Length)
                    {
                        if (LeftRightMid.Left(img, config.getProfile(bubble.profileInUse).filenamePrefix.Length) == config.getProfile(bubble.profileInUse).filenamePrefix&& LeftRightMid.Right(img, bubble.ImgSuffix.Length) == bubble.ImgSuffix)
                        {
                            ftp.DeleteFTP(img, config.getProfile(bubble.profileInUse).ftpRoot, config.getProfile(bubble.profileInUse).ftpUser, config.getProfile(bubble.profileInUse).ftpPass, false);
                            tmpInt--;
                            bubble.logAddLine(tmpInt.ToString() + " web files left to delete via ftp.");
                        }
                    }
                }
                bubble.logAddLine("Deletion of web files via ftp completed.");
            }
            catch
            {
                bubble.logAddLine("Error in deleting web files.");
            }
        }
Exemplo n.º 6
0
 private static string decrypt(Interfaces.IEncryption crypt, string inStr)
 {
     if (inStr.Length < 2)
     {
         return("");
     }
     try
     {
         if (LeftRightMid.Left(inStr, 1) == "a")
         {
             inStr = inStr.Remove(0, 1);
             //return inStr;
             return(crypt.DecryptString(inStr));
         }
         else
         {
             //return inStr;
             return(ConvertFromAscii(inStr));
         }
     }
     catch { return(""); }
 }
Exemplo n.º 7
0
        private void camControl(int cam)
        {
            List <Control> availControls = controls(this);

            for (int i = 0; i < availControls.Count; i++)
            {
                if (availControls[i] is Button)
                {
                }
                else
                {
                    availControls.RemoveAt(i);
                }
            }

            foreach (Control ctrl in availControls)
            {
                if (ctrl.Name.ToString().Length > 7 && ctrl.Name.ToString().Length < 11 && LeftRightMid.Left(ctrl.Name.ToString(), 7) == "bttncam")
                {
                    if (ctrl.Text == Convert.ToString(cam + 1))
                    {
                        ctrl.BackColor = Color.LawnGreen;
                    }
                    else
                    {
                        if (Convert.ToInt32(ctrl.Text) <= CameraRig.cameraCount())
                        {
                            ctrl.BackColor = Color.SkyBlue;
                        }
                    }
                }
            }

            availControls.Clear();
        }
Exemplo n.º 8
0
        private void camButtonSetColours()
        {
            List <Control> availControls = controls(this);

            for (int i = 0; i < availControls.Count; i++)
            {
                if (availControls[i] is Button)
                {
                }
                else
                {
                    availControls.RemoveAt(i);
                }
            }

            foreach (Control ctrl in availControls)
            {
                if (ctrl.Name.ToString().Length > 7 && ctrl.Name.ToString().Length < 11 && LeftRightMid.Left(ctrl.Name.ToString(), 7) == "bttncam")
                {
                    if (camButtons.buttonState(Convert.ToInt32(ctrl.Text)) == 0)
                    {
                        ctrl.BackColor = Color.Silver;
                    }
                    if (camButtons.buttonState(Convert.ToInt32(ctrl.Text)) == 1)
                    {
                        ctrl.BackColor = Color.LawnGreen;
                    }
                    if (camButtons.buttonState(Convert.ToInt32(ctrl.Text)) == 2)
                    {
                        ctrl.BackColor = Color.SkyBlue;
                    }
                }
            }

            availControls.Clear();
        }