本文整理汇总了C#中ThreadInfo类的典型用法代码示例。如果您正苦于以下问题:C# ThreadInfo类的具体用法?C# ThreadInfo怎么用?C# ThreadInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThreadInfo类属于命名空间,在下文中一共展示了ThreadInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: btnStart_Click
private async void btnStart_Click(object sender, EventArgs e)
{
pbMain.Value = 0;
ToggleGroupBoxes(false);
TitleBuilder.Build(this, "Initializing");
try
{
var threadInfo = new ThreadInfo(txtThread.Text);
var scraper = new Scraper(threadInfo, UpdateProgress);
var files = await scraper.CollectFilePosts(cbWEBM.Checked, cbDuplicates.Checked);
pbMain.Maximum = files.Count;
await Task.WhenAll(files.Select(p =>
scraper.DownloadAsync(p, rbUID.Checked, txtPath.Text, this)));
TitleBuilder.Build(this, "Completed", false);
}
catch (Exception ex)
{
TitleBuilder.Build(this, ex.Message, false);
}
ToggleGroupBoxes(true);
}
开发者ID:oduslabs,项目名称:4chan-Scraper,代码行数:28,代码来源:frmMain.cs
示例2: Contains
/// <summary>
/// Определяет, содержится ли указанный экземпляр в списке отображения.
/// </summary>
/// <param name="info">Проверяемый экземпляр.</param>
/// <returns>Истина - содержится, иначе - ложь.</returns>
public bool Contains(ThreadInfo info)
{
if (info == null)
throw new ArgumentNullException("Проверяемая информация не может быть неопределенной");
int i = listView.Items.OfType<ListViewItem>().ToList().FindIndex(x => (x.Tag as ThreadInfo) == info);
return i >= 0;
}
开发者ID:Hrombel,项目名称:AbstractDevelop,代码行数:14,代码来源:ThreadFrame.cs
示例3: AddThreadInfo
/// <summary>
/// Добавляет информацию о потоке в список.
/// </summary>
/// <param name="info">Отображаемая базовая информация.</param>
/// <param name="selected">Определяет, является ли добавляемая информация выделенной.</param>
public void AddThreadInfo(ThreadInfo info, bool selected)
{
if (info == null)
throw new ArgumentNullException("Отображаемая информация не может быть неопределенной");
ListViewItem item = new ListViewItem();
item.Text = info.Id.ToString();
item.SubItems.Add(info.Program);
item.SubItems.Add(info.Command.ToString());
item.Tag = info;
listView.Items.Add(item);
item.Checked = selected;
listView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
}
开发者ID:Hrombel,项目名称:AbstractDevelop,代码行数:20,代码来源:ThreadFrame.cs
示例4: Scraper
/// <summary>
/// Initializes the scraper.
/// </summary>
/// <param name="threadInfo">A <paramref name="ThreadInfo"/> model of the thread.</param>
/// <param name="action">An action to invoke on completion.</param>
public Scraper(ThreadInfo threadInfo, Action action)
{
var handler = new HttpClientHandler
{
AllowAutoRedirect = true,
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
UseCookies = false,
UseProxy = false
};
_client = new HttpClient(handler);
_thread = threadInfo;
_updateAction = action;
}
开发者ID:oduslabs,项目名称:4chan-Scraper,代码行数:21,代码来源:Scraper.cs
示例5: GlacierizerUploader
public GlacierizerUploader(GlacierAPIInterface api, Stream input, int partSize, short numThreads)
{
glacierAPI = api;
inputStream = input;
this.partSize = partSize;
numRequestedThreads = numThreads;
threads = new List<ThreadInfo>();
for (int i = 0; i < numRequestedThreads; ++i)
{
ThreadInfo info = new ThreadInfo(partSize);
threads.Add(info);
}
hashList = new List<string>();
transferMetric = new TransferMetric();
}
开发者ID:bfanti,项目名称:Glacierizer,代码行数:18,代码来源:GlacierizerUploader.cs
示例6: Broadcast
private static QAcidRunner<Unit> Broadcast(Broadcaster broadcaster, ThreadInfo info)
{
return
from canact in
"when threadswitch is false".If(
() => info.ThreadSwitch == false,
from start in "start broadcasting".Act(
() =>
{
info.ThreadSwitch = true;
info.ExceptionFromThread = null;
info.Thread =
new Thread(
() => info.ExceptionFromThread =
GetExceptionThrownBy(
() => broadcaster.Broadcast(null)));
info.Thread.Start();
})
from spec in "Broadcast : No Exception is thrown".Spec(() => info.ExceptionFromThread == null)
select Unit.Instance)
select Unit.Instance;
}
开发者ID:kilfour,项目名称:QuickAcid,代码行数:23,代码来源:BroadCasterTest.cs
示例7: HasUserFrame
//we use the Mono.Debugging classes because they are cached
bool HasUserFrame (long tid, ThreadInfo[] infos)
{
foreach (var t in infos) {
if (t.Id != tid)
continue;
var bt = t.Backtrace;
for (int i = 0; i < bt.FrameCount; i++) {
var frame = bt.GetFrame (i);
if (frame != null && !frame.IsExternalCode)
return true;
}
return false;
}
return false;
}
开发者ID:trustme,项目名称:monodevelop,代码行数:16,代码来源:SoftDebuggerSession.cs
示例8: ThreadInfoViewModel
public ThreadInfoViewModel(ThreadInfo threadInfo) {
ThreadInfo = threadInfo;
}
开发者ID:acedened,项目名称:TheChan,代码行数:3,代码来源:ThreadInfoViewModel.cs
示例9: OnStarted
internal protected virtual void OnStarted (ThreadInfo t)
{
OnTargetEvent (new TargetEventArgs (TargetEventType.TargetReady) { Thread = t });
lock (slock) {
started = true;
foreach (BreakEvent bp in breakpointStore)
AddBreakEvent (bp);
}
}
开发者ID:kmarecki,项目名称:monodevelop,代码行数:9,代码来源:DebuggerSession.cs
示例10: DisseminateInformation
private void DisseminateInformation(ReservationMessage reservationMessage, MessageTypeToDisseminate typeOfMessage, bool secondDissemination)
{
Console.WriteLine("[Calling] DisseminateReservation");
Console.WriteLine("Mode-> " + typeOfMessage.ToString());
Console.WriteLine("");
List<UserView> chosenUsers = null;
if (typeOfMessage.Equals(MessageTypeToDisseminate.UPDATE_USERS_RESERVATION_INFO) || typeOfMessage.Equals(MessageTypeToDisseminate.ABORT_RESERVATION) || typeOfMessage.Equals(MessageTypeToDisseminate.COMMIT_RESERVATION)) {
chosenUsers = reservationMessage.reservation.getUserList();
}
else
chosenUsers = ChooseUsers(reservationMessage.reservation,reservationMessage.messageCounter);
Console.WriteLine("Printing chosen users..");
foreach (UserView u in chosenUsers) {
Console.WriteLine(u.getName() + " port: " + u.getPort());
}
List<UserInterface> chosenUsersProxys = new List<UserInterface>();
foreach (UserView u in chosenUsers) {
UserInterface proxy = User.GetUser(u.getIPAddress(), u.getPort(), u.getName());
chosenUsersProxys.Add(proxy);
}
Console.WriteLine("Creating Threads...");
int i = 0;
foreach (UserInterface ui in chosenUsersProxys) {
ThreadInfo threadInfo = new ThreadInfo();
threadInfo.proxy = ui;
threadInfo.userName = ui.getName(); //caso
threadInfo.sendUserName = User.Name;
threadInfo.reservationMessage = reservationMessage;
threadInfo.threadNumber = i++;
if (secondDissemination) threadInfo.secondDissemination = true;
else threadInfo.secondDissemination = false;
Thread t;
if (typeOfMessage.Equals(MessageTypeToDisseminate.SEND_RESERVATION)) {
t = new Thread(delegate() {
CallSendReservation(threadInfo);
});
if (secondDissemination)
t.Name = threadInfo.threadNumber + " SEND_RESERVATION HAS_DISSEMINATED";
else
t.Name = threadInfo.threadNumber + " SEND_RESERVATION";
}
else if (typeOfMessage.Equals(MessageTypeToDisseminate.UPDATE_USERS_RESERVATION_INFO)) {
t = new Thread(delegate() {
CallUpdateUsersReservationInfo(threadInfo);
});
if (secondDissemination)
t.Name = threadInfo.threadNumber + " UPDATE HAS_DISSEMINATED";
else
t.Name = threadInfo.threadNumber + " UPDATE";
}
else if (typeOfMessage.Equals(MessageTypeToDisseminate.ABORT_RESERVATION)) {
t = new Thread(delegate() {
CallAbortReservation(threadInfo);
});
t.Name = threadInfo.threadNumber + " ABORT";
}
else if (typeOfMessage.Equals(MessageTypeToDisseminate.COMMIT_RESERVATION))
{
t = new Thread(delegate()
{
CallCommitReservation(threadInfo);
});
if (secondDissemination)
t.Name = threadInfo.threadNumber + " COMMIT HAS_DISSEMINATED";
else
t.Name = threadInfo.threadNumber + " COMMIT";
}
else if (typeOfMessage.Equals(MessageTypeToDisseminate.TWO_PHASE_COMMIT))
{
t = new Thread(delegate()
{
CallTwoPhaseCommit(threadInfo);
});
if (secondDissemination)
t.Name = threadInfo.threadNumber + " 2PC HAS_DISSEMINATED";
else
t.Name = threadInfo.threadNumber + " 2PC";
}
else
{
t = new Thread(delegate()
{
CallProposeSlot(threadInfo);
});
if (secondDissemination)
t.Name = threadInfo.threadNumber + " PROPOSE HAS_DISSEMINATED";
//.........这里部分代码省略.........
开发者ID:JVasques,项目名称:User,代码行数:101,代码来源:UserRemoteObject.cs
示例11: DoUpdate
public void DoUpdate(object argument, DoWorkEventArgs e)
{
if (Cache == null)
Cache = new Hashtable();
UpdateParameters _params = (UpdateParameters)e.Argument;
List<ThreadInfo> list = new List<ThreadInfo>();
//
Regex repliesrgx = new Regex("Пропущено (\\d{1,3})");
Regex imagergx = new Regex("thumb/\\d+s\\.[a-z]{3}");
//
string board = _params.Board;
WebClient wcl = new WebClient();
HtmlAgilityPack.HtmlDocument page = null;
HtmlWeb web = new HtmlWeb();
for (int i = 0; i <= _params.PagesNum; i++)
{
int totalThreads = 20 * (_params.PagesNum + 1);
var postfix = (i == 0) ? "wakaba.html" : i.ToString() + ".html";
try
{
page = web.Load("http://2ch.so/" + board + "/" + postfix);
}
catch
{
e.Result = null;
return;
}
int j = 1;
foreach (var oppost in page.DocumentNode.SelectNodes("//div[@class=\"oppost\"]"))
{
ThreadInfo ti = new ThreadInfo();
//порядок треда
ti.Order = i * 20 + j;
//номер треда
string threadNum = oppost.Attributes["id"].Value.Substring(5);
ti.ThreadCode = board + "_" + threadNum;
//восстановление объекта ThreadInfo из кэша
bool fromCache = false;
if (Cache.Contains(ti.ThreadCode))
{
ti = (ThreadInfo)Cache[ti.ThreadCode];
fromCache = true;
}
//восстановление статуса "Отслеживается"
ti.Track = ThreadTracks.Contains(ti.ThreadCode);
//восстановление статуса "Sage"
ti.Sage = ThreadSage.Contains(ti.ThreadCode);
//линк
ti.Link = "http://2ch.so/" + board + "/res/" + threadNum + ".html";
if (!fromCache)
{
//Тема
ti.Topic = RefineString(oppost.SelectSingleNode(".//span[@class=\"filetitle\"]").InnerText);
//Оп-пост
ti.OPPost = RefineString(oppost.SelectSingleNode(".//blockquote").InnerHtml);
}
//Количество ответов
var om_p = oppost.SelectSingleNode(".//span[@class=\"omittedposts\"]");
if (om_p == null)
{
ti.IntReplies = 1;
}
else
{
Match match = repliesrgx.Match(om_p.InnerText);
ti.IntReplies = int.Parse(match.Groups[1].Value) + 6;
//подсчет разницы в количестве постов
if (ti.Track && ThreadTracks.Contains(ti.ThreadCode))
{
int trackedCount = (int)ThreadTracks[ti.ThreadCode];
ti.Difference = ti.IntReplies - trackedCount;
}
}
//Картинка
if (!fromCache && _params.LoadImages && !ti.Sage && !TryRecoverImage(ti))
{
string path = String.Format(".//span[@id=\"exlink_{0}\"]", threadNum);
var img_ = oppost.SelectSingleNode(path);
if (img_ != null)
{
Match match = imagergx.Match(img_.InnerHtml);
string imageUrl = "http://2ch.so/" + board + "/" + match.Value;
try
{
byte[] imageData = wcl.DownloadData(imageUrl);
MemoryStream stream = new MemoryStream(imageData);
ti.Image = Image.FromStream(stream);
string filename = "images\\" + ti.ThreadCode + ".jpg";
if (!File.Exists(filename))
ti.Image.Save(filename, ImageFormat.Jpeg);
stream.Close();
}
catch
{
}
}
}
list.Add(ti);
if (!fromCache)
//.........这里部分代码省略.........
开发者ID:sempers,项目名称:2ch.so_Tracker,代码行数:101,代码来源:Form1.cs
示例12: Generate
public override bool Generate(CommandExecutionContext context)
{
var target = context.NativeDbgEngTarget;
var unifiedStackTraces = new UnifiedStackTraces(target.DebuggerInterface, context);
var blockingObjectsStrategy = new DumpFileBlockingObjectsStrategy(context.Runtime, unifiedStackTraces, target);
foreach (var thread in unifiedStackTraces.Threads)
{
// This function is created lazily because we don't need the managed
// code state for each thread.
Func<bool> checkManagedCodeStateForThisThread = () =>
unifiedStackTraces.GetStackTrace(thread.EngineThreadId)
.Any(f => f.Type == UnifiedStackFrameType.Managed);
var threadWithBlockingInfo = blockingObjectsStrategy.GetThreadWithBlockingObjects(thread);
var threadInfo = new ThreadInfo
{
ManagedThreadId = threadWithBlockingInfo.ManagedThreadId,
OSThreadId = threadWithBlockingInfo.OSThreadId,
IsRunningManagedCode = checkManagedCodeStateForThisThread
};
foreach (var blockingObject in threadWithBlockingInfo.BlockingObjects)
{
var lockInfo = new LockInfo
{
Reason = blockingObject.Reason.ToString()
};
if (blockingObject.Type == UnifiedBlockingType.ClrBlockingObject)
{
lockInfo.Object = blockingObject.ManagedObjectAddress;
lockInfo.ManagedObjectType = context.Heap.GetObjectType(lockInfo.Object)?.Name;
}
else
{
lockInfo.Object = blockingObject.Handle;
lockInfo.OSObjectName = blockingObject.KernelObjectName;
}
lockInfo.OwnerThreadOSIds.AddRange(blockingObject.OwnerOSThreadIds);
threadInfo.Locks.Add(lockInfo);
}
Threads.Add(threadInfo);
RecommendFinalizerThreadBlocked(context);
RecommendDeadlockedThreads();
}
return Threads.Any();
}
开发者ID:goldshtn,项目名称:msos,代码行数:48,代码来源:Report.cs
示例13: SendRelationshipsInfo
private void SendRelationshipsInfo(IEnumerable<DocumentDetail> documentDetailList)
{
bool familiesLinkingRequested = _jobParameter.IsImportFamilyRelations;
bool threadsLinkingRequested = _jobParameter.IsMapEmailThread;
FamiliesInfo familiesInfo = familiesLinkingRequested ? new FamiliesInfo() : null;
ThreadsInfo threadsInfo = threadsLinkingRequested ? new ThreadsInfo() : null;
foreach (DocumentDetail doc in documentDetailList)
{
if (doc.docType != DocumentsetType.NativeSet)
{
continue; // Only original documents may participate in relationships
}
string docReferenceId = doc.document.DocumentId;
if (String.IsNullOrEmpty(docReferenceId))
{
continue;
}
// Debug
//Tracer.Warning("DOCID {0} corresponds to the document {1}", doc.document.FieldList[0].FieldValue, docReferenceId.Hint(4));
//if (docReferenceId.Hint(4) == "AFE1")
//{
// Tracer.Warning("STOP!");
//}
if (familiesLinkingRequested && !String.IsNullOrEmpty(doc.document.EVLoadFileDocumentId))
{
// We don't skip standalone documents for Families, because they always can appear to be topmost parents
FamilyInfo familyInfoRecord = new FamilyInfo(docReferenceId);
familyInfoRecord.OriginalDocumentId = doc.document.EVLoadFileDocumentId;
familyInfoRecord.OriginalParentId = String.IsNullOrEmpty(doc.document.EVLoadFileParentId) ? null : doc.document.EVLoadFileParentId;
//Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId = {1}",
// familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId);
if (String.Equals(familyInfoRecord.OriginalDocumentId, familyInfoRecord.OriginalParentId, StringComparison.InvariantCulture))
{
//Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, OriginalParentId reset to null", familyInfoRecord.OriginalDocumentId);
familyInfoRecord.OriginalParentId = null; // Document must not be its own parent
}
// Family has priority over thread, so if the document is part of the family we ignore its thread
//if (familyInfoRecord.OriginalParentId != null)
//{
// //Tracer.Warning("SendRelationshipsInfo: OriginalDocumentId = {0}, ConversationIndex reset to null", familyInfoRecord.OriginalDocumentId);
// doc.ConversationIndex = null;
//}
familiesInfo.FamilyInfoList.Add(familyInfoRecord);
}
// BEWARE: doc.document.ConversationIndex is not the right thing!!
if (threadsLinkingRequested)
{
// Sanitize the value
doc.ConversationIndex = String.IsNullOrEmpty(doc.ConversationIndex) ? null : doc.ConversationIndex;
// Debug
//Tracer.Warning("SendRelationshipsInfo: CollectionId = {0}", doc.document.CollectionId);
var threadInfo = new ThreadInfo(docReferenceId, doc.ConversationIndex);
threadsInfo.ThreadInfoList.Add(threadInfo);
}
}
if (threadsLinkingRequested && threadsInfo.ThreadInfoList.Any())
{
SendThreads(threadsInfo);
}
if (familiesLinkingRequested && familiesInfo.FamilyInfoList.Any())
{
SendFamilies(familiesInfo);
}
}
开发者ID:Rajeshbharathi,项目名称:CGN.Paralegal,代码行数:77,代码来源:OverlayWorker.cs
示例14: OnStarted
internal protected virtual void OnStarted (ThreadInfo t)
{
if (HasExited)
return;
OnTargetEvent (new TargetEventArgs (TargetEventType.TargetReady) { Thread = t });
lock (slock) {
if (!HasExited) {
IsConnected = true;
foreach (BreakEvent bp in breakpointStore)
AddBreakEvent (bp);
}
}
}
开发者ID:segaman,项目名称:monodevelop,代码行数:15,代码来源:DebuggerSession.cs
示例15: HasCycle
private bool HasCycle(ThreadInfo thread, HashSet<uint> visitedThreadIds)
{
if (visitedThreadIds.Contains(thread.OSThreadId))
return true;
visitedThreadIds.Add(thread.OSThreadId);
foreach (var @lock in thread.Locks)
{
foreach (var ownerThreadOSId in @lock.OwnerThreadOSIds)
{
var ownerThread = Threads.SingleOrDefault(t => t.OSThreadId == ownerThreadOSId);
if (ownerThread == null)
continue;
if (HasCycle(ownerThread, visitedThreadIds))
return true;
}
}
return false;
}
开发者ID:goldshtn,项目名称:msos,代码行数:22,代码来源:Report.cs
示例16: TryRecoverImage
private bool TryRecoverImage(ThreadInfo ti)
{
if (File.Exists("images\\" + ti.ThreadCode + ".jpg"))
{
try
{
ti.Image = Image.FromFile("images\\" + ti.ThreadCode + ".jpg");
return true;
}
catch
{
return false;
}
}
return false;
}
开发者ID:sempers,项目名称:2ch.so_Tracker,代码行数:16,代码来源:Form1.cs
示例17: FinalizerThreadBlocked
public FinalizerThreadBlocked(ThreadInfo info)
{
LockCount = info.Locks.Count;
FinalizerThreadOSId = info.OSThreadId;
}
开发者ID:goldshtn,项目名称:msos,代码行数:5,代码来源:Report.cs
示例18: PrepareRetryTwoPhaseCommit
private void PrepareRetryTwoPhaseCommit(List<UserView> listToSend, ReservationMessage reservation)
{
Console.WriteLine("[Calling] PrepareRetryTwoPhaseCommit");
List<UserInterface> usersProxy = new List<UserInterface>();
lock (User.userLoger)
{
User.userLoger.IncrementNumberOfExchangedMessages("TwoPhaseCommit");
}
foreach (UserView u in listToSend)
{
UserInterface proxy = User.GetUser(u.getIPAddress(), u.getPort(), u.getName());
usersProxy.Add(proxy);
}
Console.WriteLine("Creating Threads...");
int i = 0;
foreach (UserInterface ui in usersProxy)
{
ThreadInfo threadInfo = new ThreadInfo();
threadInfo.proxy = ui;
threadInfo.userName = ui.getName();
threadInfo.sendUserName = User.Name;
threadInfo.reservationMessage = reservation;
threadInfo.threadNumber = i++;
//send a message counter equal to the user list size to avoid further dissemination
threadInfo.reservationMessage.messageCounter = -1;
Thread t = new Thread(delegate()
{
CallTwoPhaseCommit(threadInfo);
});
t.Name = threadInfo.threadNumber + " 2PC";
localThreadList.Add(t);
t.Start();
}
Console.WriteLine("Waiting for threads to finish...");
foreach (Thread t in localThreadList)
{
t.Join();
}
Console.WriteLine("all threads have finished!");
}
开发者ID:JVasques,项目名称:User,代码行数:46,代码来源:UserRemoteObject.cs
示例19: ArchThread
private ArchThread(ThreadInfo value)
{
this._value = value;
}
开发者ID:samarunraj,项目名称:expressos,代码行数:4,代码来源:ArchThread.cs
示例20: NotifyStarted
public void NotifyStarted (ThreadInfo t)
{
session.OnStarted (t);
}
开发者ID:kmarecki,项目名称:monodevelop,代码行数:4,代码来源:DebuggerSession.cs
注:本文中的ThreadInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论