Ejemplo n.º 1
0
        private void LoadOption()
        {
            string configFile = SetunaOption.ConfigFile;

            try
            {
                if (!File.Exists(configFile))
                {
                    this.optSetuna = SetunaOption.GetDefaultOption();
                }
                else
                {
                    System.Type[] allType    = SetunaOption.GetAllType();
                    XmlSerializer serializer = new XmlSerializer(typeof(SetunaOption), allType);
                    FileStream    stream     = new FileStream(configFile, FileMode.Open);
                    this.optSetuna = (SetunaOption)serializer.Deserialize(stream);
                    stream.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                this.optSetuna = SetunaOption.GetDefaultOption();
                MessageBox.Show("无法读取配置文件。\n使用默认设置。", "SETUNA2", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            finally
            {
                this.OptionApply();
            }
        }
Ejemplo n.º 2
0
        private void button6_Click(object sender, EventArgs e)
        {
            this.optSetuna = SetunaOption.GetDefaultOption();
            int num = 0;

            num++;
        }
Ejemplo n.º 3
0
 public void Option()
 {
     if (!this.IsCapture)
     {
         this.IsOption = true;
         SetunaOption     opt  = (SetunaOption)this.optSetuna.Clone();
         List <ScrapBase> list = new List <ScrapBase>();
         try
         {
             foreach (ScrapBase base2 in this.scrapBook)
             {
                 if (base2.Visible && base2.TopMost)
                 {
                     list.Add(base2);
                 }
             }
             foreach (ScrapBase base3 in list)
             {
                 base3.TopMost = false;
             }
             base.TopMost = false;
             this.optSetuna.UnregistHotKey();
             if (this.frmClickCapture != null)
             {
                 this.frmClickCapture.Stop();
             }
             OptionForm form = new OptionForm(opt)
             {
                 StartPosition = FormStartPosition.CenterScreen
             };
             form.ShowDialog();
             if (form.DialogResult == DialogResult.OK)
             {
                 this.optSetuna = form.Option;
                 this.OptionApply();
             }
             if (!this.optSetuna.RegistHotKey(base.Handle))
             {
                 this.optSetuna.ScrapHotKeyEnable = false;
                 new HotkeyMsg {
                     HotKey = (Keys)this.optSetuna.ScrapHotKey
                 }.ShowDialog();
             }
             if (form.DialogResult == DialogResult.OK)
             {
                 this.SaveOption();
             }
         }
         finally
         {
             base.TopMost = true;
             foreach (ScrapBase base4 in list)
             {
                 base4.TopMost = true;
             }
             this.IsOption = false;
         }
     }
 }
Ejemplo n.º 4
0
 public Mainform()
 {
     this.InitializeComponent();
     this.scrapBook = new ScrapBook(this);
     this.scrapBook.addKeyPressListener(this);
     this.scrapBook.addScrapAddedListener(this);
     this.scrapBook.addScrapRemovedListener(this);
     this.optSetuna                 = new SetunaOption();
     this.dustbox                   = new Queue <ScrapBase>();
     this.scrapBook.DustBox         = this.dustbox;
     this.scrapBook.DustBoxCapacity = 5;
     this.keyBook                   = this.optSetuna.GetKeyItemBook();
     this._imgpool                  = new Queue <ScrapSource>();
     this.SetSubMenu();
 }
Ejemplo n.º 5
0
        public void Option()
        {
            if (!this.IsCapture)
            {
                if (this.optionForm)
                {
                    this.optionForm.Activate();
                    return;
                }

                SetunaOption     opt  = (SetunaOption)this.optSetuna.Clone();
                List <ScrapBase> list = new List <ScrapBase>();
                try
                {
                    this.optSetuna.UnregistHotKey();
                    if (this.frmClickCapture != null)
                    {
                        this.frmClickCapture.Stop();
                    }
                    this.optionForm = new OptionForm(opt)
                    {
                        StartPosition = FormStartPosition.CenterScreen,
                    };
                    this.optionForm.ShowDialog();
                    if (this.optionForm.DialogResult == DialogResult.OK)
                    {
                        this.optSetuna = this.optionForm.Option;
                        this.OptionApply();
                    }
                    if (!this.optSetuna.RegistHotKey(base.Handle))
                    {
                        this.optSetuna.ScrapHotKeyEnable = false;
                        new HotkeyMsg {
                            HotKey = (Keys)this.optSetuna.ScrapHotKey
                        }.ShowDialog();
                    }
                    if (this.optionForm.DialogResult == DialogResult.OK)
                    {
                        this.SaveOption();
                    }
                }
                finally
                {
                    this.optionForm = null;
                }
            }
        }
Ejemplo n.º 6
0
        private void SaveOption()
        {
            string configFile = SetunaOption.ConfigFile;

            System.Type[] allType = SetunaOption.GetAllType();
            try
            {
                XmlSerializer serializer = new XmlSerializer(this.optSetuna.GetType(), allType);
                FileStream    stream     = new FileStream(configFile, FileMode.Create);
                serializer.Serialize((Stream)stream, this.optSetuna);
                stream.Close();
            }
            catch
            {
                MessageBox.Show("无法保存配置文件。", "SETUNA2", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
Ejemplo n.º 7
0
        // Token: 0x060001EE RID: 494 RVA: 0x0000A4C4 File Offset: 0x000086C4
        public Mainform()
        {
            Instance = this;

            _isstart   = false;
            _iscapture = false;
            _isoption  = false;
            InitializeComponent();
            scrapBook = new ScrapBook(this);
            scrapBook.addKeyPressListener(this);
            scrapBook.addScrapAddedListener(this);
            scrapBook.addScrapRemovedListener(this);
            optSetuna                 = new SetunaOption();
            dustbox                   = new Queue <ScrapBase>();
            scrapBook.DustBox         = dustbox;
            scrapBook.DustBoxCapacity = 5;
            keyBook                   = optSetuna.GetKeyItemBook();
            _imgpool                  = new List <ScrapSource>();
            SetSubMenu();

            Text = $"SETUNA {Application.ProductVersion}";

            NetUtils.Init();
        }