Exemplo n.º 1
0
        private void butFromUnixDate_Click(object sender, EventArgs e)
        {
            try
            {
                // Unix timestamp is seconds past epoch
                var dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                var date       = dtDateTime.AddSeconds(Convert.ToDouble(textRaw.Text)).ToLocalTime();

                var dlg = new ResultForm {
                    StringResult = date.ToString()
                };
                dlg.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
 private void butDecodeHex_Click(object sender, EventArgs e)
 {
     try
     {
         var dlg = new ResultForm();
         if (_useBytes)
         {
             dlg.Bytes = Encoder.BytesFromHex(Encoding.UTF8.GetString(_bytes));
         }
         else
         {
             dlg.Bytes = Encoder.BytesFromHex(textRaw.Text);
         }
         dlg.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 3
0
 private void butEncode64_Click(object sender, EventArgs e)
 {
     try
     {
         var dlg = new ResultForm();
         if (_useBytes)
         {
             dlg.Bytes = Encoding.UTF8.GetBytes(Encoder.ToBase64(_bytes));
         }
         else
         {
             dlg.Bytes = Encoding.UTF8.GetBytes(Encoder.ToBase64(textRaw.Text));
         }
         dlg.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }