private void SaveLogMenuItem_Click(object sender, EventArgs e)
{
DialogResult rslt = MessageBox.Show(string.Format(Properties.Resources.SaveLogMenuItem_ClickText1, Environment.NewLine),
Properties.Resources.SaveLogMenuItem_ClickText2,
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (rslt == DialogResult.Cancel) return;
SaveFileDialog1.FileName = MyCommon.GetAssemblyName() + "Posts" + DateTime.Now.ToString("yyMMdd-HHmmss") + ".tsv";
SaveFileDialog1.InitialDirectory = Application.ExecutablePath;
SaveFileDialog1.Filter = Properties.Resources.SaveLogMenuItem_ClickText3;
SaveFileDialog1.FilterIndex = 0;
SaveFileDialog1.Title = Properties.Resources.SaveLogMenuItem_ClickText4;
SaveFileDialog1.RestoreDirectory = true;
if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
{
if (!SaveFileDialog1.ValidateNames) return;
using (StreamWriter sw = new StreamWriter(SaveFileDialog1.FileName, false, Encoding.UTF8))
{
if (rslt == DialogResult.Yes)
{
//All
for (int idx = 0; idx < _curList.VirtualListSize; idx++)
{
PostClass post = _statuses.Tabs[_curTab.Text][idx];
string protect = "";
if (post.IsProtect) protect = "Protect";
sw.WriteLine(post.Nickname + "\t" +
"\"" + post.TextFromApi.Replace("\n", "").Replace("\"", "\"\"") + "\"" + "\t" +
post.CreatedAt + "\t" +
post.ScreenName + "\t" +
post.StatusId + "\t" +
post.ImageUrl + "\t" +
"\"" + post.Text.Replace("\n", "").Replace("\"", "\"\"") + "\"" + "\t" +
protect);
}
}
else
{
foreach (int idx in _curList.SelectedIndices)
{
PostClass post = _statuses.Tabs[_curTab.Text][idx];
string protect = "";
if (post.IsProtect) protect = "Protect";
sw.WriteLine(post.Nickname + "\t" +
"\"" + post.TextFromApi.Replace("\n", "").Replace("\"", "\"\"") + "\"" + "\t" +
post.CreatedAt + "\t" +
post.ScreenName + "\t" +
post.StatusId + "\t" +
post.ImageUrl + "\t" +
"\"" + post.Text.Replace("\n", "").Replace("\"", "\"\"") + "\"" + "\t" +
protect);
}
}
}
}
this.TopMost = this._cfgCommon.AlwaysTop;
}