Example #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            RepliedPokerToolStripMenuItem.Checked = Properties.Settings.Default.IsRepliedPokerChecked;
            string folder = AppDomain.CurrentDomain.BaseDirectory + "Setting";

            Directory.CreateDirectory(folder);
            string fileName = $@"{folder}\Account.cfg";

            fileName = Path.GetFullPath(fileName);

            if (File.Exists(fileName))
            {
                using (StreamReader sr = new StreamReader(fileName))
                {
                    while (sr.Peek() >= 1)
                    {
                        var readLine = sr.ReadLine();
                        if (readLine != null)
                        {
                            string[] token = readLine.Split('|');
                            AccountComboBox.Items.Add($"{token[0]}({token[1]})");
                        }
                    }
                }
            }
            else
            {
                AccountComboBox.Items.Add("あかうんとせんたく");
            }
            AccountComboBox.SelectedIndex = 0;

            fileName = $@"{folder}\ScheduledTweets.json";
            if (File.Exists(fileName))
            {
                using (StreamReader sr = new StreamReader(fileName, Encoding.UTF8))
                {
                    string text = sr.ReadToEnd();
                    ScheduledTweetList = JsonConvert.DeserializeObject <List <ScheduledTweetClass> >(text);
                }
                using (StreamWriter sw = new StreamWriter(fileName, false, Encoding.UTF8))
                {
                    sw.Write("");
                }
            }

            if (ScheduledTweetList == null)
            {
                ScheduledTweetList = new List <ScheduledTweetClass>();
            }

            fileName = $@"{folder}\Settings.json";
            if (File.Exists(fileName))
            {
                using (StreamReader sr = new StreamReader(fileName, Encoding.UTF8))
                {
                    string text = sr.ReadToEnd();
                    _kibotterSetting = JsonConvert.DeserializeObject <KIBOTTERSettingClass>(text);
                }
                Properties.Settings.Default.IsBlackTheme = _kibotterSetting.IsBlackTheme;
                if (_kibotterSetting.IsBlackTheme)
                {
                    ChangeThemeToBlack();
                }
            }

            if (_kibotterSetting == null)
            {
                _kibotterSetting = new KIBOTTERSettingClass();
                _kibotterSetting.ExperiencePoint = 0;
            }

            int left = Screen.PrimaryScreen.WorkingArea.Width - Width;
            int top  = Screen.PrimaryScreen.WorkingArea.Height - Height;

            DesktopBounds   = new Rectangle(left, top, Width, Height);
            FormBorderStyle = FormBorderStyle.FixedSingle;
            MaximumSize     = Size;

            TweetTextBox.AllowDrop = true;

            LiveTag = string.Empty;

            NewTimer();
            StartTimer();

            TweetTextBox.Focus();
        }
Example #2
0
 public MainForm()
 {
     _kibotterSetting = null;
     InitializeComponent();
 }