Exemplo n.º 1
0
        public void Save_Data(Key_Erea key_erea)
        {
            string         exePath        = Environment.GetCommandLineArgs()[0];
            string         exeFullPath    = System.IO.Path.GetFullPath(exePath);
            string         path           = System.IO.Path.GetDirectoryName(exeFullPath);
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            //saveFileDialog.InitialDirectory = path + "\\";
            saveFileDialog.FilterIndex = 1;
            saveFileDialog.FileName    = key_erea.name;
            saveFileDialog.Filter      = "Birth ファイル(.br)|*.br";
            //saveFileDialog.s
            //Console.WriteLine(saveFileDialog.InitialDirectory);

            bool?result = saveFileDialog.ShowDialog();

            if (result == true)
            {
                string    fname     = saveFileDialog.FileName;
                Keys_Save keys_save = new Keys_Save();
                keys_save.Save(key_erea, fname);
                keys_save.Free();
                key_erea.name = saveFileDialog.SafeFileName.TrimEnd('.', 'b', 'r');
                m.Title       = "Birth   - " + key_erea.name + " -";
            }
        }
Exemplo n.º 2
0
 public void  Make_Regex(Key_Erea key_erea)
 {
     foreach (var key_data in key_erea.key)
     {
         if (key_data.IsEnabled == true)
         {
             string regex_str = "^";
             foreach (var keyword_data in key_data.keyword)
             {
                 string text = keyword_data.kw_text.Text;
                 if ((text != "") && (!(new Regex("^\\s+$").IsMatch(text))))
                 {
                     if (keyword_data.IsReversal == true)
                     {
                         regex_str += "(?!.*" + text + ")";
                     }
                     else
                     {
                         regex_str += "(?=.*" + text + ")";
                     }
                 }
             }
             regex_str += ".*$";
             if (regex_str != "^.*$")
             {
                 regex.Add(new Regex(regex_str));
             }
         }
     }
     WithHeart = key_erea.WithHeart;
 }
Exemplo n.º 3
0
 public void New(Key_Erea key_erea)
 {
     Key_Erea_Clear(key_erea);
     key_erea.First_Keyword_Add();
     key_erea.heart.Source = new BitmapImage(new Uri("img/heart_off.png", UriKind.Relative));
     key_erea.Change_Size();
 }
Exemplo n.º 4
0
 public void Key_Erea_Clear(Key_Erea key_erea)
 {
     /*
      * foreach (var key_data in key_erea.key)
      * {
      *  foreach (var keyword_data in key_data.keyword)
      *  {
      *      keyword_data.kw_text = null;
      *      keyword_data.reverse = null;
      *      keyword_data.and = null;
      *      keyword_data.close = null;
      *      Console.WriteLine("keyword");
      *  }
      *  key_data.keyword.Clear();
      *  //key_data.use.Dispose;
      *  key_data.use.Visibility = System.Windows.Visibility.Collapsed;
      *  key_data.use = null;
      *  key_data.key_c.Visibility=System.Windows.Visibility.Collapsed;
      *  Console.WriteLine("key");
      * }
      * key_erea.key.Clear();
      */
     foreach (var key_data in key_erea.key)
     {
         key_data.Delete();
     }
     key_erea.key.Clear();
     key_erea.WithHeart = false;
 }
Exemplo n.º 5
0
        public void Save(Key_Erea key_erea, String fname)
        {
            WithHeart = key_erea.WithHeart;
            //interval = key_erea.interval;
            name = key_erea.name;
            foreach (var key_data in key_erea.key)
            {
                Key_Save tmp_key = new Key_Save();
                tmp_key.IsEnabled = key_data.IsEnabled;
                foreach (var keyword_data in key_data.keyword)
                {
                    KeyWord_Save tmp_keyword = new KeyWord_Save();
                    tmp_keyword.IsReversal = keyword_data.IsReversal;
                    tmp_keyword.text       = keyword_data.kw_text.Text;
                    tmp_key.keyword.Add(tmp_keyword);
                }
                this.key.Add(tmp_key);
            }

            DataContractSerializer serializer = new DataContractSerializer(typeof(Keys_Save));
            XmlWriterSettings      settings   = new XmlWriterSettings();

            settings.Encoding = new System.Text.UTF8Encoding(false);
            XmlWriter xw = XmlWriter.Create(fname, settings);

            serializer.WriteObject(xw, this);
            xw.Close();
        }
Exemplo n.º 6
0
 public void SetData(List <Tokens> fromtokens, Account fromaccount, Key_Erea fromkeyerea, Menu frommenu, Setting fromsetting)
 {
     tokens   = fromtokens;
     account  = fromaccount;
     key_erea = fromkeyerea;
     menu     = frommenu;
     setting  = fromsetting;
 }
Exemplo n.º 7
0
        public void Load(Key_Erea key_erea, String fname, Color_List color_list)
        {
            Key_Erea_Clear(key_erea);
            Pass pass = new Pass();

            DataContractSerializer serializer = new DataContractSerializer(typeof(Keys_Save));
            XmlReader xr  = XmlReader.Create(fname);
            Keys_Save tmp = (Keys_Save)serializer.ReadObject(xr);

            xr.Close();

            key_erea.WithHeart = tmp.WithHeart;
            key_erea.name      = tmp.name;

            if (key_erea.WithHeart)
            {
                key_erea.heart.Source = new BitmapImage(new Uri("img/heart_on.png", UriKind.Relative));
            }
            else
            {
                key_erea.heart.Source = new BitmapImage(new Uri("img/heart_off.png", UriKind.Relative));
            }

            key_erea.interval = tmp.interval;
            foreach (var skey_data in tmp.key.Select((v, i) => new { v, i }))
            {
                if (skey_data.i == 0)
                {
                    key_erea.First_Keyword_Add();
                }
                else
                {
                    key_erea.Add_Key();
                }
                key_erea.key[skey_data.i].IsEnabled = skey_data.v.IsEnabled;
                if (key_erea.key[skey_data.i].IsEnabled == false)
                {
                    key_erea.key[skey_data.i].use.Source = new BitmapImage(new Uri(Pass.img_key + "/" + Pass.colors[color_list.num] + "/use_off.png", UriKind.Relative));
                }
                foreach (var skeyword_data in skey_data.v.keyword.Select((v, i) => new { v, i }))
                {
                    if (skeyword_data.i != 0)
                    {
                        key_erea.key[skey_data.i].keyword[skeyword_data.i - 1].and.MouseLeftButtonDown -= key_erea.key[skey_data.i].And_Click;
                        key_erea.key[skey_data.i].keyword[skeyword_data.i - 1].Change_And();
                        key_erea.key[skey_data.i].Add_Key();
                    }
                    key_erea.key[skey_data.i].keyword[skeyword_data.i].IsReversal   = skeyword_data.v.IsReversal;
                    key_erea.key[skey_data.i].keyword[skeyword_data.i].kw_text.Text = skeyword_data.v.text;
                }
            }
        }
Exemplo n.º 8
0
        public void New_Data(Key_Erea key_erea, MainWindow main)
        {
            /*
             * var dlg = new emanual.Wpf.Utility.MessageBoxEx();
             * // 単なるテキストを設定する場合は Message プロパティを設定する
             * dlg.Message = "Brith";
             * dlg.Width = 350;
             * dlg.Height = 165;
             * dlg.TextBlock.Height = 65;
             * // Inlines プロパティを設定する場合
             * dlg.TextBlock.Inlines.Add(new System.Windows.Documents.Bold(new System.Windows.Documents.Run("新しいファイルを作ります。\n\n")));
             * dlg.TextBlock.Inlines.Add(new System.Windows.Documents.Run("保存していないデータは失われますがよろしいですか?\n"));
             *
             * dlg.Owner = main;
             * dlg.Left = main.Left + 50;
             * dlg.Top = main.Top + 50;
             *
             * // デフォルトでは薄い水色のグラデーションですが、好みの色に指定可能
             * //dlg.Background = Brushes.Wheat;
             * dlg.Button = MessageBoxButton.YesNo;
             * dlg.Image = MessageBoxImage.Warning;
             *
             * // ダイアログを開いたときにフォーカスをあてるボタン
             * dlg.Result = MessageBoxResult.No;
             * dlg.ShowDialog();
             *
             * MessageBoxResult result = dlg.Result;
             * if (result == MessageBoxResult.No)
             * {
             *  return;
             * }
             *
             * key_erea.name = "New File";
             * Keys_Save keys_save = new Keys_Save();
             * keys_save.New(key_erea);
             * m.Title = "Birth   -" + key_erea.name + "-";
             *
             */
            Keys_Save keys_save = new Keys_Save();

            keys_save.Save(key_erea, Pass.tmpkey);
            keys_save.Free();

            key_erea.name = "New File";
            keys_save     = new Keys_Save();
            keys_save.New(key_erea);
            m.Title = "Birth   - " + key_erea.name + " -";
        }
Exemplo n.º 9
0
        public Key_Data(Key_Erea c_in, Color_List fromcolor, Title fromtitle)
        {
            c          = c_in;
            color_list = fromcolor;
            title      = fromtitle;
            c.Children.Add(this);
            this.Children.Add(key_c);
            key_c.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            key_c.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
            this.Height = 60;
            Canvas.SetTop(key_c, 0);
            Canvas.SetLeft(key_c, 55);
            use.Source = new BitmapImage(new Uri(Pass.img_key + "/" + Pass.colors[color_list.num] + "/use_on.png", UriKind.Relative));
            use.Width  = 30;

            Canvas.SetTop(use, 20);
            Canvas.SetLeft(use, 10);
            this.Children.Add(use);
            use.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(Use_On_Clicked);


            Add_Key();
        }
Exemplo n.º 10
0
        public void Load_Data(Key_Erea key_erea, Canvas c)
        {
            string         exePath        = Environment.GetCommandLineArgs()[0];
            string         exeFullPath    = System.IO.Path.GetFullPath(exePath);
            string         path           = System.IO.Path.GetDirectoryName(exeFullPath);
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.FilterIndex = 1;
            openFileDialog.Filter      = "Birth File(.br)|*.br";
            bool?result = openFileDialog.ShowDialog();

            if (result == true)
            {
                string    fname     = openFileDialog.FileName;
                Keys_Save keys_save = new Keys_Save();
                keys_save.Load(key_erea, fname, color_list);
                keys_save.Free();
                key_erea.name = openFileDialog.SafeFileName.TrimEnd('.', 'b', 'r');
                //key_erea.name = openFileDialog.SafeFileName;
                m.Title = "Birth   - " + key_erea.name + " -";
            }
            //openFileDialog = null;
        }
Exemplo n.º 11
0
 public void GetKeyAndTitleAndColor(Key_Erea fromkeyerea, Title fromtitle, Color_List fromcolor)
 {
     key_erea   = fromkeyerea;
     title      = fromtitle;
     color_list = fromcolor;
 }
Exemplo n.º 12
0
        public MainWindow()
        {
            bool IsInScreen = false;


            InitializeComponent();

            this.Visibility = Visibility.Hidden;

            Load_Setting();
            Load_NGdata();

            if (!mutex.WaitOne(0, false))
            {
                MessageBox.Show(Properties.Resources.multiple_startup_1, Properties.Resources.multiple_startup_title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                second_run = true;
                this.Close();
                return;
            }

            if (!(Network.Network_Connected()))
            {
                var dlg = new emanual.Wpf.Utility.MessageBoxEx();
                dlg.Message          = "Brith";
                dlg.Width            = 350;
                dlg.Height           = 165;
                dlg.TextBlock.Height = 65;
                dlg.TextBlock.Inlines.Add(new System.Windows.Documents.Bold(new System.Windows.Documents.Run(Properties.Resources.network_error_1)));
                dlg.TextBlock.Inlines.Add(Properties.Resources.network_error_2);

                //dlg.Owner = this;
                dlg.Left = this.Left + 50;
                dlg.Top  = this.Top + 50;

                //dlg.Background = Brushes.Wheat;
                dlg.Button = MessageBoxButton.OK;
                dlg.Image  = MessageBoxImage.Warning;

                dlg.Result = MessageBoxResult.OK;
                dlg.ShowDialog();

                this.Close();
                return;
            }



            window.SizeChanged += OnSizeChanged;

            window.BorderThickness = new Thickness(0);
            info = new InfoBox(this, Base_Grid);
            //window.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 255, 10, 10));



            Change_Lang();


            if (!(Directory.Exists(Pass.tmp)))
            {
                Directory.CreateDirectory(Pass.tmp);
            }
            if (!(Directory.Exists(Pass.data)))
            {
                Directory.CreateDirectory(Pass.data);
            }


            if (!(Directory.Exists(Pass.pindir)))
            {
                var Pincode = new PIN_Code();
                Pincode.Topmost = true;
                Pincode.Closed += this.PIN_Code_Closed;
                Pincode.Show();
                this.Hide();
                this.IsEnabled = false;
            }
            else
            {
                this.Load_Token();
            }



            IsStarted = true;


            color_list.SetWindow(window);
            color_list.SetNum(setdata.d.colors);

            title = new Title(window, Title_Grid);

            account = new Account(Accont_Erea, tokens, color_list);
            account.add.MouseLeftButtonDown += Add_Account;


            key_erea   = new Key_Erea(Canvas_Erea, color_list, title);
            this.Title = "Birth   - " + key_erea.name + " -";

            menu = new Menu(this, Menu_Canvas, 0, color_list);
            menu.new_data.MouseLeftButtonDown  += On_New;
            menu.load_data.MouseLeftButtonDown += On_Load;
            menu.load_data.TouchDown           += On_Load;
            menu.save_data.MouseLeftButtonDown += On_Save;
            menu.save_data.TouchDown           += On_Save;
            menu.rt_data.MouseLeftButtonDown   += On_Run;
            menu.setting.MouseLeftButtonDown   += On_Setting;

            NewSetting();


            Base_Grid.Children.Add(Cover);
            Cover.Margin = new Thickness(0, Title_Grid.Height, 0, 0);

            color_list.Main_Back_Panel = Canvas_Erea;
            Color_Set();

            window.KeyDown += Window_KeyDown;
            title.Title_Change();



            Title_Grid.MouseLeftButtonDown        += (sender, e) => { this.DragMove(); };
            title.WindowTitle.MouseLeftButtonDown += Title_Clicking;
            title.WindowTitle.MouseLeftButtonUp   += Title_Clicked;

            foreach (System.Windows.Forms.Screen s in System.Windows.Forms.Screen.AllScreens)
            {
                monitor_point.Add(new Point(s.Bounds.X, s.Bounds.Y));
                monitor_size.Add(new Point(s.Bounds.Width, s.Bounds.Height));
                if ((s.Bounds.Top < setdata.d.window_pos.Y) && (s.Bounds.Bottom > setdata.d.window_pos.Y) && (s.Bounds.Left < setdata.d.window_pos.X) && (s.Bounds.Right > setdata.d.window_pos.X))
                {
                    IsInScreen = true;
                }
            }
            if (IsInScreen)
            {
                window.Top        = setdata.d.window_pos.Y;
                window.Left       = setdata.d.window_pos.X;
                window.Height     = setdata.d.window_size.Height;
                window.Width      = setdata.d.window_size.Width;
                window.Activated += Window_Activated;
            }
            //Title_Grid.Visibility = Visibility.Hidden;

            /*
             * Border winborder = new Border();
             * winborder.BorderThickness = new Thickness(7);
             * winborder.Child = Base_Grid;
             */
            /*neosize.Stroke = new SolidColorBrush(Color.FromArgb(255, 10, 10, 10));
             * neosize.StrokeThickness = 3;
             * neosize.Width = 100;
             * neosize.Height = 100;
             * neosize.Visibility = Visibility.Collapsed;
             * Base_Grid.Children.Add(neosize);
             */
            //info.Refresh();

            info.GetKeyAndTitleAndColor(key_erea, title, color_list);

            this.Visibility = Visibility.Visible;
        }