本文整理汇总了C#中HFM.Core.DataTypes.UnitInfo.ProjectIsUnknown方法的典型用法代码示例。如果您正苦于以下问题:C# UnitInfo.ProjectIsUnknown方法的具体用法?C# UnitInfo.ProjectIsUnknown怎么用?C# UnitInfo.ProjectIsUnknown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HFM.Core.DataTypes.UnitInfo
的用法示例。
在下文中一共展示了UnitInfo.ProjectIsUnknown方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProjectsMatch
private static bool ProjectsMatch(UnitInfo unit, IProjectInfo projectInfo)
{
Debug.Assert(unit != null);
if (unit.ProjectIsUnknown() || projectInfo == null) return false;
return (unit.ProjectID == projectInfo.ProjectID &&
unit.ProjectRun == projectInfo.ProjectRun &&
unit.ProjectClone == projectInfo.ProjectClone &&
unit.ProjectGen == projectInfo.ProjectGen);
}
示例2: ValidateUnitInfo
private static bool ValidateUnitInfo(UnitInfo unitInfo)
{
// if Project and Download Time are valid
if (!unitInfo.ProjectIsUnknown() && unitInfo.DownloadTime != DateTime.MinValue)
{
// if UnitResult is FinishedUnit
if (unitInfo.UnitResult == WorkUnitResult.FinishedUnit)
{
// the Finished Time must be valid
return unitInfo.FinishedTime != DateTime.MinValue;
}
// otherwise, the UnitResult must be a Terminating error result
return unitInfo.UnitResult.IsTerminating();
}
return false;
}
示例3: PopulateUnitInfoFromLogs
private static void PopulateUnitInfoFromLogs(ClientRun currentClientRun, FahLogUnitData fahLogUnitData,
UnitInfoLogData unitInfoLogData, UnitInfo unit)
{
Debug.Assert(currentClientRun != null);
Debug.Assert(fahLogUnitData != null);
// unitInfoLogData can be null
Debug.Assert(unit != null);
/* Project (R/C/G) (Could have already been read through Queue) */
if (unit.ProjectIsUnknown())
{
unit.ProjectID = fahLogUnitData.ProjectID;
unit.ProjectRun = fahLogUnitData.ProjectRun;
unit.ProjectClone = fahLogUnitData.ProjectClone;
unit.ProjectGen = fahLogUnitData.ProjectGen;
}
if (fahLogUnitData.Threads > 1)
{
unit.SlotType = SlotType.CPU;
}
if (unitInfoLogData != null)
{
unit.ProteinName = unitInfoLogData.ProteinName;
/* Tag (Could have already been read through Queue) */
if (unit.ProteinTag.Length == 0)
{
unit.ProteinTag = unitInfoLogData.ProteinTag;
}
/* DownloadTime (Could have already been read through Queue) */
if (unit.DownloadTime.IsUnknown())
{
unit.DownloadTime = unitInfoLogData.DownloadTime;
}
/* DueTime (Could have already been read through Queue) */
if (unit.DueTime.IsUnknown())
{
unit.DueTime = unitInfoLogData.DueTime;
}
/* FinishedTime (Not available in unitinfo log) */
/* Project (R/C/G) (Could have already been read through Queue) */
if (unit.ProjectIsUnknown())
{
unit.ProjectID = unitInfoLogData.ProjectID;
unit.ProjectRun = unitInfoLogData.ProjectRun;
unit.ProjectClone = unitInfoLogData.ProjectClone;
unit.ProjectGen = unitInfoLogData.ProjectGen;
}
}
/* FoldingID and Team from Last Client Run (Could have already been read through Queue) */
if (unit.FoldingID.Equals(Constants.DefaultFoldingID) &&
!String.IsNullOrEmpty(currentClientRun.FoldingID))
{
unit.FoldingID = currentClientRun.FoldingID;
}
if (unit.Team == Constants.DefaultTeam)
{
unit.Team = currentClientRun.Team;
}
// Possibly check the currentClientRun from the log file.
// The queue will have the ID and Team that was set when the work unit was received.
//if (unit.FoldingID.Equals(Default.FoldingID) ||
// !unit.FoldingID.Equals(currentClientRun.FoldingID))
//{
// unit.FoldingID = currentClientRun.FoldingID;
//}
//if (unit.Team == Default.Team ||
// unit.Team != currentClientRun.Team)
//{
// unit.Team = currentClientRun.Team;
//}
}
示例4: UpdateUnitInfoFromLogData
private static void UpdateUnitInfoFromLogData(UnitInfo unitInfo, ClientRunData clientRunData, UnitRunData unitRunData, UnitInfoLogData unitInfoLogData)
{
Debug.Assert(unitInfo != null);
Debug.Assert(clientRunData != null);
Debug.Assert(unitRunData != null);
// unitInfoLogData can be null
/* Project (R/C/G) (Could have already been read through Queue) */
if (unitInfo.ProjectIsUnknown())
{
unitInfo.ProjectID = unitRunData.ProjectID;
unitInfo.ProjectRun = unitRunData.ProjectRun;
unitInfo.ProjectClone = unitRunData.ProjectClone;
unitInfo.ProjectGen = unitRunData.ProjectGen;
}
if (unitRunData.Threads > 1)
{
unitInfo.SlotType = SlotType.CPU;
}
if (unitInfoLogData != null)
{
unitInfo.ProteinName = unitInfoLogData.ProteinName;
/* Tag (Could have already been read through Queue) */
if (unitInfo.ProteinTag.Length == 0)
{
unitInfo.ProteinTag = unitInfoLogData.ProteinTag;
}
/* DownloadTime (Could have already been read through Queue) */
if (unitInfo.DownloadTime.IsUnknown())
{
unitInfo.DownloadTime = unitInfoLogData.DownloadTime;
}
/* DueTime (Could have already been read through Queue) */
if (unitInfo.DueTime.IsUnknown())
{
unitInfo.DueTime = unitInfoLogData.DueTime;
}
/* FinishedTime (Not available in unitinfo log) */
/* Project (R/C/G) (Could have already been read through Queue) */
if (unitInfo.ProjectIsUnknown())
{
unitInfo.ProjectID = unitInfoLogData.ProjectID;
unitInfo.ProjectRun = unitInfoLogData.ProjectRun;
unitInfo.ProjectClone = unitInfoLogData.ProjectClone;
unitInfo.ProjectGen = unitInfoLogData.ProjectGen;
}
}
/* FoldingID and Team from last ClientRun (Could have already been read through Queue) */
if (unitInfo.FoldingID == Constants.DefaultFoldingID && unitInfo.Team == Constants.DefaultTeam)
{
if (!String.IsNullOrEmpty(clientRunData.FoldingID))
{
unitInfo.FoldingID = clientRunData.FoldingID;
unitInfo.Team = clientRunData.Team;
}
}
// The queue will have the FoldingID and Team that was set in the client when the work unit was assigned.
// If the user subsequently changed their FoldingID and Team before this unit was completed the
// FoldingID and Team read from the queue will NOT reflect that change.
//if (unitInfo.FoldingID != clientRunData.FoldingID || unitInfo.Team != clientRunData.Team)
//{
// if (!String.IsNullOrEmpty(clientRunData.FoldingID))
// {
// unitInfo.FoldingID = clientRunData.FoldingID;
// unitInfo.Team = clientRunData.Team;
// }
//}
}
示例5: IsSameUnitAs
internal static bool IsSameUnitAs(this UnitInfo unit1, UnitInfo unit2)
{
if (unit1 == null) throw new ArgumentNullException("unit1");
if (unit2 == null)
{
return false;
}
// if the Projects are known
if (!unit1.ProjectIsUnknown() && !unit2.ProjectIsUnknown())
{
// ReSharper disable RedundantThisQualifier
// equals the Project and Download Time
if (unit1.EqualsProject(unit2) &&
unit1.DownloadTime.Equals(unit2.DownloadTime))
{
return true;
}
// ReSharper restore RedundantThisQualifier
}
return false;
}
示例6: ValidateIncompleteUnitInfo
private static bool ValidateIncompleteUnitInfo(UnitInfo unitInfo)
{
// Finished Time will not be populated if any of these error
// results are detected. Only check for valid Project and
// download time - Issue 233
return unitInfo.ProjectIsUnknown() == false &&
(unitInfo.UnitResult.Equals(WorkUnitResult.BadWorkUnit) ||
unitInfo.UnitResult.Equals(WorkUnitResult.CoreOutdated) ||
unitInfo.UnitResult.Equals(WorkUnitResult.EarlyUnitEnd) ||
unitInfo.UnitResult.Equals(WorkUnitResult.Interrupted) ||
unitInfo.UnitResult.Equals(WorkUnitResult.UnstableMachine)) &&
unitInfo.DownloadTime.Equals(DateTime.MinValue) == false;
}
示例7: ValidateFinishedUnitInfo
private static bool ValidateFinishedUnitInfo(UnitInfo unitInfo)
{
return unitInfo.ProjectIsUnknown() == false &&
unitInfo.UnitResult.Equals(WorkUnitResult.FinishedUnit) &&
unitInfo.DownloadTime.Equals(DateTime.MinValue) == false &&
unitInfo.FinishedTime.Equals(DateTime.MinValue) == false;
}