public void AutoLinkHtml_EntityNullTest2()
{
var text = "てすとてすとー";
- TwitterEntities entities = new TwitterEntities
+ var entities = new TwitterEntities
{
Urls = null,
Hashtags = null,
[Fact]
public void ParseSource_UnescapeTest()
{
- string sourceHtml = "<a href=\"http://example.com/?aaa=123&bbb=456\" rel=\"nofollow\"><<hogehoge>></a>";
+ var sourceHtml = "<a href=\"http://example.com/?aaa=123&bbb=456\" rel=\"nofollow\"><<hogehoge>></a>";
var expected = ("<<hogehoge>>", new Uri("http://example.com/?aaa=123&bbb=456"));
Assert.Equal(expected, Twitter.ParseSource(sourceHtml));
[Fact]
public void ParseSource_UnescapeNoUriTest()
{
- string sourceHtml = "<<hogehoge>>";
+ var sourceHtml = "<<hogehoge>>";
var expected = ("<<hogehoge>>", (Uri)null);
Assert.Equal(expected, Twitter.ParseSource(sourceHtml));
private void OpenUrl(string url)
{
- string myPath = url;
- string path = this.ActionPanel.BrowserPathText.Text;
+ var myPath = url;
+ var path = this.ActionPanel.BrowserPathText.Text;
try
{
if (!string.IsNullOrEmpty(path))
{
if (path.StartsWith("\"", StringComparison.Ordinal) && path.Length > 2 && path.IndexOf("\"", 2, StringComparison.Ordinal) > -1)
{
- int sep = path.IndexOf("\"", 2, StringComparison.Ordinal);
- string browserPath = path.Substring(1, sep - 1);
- string arg = "";
+ var sep = path.IndexOf("\"", 2, StringComparison.Ordinal);
+ var browserPath = path.Substring(1, sep - 1);
+ var arg = "";
if (sep < path.Length - 1)
{
arg = path.Substring(sep + 1);
InitCulture();
// 同じ設定ファイルを使用する OpenTween プロセスの二重起動を防止する
- string pt = MyCommon.settingPath.Replace("\\", "/") + "/" + ApplicationSettings.AssemblyName;
- using (Mutex mt = new Mutex(false, pt))
+ var pt = MyCommon.settingPath.Replace("\\", "/") + "/" + ApplicationSettings.AssemblyName;
+ using (var mt = new Mutex(false, pt))
{
if (!mt.WaitOne(0, false))
{
return;
}
- IntPtr windowHandle = NativeMethods.GetWindowHandle((uint)prevProcess.Id, ApplicationSettings.ApplicationName);
+ var windowHandle = NativeMethods.GetWindowHandle((uint)prevProcess.Id, ApplicationSettings.ApplicationName);
if (windowHandle != IntPtr.Zero)
{
NativeMethods.SetActiveWindow(windowHandle);
public List<string> GetItemList()
{
var ids = new List<string>();
- for (int i = 0; i < this.TextId.AutoCompleteCustomSource.Count; ++i)
+ for (var i = 0; i < this.TextId.AutoCompleteCustomSource.Count; ++i)
{
ids.Add(this.TextId.AutoCompleteCustomSource[i]);
}
{
InitializeComponent();
- for (int i = 0; i < ItemList.Count; ++i)
+ for (var i = 0; i < ItemList.Count; ++i)
{
this.TextId.AutoCompleteCustomSource.Add(ItemList[i]);
}
string realm = null)
{
// OAuth共通情報取得
- Dictionary<string, string> parameter = GetOAuthParameter(consumerKey, token);
+ var parameter = GetOAuthParameter(consumerKey, token);
// OAuth共通情報にquery情報を追加
if (query != null)
foreach (var (key, value) in query)
// 署名の作成・追加
parameter.Add("oauth_signature", CreateSignature(consumerSecret, tokenSecret, httpMethod, requestUri, parameter));
// HTTPリクエストのヘッダに追加
- StringBuilder sb = new StringBuilder("OAuth ");
+ var sb = new StringBuilder("OAuth ");
if (realm != null)
sb.AppendFormat("realm=\"{0}\",", realm);
public static string CreateSignature(string consumerSecret, string tokenSecret, string method, Uri uri, Dictionary<string, string> parameter)
{
// パラメタをソート済みディクショナリに詰替(OAuthの仕様)
- SortedDictionary<string, string> sorted = new SortedDictionary<string, string>(parameter);
+ var sorted = new SortedDictionary<string, string>(parameter);
// URLエンコード済みのクエリ形式文字列に変換
- string paramString = MyCommon.BuildQueryString(sorted);
+ var paramString = MyCommon.BuildQueryString(sorted);
// アクセス先URLの整形
- string url = string.Format("{0}://{1}{2}", uri.Scheme, uri.Host, uri.AbsolutePath);
+ var url = string.Format("{0}://{1}{2}", uri.Scheme, uri.Host, uri.AbsolutePath);
// 署名のベース文字列生成(&区切り)。クエリ形式文字列は再エンコードする
- string signatureBase = string.Format("{0}&{1}&{2}", method, MyCommon.UrlEncode(url), MyCommon.UrlEncode(paramString));
+ var signatureBase = string.Format("{0}&{1}&{2}", method, MyCommon.UrlEncode(url), MyCommon.UrlEncode(paramString));
// 署名鍵の文字列をコンシューマー秘密鍵とアクセストークン秘密鍵から生成(&区切り。アクセストークン秘密鍵なくても&残すこと)
- string key = MyCommon.UrlEncode(consumerSecret) + "&";
+ var key = MyCommon.UrlEncode(consumerSecret) + "&";
if (!string.IsNullOrEmpty(tokenSecret))
key += MyCommon.UrlEncode(tokenSecret);
// 鍵生成&署名生成
- using (HMACSHA1 hmac = new HMACSHA1(Encoding.ASCII.GetBytes(key)))
+ using (var hmac = new HMACSHA1(Encoding.ASCII.GetBytes(key)))
{
- byte[] hash = hmac.ComputeHash(Encoding.ASCII.GetBytes(signatureBase));
+ var hash = hmac.ComputeHash(Encoding.ASCII.GetBytes(signatureBase));
return Convert.ToBase64String(hash);
}
}
const long LVSICF_NOSCROLL = 0x2;
const long LVSICF_NOINVALIDATEALL = 0x1;
- int hPos = -1;
- int vPos = -1;
+ var hPos = -1;
+ var vPos = -1;
switch (m.Msg)
{
{
try
{
- Regex rx = new Regex(TextBoxKeyword.Text);
+ var rx = new Regex(TextBoxKeyword.Text);
return rx.Match(x.Username).Success || rx.Match(x.Target).Success;
}
catch (Exception ex)
_ItemCache = new ListViewItem[] { };
Array.Resize(ref _ItemCache, EndIndex - StartIndex + 1);
_itemCacheIndex = StartIndex;
- for (int i = 0; i < _ItemCache.Length; i++)
+ for (var i = 0; i < _ItemCache.Length; i++)
{
_ItemCache[i] = CreateListViewItem(_filterdEventSource[StartIndex + i]);
}
private void SaveLogButton_Click(object sender, EventArgs e)
{
- DialogResult rslt = MessageBox.Show(string.Format(Properties.Resources.SaveLogMenuItem_ClickText5, Environment.NewLine),
+ var rslt = MessageBox.Show(string.Format(Properties.Resources.SaveLogMenuItem_ClickText5, Environment.NewLine),
Properties.Resources.SaveLogMenuItem_ClickText2,
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
switch (rslt)
if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
{
if (!SaveFileDialog1.ValidateNames) return;
- using (StreamWriter sw = new StreamWriter(SaveFileDialog1.FileName, false, Encoding.UTF8))
+ using (var sw = new StreamWriter(SaveFileDialog1.FileName, false, Encoding.UTF8))
{
switch (rslt)
{
private void SaveEventLog(List<Twitter.FormattedEvent> source, StreamWriter sw)
{
- foreach (Twitter.FormattedEvent _event in source)
+ foreach (var _event in source)
{
sw.WriteLine(_event.Eventtype + "\t" +
"\"" + _event.CreatedAt.ToLocalTimeString() + "\"\t" +
CheckManageRead.Checked = tab.UnreadManage;
CheckNotifyNew.Checked = tab.Notify;
- int idx = ComboSound.Items.IndexOf(tab.SoundFile);
+ var idx = ComboSound.Items.IndexOf(tab.SoundFile);
if (idx == -1) idx = 0;
ComboSound.SelectedIndex = idx;
ShowDetail();
- int idx = ListFilters.SelectedIndex;
+ var idx = ListFilters.SelectedIndex;
ListFilters.SelectedIndex = -1;
ListFilters.SelectedIndex = idx;
ListFilters.Enabled = false;
if (ListFilters.SelectedIndex > -1)
{
- PostFilterRule fc = (PostFilterRule)ListFilters.SelectedItem;
+ var fc = (PostFilterRule)ListFilters.SelectedItem;
if (fc.UseNameField)
{
RadioAND.Checked = true;
private void RadioAND_CheckedChanged(object sender, EventArgs e)
{
- bool flg = RadioAND.Checked;
+ var flg = RadioAND.Checked;
UID.Enabled = flg;
MSG1.Enabled = flg;
MSG2.Enabled = !flg;
}
var tab = (FilterTabModel)this.SelectedTab;
- int i = ListFilters.SelectedIndex;
+ var i = ListFilters.SelectedIndex;
PostFilterRule ft;
if (_mode == EDITMODE.AddNew)
ft.MarkMatches = false;
}
- string bdy = "";
+ var bdy = "";
if (RadioAND.Checked)
{
ft.FilterName = UID.Text;
- TweenMain owner = (TweenMain)this.Owner;
- int cnt = owner.AtIdSupl.ItemCount;
+ var owner = (TweenMain)this.Owner;
+ var cnt = owner.AtIdSupl.ItemCount;
owner.AtIdSupl.AddItem("@" + ft.FilterName);
if (cnt != owner.AtIdSupl.ItemCount)
{
ComboSound.Items.Clear();
ComboSound.Items.Add("");
- DirectoryInfo oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
+ var oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
if (Directory.Exists(Path.Combine(Application.StartupPath, "Sounds")))
{
oDir = oDir.GetDirectories("Sounds")[0];
}
- foreach (FileInfo oFile in oDir.GetFiles("*.wav"))
+ foreach (var oFile in oDir.GetFiles("*.wav"))
{
ComboSound.Items.Add(oFile.Name);
}
idlist.Clear();
- foreach (string tmp in ((TweenMain)this.Owner).AtIdSupl.GetItemList())
+ foreach (var tmp in ((TweenMain)this.Owner).AtIdSupl.GetItemList())
{
idlist.Add(tmp.Remove(0, 1)); // @文字削除
}
{
string tabName = null;
MyCommon.TabUsageType tabType;
- using (InputTabName inputName = new InputTabName())
+ using (var inputName = new InputTabName())
{
inputName.TabName = _sts.MakeTabName("MyTab");
inputName.IsShowUsage = true;
{
MessageBox.Show("Failed to get lists. (" + ex.Message + ")");
}
- using (ListAvailable listAvail = new ListAvailable())
+ using (var listAvail = new ListAvailable())
{
if (listAvail.ShowDialog(this) == DialogResult.Cancel) return;
if (listAvail.SelectedList == null) return;
if (!_sts.AddTab(tab) || !((TweenMain)this.Owner).AddNewTab(tab, startup: false))
{
- string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName);
+ var tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName);
MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (ListTabs.SelectedIndex > -1)
{
var tb = this.SelectedTab.TabName;
- int idx = ListTabs.SelectedIndex;
+ var idx = ListTabs.SelectedIndex;
if (((TweenMain)this.Owner).RemoveSpecifiedTab(tb, true))
{
this.RefreshListTabs();
{
if (ListTabs.SelectedIndex > -1)
{
- string filename = "";
+ var filename = "";
if (ComboSound.SelectedIndex > -1) filename = ComboSound.SelectedItem.ToString();
this.SelectedTab.SoundFile = filename;
}
private void RadioExAnd_CheckedChanged(object sender, EventArgs e)
{
- bool flg = RadioExAnd.Checked;
+ var flg = RadioExAnd.Checked;
ExUID.Enabled = flg;
ExMSG1.Enabled = flg;
ExMSG2.Enabled = !flg;
if (ListTabs.SelectedIndex > -1 && ListFilters.SelectedItem != null)
{
TabModel[] selectedTabs;
- using (TabsDialog dialog = new TabsDialog(_sts))
+ using (var dialog = new TabsDialog(_sts))
{
dialog.MultiSelect = true;
dialog.Text = Properties.Resources.ButtonRuleCopy_ClickText1;
}
var currentTab = (FilterTabModel)this.SelectedTab;
- List<PostFilterRule> filters = new List<PostFilterRule>();
+ var filters = new List<PostFilterRule>();
foreach (int idx in ListFilters.SelectedIndices)
{
{
if (tb.TabName == currentTab.TabName) continue;
- foreach (PostFilterRule flt in filters)
+ foreach (var flt in filters)
{
if (!tb.FilterArray.Contains(flt))
tb.AddFilter(flt.Clone());
selectedTabs = dialog.SelectedTabs;
}
var currentTab = (FilterTabModel)this.SelectedTab;
- List<PostFilterRule> filters = new List<PostFilterRule>();
+ var filters = new List<PostFilterRule>();
foreach (int idx in ListFilters.SelectedIndices)
{
{
if (tb.TabName == currentTab.TabName) continue;
- foreach (PostFilterRule flt in filters)
+ foreach (var flt in filters)
{
if (!tb.FilterArray.Contains(flt))
tb.AddFilter(flt.Clone());
}
}
- for (int idx = ListFilters.Items.Count - 1; idx >= 0; idx--)
+ for (var idx = ListFilters.Items.Count - 1; idx >= 0; idx--)
{
if (ListFilters.GetSelected(idx))
{
{
if (e.KeyCode == Keys.Space && e.Modifiers == (Keys.Shift | Keys.Control))
{
- TweenMain main = (TweenMain)this.Owner;
- TextBox tbox = (TextBox)sender;
+ var main = (TweenMain)this.Owner;
+ var tbox = (TextBox)sender;
if (tbox.SelectionStart > 0)
{
- int endidx = tbox.SelectionStart - 1;
- string startstr = "";
- for (int i = tbox.SelectionStart - 1; i >= 0; i--)
+ var endidx = tbox.SelectionStart - 1;
+ var startstr = "";
+ for (var i = tbox.SelectionStart - 1; i >= 0; i--)
{
- char c = tbox.Text[i];
+ var c = tbox.Text[i];
if (Char.IsLetterOrDigit(c) || c == '_')
{
continue;
private void FilterTextBox_KeyPress(object sender, KeyPressEventArgs e)
{
- TweenMain main = (TweenMain)this.Owner;
- TextBox tbox = (TextBox)sender;
+ var main = (TweenMain)this.Owner;
+ var tbox = (TextBox)sender;
if (e.KeyChar == '@')
{
//if (!SettingDialog.UseAtIdSupplement) return;
{
_multiSelState |= MultiSelectionState.SelectAll;
- for (int i = 1; i < itemCount; i++)
+ for (var i = 1; i < itemCount; i++)
{
this.ListFilters.SetSelected(i, true);
}
private byte[] IconToByteArray(string filename)
{
- using (Icon ic = new Icon(filename))
+ using (var ic = new Icon(filename))
{
return IconToByteArray(ic);
}
private byte[] IconToByteArray(Icon icondata)
{
- using (MemoryStream ms = new MemoryStream())
+ using (var ms = new MemoryStream())
{
- using (Icon ic = new Icon(icondata, 48, 48))
+ using (var ic = new Icon(icondata, 48, 48))
{
ic.ToBitmap().Save(ms, ImageFormat.Png);
return ms.ToArray();
{
get
{
- string dir = Application.StartupPath;
- string connectorPath = Path.Combine(dir, "Growl.Connector.dll");
- string corePath = Path.Combine(dir, "Growl.CoreLibrary.dll");
+ var dir = Application.StartupPath;
+ var connectorPath = Path.Combine(dir, "Growl.Connector.dll");
+ var corePath = Path.Combine(dir, "Growl.CoreLibrary.dll");
if (File.Exists(connectorPath) && File.Exists(corePath))
return true;
else
public bool RegisterGrowl()
{
_initialized = false;
- string dir = Application.StartupPath;
- string connectorPath = Path.Combine(dir, "Growl.Connector.dll");
- string corePath = Path.Combine(dir, "Growl.CoreLibrary.dll");
+ var dir = Application.StartupPath;
+ var connectorPath = Path.Combine(dir, "Growl.Connector.dll");
+ var corePath = Path.Combine(dir, "Growl.CoreLibrary.dll");
try
{
try
{
_targetConnector = _connector.CreateInstance("Growl.Connector.GrowlConnector");
- Type _t = _connector.GetType("Growl.Connector.NotificationType");
+ var _t = _connector.GetType("Growl.Connector.NotificationType");
_growlNTreply = _t.InvokeMember(null,
BindingFlags.CreateInstance, null, null, new object[] { "REPLY", "Reply" }, CultureInfo.InvariantCulture);
_growlNTusevent = _t.InvokeMember(null,
BindingFlags.CreateInstance, null, null, new object[] { "USERSTREAM_EVENT", "UserStream Event" }, CultureInfo.InvariantCulture);
- object encryptType =
+ var encryptType =
_connector.GetType("Growl.Connector.Cryptography+SymmetricAlgorithmType").InvokeMember(
"PlainText", BindingFlags.GetField, null, null, null, CultureInfo.InvariantCulture);
_targetConnector.GetType().InvokeMember("EncryptionAlgorithm", BindingFlags.SetProperty, null, _targetConnector, new object[] { encryptType }, CultureInfo.InvariantCulture);
if (File.Exists(Path.Combine(Application.StartupPath, "Icons\\Tween.png")))
{
// Icons\Tween.pngを使用
- ConstructorInfo ci = _core.GetType(
+ var ci = _core.GetType(
"Growl.CoreLibrary.Resource").GetConstructor(
BindingFlags.NonPublic | BindingFlags.Instance,
null, new Type[] { typeof(string) }, null);
- object data = ci.Invoke(new object[] { Path.Combine(Application.StartupPath, "Icons\\Tween.png") });
- PropertyInfo pi = _growlApp.GetType().GetProperty("Icon");
+ var data = ci.Invoke(new object[] { Path.Combine(Application.StartupPath, "Icons\\Tween.png") });
+ var pi = _growlApp.GetType().GetProperty("Icon");
pi.SetValue(_growlApp, data, null);
}
else if (File.Exists(Path.Combine(Application.StartupPath, "Icons\\MIcon.ico")))
{
// アイコンセットにMIcon.icoが存在する場合それを使用
- ConstructorInfo cibd = _core.GetType(
+ var cibd = _core.GetType(
"Growl.CoreLibrary.BinaryData").GetConstructor(
BindingFlags.Public | BindingFlags.Instance,
null, new Type[] { typeof(byte[]) }, null);
- object bdata = cibd.Invoke(
+ var bdata = cibd.Invoke(
new object[] { IconToByteArray(Path.Combine(Application.StartupPath, "Icons\\MIcon.ico")) });
- ConstructorInfo ciRes = _core.GetType(
+ var ciRes = _core.GetType(
"Growl.CoreLibrary.Resource").GetConstructor(
BindingFlags.NonPublic | BindingFlags.Instance,
null, new Type[] { bdata.GetType() }, null);
- object data = ciRes.Invoke(new object[] { bdata });
- PropertyInfo pi = _growlApp.GetType().GetProperty("Icon");
+ var data = ciRes.Invoke(new object[] { bdata });
+ var pi = _growlApp.GetType().GetProperty("Icon");
pi.SetValue(_growlApp, data, null);
}
else
{
//内蔵アイコンリソースを使用
- ConstructorInfo cibd = _core.GetType(
+ var cibd = _core.GetType(
"Growl.CoreLibrary.BinaryData").GetConstructor(
BindingFlags.Public | BindingFlags.Instance,
null, new Type[] { typeof(byte[]) }, null);
- object bdata = cibd.Invoke(
+ var bdata = cibd.Invoke(
new object[] { IconToByteArray(Properties.Resources.MIcon) });
- ConstructorInfo ciRes = _core.GetType(
+ var ciRes = _core.GetType(
"Growl.CoreLibrary.Resource").GetConstructor(
BindingFlags.NonPublic | BindingFlags.Instance,
null, new Type[] { bdata.GetType() }, null);
- object data = ciRes.Invoke(new object[] { bdata });
- PropertyInfo pi = _growlApp.GetType().GetProperty("Icon");
+ var data = ciRes.Invoke(new object[] { bdata });
+ var pi = _growlApp.GetType().GetProperty("Icon");
pi.SetValue(_growlApp, data, null);
}
- MethodInfo mi = _targetConnector.GetType().GetMethod("Register", new Type[] { _growlApp.GetType(), _connector.GetType("Growl.Connector.NotificationType[]") });
+ var mi = _targetConnector.GetType().GetMethod("Register", new Type[] { _growlApp.GetType(), _connector.GetType("Growl.Connector.NotificationType[]") });
_t = _connector.GetType("Growl.Connector.NotificationType");
mi.Invoke(_targetConnector, new object[] { _growlApp, arglist.ToArray(_t) });
// コールバックメソッドの登録
- Type tGrowlConnector = _connector.GetType("Growl.Connector.GrowlConnector");
- EventInfo evNotificationCallback = tGrowlConnector.GetEvent("NotificationCallback");
- Type tDelegate = evNotificationCallback.EventHandlerType;
- MethodInfo miHandler = typeof(GrowlHelper).GetMethod("GrowlCallbackHandler", BindingFlags.NonPublic | BindingFlags.Instance);
- Delegate d = Delegate.CreateDelegate(tDelegate, this, miHandler);
- MethodInfo miAddHandler = evNotificationCallback.GetAddMethod();
+ var tGrowlConnector = _connector.GetType("Growl.Connector.GrowlConnector");
+ var evNotificationCallback = tGrowlConnector.GetEvent("NotificationCallback");
+ var tDelegate = evNotificationCallback.EventHandlerType;
+ var miHandler = typeof(GrowlHelper).GetMethod("GrowlCallbackHandler", BindingFlags.NonPublic | BindingFlags.Instance);
+ var d = Delegate.CreateDelegate(tDelegate, this, miHandler);
+ var miAddHandler = evNotificationCallback.GetAddMethod();
object[] addHandlerArgs = { d };
miAddHandler.Invoke(_targetConnector, addHandlerArgs);
public void Notify(NotifyType notificationType, string id, string title, string text, Image icon = null, string url = "")
{
if (!_initialized) return;
- string notificationName = "";
+ var notificationName = "";
switch (notificationType)
{
case NotifyType.Reply:
object n = null;
if (icon != null || !string.IsNullOrEmpty(url))
{
- Type gCore = _core.GetType("Growl.CoreLibrary.Resource");
+ var gCore = _core.GetType("Growl.CoreLibrary.Resource");
object res = null;
if (icon != null)
{
new object[] { url },
CultureInfo.InvariantCulture);
}
- object priority =
+ var priority =
_connector.GetType("Growl.Connector.Priority").InvokeMember(
"Normal", BindingFlags.GetField, null, null, null, CultureInfo.InvariantCulture);
n = _connector.GetType("Growl.Connector.Notification").InvokeMember(
CultureInfo.InvariantCulture);
}
//_targetConnector.GetType.InvokeMember("Notify", BindingFlags.InvokeMethod, null, _targetConnector, new object[] {n});
- object cc = _connector.GetType("Growl.Connector.CallbackContext").InvokeMember(
+ var cc = _connector.GetType("Growl.Connector.CallbackContext").InvokeMember(
null, BindingFlags.CreateInstance, null, _connector,
new object[] { "some fake information", notificationName },
CultureInfo.InvariantCulture);
try
{
// 定数取得
- object vCLICK =
+ var vCLICK =
_core.GetType("Growl.CoreLibrary.CallbackResult").GetField(
"CLICK",
BindingFlags.Public | BindingFlags.Static).GetRawConstantValue();
// 実際の値
- object vResult = callbackData.GetType().GetProperty(
+ var vResult = callbackData.GetType().GetProperty(
"Result",
BindingFlags.Public | BindingFlags.Instance).GetGetMethod().Invoke(callbackData, null);
vResult = (int)vResult;
- string notifyId = (string)callbackData.GetType().GetProperty("NotificationID").GetGetMethod().Invoke(callbackData, null);
- string notifyName = (string)callbackData.GetType().GetProperty("Type").GetGetMethod().Invoke(callbackData, null);
+ var notifyId = (string)callbackData.GetType().GetProperty("NotificationID").GetGetMethod().Invoke(callbackData, null);
+ var notifyName = (string)callbackData.GetType().GetProperty("Type").GetGetMethod().Invoke(callbackData, null);
if (vCLICK.Equals(vResult))
{
NotifyType nt;
{
if (string.IsNullOrEmpty(value)) return -1;
- int idx = 0;
+ var idx = 0;
- foreach (object l in list)
+ foreach (var l in list)
{
- string src = l as string;
+ var src = l as string;
if (string.IsNullOrEmpty(src))
{
idx += 1;
if (isIgnorePermanent || !this.IsPermanent)
{
//無条件に先頭に挿入
- int idx = GetIndexOf(HistoryHashList.Items, hash);
+ var idx = GetIndexOf(HistoryHashList.Items, hash);
if (idx != -1) HistoryHashList.Items.RemoveAt(idx);
HistoryHashList.Items.Insert(0, hash);
else
{
//固定されていたら2行目に挿入
- int idx = GetIndexOf(HistoryHashList.Items, hash);
+ var idx = GetIndexOf(HistoryHashList.Items, hash);
if (this.IsPermanent)
{
if (idx > 0)
_hashSupl.ShowDialog();
if (!string.IsNullOrEmpty(_hashSupl.inputText))
{
- string fHalf = "";
- string eHalf = "";
- int selStart = UseHashText.SelectionStart;
+ var fHalf = "";
+ var eHalf = "";
+ var selStart = UseHashText.SelectionStart;
if (selStart > 0)
{
fHalf = UseHashText.Text.Substring(0, selStart);
{
get
{
- List<string> hash = new List<string>();
+ var hash = new List<string>();
foreach (string item in HistoryHashList.Items)
{
hash.Add(item);
private void PermOK_Button_Click(object sender, EventArgs e)
{
//ハッシュタグの整形
- string hashStr = UseHashText.Text;
+ var hashStr = UseHashText.Text;
if (!this.AdjustHashtags(ref hashStr, !this.RunSilent)) return;
UseHashText.Text = hashStr;
- int idx = 0;
+ var idx = 0;
if (!this._isAdd && this.HistoryHashList.SelectedIndices.Count > 0)
{
idx = this.HistoryHashList.SelectedIndices[0];
}
hashtag = hashtag.Replace("#", "#");
hashtag = hashtag.Replace(" ", " ");
- string adjust = "";
- foreach (string hash in hashtag.Split(' '))
+ var adjust = "";
+ foreach (var hash in hashtag.Split(' '))
{
if (hash.Length > 0)
{
private void OK_Button_Click(object sender, EventArgs e)
{
- string hash = "";
+ var hash = "";
foreach (string hs in this.HistoryHashList.SelectedItems)
{
hash += hs + " ";
{
if (this.Count <= this.TrimLimit) return false;
- for (int i = this.Count; i > this.TrimLimit; i--)
+ for (var i = this.Count; i > this.TrimLimit; i--)
{
var node = this.innerList.Last;
this.innerList.Remove(node);
{
if (this.ListsList.SelectedItem == null) return;
- ListElement list = (ListElement) this.ListsList.SelectedItem;
+ var list = (ListElement) this.ListsList.SelectedItem;
this.UsernameTextBox.Text = list.Username;
this.NameTextBox.Text = list.Name;
this.PublicRadioButton.Checked = list.IsPublic;
this.DescriptionText.Text = list.Description;
this.UserList.Items.Clear();
- foreach (UserInfo user in list.Members)
+ foreach (var user in list.Members)
this.UserList.Items.Add(user);
this.GetMoreUsersButton.Text = this.UserList.Items.Count > 0 ? Properties.Resources.ListManageGetMoreUsers2 : Properties.Resources.ListManageGetMoreUsers1;
using (ControlTransaction.Disabled(this))
{
- ListElement listItem = (ListElement)this.ListsList.SelectedItem;
+ var listItem = (ListElement)this.ListsList.SelectedItem;
if (string.IsNullOrEmpty(this.NameTextBox.Text))
{
this.EditCheckBox.AutoCheck = true;
this.EditCheckBox.Checked = false;
- for (int i = this.ListsList.Items.Count - 1; i >= 0; i--)
+ for (var i = this.ListsList.Items.Count - 1; i >= 0; i--)
if (this.ListsList.Items[i] is NewListElement)
this.ListsList.Items.RemoveAt(i);
using (ControlTransaction.Disabled(this))
{
- ListElement list = (ListElement)this.ListsList.SelectedItem;
- UserInfo user = (UserInfo)this.UserList.SelectedItem;
+ var list = (ListElement)this.ListsList.SelectedItem;
+ var user = (UserInfo)this.UserList.SelectedItem;
if (MessageBox.Show(Properties.Resources.ListManageDeleteUser1, ApplicationSettings.ApplicationName, MessageBoxButtons.OKCancel) == DialogResult.OK)
{
try
return;
}
- int idx = ListsList.SelectedIndex;
+ var idx = ListsList.SelectedIndex;
list.Members.Remove(user);
this.ListsList_SelectedIndexChanged(this.ListsList, EventArgs.Empty);
if (idx < ListsList.Items.Count) ListsList.SelectedIndex = idx;
using (ControlTransaction.Disabled(this))
{
- ListElement list = (ListElement)this.ListsList.SelectedItem;
+ var list = (ListElement)this.ListsList.SelectedItem;
if (MessageBox.Show(Properties.Resources.ListManageDeleteLists1, ApplicationSettings.ApplicationName, MessageBoxButtons.OKCancel) == DialogResult.OK)
{
private void AddListButton_Click(object sender, EventArgs e)
{
- NewListElement newList = new NewListElement(this.tw);
+ var newList = new NewListElement(this.tw);
this.ListsList.Items.Add(newList);
this.ListsList.SelectedItem = newList;
this.EditCheckBox.Checked = true;
}
else
{
- UserInfo user = (UserInfo)this.UserList.SelectedItem;
+ var user = (UserInfo)this.UserList.SelectedItem;
this.UserLocation.Text = user.Location;
this.UserWeb.Text = user.Url;
this.UserFollowNum.Text = user.FriendsCount.ToString("#,###,##0");
/// </summary>
public bool HasUploadableService(string fileName, bool ignoreSize)
{
- FileInfo fl = new FileInfo(fileName);
- string ext = fl.Extension;
- long? size = ignoreSize ? (long?)null : fl.Length;
+ var fl = new FileInfo(fileName);
+ var ext = fl.Extension;
+ var size = ignoreSize ? (long?)null : fl.Length;
if (IsUploadable(this.ServiceName, ext, size))
return true;
}
else
{
- for (int i = 0; i < count; i++)
+ for (var i = 0; i < count; i++)
{
var index = ImagePageCombo.Items.Count - 1;
if (index == 0)
{
using (ControlTransaction.Update(ImageServiceCombo))
{
- string svc = "";
+ var svc = "";
if (ImageServiceCombo.SelectedIndex > -1) svc = ImageServiceCombo.Text;
ImageServiceCombo.Items.Clear();
var homeTab = GetTabByType(MyCommon.TabUsageType.Home);
var dmTab = GetTabByType(MyCommon.TabUsageType.DirectMessage);
- for (int idx = 0; idx < tb.AllCount; ++idx)
+ for (var idx = 0; idx < tb.AllCount; ++idx)
{
var exist = false;
var Id = tb.GetStatusIdAt(idx);
public static string ExceptionOutMessage(Exception ex)
{
- bool IsTerminatePermission = true;
+ var IsTerminatePermission = true;
return ExceptionOutMessage(ex, ref IsTerminatePermission);
}
desdecrypt = des.CreateEncryptor();
//書き込むためのCryptoStreamの作成
- using (CryptoStream cryptStream = new CryptoStream(msOut, desdecrypt, CryptoStreamMode.Write))
+ using (var cryptStream = new CryptoStream(msOut, desdecrypt, CryptoStreamMode.Write))
{
//Disposeが重複して呼ばれないようにする
- MemoryStream msTmp = msOut;
+ var msTmp = msOut;
msOut = null;
desdecrypt = null;
desdecrypt = null;
//復号化されたデータを取得するためのStreamReader
- using (StreamReader srOut = new StreamReader(cryptStreem, Encoding.UTF8))
+ using (var srOut = new StreamReader(cryptStreem, Encoding.UTF8))
{
//Disposeが重複して呼ばれないようにする
cryptStreem = null;
internal static bool _IsKeyDown(Keys modifierKeys, Keys[] targetKeys)
{
- foreach (Keys key in targetKeys)
+ foreach (var key in targetKeys)
{
if ((modifierKeys & key) != key)
{
public static string UrlEncode(string stringToEncode)
{
const string UnreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
- StringBuilder sb = new StringBuilder();
- byte[] bytes = Encoding.UTF8.GetBytes(stringToEncode);
+ var sb = new StringBuilder();
+ var bytes = Encoding.UTF8.GetBytes(stringToEncode);
- foreach (byte b in bytes)
+ foreach (var b in bytes)
{
if (UnreservedChars.IndexOf((char)b) != -1)
sb.Append((char)b);
{
case MouseButtons.Left:
//項目が無い部分をクリックしても、選択されている項目のチェック状態が変更されてしまうので、その対策
- for (int index = 0; index < this.ListsCheckedListBox.Items.Count; index++)
+ for (var index = 0; index < this.ListsCheckedListBox.Items.Count; index++)
{
if (this.ListsCheckedListBox.GetItemRectangle(index).Contains(e.Location))
return;
break;
case MouseButtons.Right:
//コンテキストメニューの項目実行時にSelectedItemプロパティを利用出来るように
- for (int index = 0; index < this.ListsCheckedListBox.Items.Count; index++)
+ for (var index = 0; index < this.ListsCheckedListBox.Items.Count; index++)
{
if (this.ListsCheckedListBox.GetItemRectangle(index).Contains(e.Location))
{
if (procId == pid)
{
- int windowTitleLen = GetWindowTextLength(hWnd);
+ var windowTitleLen = GetWindowTextLength(hWnd);
if (windowTitleLen > 0)
{
- StringBuilder windowTitle = new StringBuilder(windowTitleLen + 1);
+ var windowTitle = new StringBuilder(windowTitleLen + 1);
GetWindowText(hWnd, windowTitle, windowTitle.Capacity);
if (windowTitle.ToString().Contains(searchWindowTitle))
private void Button3_Click(object sender, EventArgs e)
{
- using (OpenFileDialog filedlg = new OpenFileDialog())
+ using (var filedlg = new OpenFileDialog())
{
filedlg.Filter = Properties.Resources.Button3_ClickText1;
filedlg.FilterIndex = 1;
{
this.ComboBoxEventNotifySound.Items.Clear();
this.ComboBoxEventNotifySound.Items.Add("");
- DirectoryInfo oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
+ var oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
if (Directory.Exists(Path.Combine(Application.StartupPath, "Sounds")))
{
oDir = oDir.GetDirectories("Sounds")[0];
}
- foreach (FileInfo oFile in oDir.GetFiles("*.wav"))
+ foreach (var oFile in oDir.GetFiles("*.wav"))
{
this.ComboBoxEventNotifySound.Items.Add(oFile.Name);
}
private void GetEventNotifyFlag(ref MyCommon.EVENTTYPE eventnotifyflag, ref MyCommon.EVENTTYPE isMyeventnotifyflag)
{
- MyCommon.EVENTTYPE evt = MyCommon.EVENTTYPE.None;
- MyCommon.EVENTTYPE myevt = MyCommon.EVENTTYPE.None;
+ var evt = MyCommon.EVENTTYPE.None;
+ var myevt = MyCommon.EVENTTYPE.None;
- foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
+ foreach (var tbl in GetEventCheckboxTable())
{
switch (tbl.CheckBox.CheckState)
{
private void ApplyEventNotifyFlag(bool rootEnabled, MyCommon.EVENTTYPE eventnotifyflag, MyCommon.EVENTTYPE isMyeventnotifyflag)
{
- MyCommon.EVENTTYPE evt = eventnotifyflag;
- MyCommon.EVENTTYPE myevt = isMyeventnotifyflag;
+ var evt = eventnotifyflag;
+ var myevt = isMyeventnotifyflag;
this.CheckEventNotify.Checked = rootEnabled;
- foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
+ foreach (var tbl in GetEventCheckboxTable())
{
if ((evt & tbl.Type) != 0)
{
private void RadioProxySpecified_CheckedChanged(object sender, EventArgs e)
{
- bool chk = RadioProxySpecified.Checked;
+ var chk = RadioProxySpecified.Checked;
LabelProxyAddress.Enabled = chk;
TextProxyAddress.Enabled = chk;
LabelProxyPort.Enabled = chk;
#region Settingクラス基本
public static SettingAtIdList Load()
{
- SettingAtIdList setting = LoadSettings();
+ var setting = LoadSettings();
return setting;
}
lock (lockObj)
{
- using (FileStream fs = new FileStream(settingFilePath, FileMode.Open, FileAccess.Read))
+ using (var fs = new FileStream(settingFilePath, FileMode.Open, FileAccess.Read))
{
fs.Position = 0;
- XmlSerializer xs = new XmlSerializer(typeof(T));
- T instance = (T)xs.Deserialize(fs);
+ var xs = new XmlSerializer(typeof(T));
+ var instance = (T)xs.Deserialize(fs);
return instance;
}
}
}
catch (Exception)
{
- string backupFile = Path.Combine(
+ var backupFile = Path.Combine(
Path.Combine(
Application.StartupPath,
ApplicationSettings.AssemblyName + "Backup1st"),
{
lock (lockObj)
{
- using (FileStream fs = new FileStream(backupFile, FileMode.Open, FileAccess.Read))
+ using (var fs = new FileStream(backupFile, FileMode.Open, FileAccess.Read))
{
fs.Position = 0;
- XmlSerializer xs = new XmlSerializer(typeof(T));
- T instance = (T)xs.Deserialize(fs);
+ var xs = new XmlSerializer(typeof(T));
+ var instance = (T)xs.Deserialize(fs);
MessageBox.Show("File: " + GetSettingFilePath(FileId) + Environment.NewLine + "Use old setting file, because application can't read this setting file.");
return instance;
}
{
get
{
- string pwd = ProxyPassword;
+ var pwd = ProxyPassword;
if (string.IsNullOrEmpty(pwd)) pwd = "";
if (pwd.Length > 0)
{
}
set
{
- string pwd = value;
+ var pwd = value;
if (string.IsNullOrEmpty(pwd)) pwd = "";
if (pwd.Length > 0)
{
{
Type classType;
- MapProvider confValue = SettingManager.Common.MapThumbnailProvider;
+ var confValue = SettingManager.Common.MapThumbnailProvider;
switch (confValue)
{
case MapProvider.OpenStreetMap:
{
get
{
- StringBuilder sb = new StringBuilder();
- foreach (LogEntry e in _logs)
+ var sb = new StringBuilder();
+ foreach (var e in _logs)
{
sb.AppendLine(e.ToString());
}
ColumnOrgText[6] = "";
ColumnOrgText[7] = "Source";
- int c = 0;
+ var c = 0;
switch (_statuses.SortMode)
{
case ComparerMode.Nickname: //ニックネーム
Networking.Initialize();
- bool saveRequired = false;
- bool firstRun = false;
+ var saveRequired = false;
+ var firstRun = false;
//ユーザー名、パスワードが未設定なら設定画面を表示(初回起動時など)
if (string.IsNullOrEmpty(tw.Username))
//タイトルバー領域
if (this.WindowState != FormWindowState.Minimized)
{
- Rectangle tbarRect = new Rectangle(this._myLoc, new Size(_mySize.Width, SystemInformation.CaptionHeight));
- bool outOfScreen = true;
+ var tbarRect = new Rectangle(this._myLoc, new Size(_mySize.Width, SystemInformation.CaptionHeight));
+ var outOfScreen = true;
if (Screen.AllScreens.Length == 1) //ハングするとの報告
{
- foreach (Screen scr in Screen.AllScreens)
+ foreach (var scr in Screen.AllScreens)
{
if (!Rectangle.Intersect(tbarRect, scr.Bounds).IsEmpty)
{
if (SettingManager.Common.HotkeyEnabled)
{
//////グローバルホットキーの登録
- HookGlobalHotkey.ModKeys modKey = HookGlobalHotkey.ModKeys.None;
+ var modKey = HookGlobalHotkey.ModKeys.None;
if ((SettingManager.Common.HotkeyModifier & Keys.Alt) == Keys.Alt)
modKey |= HookGlobalHotkey.ModKeys.Alt;
if ((SettingManager.Common.HotkeyModifier & Keys.Control) == Keys.Control)
//Growlは一個ずつばらして通知。ただし、3ポスト以上あるときはまとめる
if (SettingManager.Common.IsUseNotifyGrowl)
{
- StringBuilder sb = new StringBuilder();
- bool reply = false;
- bool dm = false;
+ var sb = new StringBuilder();
+ var reply = false;
+ var dm = false;
- foreach (PostClass post in notifyPosts)
+ foreach (var post in notifyPosts)
{
if (!(notifyPosts.Length > 3))
{
if (notifyPosts.Last() != post) continue;
}
- StringBuilder title = new StringBuilder();
+ var title = new StringBuilder();
GrowlHelper.NotifyType nt;
if (SettingManager.Common.DispUsername)
{
title.AppendFormat(Properties.Resources.RefreshTimeline_NotifyText, addCount);
nt = GrowlHelper.NotifyType.Notify;
}
- string bText = sb.ToString();
+ var bText = sb.ToString();
if (string.IsNullOrEmpty(bText)) return;
var image = this.IconCache.TryGetFromCache(post.ImageUrl);
}
else
{
- StringBuilder sb = new StringBuilder();
- bool reply = false;
- bool dm = false;
- foreach (PostClass post in notifyPosts)
+ var sb = new StringBuilder();
+ var reply = false;
+ var dm = false;
+ foreach (var post in notifyPosts)
{
if (post.IsReply && !post.IsExcludeReply) reply = true;
if (post.IsDm) dm = true;
}
//if (SettingDialog.DispUsername) { NotifyIcon1.BalloonTipTitle = tw.Username + " - "; } else { NotifyIcon1.BalloonTipTitle = ""; }
- StringBuilder title = new StringBuilder();
+ var title = new StringBuilder();
ToolTipIcon ntIcon;
if (SettingManager.Common.DispUsername)
{
title.Append(" ");
title.AppendFormat(Properties.Resources.RefreshTimeline_NotifyText, addCount);
}
- string bText = sb.ToString();
+ var bText = sb.ToString();
if (string.IsNullOrEmpty(bText)) return;
//NotifyIcon1.BalloonTipText = sb.ToString();
//NotifyIcon1.ShowBalloonTip(500);
{
try
{
- string dir = Application.StartupPath;
+ var dir = Application.StartupPath;
if (Directory.Exists(Path.Combine(dir, "Sounds")))
{
dir = Path.Combine(dir, "Sounds");
}
- using (SoundPlayer player = new SoundPlayer(Path.Combine(dir, soundFile)))
+ using (var player = new SoundPlayer(Path.Combine(dir, soundFile)))
{
player.Play();
}
var currentPost = this.CurrentPost;
if (this.ExistCurrentPost && StatusText.Text.Trim() == string.Format("RT @{0}: {1}", currentPost.ScreenName, currentPost.TextFromApi))
{
- DialogResult rtResult = MessageBox.Show(string.Format(Properties.Resources.PostButton_Click1, Environment.NewLine),
+ var rtResult = MessageBox.Show(string.Format(Properties.Resources.PostButton_Click1, Environment.NewLine),
"Retweet",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question);
//Google検索(試験実装)
if (StatusText.Text.StartsWith("Google:", StringComparison.OrdinalIgnoreCase) && StatusText.Text.Trim().Length > 7)
{
- string tmp = string.Format(Properties.Resources.SearchItem2Url, Uri.EscapeDataString(StatusText.Text.Substring(7)));
+ var tmp = string.Format(Properties.Resources.SearchItem2Url, Uri.EscapeDataString(StatusText.Text.Substring(7)));
await this.OpenUriInBrowserAsync(tmp);
}
private DialogResult ShowSettingDialog(bool showTaskbarIcon = false)
{
- DialogResult result = DialogResult.Abort;
+ var result = DialogResult.Abort;
using (var settingDialog = new AppendSettingDialog())
{
foreach (TabPage tp in ListTab.TabPages)
{
- DetailsListView lst = (DetailsListView)tp.Tag;
+ var lst = (DetailsListView)tp.Tag;
using (ControlTransaction.Update(lst))
{
if (SettingManager.Common.HotkeyEnabled)
{
///グローバルホットキーの登録。設定で変更可能にするかも
- HookGlobalHotkey.ModKeys modKey = HookGlobalHotkey.ModKeys.None;
+ var modKey = HookGlobalHotkey.ModKeys.None;
if ((SettingManager.Common.HotkeyModifier & Keys.Alt) == Keys.Alt)
modKey |= HookGlobalHotkey.ModKeys.Alt;
if ((SettingManager.Common.HotkeyModifier & Keys.Control) == Keys.Control)
}
}
//ユニークなタブ名生成
- string tabName = searchWord;
- for (int i = 0; i <= 100; i++)
+ var tabName = searchWord;
+ for (var i = 0; i <= 100; i++)
{
if (_statuses.ContainsTab(tabName))
tabName += "_";
ListTab.SelectedIndex = this._statuses.Tabs.Count - 1;
//検索条件の設定
var tabPage = this.CurrentTabPage;
- ComboBox cmb = (ComboBox)tabPage.Controls["panelSearch"].Controls["comboSearch"];
+ var cmb = (ComboBox)tabPage.Controls["panelSearch"].Controls["comboSearch"];
cmb.Items.Add(searchWord);
cmb.Text = searchWord;
SaveConfigsTabs();
}
}
//ユニークなタブ名生成
- string tabName = "user:" + user;
+ var tabName = "user:" + user;
while (_statuses.ContainsTab(tabName))
{
tabName += "_";
var _tabPage = new TabPage();
var _listCustom = new DetailsListView();
- int cnt = this._statuses.Tabs.Count;
+ var cnt = this._statuses.Tabs.Count;
///ToDo:Create and set controls follow tabtypes
label.Text = userTab.ScreenName + "'s Timeline";
}
label.TextAlign = ContentAlignment.MiddleLeft;
- using (ComboBox tmpComboBox = new ComboBox())
+ using (var tmpComboBox = new ComboBox())
{
label.Height = tmpComboBox.Height;
}
if (confirm)
{
- string tmp = string.Format(Properties.Resources.RemoveSpecifiedTabText1, Environment.NewLine);
+ var tmp = string.Format(Properties.Resources.RemoveSpecifiedTabText1, Environment.NewLine);
if (MessageBox.Show(tmp, TabName + " " + Properties.Resources.RemoveSpecifiedTabText2,
MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
{
SetListProperty(); //他のタブに列幅等を反映
//オブジェクトインスタンスの削除
- DetailsListView _listCustom = (DetailsListView)_tabPage.Tag;
+ var _listCustom = (DetailsListView)_tabPage.Tag;
_tabPage.Tag = null;
using (ControlTransaction.Layout(this.SplitContainer1.Panel1, false))
// 後付けのコントロールを破棄
if (tabInfo.TabType == MyCommon.TabUsageType.UserTimeline || tabInfo.TabType == MyCommon.TabUsageType.Lists)
{
- using (Control label = _tabPage.Controls["labelUser"])
+ using (var label = _tabPage.Controls["labelUser"])
{
_tabPage.Controls.Remove(label);
}
}
else if (tabInfo.TabType == MyCommon.TabUsageType.PublicSearch)
{
- using (Control pnl = _tabPage.Controls["panelSearch"])
+ using (var pnl = _tabPage.Controls["panelSearch"])
{
pnl.Enter -= SearchControls_Enter;
pnl.Leave -= SearchControls_Leave;
if (!SettingManager.Common.TabMouseLock && e.Button == MouseButtons.Left && _tabDrag)
{
- string tn = "";
- Rectangle dragEnableRectangle = new Rectangle(_tabMouseDownPoint.X - (SystemInformation.DragSize.Width / 2), _tabMouseDownPoint.Y - (SystemInformation.DragSize.Height / 2), SystemInformation.DragSize.Width, SystemInformation.DragSize.Height);
+ var tn = "";
+ var dragEnableRectangle = new Rectangle(_tabMouseDownPoint.X - (SystemInformation.DragSize.Width / 2), _tabMouseDownPoint.Y - (SystemInformation.DragSize.Height / 2), SystemInformation.DragSize.Width, SystemInformation.DragSize.Height);
if (!dragEnableRectangle.Contains(e.Location))
{
//タブが多段の場合にはMouseDownの前の段階で選択されたタブの段が変わっているので、このタイミングでカーソルの位置からタブを判定出来ない。
_tabDrag = false;
}
- Point cpos = new Point(e.X, e.Y);
+ var cpos = new Point(e.X, e.Y);
foreach (var (tab, index) in this._statuses.Tabs.WithIndex())
{
var rect = ListTab.GetTabRect(index);
var currentListView = this.CurrentListView;
- int[] dispOrder = new int[currentListView.Columns.Count];
- for (int i = 0; i < currentListView.Columns.Count; i++)
+ var dispOrder = new int[currentListView.Columns.Count];
+ for (var i = 0; i < currentListView.Columns.Count; i++)
{
- for (int j = 0; j < currentListView.Columns.Count; j++)
+ for (var j = 0; j < currentListView.Columns.Count; j++)
{
if (currentListView.Columns[j].DisplayIndex == i)
{
if (tb.Tag != null && tb.Controls.Count > 0)
{
- DetailsListView lst = (DetailsListView)tb.Tag;
- for (int i = 0; i < lst.Columns.Count; i++)
+ var lst = (DetailsListView)tb.Tag;
+ for (var i = 0; i < lst.Columns.Count; i++)
{
lst.Columns[dispOrder[i]].DisplayIndex = i;
lst.Columns[i].Width = currentListView.Columns[i].Width;
{
if (!SettingManager.Common.UseAtIdSupplement) return;
//@マーク
- int cnt = AtIdSupl.ItemCount;
+ var cnt = AtIdSupl.ItemCount;
ShowSuplDialog(StatusText, AtIdSupl);
if (cnt != AtIdSupl.ItemCount)
this.MarkSettingAtIdModified();
dialog.ShowDialog();
}
this.TopMost = SettingManager.Common.AlwaysTop;
- int selStart = owner.SelectionStart;
- string fHalf = "";
- string eHalf = "";
+ var selStart = owner.SelectionStart;
+ var fHalf = "";
+ var eHalf = "";
if (dialog.DialogResult == DialogResult.OK)
{
if (!string.IsNullOrEmpty(dialog.inputText))
{
if (e.KeyCode == Keys.Space || e.KeyCode == Keys.ProcessKey)
{
- bool isSpace = false;
- foreach (char c in StatusText.Text)
+ var isSpace = false;
+ foreach (var c in StatusText.Text)
{
if (c == ' ' || c == ' ')
{
private void StatusText_TextChanged(object sender, EventArgs e)
{
//文字数カウント
- int pLen = this.GetRestStatusCount(this.FormatStatusTextExtended(this.StatusText.Text));
+ var pLen = this.GetRestStatusCount(this.FormatStatusTextExtended(this.StatusText.Text));
lblLen.Text = pLen.ToString();
if (pLen < 0)
{
/// </summary>
private string RemoveAutoPopuratedMentions(string statusText, out long[] autoPopulatedUserIds)
{
- List<long> _autoPopulatedUserIds = new List<long>();
+ var _autoPopulatedUserIds = new List<long>();
var replyToPost = this.inReplyTo != null ? this._statuses[this.inReplyTo.Value.StatusId] : null;
if (replyToPost != null)
private ListViewItem CreateItem(TabModel tab, PostClass Post, int Index)
{
- StringBuilder mk = new StringBuilder();
+ var mk = new StringBuilder();
//if (Post.IsDeleted) mk.Append("×");
//if (Post.IsMark) mk.Append("♪");
//if (Post.IsProtect) mk.Append("Ю");
itm.StateIndex = Post.StateIndex;
itm.Tag = Post;
- bool read = Post.IsRead;
+ var read = Post.IsRead;
// 未読管理していなかったら既読として扱う
if (!tab.UnreadManage || !SettingManager.Common.UnreadManage)
read = true;
RectangleF rct = e.Bounds;
rct.Width = e.Header.Width;
- int fontHeight = e.Item.Font.Height;
+ var fontHeight = e.Item.Font.Height;
if (_iconCol)
{
rct.Y += fontHeight;
rct.Height -= fontHeight;
}
- int drawLineCount = Math.Max(1, Math.DivRem((int)rct.Height, fontHeight, out var heightDiff));
+ var drawLineCount = Math.Max(1, Math.DivRem((int)rct.Height, fontHeight, out var heightDiff));
//if (heightDiff > fontHeight * 0.7)
//{
if (rct.Width > 0)
{
- Color color = (!e.Item.Selected) ? e.Item.ForeColor : //選択されていない行
+ var color = (!e.Item.Selected) ? e.Item.ForeColor : //選択されていない行
(((Control)sender).Focused) ? _clHighLight : //選択中の行
_clUnread;
if (_iconCol)
{
- Rectangle rctB = e.Bounds;
+ var rctB = e.Bounds;
rctB.Width = e.Header.Width;
rctB.Height = fontHeight;
- using (Font fnt = new Font(e.Item.Font, FontStyle.Bold))
+ using (var fnt = new Font(e.Item.Font, FontStyle.Bold))
{
TextRenderer.DrawText(e.Graphics,
post.IsDeleted ? "(DELETED)" : post.TextSingleLine,
{
if (_iconSz == 0) return;
- ImageListViewItem item = (ImageListViewItem)e.Item;
+ var item = (ImageListViewItem)e.Item;
//e.Bounds.Leftが常に0を指すから自前で計算
- Rectangle itemRect = item.Bounds;
+ var itemRect = item.Bounds;
var col0 = e.Item.ListView.Columns[0];
itemRect.Width = col0.Width;
if (item.StateIndex > -1)
{
- Rectangle stateRect = Rectangle.Intersect(new Rectangle(new Point(iconRect.X + realIconSize.Width + 2, iconRect.Y), realStateSize), itemRect);
+ var stateRect = Rectangle.Intersect(new Rectangle(new Point(iconRect.X + realIconSize.Width + 2, iconRect.Y), realStateSize), itemRect);
if (stateRect.Width > 0)
{
//e.Graphics.FillRectangle(Brushes.White, stateRect);
private void AboutMenuItem_Click(object sender, EventArgs e)
{
- using (TweenAboutBox about = new TweenAboutBox())
+ using (var about = new TweenAboutBox())
{
about.ShowDialog(this);
}
return;
TabModel foundTab = null;
- int foundIndex = 0;
+ var foundIndex = 0;
DetailsListView lst = null;
var tab = this.CurrentTab;
if (tab.TabType == MyCommon.TabUsageType.PublicSearch)
{
- Control pnl = this.CurrentTabPage.Controls["panelSearch"];
+ var pnl = this.CurrentTabPage.Controls["panelSearch"];
if (pnl.Controls["comboSearch"].Focused ||
pnl.Controls["comboLang"].Focused ||
pnl.Controls["buttonSearch"].Focused) return;
.Do(() => {
if (StatusText.SelectionStart > 0)
{
- int endidx = StatusText.SelectionStart - 1;
- string startstr = "";
- for (int i = StatusText.SelectionStart - 1; i >= 0; i--)
+ var endidx = StatusText.SelectionStart - 1;
+ var startstr = "";
+ for (var i = StatusText.SelectionStart - 1; i >= 0; i--)
{
- char c = StatusText.Text[i];
+ var c = StatusText.Text[i];
if (Char.IsLetterOrDigit(c) || c == '_')
{
continue;
if (c == '@')
{
startstr = StatusText.Text.Substring(i + 1, endidx - i);
- int cnt = AtIdSupl.ItemCount;
+ var cnt = AtIdSupl.ItemCount;
ShowSuplDialog(StatusText, AtIdSupl, startstr.Length + 1, startstr);
if (AtIdSupl.ItemCount != cnt)
this.MarkSettingAtIdModified();
private void GoNextTab(bool forward)
{
- int idx = this._statuses.SelectedTabIndex;
+ var idx = this._statuses.SelectedTabIndex;
var tabCount = this._statuses.Tabs.Count;
if (forward)
{
private void CopyStot()
{
- string clstr = "";
- StringBuilder sb = new StringBuilder();
+ var clstr = "";
+ var sb = new StringBuilder();
var tab = this.CurrentTab;
- bool IsProtected = false;
+ var IsProtected = false;
var isDm = tab.TabType == MyCommon.TabUsageType.DirectMessage;
foreach (var post in tab.SelectedPosts)
{
var selectedIndex = tab.SelectedIndex;
- int fIdx = 0;
- int toIdx = 0;
- int stp = 1;
+ var fIdx = 0;
+ var toIdx = 0;
+ var stp = 1;
if (forward)
{
stp = -1;
}
- for (int idx = fIdx; idx != toIdx; idx += stp)
+ for (var idx = fIdx; idx != toIdx; idx += stp)
{
if (tab[idx].IsFav)
{
stp = 1;
}
- for (int tabidx = fIdx; tabidx != toIdx; tabidx += stp)
+ for (var tabidx = fIdx; tabidx != toIdx; tabidx += stp)
{
var targetTab = this._statuses.Tabs[tabidx];
stp = -1;
}
- string name = "";
+ var name = "";
if (currentPost.RetweetedId == null)
{
name = currentPost.ScreenName;
{
name = currentPost.RetweetedBy;
}
- for (int idx = fIdx; idx != toIdx; idx += stp)
+ for (var idx = fIdx; idx != toIdx; idx += stp)
{
var post = tab[idx];
if (post.RetweetedId == null)
if (_anchorPost == null) return;
}
- for (int idx = fIdx; idx != toIdx; idx += stp)
+ for (var idx = fIdx; idx != toIdx; idx += stp)
{
var post = tab[idx];
if (post.ScreenName == _anchorPost.ScreenName ||
private void GoAnchor()
{
if (_anchorPost == null) return;
- int idx = this.CurrentTab.IndexOf(_anchorPost.StatusId);
+ var idx = this.CurrentTab.IndexOf(_anchorPost.StatusId);
if (idx == -1) return;
var listView = this.CurrentListView;
{
var listView = this.CurrentListView;
if (listView.SelectedIndices.Count == 0) return;
- int idx = listView.SelectedIndices[0];
+ var idx = listView.SelectedIndices[0];
if (_statuses.SortOrder == SortOrder.Ascending)
{
listView.EnsureVisible(listView.VirtualListSize - 1);
var tabIndex = this._statuses.Tabs.IndexOf(inReplyToTabName);
var tabPage = this.ListTab.TabPages[tabIndex];
- DetailsListView listView = (DetailsListView)tabPage.Tag;
+ var listView = (DetailsListView)tabPage.Tag;
if (this.CurrentTabName != inReplyToTabName)
{
try
{
var postList = posts.ToList();
- for (int i = postList.Count - 1; i >= 0; i--)
+ for (var i = postList.Count - 1; i >= 0; i--)
{
- int index = i;
+ var index = i;
if (postList.FindIndex((pst) => { return pst.Post.StatusId == postList[index].Post.StatusId; }) != index)
{
postList.RemoveAt(index);
}
else
{
- ReplyChain chainHead = replyChains.Pop();
+ var chainHead = replyChains.Pop();
if (chainHead.InReplyToId == currentPost.StatusId)
{
var tab = chainHead.OriginalTab;
var currentTab = this.CurrentTab;
var currentPost = this.CurrentPost;
- int count = this.selectPostChains.Count;
+ var count = this.selectPostChains.Count;
if (count > 0)
{
var (tab, post) = this.selectPostChains.Peek();
{
if (this.selectPostChains.Count <= 2000) return;
var p = new Stack<(TabModel, PostClass)>(2000);
- for (int i = 0; i < 2000; i++)
+ for (var i = 0; i < 2000; i++)
{
p.Push(this.selectPostChains.Pop());
}
this.selectPostChains.Clear();
- for (int i = 0; i < 2000; i++)
+ for (var i = 0; i < 2000; i++)
{
this.selectPostChains.Push(p.Pop());
}
{
var tab = this.CurrentTab;
- DialogResult rslt = MessageBox.Show(string.Format(Properties.Resources.SaveLogMenuItem_ClickText1, Environment.NewLine),
+ var rslt = MessageBox.Show(string.Format(Properties.Resources.SaveLogMenuItem_ClickText1, Environment.NewLine),
Properties.Resources.SaveLogMenuItem_ClickText2,
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (rslt == DialogResult.Cancel) return;
if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
{
if (!SaveFileDialog1.ValidateNames) return;
- using (StreamWriter sw = new StreamWriter(SaveFileDialog1.FileName, false, Encoding.UTF8))
+ using (var sw = new StreamWriter(SaveFileDialog1.FileName, false, Encoding.UTF8))
{
if (rslt == DialogResult.Yes)
{
//All
- for (int idx = 0; idx < tab.AllCount; idx++)
+ for (var idx = 0; idx < tab.AllCount; idx++)
{
var post = tab[idx];
- string protect = "";
+ var protect = "";
if (post.IsProtect) protect = "Protect";
sw.WriteLine(post.Nickname + "\t" +
"\"" + post.TextFromApi.Replace("\n", "").Replace("\"", "\"\"") + "\"" + "\t" +
{
foreach (var post in this.CurrentTab.SelectedPosts)
{
- string protect = "";
+ var protect = "";
if (post.IsProtect) protect = "Protect";
sw.WriteLine(post.Nickname + "\t" +
"\"" + post.TextFromApi.Replace("\n", "").Replace("\"", "\"\"") + "\"" + "\t" +
{
//タブ名変更
newTabName = null;
- using (InputTabName inputName = new InputTabName())
+ using (var inputName = new InputTabName())
{
inputName.TabName = origTabName;
inputName.ShowDialog();
//新タブ名存在チェック
if (this._statuses.ContainsTab(newTabName))
{
- string tmp = string.Format(Properties.Resources.Tabs_DoubleClickText1, newTabName);
+ var tmp = string.Format(Properties.Resources.Tabs_DoubleClickText1, newTabName);
MessageBox.Show(tmp, Properties.Resources.Tabs_DoubleClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return false;
}
if (!e.Data.GetDataPresent(typeof(TabPage))) return;
_tabDrag = false;
- string tn = "";
- bool bef = false;
- Point cpos = new Point(e.X, e.Y);
- Point spos = ListTab.PointToClient(cpos);
+ var tn = "";
+ var bef = false;
+ var cpos = new Point(e.X, e.Y);
+ var spos = ListTab.PointToClient(cpos);
foreach (var (tab, index) in this._statuses.Tabs.WithIndex())
{
- Rectangle rect = ListTab.GetTabRect(index);
+ var rect = ListTab.GetTabRect(index);
if (rect.Contains(spos))
{
tn = tab.TabName;
bef = false;
}
- TabPage tp = (TabPage)e.Data.GetData(typeof(TabPage));
+ var tp = (TabPage)e.Data.GetData(typeof(TabPage));
if (tp.Text == tn) return;
ReOrderTab(tp.Text, tn, bef);
else
{
//1件選んでCtrl-Rの場合(返信先操作せず)
- int sidx = StatusText.SelectionStart;
- string id = "@" + post.ScreenName + " ";
+ var sidx = StatusText.SelectionStart;
+ var id = "@" + post.ScreenName + " ";
if (sidx > 0)
{
if (StatusText.Text.Substring(sidx - 1, 1) != " ")
{
//Enter or DoubleClick
- string sTxt = StatusText.Text;
+ var sTxt = StatusText.Text;
if (!sTxt.StartsWith(". ", StringComparison.Ordinal))
{
sTxt = ". " + sTxt;
{
//複数ポスト選択
- string ids = "";
- int sidx = StatusText.SelectionStart;
+ var ids = "";
+ var sidx = StatusText.SelectionStart;
foreach (var post in selectedPosts)
{
if (!ids.Contains("@" + post.ScreenName + " ") && post.UserId != tw.UserId)
if (!ids.Contains("@" + screenName + " ") &&
!screenName.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
{
- Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + screenName + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
+ var m = Regex.Match(post.TextFromApi, "[@@](?<id>" + screenName + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
if (m.Success)
ids += "@" + m.Result("${id}") + " ";
else
{
//1件のみ選択のC-S-r(返信元付加する可能性あり)
- string ids = "";
- int sidx = StatusText.SelectionStart;
+ var ids = "";
+ var sidx = StatusText.SelectionStart;
var post = selectedPosts.Single();
if (!ids.Contains("@" + post.ScreenName + " ") && post.UserId != tw.UserId)
{
if (!ids.Contains("@" + screenName + " ") &&
!screenName.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
{
- Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + screenName + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
+ var m = Regex.Match(post.TextFromApi, "[@@](?<id>" + screenName + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
if (m.Success)
ids += "@" + m.Result("${id}") + " ";
else
this.SoundFileTbComboBox.Items.Clear();
SoundFileComboBox.Items.Add("");
this.SoundFileTbComboBox.Items.Add("");
- DirectoryInfo oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
+ var oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
if (Directory.Exists(Path.Combine(Application.StartupPath, "Sounds")))
{
oDir = oDir.GetDirectories("Sounds")[0];
}
- foreach (FileInfo oFile in oDir.GetFiles("*.wav"))
+ foreach (var oFile in oDir.GetFiles("*.wav"))
{
SoundFileComboBox.Items.Add(oFile.Name);
this.SoundFileTbComboBox.Items.Add(oFile.Name);
}
- int idx = SoundFileComboBox.Items.IndexOf(tb.SoundFile);
+ var idx = SoundFileComboBox.Items.IndexOf(tb.SoundFile);
if (idx == -1) idx = 0;
SoundFileComboBox.SelectedIndex = idx;
this.SoundFileTbComboBox.SelectedIndex = idx;
{
string tabName = null;
MyCommon.TabUsageType tabUsage;
- using (InputTabName inputName = new InputTabName())
+ using (var inputName = new InputTabName())
{
inputName.TabName = _statuses.MakeTabName("MyTab");
inputName.IsShowUsage = true;
ListElement list = null;
if (tabUsage == MyCommon.TabUsageType.Lists)
{
- using (ListAvailable listAvail = new ListAvailable())
+ using (var listAvail = new ListAvailable())
{
if (listAvail.ShowDialog(this) == DialogResult.Cancel) return;
if (listAvail.SelectedList == null) return;
if (!_statuses.AddTab(tab) || !AddNewTab(tab, startup: false))
{
- string tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName);
+ var tmp = string.Format(Properties.Resources.AddTabMenuItem_ClickText1, tabName);
MessageBox.Show(tmp, Properties.Resources.AddTabMenuItem_ClickText2, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
if (StatusText.Focused)
{
- bool _NewLine = false;
- bool _Post = false;
+ var _NewLine = false;
+ var _Post = false;
if (SettingManager.Common.PostCtrlEnter) //Ctrl+Enter投稿時
{
if (_NewLine)
{
- int pos1 = StatusText.SelectionStart;
+ var pos1 = StatusText.SelectionStart;
if (StatusText.SelectionLength > 0)
{
StatusText.Text = StatusText.Text.Remove(pos1, StatusText.SelectionLength); //選択状態文字列削除
if (screenNameArray.Length != 0)
{
- List<string> atids = new List<string>();
+ var atids = new List<string>();
foreach (var screenName in screenNameArray)
{
atids.Add("@" + screenName);
}
- int cnt = AtIdSupl.ItemCount;
+ var cnt = AtIdSupl.ItemCount;
AtIdSupl.AddRangeItem(atids.ToArray());
if (AtIdSupl.ItemCount != cnt)
this.MarkSettingAtIdModified();
//新規タブを選択→タブ作成
if (tabName == null)
{
- using (InputTabName inputName = new InputTabName())
+ using (var inputName = new InputTabName())
{
inputName.TabName = _statuses.MakeTabName("MyTab");
inputName.ShowDialog();
var tab = new FilterTabModel(tabName);
if (!_statuses.AddTab(tab) || !AddNewTab(tab, startup: false))
{
- string tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText2, tabName);
+ var tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText2, tabName);
MessageBox.Show(tmp, Properties.Resources.IDRuleMenuItem_ClickText3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
//もう一度タブ名入力
}
{
{
//移動するか?
- string _tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText4, Environment.NewLine);
+ var _tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText4, Environment.NewLine);
if (MessageBox.Show(_tmp, Properties.Resources.IDRuleMenuItem_ClickText5, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
move = false;
else
if (!move)
{
//マークするか?
- string _tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText6, Environment.NewLine);
+ var _tmp = string.Format(Properties.Resources.IDRuleMenuItem_ClickText6, Environment.NewLine);
if (MessageBox.Show(_tmp, Properties.Resources.IDRuleMenuItem_ClickText7, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
mark = true;
else
var listView = this.CurrentListView;
if (listView.SelectedIndices.Count == 0) return;
- int idx = listView.SelectedIndices[0];
+ var idx = listView.SelectedIndices[0];
_item = listView.GetItemAt(0, 25);
if (_item == null)
{
if (showWarning)
{
- string tmp = string.Format(Properties.Resources.ClearTabMenuItem_ClickText1, Environment.NewLine);
+ var tmp = string.Format(Properties.Resources.ClearTabMenuItem_ClickText1, Environment.NewLine);
if (MessageBox.Show(tmp, tabName + " " + Properties.Resources.ClearTabMenuItem_ClickText2, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
{
return;
private void SetMainWindowTitle()
{
//メインウインドウタイトルの書き換え
- StringBuilder ttl = new StringBuilder(256);
- int ur = 0;
- int al = 0;
+ var ttl = new StringBuilder(256);
+ var ur = 0;
+ var al = 0;
if (SettingManager.Common.DispLatestPost != MyCommon.DispTitleEnum.None &&
SettingManager.Common.DispLatestPost != MyCommon.DispTitleEnum.Post &&
SettingManager.Common.DispLatestPost != MyCommon.DispTitleEnum.Ver &&
//ステータス欄にカウント表示
//タブ未読数/タブ発言数 全未読数/総発言数 (未読@+未読DM数)
if (_statuses == null) return "";
- TabModel tbRep = _statuses.GetTabByType(MyCommon.TabUsageType.Mentions);
- TabModel tbDm = _statuses.GetTabByType(MyCommon.TabUsageType.DirectMessage);
+ var tbRep = _statuses.GetTabByType(MyCommon.TabUsageType.Mentions);
+ var tbDm = _statuses.GetTabByType(MyCommon.TabUsageType.DirectMessage);
if (tbRep == null || tbDm == null) return "";
- int urat = tbRep.UnreadCount + tbDm.UnreadCount;
- int ur = 0;
- int al = 0;
- int tur = 0;
- int tal = 0;
- StringBuilder slbl = new StringBuilder(256);
+ var urat = tbRep.UnreadCount + tbDm.UnreadCount;
+ var ur = 0;
+ var al = 0;
+ var tur = 0;
+ var tal = 0;
+ var slbl = new StringBuilder(256);
try
{
foreach (var tab in _statuses.Tabs)
MatchCollection m;
//ハッシュタグの保存
m = Regex.Matches(StatusText, Twitter.HASHTAG, RegexOptions.IgnoreCase);
- string hstr = "";
+ var hstr = "";
foreach (Match hm in m)
{
if (!hstr.Contains("#" + hm.Result("$3") + " "))
if (SettingManager.Common.UseAtIdSupplement)
{
- int bCnt = AtIdSupl.ItemCount;
+ var bCnt = AtIdSupl.ItemCount;
foreach (Match mid in m)
{
AtIdSupl.AddItem(mid.Result("${id}"));
if (StatusText.Multiline)
{
var statusTextHeight = ScaleBy(configScaleFactor.Height, SettingManager.Local.StatusTextHeight);
- int dis = SplitContainer2.Height - statusTextHeight - SplitContainer2.SplitterWidth;
+ var dis = SplitContainer2.Height - statusTextHeight - SplitContainer2.SplitterWidth;
if (dis > SplitContainer2.Panel1MinSize && dis < SplitContainer2.Height - SplitContainer2.Panel2MinSize - SplitContainer2.SplitterWidth)
{
SplitContainer2.SplitterDistance = SplitContainer2.Height - statusTextHeight - SplitContainer2.SplitterWidth;
}
if (_statuses.ContainsKey(currentPost.InReplyToStatusId.Value))
{
- PostClass repPost = _statuses[currentPost.InReplyToStatusId.Value];
+ var repPost = _statuses[currentPost.InReplyToStatusId.Value];
MessageBox.Show($"{repPost.ScreenName} / {repPost.Nickname} ({repPost.CreatedAt.ToLocalTimeString()})" + Environment.NewLine + repPost.TextFromApi);
}
else
{
- foreach (TabModel tb in _statuses.GetTabsByType(MyCommon.TabUsageType.Lists | MyCommon.TabUsageType.PublicSearch))
+ foreach (var tb in _statuses.GetTabsByType(MyCommon.TabUsageType.Lists | MyCommon.TabUsageType.PublicSearch))
{
if (tb == null || !tb.Contains(currentPost.InReplyToStatusId.Value)) break;
- PostClass repPost = _statuses[currentPost.InReplyToStatusId.Value];
+ var repPost = _statuses[currentPost.InReplyToStatusId.Value];
MessageBox.Show($"{repPost.ScreenName} / {repPost.Nickname} ({repPost.CreatedAt.ToLocalTimeString()})" + Environment.NewLine + repPost.TextFromApi);
return;
}
//Appendix A. Collected ABNF for URI
//http://www.ietf.org/rfc/rfc3986.txt
- string result = "";
+ var result = "";
const string nico = @"^https?://[a-z]+\.(nicovideo|niconicommons|nicolive)\.jp/[a-z]+/[a-z0-9]+$";
if (StatusText.SelectionLength > 0)
{
- string tmp = StatusText.SelectedText;
+ var tmp = StatusText.SelectedText;
// httpから始まらない場合、ExcludeStringで指定された文字列で始まる場合は対象としない
if (tmp.StartsWith("http", StringComparison.OrdinalIgnoreCase))
{
if (!string.IsNullOrEmpty(result))
{
- urlUndo undotmp = new urlUndo();
+ var undotmp = new urlUndo();
// 短縮 URL が生成されるまでの間に投稿欄から元の URL が削除されていたら中断する
var origUrlIndex = this.StatusText.Text.IndexOf(tmp, StringComparison.Ordinal);
foreach (Match mt in Regex.Matches(StatusText.Text, url, RegexOptions.IgnoreCase))
{
if (StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal) == -1) continue;
- string tmp = mt.Result("${url}");
+ var tmp = mt.Result("${url}");
if (tmp.StartsWith("w", StringComparison.OrdinalIgnoreCase)) tmp = "http://" + tmp;
- urlUndo undotmp = new urlUndo();
+ var undotmp = new urlUndo();
//選んだURLを選択(?)
StatusText.Select(StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal), mt.Result("${url}").Length);
{
if (urlUndoBuffer != null)
{
- string tmp = StatusText.Text;
- foreach (urlUndo data in urlUndoBuffer)
+ var tmp = StatusText.Text;
+ foreach (var data in urlUndoBuffer)
{
tmp = tmp.Replace(data.After, data.Before);
}
{
if (!await UrlConvertAsync(SettingManager.Common.AutoShortUrlFirst))
{
- MyCommon.UrlConverter svc = SettingManager.Common.AutoShortUrlFirst;
- Random rnd = new Random();
+ var svc = SettingManager.Common.AutoShortUrlFirst;
+ var rnd = new Random();
// 前回使用した短縮URLサービス以外を選択する
do
{
private void MyList_ColumnReordered(object sender, ColumnReorderedEventArgs e)
{
- DetailsListView lst = (DetailsListView)sender;
+ var lst = (DetailsListView)sender;
if (SettingManager.Local == null) return;
if (_iconCol)
}
else
{
- int[] darr = new int[lst.Columns.Count];
- for (int i = 0; i < lst.Columns.Count; i++)
+ var darr = new int[lst.Columns.Count];
+ for (var i = 0; i < lst.Columns.Count; i++)
{
darr[lst.Columns[i].DisplayIndex] = i;
}
MyCommon.MoveArrayItem(darr, e.OldDisplayIndex, e.NewDisplayIndex);
- for (int i = 0; i < lst.Columns.Count; i++)
+ for (var i = 0; i < lst.Columns.Count; i++)
{
switch (darr[i])
{
private void MyList_ColumnWidthChanged(object sender, ColumnWidthChangedEventArgs e)
{
- DetailsListView lst = (DetailsListView)sender;
+ var lst = (DetailsListView)sender;
if (SettingManager.Local == null) return;
var modified = false;
}
else if (e.Data.GetDataPresent(DataFormats.StringFormat))
{
- string data = (string)e.Data.GetData(DataFormats.StringFormat, true);
+ var data = (string)e.Data.GetData(DataFormats.StringFormat, true);
if (data != null) StatusText.Text += data;
}
}
public bool IsNetworkAvailable()
{
- bool nw = true;
+ var nw = true;
nw = MyCommon.IsNetworkAvailable();
_myStatusOnline = nw;
return nw;
{
return Task.Run(() =>
{
- string myPath = UriString;
+ var myPath = UriString;
try
{
{
if (configBrowserPath.StartsWith("\"", StringComparison.Ordinal) && configBrowserPath.Length > 2 && configBrowserPath.IndexOf("\"", 2, StringComparison.Ordinal) > -1)
{
- int sep = configBrowserPath.IndexOf("\"", 2, StringComparison.Ordinal);
- string browserPath = configBrowserPath.Substring(1, sep - 1);
- string arg = "";
+ var sep = configBrowserPath.IndexOf("\"", 2, StringComparison.Ordinal);
+ var browserPath = configBrowserPath.Substring(1, sep - 1);
+ var arg = "";
if (sep < configBrowserPath.Length - 1)
{
arg = configBrowserPath.Substring(sep + 1);
}
else
{
- for (int i = 0; i < listView.Columns.Count; i++)
+ for (var i = 0; i < listView.Columns.Count; i++)
{
listView.Columns[i].Text = ColumnText[i];
}
private void SelectListItem(DetailsListView LView, int Index)
{
//単一
- Rectangle bnd = new Rectangle();
- bool flg = false;
+ var bnd = new Rectangle();
+ var flg = false;
var item = LView.FocusedItem;
if (item != null)
{
private void SelectListItem(DetailsListView LView , int[] Index, int focusedIndex, int selectionMarkIndex)
{
//複数
- Rectangle bnd = new Rectangle();
- bool flg = false;
+ var bnd = new Rectangle();
+ var flg = false;
var item = LView.FocusedItem;
if (item != null)
{
}
else if (selectedPosts.Length > 1)
{
- string QuestionText = Properties.Resources.RetweetQuestion2;
+ var QuestionText = Properties.Resources.RetweetQuestion2;
if (_DoFavRetweetFlags) QuestionText = Properties.Resources.FavoriteRetweetQuestionText1;
switch (MessageBox.Show(QuestionText, "Retweet", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
{
{
if (!SettingManager.Common.RetweetNoConfirm)
{
- string Questiontext = Properties.Resources.RetweetQuestion1;
+ var Questiontext = Properties.Resources.RetweetQuestion1;
if (_DoFavRetweetFlags) Questiontext = Properties.Resources.FavoritesRetweetQuestionText2;
if (isConfirm && MessageBox.Show(Questiontext, "Retweet", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
{
return;
}
- string result = "";
+ var result = "";
if (isFollowing)
{
result = Properties.Resources.GetFriendshipInfo1 + System.Environment.NewLine;
internal async Task ShowFriendship(string[] ids)
{
- foreach (string id in ids)
+ foreach (var id in ids)
{
bool isFollowing, isFollowed;
return;
}
- string result = "";
- string ff = "";
+ var result = "";
+ var ff = "";
ff = " ";
if (isFollowing)
MessageBox.Show("Protected.");
return;
}
- string rtdata = post.Text;
+ var rtdata = post.Text;
rtdata = CreateRetweetUnofficial(rtdata, this.StatusText.Multiline);
var selection = (this.StatusText.SelectionStart, this.StatusText.SelectionLength);
private async void SearchButton_Click(object sender, EventArgs e)
{
//公式検索
- Control pnl = ((Control)sender).Parent;
+ var pnl = ((Control)sender).Parent;
if (pnl == null) return;
- string tbName = pnl.Parent.Text;
+ var tbName = pnl.Parent.Text;
var tb = (PublicSearchTabModel)_statuses.Tabs[tbName];
- ComboBox cmb = (ComboBox)pnl.Controls["comboSearch"];
- ComboBox cmbLang = (ComboBox)pnl.Controls["comboLang"];
+ var cmb = (ComboBox)pnl.Controls["comboSearch"];
+ var cmbLang = (ComboBox)pnl.Controls["comboLang"];
cmb.Text = cmb.Text.Trim();
// 検索式演算子 OR についてのみ大文字しか認識しないので強制的に大文字とする
- bool Quote = false;
- StringBuilder buf = new StringBuilder();
- char[] c = cmb.Text.ToCharArray();
- for (int cnt = 0; cnt < cmb.Text.Length; cnt++)
+ var Quote = false;
+ var buf = new StringBuilder();
+ var c = cmb.Text.ToCharArray();
+ for (var cnt = 0; cnt < cmb.Text.Length; cnt++)
{
if (cnt > cmb.Text.Length - 4)
{
}
if (queryChanged)
{
- int idx = cmb.Items.IndexOf(tb.SearchWords);
+ var idx = cmb.Items.IndexOf(tb.SearchWords);
if (idx > -1) cmb.Items.RemoveAt(idx);
cmb.Items.Insert(0, tb.SearchWords);
cmb.Text = tb.SearchWords;
{
DetailsListView listView = null;
- TabModel tb = _statuses.RemovedTab.Pop();
+ var tb = _statuses.RemovedTab.Pop();
if (tb.TabType == MyCommon.TabUsageType.Related)
{
var relatedTab = _statuses.GetTabByType(MyCommon.TabUsageType.Related);
else
{
const string TabName = "Related Tweets";
- string renamed = TabName;
- for (int i = 2; i <= 100; i++)
+ var renamed = TabName;
+ for (var i = 2; i <= 100; i++)
{
if (!_statuses.ContainsTab(renamed)) break;
renamed = TabName + i;
}
else
{
- string renamed = tb.TabName;
- for (int i = 1; i < int.MaxValue; i++)
+ var renamed = tb.TabName;
+ for (var i = 1; i < int.MaxValue; i++)
{
if (!_statuses.ContainsTab(renamed)) break;
renamed = tb.TabName + "(" + i + ")";
private void SearchControls_Enter(object sender, EventArgs e)
{
- Control pnl = (Control)sender;
+ var pnl = (Control)sender;
foreach (Control ctl in pnl.Controls)
{
ctl.TabStop = true;
private void SearchControls_Leave(object sender, EventArgs e)
{
- Control pnl = (Control)sender;
+ var pnl = (Control)sender;
foreach (Control ctl in pnl.Controls)
{
ctl.TabStop = false;
private void HashManageMenuItem_Click(object sender, EventArgs e)
{
- DialogResult rslt = DialogResult.Cancel;
+ var rslt = DialogResult.Cancel;
try
{
rslt = HashMgr.ShowDialog();
private void ListManageToolStripMenuItem_Click(object sender, EventArgs e)
{
- using (ListManage form = new ListManage(tw))
+ using (var form = new ListManage(tw))
{
form.ShowDialog(this);
}
private void CacheInfoMenuItem_Click(object sender, EventArgs e)
{
- StringBuilder buf = new StringBuilder();
+ var buf = new StringBuilder();
//buf.AppendFormat("キャッシュメモリ容量 : {0}bytes({1}MB)" + Environment.NewLine, IconCache.CacheMemoryLimit, ((ImageDictionary)IconCache).CacheMemoryLimit / 1048576);
//buf.AppendFormat("物理メモリ使用割合 : {0}%" + Environment.NewLine, IconCache.PhysicalMemoryLimit);
buf.AppendFormat("キャッシュエントリ保持数 : {0}" + Environment.NewLine, IconCache.CacheCount);
NotifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
//if (SettingDialog.DispUsername) NotifyIcon1.BalloonTipTitle = tw.Username + " - "; else NotifyIcon1.BalloonTipTitle = "";
//NotifyIcon1.BalloonTipTitle += Application.ProductName + " [" + ev.Event.ToUpper() + "] by " + ((string)(!string.IsNullOrEmpty(ev.Username) ? ev.Username : ""), string);
- StringBuilder title = new StringBuilder();
+ var title = new StringBuilder();
if (SettingManager.Common.DispUsername)
{
title.Append(tw.Username);
}
//サウンド再生
- string snd = SettingManager.Common.EventSoundFile;
+ var snd = SettingManager.Common.EventSoundFile;
if (!_initial && SettingManager.Common.PlaySound && !string.IsNullOrEmpty(snd))
{
if ((ev.Eventtype & SettingManager.Common.EventNotifyFlag) != 0 && IsMyEventNotityAsEventType(ev))
{
try
{
- string dir = Application.StartupPath;
+ var dir = Application.StartupPath;
if (Directory.Exists(Path.Combine(dir, "Sounds")))
{
dir = Path.Combine(dir, "Sounds");
}
- using (SoundPlayer player = new SoundPlayer(Path.Combine(dir, snd)))
+ using (var player = new SoundPlayer(Path.Combine(dir, snd)))
{
player.Play();
}
{
if (TrackToolStripMenuItem.Checked)
{
- using (InputTabName inputForm = new InputTabName())
+ using (var inputForm = new InputTabName())
{
inputForm.TabName = inputTrack;
inputForm.FormTitle = "Input track word";
{
var id = this.CurrentPost?.ScreenName ?? "";
- using (InputTabName inputName = new InputTabName())
+ using (var inputName = new InputTabName())
{
inputName.FormTitle = caption;
inputName.FormDescription = Properties.Resources.FRMessage1;
private async void UserTimelineToolStripMenuItem_Click(object sender, EventArgs e)
{
- string id = GetUserIdFromCurPostOrInput("Show UserTimeline");
+ var id = GetUserIdFromCurPostOrInput("Show UserTimeline");
if (!string.IsNullOrEmpty(id))
{
await this.AddNewTabForUserTimeline(id);
var post = this.CurrentPost;
if (post != null)
{
- string xUrl = SettingManager.Common.UserAppointUrl;
+ var xUrl = SettingManager.Common.UserAppointUrl;
xUrl = xUrl.Replace("{ID}", post.ScreenName);
var statusId = post.RetweetedId ?? post.StatusId;
protected T GetApplicationAttribute<T>() where T : Attribute
{
- Assembly currentAssembly = Assembly.GetExecutingAssembly();
+ var currentAssembly = Assembly.GetExecutingAssembly();
return (T) Attribute.GetCustomAttribute(currentAssembly, typeof(T));
}
if (this.DumpPostClass)
{
- StringBuilder sb = new StringBuilder(512);
+ var sb = new StringBuilder(512);
sb.Append("-----Start PostClass Dump<br>");
sb.AppendFormat("TextFromApi : {0}<br>", post.TextFromApi);
sb.AppendFormat("IsRead : {0}<br>", post.IsRead);
sb.AppendFormat("IsReply : {0}<br>", post.IsReply);
- foreach (string nm in post.ReplyToList.Select(x => x.ScreenName))
+ foreach (var nm in post.ReplyToList.Select(x => x.ScreenName))
{
sb.AppendFormat("ReplyToList : {0}<br>", nm);
}
sb.AppendFormat("Media.Count : {0}<br>", post.Media.Count);
if (post.Media.Count > 0)
{
- for (int i = 0; i < post.Media.Count; i++)
+ for (var i = 0; i < post.Media.Count; i++)
{
var info = post.Media[i];
sb.AppendFormat("Media[{0}].Url : {1}<br>", i, info.Url);
private async Task DoSearchToolStrip(string url)
{
//発言詳細で「選択文字列で検索」(選択文字列取得)
- string _selText = this.PostBrowser.GetSelectedText();
+ var _selText = this.PostBrowser.GetSelectedText();
if (_selText != null)
{
return;
}
- string tmp = string.Format(url, Uri.EscapeDataString(_selText));
+ var tmp = string.Format(url, Uri.EscapeDataString(_selText));
await this.Owner.OpenUriInBrowserAsync(tmp);
}
}
private string GetUserId()
{
- Match m = Regex.Match(this._postBrowserStatusText, @"^https?://twitter.com/(#!/)?(?<ScreenName>[a-zA-Z0-9_]+)(/status(es)?/[0-9]+)?$");
+ var m = Regex.Match(this._postBrowserStatusText, @"^https?://twitter.com/(#!/)?(?<ScreenName>[a-zA-Z0-9_]+)(/status(es)?/[0-9]+)?$");
if (m.Success && this.Owner.IsTwitterId(m.Result("${ScreenName}")))
return m.Result("${ScreenName}");
else
//発言詳細のアイコン右クリック時のメニュー制御
if (this.CurrentPost != null)
{
- string name = this.CurrentPost.ImageUrl;
+ var name = this.CurrentPost.ImageUrl;
if (!string.IsNullOrEmpty(name))
{
- int idx = name.LastIndexOf('/');
+ var idx = name.LastIndexOf('/');
if (idx != -1)
{
name = Path.GetFileName(name.Substring(idx));
{
using (Image orgBmp = new Bitmap(IconCache.TryGetFromCache(imageUrl).Image))
{
- using (Bitmap bmp2 = new Bitmap(orgBmp.Size.Width, orgBmp.Size.Height))
+ using (var bmp2 = new Bitmap(orgBmp.Size.Width, orgBmp.Size.Height))
{
- using (Graphics g = Graphics.FromImage(bmp2))
+ using (var g = Graphics.FromImage(bmp2))
{
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
g.DrawImage(orgBmp, 0, 0, orgBmp.Size.Width, orgBmp.Size.Height);
if (PostBrowser.StatusText.StartsWith("http", StringComparison.Ordinal))
{
this._postBrowserStatusText = PostBrowser.StatusText;
- string name = GetUserId();
+ var name = GetUserId();
UrlCopyContextMenuItem.Enabled = true;
if (name != null)
{
ListManageUserContextToolStripMenuItem.Enabled = false;
}
// 文字列選択されていないときは選択文字列関係の項目を非表示に
- string _selText = this.PostBrowser.GetSelectedText();
+ var _selText = this.PostBrowser.GetSelectedText();
if (_selText == null)
{
SelectionSearchContextMenuItem.Enabled = false;
SelectionTranslationToolStripMenuItem.Enabled = true;
}
//発言内に自分以外のユーザーが含まれてればフォロー状態全表示を有効に
- MatchCollection ma = Regex.Matches(this.PostBrowser.DocumentText, @"href=""https?://twitter.com/(#!/)?(?<ScreenName>[a-zA-Z0-9_]+)(/status(es)?/[0-9]+)?""");
- bool fAllFlag = false;
+ var ma = Regex.Matches(this.PostBrowser.DocumentText, @"href=""https?://twitter.com/(#!/)?(?<ScreenName>[a-zA-Z0-9_]+)(/status(es)?/[0-9]+)?""");
+ var fAllFlag = false;
foreach (Match mu in ma)
{
if (!mu.Result("${ScreenName}").Equals(this.Owner.TwitterInstance.Username, StringComparison.InvariantCultureIgnoreCase))
private void CurrentTabToolStripMenuItem_Click(object sender, EventArgs e)
{
//発言詳細の選択文字列で現在のタブを検索
- string _selText = this.PostBrowser.GetSelectedText();
+ var _selText = this.PostBrowser.GetSelectedText();
if (_selText != null)
{
private void SelectionCopyContextMenuItem_Click(object sender, EventArgs e)
{
//発言詳細で「選択文字列をコピー」
- string _selText = this.PostBrowser.GetSelectedText();
+ var _selText = this.PostBrowser.GetSelectedText();
try
{
Clipboard.SetDataObject(_selText, false, 5, 100);
private async void FollowContextMenuItem_Click(object sender, EventArgs e)
{
- string name = GetUserId();
+ var name = GetUserId();
if (name != null)
await this.Owner.FollowCommand(name);
}
private async void RemoveContextMenuItem_Click(object sender, EventArgs e)
{
- string name = GetUserId();
+ var name = GetUserId();
if (name != null)
await this.Owner.RemoveCommand(name, false);
}
private async void FriendshipContextMenuItem_Click(object sender, EventArgs e)
{
- string name = GetUserId();
+ var name = GetUserId();
if (name != null)
await this.Owner.ShowFriendship(name);
}
private async void FriendshipAllMenuItem_Click(object sender, EventArgs e)
{
- MatchCollection ma = Regex.Matches(this.PostBrowser.DocumentText, @"href=""https?://twitter.com/(#!/)?(?<ScreenName>[a-zA-Z0-9_]+)(/status(es)?/[0-9]+)?""");
- List<string> ids = new List<string>();
+ var ma = Regex.Matches(this.PostBrowser.DocumentText, @"href=""https?://twitter.com/(#!/)?(?<ScreenName>[a-zA-Z0-9_]+)(/status(es)?/[0-9]+)?""");
+ var ids = new List<string>();
foreach (Match mu in ma)
{
if (!mu.Result("${ScreenName}").Equals(this.Owner.TwitterInstance.Username, StringComparison.InvariantCultureIgnoreCase))
private async void ShowUserStatusContextMenuItem_Click(object sender, EventArgs e)
{
- string name = GetUserId();
+ var name = GetUserId();
if (name != null)
await this.Owner.ShowUserStatus(name);
}
private async void SearchPostsDetailToolStripMenuItem_Click(object sender, EventArgs e)
{
- string name = GetUserId();
+ var name = GetUserId();
if (name != null)
await this.Owner.AddNewTabForUserTimeline(name);
}
private void SearchAtPostsDetailToolStripMenuItem_Click(object sender, EventArgs e)
{
- string name = GetUserId();
+ var name = GetUserId();
if (name != null) this.Owner.AddNewTabForSearch("@" + name);
}
private void IdFilterAddMenuItem_Click(object sender, EventArgs e)
{
- string name = GetUserId();
+ var name = GetUserId();
if (name != null)
this.Owner.AddFilterRuleByScreenName(name);
}
private void ListManageUserContextToolStripMenuItem_Click(object sender, EventArgs e)
{
- ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
+ var menuItem = (ToolStripMenuItem)sender;
string user;
if (menuItem.Owner == this.ContextMenuPostBrowser)
private void UseHashtagMenuItem_Click(object sender, EventArgs e)
{
- Match m = Regex.Match(this._postBrowserStatusText, @"^https?://twitter.com/search\?q=%23(?<hash>.+)$");
+ var m = Regex.Match(this._postBrowserStatusText, @"^https?://twitter.com/search\?q=%23(?<hash>.+)$");
if (m.Success)
this.Owner.SetPermanentHashtag(Uri.UnescapeDataString(m.Groups["hash"].Value));
}
if (thumbnails.Length == 0)
return;
- for (int i = 0; i < thumbnails.Length; i++)
+ for (var i = 0; i < thumbnails.Length; i++)
{
var thumb = thumbnails[i];
var picbox = this.pictureBox[i];
this.scrollBar.Maximum = (count > 0) ? count - 1 : 0;
this.scrollBar.Value = 0;
- for (int i = 0; i < count; i++)
+ for (var i = 0; i < count; i++)
{
var picbox = CreatePictureBox("pictureBox" + i);
picbox.Visible = (i == 0);
}
}
//HTMLに整形
- string textFromApi = post.TextFromApi;
+ var textFromApi = post.TextFromApi;
var quotedStatusLink = (status.RetweetedStatus ?? status).QuotedStatusPermalink;
private async Task StreamLoop(CancellationToken cancellationToken)
{
- TimeSpan sleep = TimeSpan.Zero;
+ var sleep = TimeSpan.Zero;
for (; ; )
{
if (sleep != TimeSpan.Zero)
OpenFileDialogIcon.Title = Properties.Resources.ChangeIconToolStripMenuItem_ClickText2;
OpenFileDialogIcon.FileName = "";
- DialogResult rslt = OpenFileDialogIcon.ShowDialog();
+ var rslt = OpenFileDialogIcon.ShowDialog();
if (rslt != DialogResult.OK)
{
return;
}
- string fn = OpenFileDialogIcon.FileName;
+ var fn = OpenFileDialogIcon.FileName;
if (this.IsValidIconFile(new FileInfo(fn)))
{
await this.DoChangeIcon(fn);
if (ret != DialogResult.OK)
return;
- string filename = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0];
+ var filename = ((string[])e.Data.GetData(DataFormats.FileDrop, false))[0];
await this.DoChangeIcon(filename);
}
}