本文整理汇总了C#中MyCommon类的典型用法代码示例。如果您正苦于以下问题:C# MyCommon类的具体用法?C# MyCommon怎么用?C# MyCommon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyCommon类属于命名空间,在下文中一共展示了MyCommon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IsEventNotifyAsEventType
private bool IsEventNotifyAsEventType(MyCommon.EVENTTYPE type)
{
return this._cfgCommon.EventNotifyEnabled && (type & this._cfgCommon.EventNotifyFlag) != 0 || type == MyCommon.EVENTTYPE.None;
}
开发者ID:nanayaT,项目名称:OpenTween,代码行数:4,代码来源:Tween.cs
示例2: CreateDirectMessagesFromJson
private string CreateDirectMessagesFromJson(string content, MyCommon.WORKERTYPE gType, bool read)
{
List<TwitterDataModel.Directmessage> item;
try
{
if (gType == MyCommon.WORKERTYPE.UserStream)
{
var itm = MyCommon.CreateDataFromJson<List<TwitterDataModel.DirectmessageEvent>>(content);
item = new List<TwitterDataModel.Directmessage>();
foreach (var dat in itm)
{
item.Add(dat.Directmessage);
}
}
else
{
item = MyCommon.CreateDataFromJson<List<TwitterDataModel.Directmessage>>(content);
}
}
catch(SerializationException ex)
{
MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
return "Json Parse Error(DataContractJsonSerializer)";
}
catch(Exception ex)
{
MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
return "Invalid Json!";
}
foreach (var message in item)
{
var post = new PostClass();
try
{
post.StatusId = message.Id;
if (gType != MyCommon.WORKERTYPE.UserStream)
{
if (gType == MyCommon.WORKERTYPE.DirectMessegeRcv)
{
if (minDirectmessage > post.StatusId) minDirectmessage = post.StatusId;
}
else
{
if (minDirectmessageSent > post.StatusId) minDirectmessageSent = post.StatusId;
}
}
//二重取得回避
lock (LockObj)
{
if (TabInformations.GetInstance().GetTabByType(MyCommon.TabUsageType.DirectMessage).Contains(post.StatusId)) continue;
}
//sender_id
//recipient_id
post.CreatedAt = MyCommon.DateTimeParse(message.CreatedAt);
//本文
post.TextFromApi = message.Text;
//HTMLに整形
post.Text = CreateHtmlAnchor(post.TextFromApi, post.ReplyToList, post.Media);
post.TextFromApi = HttpUtility.HtmlDecode(post.TextFromApi);
post.TextFromApi = post.TextFromApi.Replace("<3", "?");
post.IsFav = false;
//以下、ユーザー情報
TwitterDataModel.User user;
if (gType == MyCommon.WORKERTYPE.UserStream)
{
if (twCon.AuthenticatedUsername.Equals(message.Recipient.ScreenName, StringComparison.CurrentCultureIgnoreCase))
{
user = message.Sender;
post.IsMe = false;
post.IsOwl = true;
}
else
{
user = message.Recipient;
post.IsMe = true;
post.IsOwl = false;
}
}
else
{
if (gType == MyCommon.WORKERTYPE.DirectMessegeRcv)
{
user = message.Sender;
post.IsMe = false;
post.IsOwl = true;
}
else
{
user = message.Recipient;
post.IsMe = true;
post.IsOwl = false;
}
}
post.UserId = user.Id;
post.ScreenName = user.ScreenName;
post.Nickname = user.Name.Trim();
//.........这里部分代码省略.........
开发者ID:noqisofon,项目名称:OpenTween,代码行数:101,代码来源:Twitter.cs
示例3: CreatePostsFromPhoenixSearch
private string CreatePostsFromPhoenixSearch(string content, MyCommon.WORKERTYPE gType, TabClass tab, bool read, int count, ref long minimumId, ref string nextPageQuery)
{
TwitterDataModel.SearchResult items;
try
{
items = MyCommon.CreateDataFromJson<TwitterDataModel.SearchResult>(content);
}
catch(SerializationException ex)
{
MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
return "Json Parse Error(DataContractJsonSerializer)";
}
catch(Exception ex)
{
MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
return "Invalid Json!";
}
nextPageQuery = items.NextPage;
foreach (var status in items.Statuses)
{
PostClass post = null;
post = CreatePostsFromStatusData(status);
if (post == null) continue;
if (minimumId > post.StatusId) minimumId = post.StatusId;
//二重取得回避
lock (LockObj)
{
if (tab == null)
{
if (TabInformations.GetInstance().ContainsKey(post.StatusId)) continue;
}
else
{
if (TabInformations.GetInstance().ContainsKey(post.StatusId, tab.TabName)) continue;
}
}
post.IsRead = read;
if (post.IsMe && !read && _readOwnPost) post.IsRead = true;
if (tab != null) post.RelTabName = tab.TabName;
//非同期アイコン取得&StatusDictionaryに追加
TabInformations.GetInstance().AddPost(post);
}
return string.IsNullOrEmpty(items.ErrMsg) ? string.Empty : "Err:" + items.ErrMsg;
}
开发者ID:noqisofon,项目名称:OpenTween,代码行数:50,代码来源:Twitter.cs
示例4: ApplyEventNotifyFlag
private void ApplyEventNotifyFlag(bool rootEnabled, MyCommon.EVENTTYPE eventnotifyflag, MyCommon.EVENTTYPE isMyeventnotifyflag)
{
MyCommon.EVENTTYPE evt = eventnotifyflag;
MyCommon.EVENTTYPE myevt = isMyeventnotifyflag;
CheckEventNotify.Checked = rootEnabled;
foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
{
if ((evt & tbl.Type) != 0)
{
if ((myevt & tbl.Type) != 0)
{
tbl.CheckBox.CheckState = CheckState.Checked;
}
else
{
tbl.CheckBox.CheckState = CheckState.Indeterminate;
}
}
else
{
tbl.CheckBox.CheckState = CheckState.Unchecked;
}
tbl.CheckBox.Enabled = rootEnabled;
}
}
开发者ID:aokomoriuta,项目名称:OpenTween,代码行数:27,代码来源:AppendSettingDialog.cs
示例5: GetFavoritesApi
public string GetFavoritesApi(bool read,
MyCommon.WORKERTYPE gType,
bool more)
{
if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return string.Empty;
if (MyCommon._endingFlag) return string.Empty;
HttpStatusCode res;
var content = string.Empty;
var count = AppendSettingDialog.Instance.CountApi;
if (AppendSettingDialog.Instance.UseAdditionalCount &&
AppendSettingDialog.Instance.FavoritesCountApi != 0)
{
count = AppendSettingDialog.Instance.FavoritesCountApi;
}
// 前ページ取得の場合はページカウンタをインクリメント、それ以外の場合はページカウンタリセット
if (more)
{
page_++;
}
else
{
page_ = 1;
}
try
{
res = twCon.Favorites(count, page_, ref content);
}
catch(Exception ex)
{
return "Err:" + ex.Message + "(" + MethodBase.GetCurrentMethod().Name + ")";
}
switch (res)
{
case HttpStatusCode.OK:
Twitter.AccountState = MyCommon.ACCOUNT_STATE.Valid;
break;
case HttpStatusCode.Unauthorized:
Twitter.AccountState = MyCommon.ACCOUNT_STATE.Invalid;
return Properties.Resources.Unauthorized;
case HttpStatusCode.BadRequest:
return "Err:API Limits?";
default:
return "Err:" + res.ToString() + "(" + MethodBase.GetCurrentMethod().Name + ")";
}
var serializer = new DataContractJsonSerializer(typeof(List<TwitterDataModel.Status>));
List<TwitterDataModel.Status> item;
try
{
item = MyCommon.CreateDataFromJson<List<TwitterDataModel.Status>>(content);
}
catch(SerializationException ex)
{
MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
return "Json Parse Error(DataContractJsonSerializer)";
}
catch(Exception ex)
{
MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
return "Invalid Json!";
}
foreach (var status in item)
{
var post = new PostClass();
TwitterDataModel.Entities entities;
try
{
post.StatusId = status.Id;
//二重取得回避
lock (LockObj)
{
if (TabInformations.GetInstance().GetTabByType(MyCommon.TabUsageType.Favorites).Contains(post.StatusId)) continue;
}
//Retweet判定
if (status.RetweetedStatus != null)
{
var retweeted = status.RetweetedStatus;
post.CreatedAt = MyCommon.DateTimeParse(retweeted.CreatedAt);
//Id
post.RetweetedId = post.StatusId;
//本文
post.TextFromApi = retweeted.Text;
entities = retweeted.Entities;
//Source取得(htmlの場合は、中身を取り出し)
post.Source = retweeted.Source;
//Reply先
long inReplyToStatusId;
long.TryParse(retweeted.InReplyToStatusId, out inReplyToStatusId);
post.InReplyToStatusId = inReplyToStatusId;
post.InReplyToUser = retweeted.InReplyToScreenName;
long inReplyToUserId;
//.........这里部分代码省略.........
开发者ID:noqisofon,项目名称:OpenTween,代码行数:101,代码来源:Twitter.cs
示例6: AddNewTab
public bool AddNewTab(string tabName, bool startup, MyCommon.TabUsageType tabType, ListElement listInfo = null)
{
//重複チェック
foreach (TabPage tb in ListTab.TabPages)
{
if (tb.Text == tabName) return false;
}
//新規タブ名チェック
if (tabName == Properties.Resources.AddNewTabText1) return false;
//タブタイプ重複チェック
if (!startup)
{
if (tabType == MyCommon.TabUsageType.DirectMessage ||
tabType == MyCommon.TabUsageType.Favorites ||
tabType == MyCommon.TabUsageType.Home ||
tabType == MyCommon.TabUsageType.Mentions ||
tabType == MyCommon.TabUsageType.Related)
{
if (_statuses.GetTabByType(tabType) != null) return false;
}
}
TabPage _tabPage = new TabPage();
DetailsListView _listCustom = new DetailsListView();
ColumnHeader _colHd1 = new ColumnHeader(); //アイコン
ColumnHeader _colHd2 = new ColumnHeader(); //ニックネーム
ColumnHeader _colHd3 = new ColumnHeader(); //本文
ColumnHeader _colHd4 = new ColumnHeader(); //日付
ColumnHeader _colHd5 = new ColumnHeader(); //ユーザID
ColumnHeader _colHd6 = new ColumnHeader(); //未読
ColumnHeader _colHd7 = new ColumnHeader(); //マーク&プロテクト
ColumnHeader _colHd8 = new ColumnHeader(); //ソース
int cnt = ListTab.TabPages.Count;
///ToDo:Create and set controls follow tabtypes
this.SplitContainer1.Panel1.SuspendLayout();
this.SplitContainer1.Panel2.SuspendLayout();
this.SplitContainer1.SuspendLayout();
this.ListTab.SuspendLayout();
this.SuspendLayout();
_tabPage.SuspendLayout();
/// UserTimeline関連
Label label = null;
if (tabType == MyCommon.TabUsageType.UserTimeline || tabType == MyCommon.TabUsageType.Lists)
{
label = new Label();
label.Dock = DockStyle.Top;
label.Name = "labelUser";
if (tabType == MyCommon.TabUsageType.Lists)
{
label.Text = listInfo.ToString();
}
else
{
label.Text = _statuses.Tabs[tabName].User + "'s Timeline";
}
label.TextAlign = ContentAlignment.MiddleLeft;
using (ComboBox tmpComboBox = new ComboBox())
{
label.Height = tmpComboBox.Height;
}
_tabPage.Controls.Add(label);
}
/// 検索関連の準備
Panel pnl = null;
if (tabType == MyCommon.TabUsageType.PublicSearch)
{
pnl = new Panel();
Label lbl = new Label();
ComboBox cmb = new ComboBox();
Button btn = new Button();
ComboBox cmbLang = new ComboBox();
pnl.SuspendLayout();
pnl.Controls.Add(cmb);
pnl.Controls.Add(cmbLang);
pnl.Controls.Add(btn);
pnl.Controls.Add(lbl);
pnl.Name = "panelSearch";
pnl.Dock = DockStyle.Top;
pnl.Height = cmb.Height;
pnl.Enter += SearchControls_Enter;
pnl.Leave += SearchControls_Leave;
cmb.Text = "";
cmb.Anchor = AnchorStyles.Left | AnchorStyles.Right;
cmb.Dock = DockStyle.Fill;
cmb.Name = "comboSearch";
cmb.DropDownStyle = ComboBoxStyle.DropDown;
cmb.ImeMode = ImeMode.NoControl;
cmb.TabStop = false;
//.........这里部分代码省略.........
开发者ID:lupeeloveee,项目名称:OpenTween,代码行数:101,代码来源:Tween.cs
示例7: IsEventNotifyAsEventType
private bool IsEventNotifyAsEventType(MyCommon.EVENTTYPE type)
{
return SettingDialog.EventNotifyEnabled && (type & SettingDialog.EventNotifyFlag) != 0 || type == MyCommon.EVENTTYPE.None;
}
开发者ID:lupeeloveee,项目名称:OpenTween,代码行数:4,代码来源:Tween.cs
示例8: GetTabsByType
public List<TabClass> GetTabsByType(MyCommon.TabUsageType tabType)
{
//合致したタブをListで返す
//合致しなければ空のListを返す
lock (LockObj)
{
var tbs = new List<TabClass>();
foreach (var tb in _tabs.Values)
{
if ((tabType & tb.TabType) == tb.TabType) tbs.Add(tb);
}
return tbs;
}
}
开发者ID:urusupa,项目名称:OpenTween,代码行数:14,代码来源:StatusDictionary.cs
示例9: TabClass
public TabClass(string TabName, MyCommon.TabUsageType TabType, ListElement list) : this()
{
this.TabName = TabName;
this.TabType = TabType;
this.ListInfo = list;
}
开发者ID:urusupa,项目名称:OpenTween,代码行数:6,代码来源:StatusDictionary.cs
示例10: ShortenUrlAsync
/// <summary>
/// 指定された短縮URLサービスを使用してURLを短縮します
/// </summary>
/// <param name="shortenerType">使用する短縮URLサービス</param>
/// <param name="srcUri">短縮するURL</param>
/// <returns>短縮されたURL</returns>
public async Task<Uri> ShortenUrlAsync(MyCommon.UrlConverter shortenerType, Uri srcUri)
{
// 既に短縮されている状態のURLであれば短縮しない
if (ShortUrlHosts.Contains(srcUri.Host))
return srcUri;
try
{
switch (shortenerType)
{
case MyCommon.UrlConverter.TinyUrl:
return await this.ShortenByTinyUrlAsync(srcUri)
.ConfigureAwait(false);
case MyCommon.UrlConverter.Isgd:
return await this.ShortenByIsgdAsync(srcUri)
.ConfigureAwait(false);
case MyCommon.UrlConverter.Twurl:
return await this.ShortenByTwurlAsync(srcUri)
.ConfigureAwait(false);
case MyCommon.UrlConverter.Bitly:
return await this.ShortenByBitlyAsync(srcUri, "bit.ly")
.ConfigureAwait(false);
case MyCommon.UrlConverter.Jmp:
return await this.ShortenByBitlyAsync(srcUri, "j.mp")
.ConfigureAwait(false);
case MyCommon.UrlConverter.Uxnu:
return await this.ShortenByUxnuAsync(srcUri)
.ConfigureAwait(false);
default:
throw new ArgumentException("Unknown shortener.", "shortenerType");
}
}
catch (OperationCanceledException)
{
// 短縮 URL の API がタイムアウトした場合
return srcUri;
}
}
开发者ID:urusupa,项目名称:OpenTween,代码行数:44,代码来源:ShortUrl.cs
示例11: GetTabByType
public TabClass GetTabByType(MyCommon.TabUsageType tabType)
{
//Home,Mentions,DM,Favは1つに制限する
//その他のタイプを指定されたら、最初に合致したものを返す
//合致しなければnullを返す
lock (LockObj)
{
foreach (var tab in _tabs.Values)
{
if (tab.TabType == tabType) return tab;
}
return null;
}
}
开发者ID:urusupa,项目名称:OpenTween,代码行数:14,代码来源:StatusDictionary.cs
示例12: UrlConvertAsync
private async Task<bool> UrlConvertAsync(MyCommon.UrlConverter Converter_Type)
{
//t.coで投稿時自動短縮する場合は、外部サービスでの短縮禁止
//if (SettingDialog.UrlConvertAuto && SettingDialog.ShortenTco) return;
//Converter_Type=Nicomsの場合は、nicovideoのみ短縮する
//参考資料 RFC3986 Uniform Resource Identifier (URI): Generic Syntax
//Appendix A. Collected ABNF for URI
//http://www.ietf.org/rfc/rfc3986.txt
string result = "";
const string nico = @"^https?://[a-z]+\.(nicovideo|niconicommons|nicolive)\.jp/[a-z]+/[a-z0-9]+$";
if (StatusText.SelectionLength > 0)
{
string tmp = StatusText.SelectedText;
// httpから始まらない場合、ExcludeStringで指定された文字列で始まる場合は対象としない
if (tmp.StartsWith("http"))
{
// 文字列が選択されている場合はその文字列について処理
//nico.ms使用、nicovideoにマッチしたら変換
if (this._cfgCommon.Nicoms && Regex.IsMatch(tmp, nico))
{
result = nicoms.Shorten(tmp);
}
else if (Converter_Type != MyCommon.UrlConverter.Nicoms)
{
//短縮URL変換 日本語を含むかもしれないのでURLエンコードする
try
{
var srcUri = new Uri(MyCommon.urlEncodeMultibyteChar(tmp));
var resultUri = await ShortUrl.Instance.ShortenUrlAsync(Converter_Type, srcUri);
result = resultUri.ToString();
}
catch (WebApiException e)
{
this.StatusLabel.Text = Converter_Type + ":" + e.Message;
return false;
}
catch (UriFormatException e)
{
this.StatusLabel.Text = Converter_Type + ":" + e.Message;
return false;
}
}
else
{
return true;
}
if (!string.IsNullOrEmpty(result))
{
urlUndo undotmp = new urlUndo();
StatusText.Select(StatusText.Text.IndexOf(tmp, StringComparison.Ordinal), tmp.Length);
StatusText.SelectedText = result;
//undoバッファにセット
undotmp.Before = tmp;
undotmp.After = result;
if (urlUndoBuffer == null)
{
urlUndoBuffer = new List<urlUndo>();
UrlUndoToolStripMenuItem.Enabled = true;
}
urlUndoBuffer.Add(undotmp);
}
}
}
else
{
const string url = @"(?<before>(?:[^\""':!=]|^|\:))" +
@"(?<url>(?<protocol>https?://)" +
@"(?<domain>(?:[\.-]|[^\p{P}\s])+\.[a-z]{2,}(?::[0-9]+)?)" +
@"(?<path>/[a-z0-9!*//();:&=+$/%#\-_.,[email protected]]*[a-z0-9)=#/]?)?" +
@"(?<query>\?[a-z0-9!*//();:&=+$/%#\-_.,[email protected]?]*[a-z0-9_&=#/])?)";
// 正規表現にマッチしたURL文字列をtinyurl化
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}");
if (tmp.StartsWith("w", StringComparison.OrdinalIgnoreCase)) tmp = "http://" + tmp;
urlUndo undotmp = new urlUndo();
//選んだURLを選択(?)
StatusText.Select(StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal), mt.Result("${url}").Length);
//nico.ms使用、nicovideoにマッチしたら変換
if (this._cfgCommon.Nicoms && Regex.IsMatch(tmp, nico))
{
result = nicoms.Shorten(tmp);
}
else if (Converter_Type != MyCommon.UrlConverter.Nicoms)
{
//短縮URL変換 日本語を含むかもしれないのでURLエンコードする
try
//.........这里部分代码省略.........
开发者ID:nanayaT,项目名称:OpenTween,代码行数:101,代码来源:Tween.cs
示例13: AddNewTab
public bool AddNewTab(string tabName, bool startup, MyCommon.TabUsageType tabType, ListElement listInfo = null)
{
//重複チェック
foreach (TabPage tb in ListTab.TabPages)
{
if (tb.Text == tabName) return false;
}
//新規タブ名チェック
if (tabName == Properties.Resources.AddNewTabText1) return false;
//タブタイプ重複チェック
if (!startup)
{
if (tabType == MyCommon.TabUsageType.DirectMessage ||
tabType == MyCommon.TabUsageType.Favorites ||
tabType == MyCommon.TabUsageType.Home ||
tabType == MyCommon.TabUsageType.Mentions ||
tabType == MyCommon.TabUsageType.Related)
{
if (_statuses.GetTabByType(tabType) != null) return false;
}
}
TabPage _tabPage = new TabPage();
DetailsListView _listCustom = new DetailsListView();
int cnt = ListTab.TabPages.Count;
///ToDo:Create and set controls follow tabtypes
using (ControlTransaction.Update(_listCustom))
using (ControlTransaction.Layout(this.SplitContainer1.Panel1, false))
using (ControlTransaction.Layout(this.SplitContainer1.Panel2, false))
using (ControlTransaction.Layout(this.SplitContainer1, false))
using (ControlTransaction.Layout(this.ListTab, false))
using (ControlTransaction.Layout(this))
using (ControlTransaction.Layout(_tabPage, false))
{
/// UserTimeline関連
Label label = null;
if (tabType == MyCommon.TabUsageType.UserTimeline || tabType == MyCommon.TabUsageType.Lists)
{
label = new Label();
label.Dock = DockStyle.Top;
label.Name = "labelUser";
if (tabType == MyCommon.TabUsageType.Lists)
{
label.Text = listInfo.ToString();
}
else
{
label.Text = _statuses.Tabs[tabName].User + "'s Timeline";
}
label.TextAlign = ContentAlignment.MiddleLeft;
using (ComboBox tmpComboBox = new ComboBox())
{
label.Height = tmpComboBox.Height;
}
_tabPage.Controls.Add(label);
}
/// 検索関連の準備
Panel pnl = null;
if (tabType == MyCommon.TabUsageType.PublicSearch)
{
pnl = new Panel();
Label lbl = new Label();
ComboBox cmb = new ComboBox();
Button btn = new Button();
ComboBox cmbLang = new ComboBox();
pnl.SuspendLayout();
pnl.Controls.Add(cmb);
pnl.Controls.Add(cmbLang);
pnl.Controls.Add(btn);
pnl.Controls.Add(lbl);
pnl.Name = "panelSearch";
pnl.Dock = DockStyle.Top;
pnl.Height = cmb.Height;
pnl.Enter += SearchControls_Enter;
pnl.Leave += SearchControls_Leave;
cmb.Text = "";
cmb.Anchor = AnchorStyles.Left | AnchorStyles.Right;
cmb.Dock = DockStyle.Fill;
cmb.Name = "comboSearch";
cmb.DropDownStyle = ComboBoxStyle.DropDown;
cmb.ImeMode = ImeMode.NoControl;
cmb.TabStop = false;
cmb.AutoCompleteMode = AutoCompleteMode.None;
cmb.KeyDown += SearchComboBox_KeyDown;
if (_statuses.ContainsTab(tabName))
{
cmb.Items.Add(_statuses.Tabs[tabName].SearchWords);
cmb.Text = _statuses.Tabs[tabName].SearchWords;
}
//.........这里部分代码省略.........
开发者ID:nanayaT,项目名称:OpenTween,代码行数:101,代码来源:Tween.cs
示例14: ApplyListViewIconSize
private void ApplyListViewIconSize(MyCommon.IconSizes iconSz)
{
// アイコンサイズの再設定
_iconCol = false;
switch (iconSz)
{
case MyCommon.IconSizes.IconNone:
_iconSz = 0;
break;
case MyCommon.IconSizes.Icon16:
_iconSz = 16;
break;
case MyCommon.IconSizes.Icon24:
_iconSz = 26;
break;
case MyCommon.IconSizes.Icon48:
_iconSz = 48;
break;
case MyCommon.IconSizes.Icon48_2:
_iconSz = 48;
_iconCol = true;
break;
}
if (_iconSz > 0)
{
// ディスプレイの DPI 設定を考慮したサイズを設定する
_listViewImageList.ImageSize = new Size(
1,
(int)Math.Ceiling(this._iconSz * this.currentScaleFactor.Height));
}
else
{
_listViewImageList.ImageSize = new Size(1, 1);
}
}
开发者ID:nanayaT,项目名称:OpenTween,代码行数:36,代码来源:Tween.cs
示例15: IsInnerStorage_Test
public void IsInnerStorage_Test(MyCommon.TabUsageType tabType, bool expected)
{
Assert.Equal(expected, tabType.IsInnerStorage());
}
开发者ID:urusupa,项目名称:OpenTween,代码行数:4,代码来源:TabClassTest.cs
示例16: AddTab
public bool AddTab(string TabName, MyCommon.TabUsageType TabType, ListElement List)
{
if (_tabs.ContainsKey(TabName)) return false;
var tb = new TabClass(TabName, TabType, List);
_tabs.Add(TabName, tb);
tb.SortMode = this.SortMode;
tb.SortOrder = this.SortOrder;
return true;
}
开发者ID:urusupa,项目名称:OpenTween,代码行数:9,代码来源:StatusDictionary.cs
示例17: UrlConvert
private bool UrlConvert(MyCommon.UrlConverter Converter_Type)
{
//t.coで投稿時自動短縮する場合は、外部サービスでの短縮禁止
//if (SettingDialog.UrlConvertAuto && SettingDialog.ShortenTco) return;
//Converter_Type=Nicomsの場合は、nicovideoのみ短縮する
//参考資料 RFC3986 Uniform Resource Identifier (URI): Generic Syntax
//Appendix A. Collected ABNF for URI
//http://www.ietf.org/rfc/rfc3986.txt
string result = "";
const string nico = @"^https?://[a-z]+\.(nicovideo|niconicommons|nicolive)\.jp/[a-z]+/[a-z0-9]+$";
if (StatusText.SelectionLength > 0)
{
string tmp = StatusText.SelectedText;
// httpから始まらない場合、ExcludeStringで指定された文字列で始まる場合は対象としない
if (tmp.StartsWith("http"))
{
// 文字列が選択されている場合はその文字列について処理
//nico.ms使用、nicovideoにマッチしたら変換
if (SettingDialog.Nicoms && Regex.IsMatch(tmp, nico))
{
result = nicoms.Shorten(tmp);
}
else if (Converter_Type != MyCommon.UrlConverter.Nicoms)
{
//短縮URL変換 日本語を含むかもしれないのでURLエンコードする
result = ShortUrl.Make(Converter_Type, tmp);
if (result.Equals("Can't convert"))
{
StatusLabel.Text = result.Insert(0, Converter_Type.ToString() + ":");
return false;
}
}
else
{
return true;
}
if (!string.IsNullOrEmpty(result))
{
urlUndo undotmp = new urlUndo();
StatusText.Select(StatusText.Text.IndexOf(tmp, StringComparison.Ordinal), tmp.Length);
StatusText.SelectedText = result;
//undoバッファにセット
undotmp.Before = tmp;
undotmp.After = result;
if (urlUndoBuffer == null)
{
urlUndoBuffer = new List<urlUndo>();
UrlUndoToolStripMenuItem.Enabled = true;
}
urlUndoBuffer.Add(undotmp);
}
}
}
else
{
const string url = @"(?<before>(?:[^\""':!=]|^|\:))" +
@"(?<url>(?<protocol>https?://)" +
@"(?<domain>(?:[\.-]|[^\p{P}\s])+\.[a-z]{2,}(?::[0-9]+)?)" +
@"(?<path>/[a-z0-9!*//();:&=+$/%#\-_.,[email protected]]*[a-z0-9)=#/]?)?" +
@"(?<query>\?[a-z0-9!*//();:&=+$/%#\-_.,[email protected]?]*[a-z0-9_&=#/])?)";
// 正規表現にマッチしたURL文字列をtinyurl化
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}");
if (tmp.StartsWith("w", StringComparison.OrdinalIgnoreCase)) tmp = "http://" + tmp;
urlUndo undotmp = new urlUndo();
//選んだURLを選択(?)
StatusText.Select(StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal), mt.Result("${url}").Length);
//nico.ms使用、nicovideoにマッチしたら変換
if (SettingDialog.Nicoms && Regex.IsMatch(tmp, nico))
{
result = nicoms.Shorten(tmp);
}
else if (Converter_Type != MyCommon.UrlConverter.Nicoms)
{
//短縮URL変換 日本語を含むかもしれないのでURLエンコードする
result = ShortUrl.Make(Converter_Type, tmp);
if (result.Equals("Can't convert"))
{
StatusLabel.Text = result.Insert(0, Converter_Type.ToString() + ":");
continue;
}
}
else
{
continue;
}
//.........这里部分代码省略.........
开发者ID:lupeeloveee,项目名称:OpenTween,代码行数:101,代码来源:Tween.cs
示例18: ShortenUrlAsync
/// <summary>
/// 指定された短縮URLサービスを使用してURLを短縮します
/// </summary>
/// <param name="shortenerType">使用する短縮URLサービス</param>
/// <param name="srcUri">短縮するURL</param>
/// <returns>短縮されたURL</returns>
public Task<Uri> ShortenUrlAsync(MyCommon.UrlConverter shortenerType, Uri srcUri)
{
// 既に短縮されている状態のURLであれば短縮しない
if (ShortUrlHosts.Contains(srcUri.Host))
return Task.FromResult(srcUri);
switch (shortenerType)
{
case MyCommon.UrlConverter.TinyUrl:
return this.ShortenByTinyUrlAsync(srcUri);
case MyCommon.UrlConverter.Isgd:
return this.ShortenByIsgdAsync(srcUri);
case MyCommon.UrlConverter.Twurl:
return this.ShortenByTwurlAsync(srcUri);
case MyCommon.UrlConverter.Bitly:
return this.ShortenByBitlyAsync(srcUri, "bit.ly");
case MyCommon.UrlConverter.Jmp:
return this.ShortenByBitlyAsync(srcUri, "j.mp");
case MyCommon.UrlConverter.Uxnu:
return this.ShortenByUxnuAsync(srcUri);
default:
throw new ArgumentException("Unknown shortener.", "shortenerType");
}
}
开发者ID:egcube,项目名称:OpenTween,代码行数:30,代码来源:ShortUrl.cs
示例19: GetTimeline
private void GetTimeline(MyCommon.WORKERTYPE WkType, int fromPage, int toPage, string tabName)
{
if (!this.IsNetworkAvailable()) return;
//非同期実行引数設定
GetWorkerArg args = new GetWorkerArg();
args.page = fromPage;
args.endPage = toPage;
args.type = WkType;
args.tName = tabName;
if (!lastTime.ContainsKey(WkType)) lastTime.Add(WkType, new DateTime());
double period = DateTime.Now.Subtract(lastTime[WkType]).TotalSeconds;
if (period > 1 || period < -1)
{
lastTime[WkType] = DateTime.Now
|
请发表评论