コード例 #1
0
 private void Label_MouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (Clipboard.ContainsText() == false)
         {
             return;
         }
         Clipboard.SetText(TextBoxPass.Text);
     }
     catch (Exception)
     {
         ControlsLib.ERROR("Clipboard ERROR!");
     }
 }
コード例 #2
0
 public void Serialize(object o)
 {
     try
     {
         BinaryFormatter formatter = new BinaryFormatter();
         using (FileStream fs = new FileStream(Name, FileMode.OpenOrCreate))
         {
             formatter.Serialize(fs, o);
         }
     }
     catch (Exception)
     {
         ControlsLib.ERROR("Serialize ERROR!");
     }
 }
コード例 #3
0
        private void Border_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (data == null)
            {
                ControlsLib.ERROR("Data NULL!");
                return;
            }
            data.URL      = BoxURL.Text;
            data.PASSWORD = BoxPassw.Text;

            if (data.PASSWORD_save.Trim().Length < 1)
            {
                return;
            }
            formatterLib.Name = $"{str.Replace(data.URL, new string[] { "\\" , "/" , ":" , ";" } , " _ ")}.dat";
            formatterLib.Serialize(data);
        }
コード例 #4
0
        public Data Deserialize(string name)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            Data            o         = new Data();

            try
            {
                using (FileStream fs = new FileStream(name, FileMode.OpenOrCreate))
                {
                    o = (Data)formatter.Deserialize(fs);
                }
            }
            catch (Exception)
            {
                ControlsLib.ERROR("Deserialize ERROR!");
            }

            return(o);
        }
コード例 #5
0
        private void UserControl_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop))
            {
                string[] files = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop);
                if (!File.Exists(files[0]))
                {
                    return;
                }
                Data data = (Data)formatterLib.Deserialize(files[0]);

                if (data == null)
                {
                    ControlsLib.ERROR("Data NULL!");
                    return;
                }



                BoxURL.Text      = data.URL;
                BoxPassw.Text    = data.PASSWORD;
                TextBoxPass.Text = data.PASSWORD_save;
            }
        }