本文整理汇总了C#中DirectionType类的典型用法代码示例。如果您正苦于以下问题:C# DirectionType类的具体用法?C# DirectionType怎么用?C# DirectionType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DirectionType类属于命名空间,在下文中一共展示了DirectionType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Convert
static public string Convert(double bytes, double reference, DirectionType direction, string format)
{
ConversionType conversionType;
conversionType = GetConversionType(reference);
conversionType = MoveDirection(conversionType, direction);
return Convert(bytes, conversionType, format);
}
示例2: PacketLogEntry
public PacketLogEntry(DateTime time, DirectionType direction, string address, byte[] data)
{
Time = time;
Direction = direction;
Address = address;
Data = data;
}
示例3: changeDirectionRandom
// ------------------------------------------------------------------------------------ //
private void changeDirectionRandom()
{
float angle = 0;
if (currentDirectionType == DirectionType.Forward)
{
if (Probability.getProbability(50)) {
currentDirectionType = DirectionType.Left;
angle = rotateAngle;
}
else {
currentDirectionType = DirectionType.Right;
angle = -rotateAngle;
}
}
else if (currentDirectionType == DirectionType.Left)
{
currentDirectionType = DirectionType.Forward;
angle = -rotateAngle;
}
else if (currentDirectionType == DirectionType.Right)
{
currentDirectionType = DirectionType.Forward;
angle = rotateAngle;
}
rotateUnit(angle);
}
示例4: SortNode
public SortNode(XmlNode xmlNode, InternalScriptSettings settings)
: base(xmlNode, settings)
{
// Load attributes
foreach (XmlAttribute attr in xmlNode.Attributes) {
switch (attr.Name) {
case "direction":
string dirStr = attr.Value.ToLower().Trim();
if (dirStr == "desc" || dirStr == "descending")
direction = DirectionType.DESCENDING;
else if (dirStr == "asc" || dirStr == "ascending")
direction = DirectionType.ASCENDING;
else {
logger.Error("Invalid sort direction on: " + xmlNode.OuterXml);
}
break;
case "by":
sortBy = attr.Value;
break;
}
}
// Validate BY attribute
if (sortBy == null) {
logger.Error("Missing BY attribute on: " + xmlNode.OuterXml);
loadSuccess = false;
return;
}
}
示例5: Thermometer
UnitsType m_Units = UnitsType.Celsius; // this defines the units of the new input temperatures, but our calculations will be in Celcius
#endregion Fields
#region Constructors
// constructor
public Thermometer(UnitsType units, DirectionType direction, double threshold, double hysterisis)
{
Units = units;
Direction = direction;
Threshold = threshold;
HysterisisThreshold = hysterisis;
}
示例6: PacketLogEntry
public PacketLogEntry(DateTime time, TransportProtocol protocol, DirectionType direction, DhtAddress address, byte[] data)
{
Time = time;
Protocol = protocol;
Direction = direction;
Address = address;
Data = data;
}
示例7: Tree
public Tree(int x, int y)
{
base.Initialize(x, y, 1, 1, Texture);
direction = DirectionType.South;
Name = "Tree";
}
示例8: HttpNetworkStream
public HttpNetworkStream(DirectionType direction, Socket socket,
System.IO.FileAccess fileAccess, bool ownsSocket)
{
Direction = direction;
_socket = socket;
_stream = new PrependableNetworkStream(socket, fileAccess, ownsSocket);
_unknownContentLength = true;
}
示例9: ResetCounter
public void ResetCounter(StateType state, DirectionType direction)
{
if (direction != Direction) {
_counter = 1000;
_animationIndex = 0;
}
State = state;
Direction = direction;
}
示例10: TransitDescription
public TransitDescription(Route route, DirectionType transitType)
{
if (route == null)
{
throw new ArgumentNullException("route");
}
this.TransitType = transitType;
this.StartLocation = route.RouteLegs[0].ActualStart.AsGeoCoordinate();
this.EndLocation = route.RouteLegs[0].ActualEnd.AsGeoCoordinate();
this.TravelDuration = route.TravelDuration;
this.ArrivalTime = route.RouteLegs[0].EndTime.ToShortTimeString();
this.DepartureTime = route.RouteLegs[0].StartTime.ToShortTimeString();
// TODO: need to add endpoint to the step list?
this.ItinerarySteps = new ObservableCollection<ItineraryStep>();
var stepNumber = 0;
foreach (var topLeg in route.RouteLegs[0].ItineraryItems)
{
this.ItinerarySteps.Add(new ItineraryStep(topLeg, ++stepNumber));
// calculate the walking start and end times
if (this.ItinerarySteps[stepNumber - 1].IconType == "Walk")
{
if (stepNumber == 1)
{
// WalkOnly directions needs to be set a default time. Using current time
this.ItinerarySteps[stepNumber - 1].StartTime = this.TransitType == DirectionType.WalkOnly ? DateTime.Now : route.RouteLegs[0].StartTime;
}
else
{
this.ItinerarySteps[stepNumber - 1].StartTime = this.ItinerarySteps[stepNumber - 2].EndTime;
}
this.ItinerarySteps[stepNumber - 1].EndTime = this.ItinerarySteps[stepNumber - 1].StartTime + TimeSpan.FromSeconds(topLeg.TravelDuration);
}
}
this.ItinerarySteps[0].StepType = ItineraryStep.ItineraryStepType.FirstStep;
this.ItinerarySteps[this.ItinerarySteps.Count - 1].StepType = ItineraryStep.ItineraryStepType.LastStep;
// check the first and last step for generic strings to replace
// TODO: need a better place to put this
this.ItinerarySteps[0].Instruction = this.ItinerarySteps[0].Instruction.Replace(SR.SourceLocation, ViewModelLocator.MainMapViewModelStatic.StartLocationText);
this.ItinerarySteps[this.ItinerarySteps.Count - 1].Instruction = this.ItinerarySteps[this.ItinerarySteps.Count - 1].Instruction.Replace(SR.DestinationLocation, ViewModelLocator.MainMapViewModelStatic.EndLocationText);
this.PathPoints = route.RoutePaths[0].Line;
this.MapView = route.BoundingBox.AsLocationRect();
}
示例11: getRight
public static DirectionType getRight(DirectionType d)
{
switch (d) {
case DirectionType.NORTH: return DirectionType.NORTHEAST;
case DirectionType.NORTHEAST: return DirectionType.EAST;
case DirectionType.EAST : return DirectionType.SOUTHEAST;
case DirectionType.SOUTHEAST : return DirectionType.SOUTH;
case DirectionType.SOUTH : return DirectionType.SOUTHWEST;
case DirectionType.SOUTHWEST : return DirectionType.WEST;
case DirectionType.WEST : return DirectionType.NORTHWEST;
case DirectionType.NORTHWEST : return DirectionType.NORTH;
default : return DirectionType.NORTH;
}
}
示例12: Person
public Person(int x, int y)
: base(x, y, 1, 1, texturesMap[ProfessionType.Worker])
{
age = 0;
education = 0;
gender = GenderType.Male;
health = HEALTH_MAX;
profession = ProfessionType.Worker;
Random random = new Random();
direction = (DirectionType)(random.Next() % (int)DirectionType.SIZE);
remainingMovement = movementRange = 36;
BlocksMovement = false;
Name = "Person";
}
示例13: GetDirectionalImageManager
private IImageManager GetDirectionalImageManager(IImageManager imageManager, DirectionType directionType)
{
//TODO: Compressed and PDF files need to be able to find each other for the case of a folder containing both .pdf and .cbr
IImageManager nextImageManager = null;
var path = imageManager.Location;
int directionOffset = directionType == DirectionType.Next ? 1 : -1;
//TODO: code for CompressedFileImageManager and FolderImageManager is virtually identical. Consolidate!
if ((imageManager is CompressedFileImageManager) || (imageManager is PDFImageManager))
{
var fileName = Path.GetFileName(path).ToLower();
var fileInfo = new FileInfo(path);
var supportFileTypes = imageManager is CompressedFileImageManager
? CompressedFileImageManager.SUPPORTED_FILETYPES
: PDFImageManager.SUPPORTED_FILETYPES;
var fileInfos = fileInfo.Directory.GetFiles()
.Where(x => supportFileTypes.Contains(x.Extension.ToLower()))
.OrderBy(x => x.Name, Utility.NaturalStringComparer)
.ToList();
var foundFileIndex = fileInfos.FindIndex(x => x.Name.ToLower() == fileName) + directionOffset;
if ((foundFileIndex < fileInfos.Count) && (foundFileIndex > -1))
{
imageManager.Dispose();
nextImageManager = this.Load(fileInfos[foundFileIndex].FullName);
}
}
else if (imageManager is FolderImageManager)
{
DirectoryInfo directoryInfo = new DirectoryInfo(path);
var directoryName = directoryInfo.Name.ToLower();
var directoryInfos = directoryInfo.Parent.GetDirectories()
.OrderBy(x => x.Name, Utility.NaturalStringComparer)
.ToList();
var foundDirectoryIndex = directoryInfos.FindIndex(x => x.Name.ToLower() == directoryName) + directionOffset;
if ((foundDirectoryIndex < directoryInfos.Count) && (foundDirectoryIndex > -1))
{
imageManager.Dispose();
nextImageManager = this.Load(directoryInfos[foundDirectoryIndex].FullName);
}
}
return nextImageManager;
}
示例14: Initialize
public void Initialize(string[] parameters)
{
if (parameters.Contains("Origin"))
hasOrigin = true;
if (parameters.Contains("Direction"))
direction = DirectionType.Direction;
else if (parameters.Contains("Angle"))
direction = DirectionType.Angle;
if (parameters.Contains("Speed"))
hasSpeed = true;
foreach (string param in parameters)
if (param == "Param")
paramCount++;
}
示例15: InputOrder
public InputOrder(
string brokerID,
string investorID,
DirectionType direction,
OffsetFlag offsetFlag,
string instrumentID,
double price,
int volume,
string groupID)
{
this.BrokerID = brokerID;
this.InvestorID = investorID;
this.Direction = direction;
this.OffsetFlag = offsetFlag;
this.InstrumentID = instrumentID;
this.Price = price;
this.Volume = volume;
this.GroupID = groupID;
}