本文整理汇总了C#中Dir类的典型用法代码示例。如果您正苦于以下问题:C# Dir类的具体用法?C# Dir怎么用?C# Dir使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dir类属于命名空间,在下文中一共展示了Dir类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePackageList
static IEnumerable<Package> CreatePackageList(
string name,
string path,
IEnumerable<Package> packageListConfig)
{
var firstPackage = packageListConfig.First();
var dir = new Dir(new DirectoryInfo(path), "");
var remainder = dir.FileList().ToHashSet();
foreach (var p in packageListConfig.Skip(1))
{
var fileList = dir.FileList(p.FileList);
remainder.ExceptWith(fileList);
yield return new Package(
name:
name +
"_" +
p.Name.Select(n => n, () => string.Empty),
package: p,
fileList: fileList
);
}
//
remainder.UnionWith(dir.FileList(firstPackage.FileList));
yield return new Package(
name: name,
package: firstPackage,
fileList: remainder
);
}
示例2: attr
/// <summary>Assigns all needed attributes to the tag</summary>
/// <returns>This instance downcasted to base class</returns>
public virtual IndexedTag attr(
Shape? shape = null,
Length[] coords = null,
string href = null,
NoHref? nohref = null,
Target target = null,
string alt = null,
string id = null,
string @class = null,
string style = null,
string title = null,
LangCode lang = null,
string xmllang = null,
Dir? dir = null,
string onclick = null,
string ondblclick = null,
string onmousedown = null,
string onmouseup = null,
string onmouseover = null,
string onmousemove = null,
string onmouseout = null,
string onkeypress = null,
string onkeydown = null,
string onkeyup = null,
char? accesskey = null,
int? tabindex = null,
string onfocus = null,
string onblur = null
)
{
Shape = shape;
Coords = coords;
Href = href;
NoHref = nohref;
Target = target;
Alt = alt;
Id = id;
Class = @class;
Style = style;
Title = title;
Lang = lang;
XmlLang = xmllang;
Dir = dir;
OnClick = onclick;
OnDblClick = ondblclick;
OnMouseDown = onmousedown;
OnMouseUp = onmouseup;
OnMouseOver = onmouseover;
OnMouseMove = onmousemove;
OnMouseOut = onmouseout;
OnKeyPress = onkeypress;
OnKeyDown = onkeydown;
OnKeyUp = onkeyup;
AccessKey = accesskey;
TabIndex = tabindex;
OnFocus = onfocus;
OnBlur = onblur;
return this;
}
示例3: attr
/// <summary>Assigns all needed attributes to the tag</summary>
/// <returns>This instance downcasted to base class</returns>
public virtual IndexedTag attr(
string abbr = null,
string axis = null,
string headers = null,
Scope? scope = null,
int? rowspan = null,
int? colspan = null,
string id = null,
string @class = null,
string style = null,
string title = null,
LangCode lang = null,
string xmllang = null,
Dir? dir = null,
string onclick = null,
string ondblclick = null,
string onmousedown = null,
string onmouseup = null,
string onmouseover = null,
string onmousemove = null,
string onmouseout = null,
string onkeypress = null,
string onkeydown = null,
string onkeyup = null,
Align? align = null,
char? @char = null,
Length charoff = null,
Valign? valign = null
)
{
Abbr = abbr;
Axis = axis;
Headers = headers;
Scope = scope;
RowSpan = rowspan;
ColSpan = colspan;
Id = id;
Class = @class;
Style = style;
Title = title;
Lang = lang;
XmlLang = xmllang;
Dir = dir;
OnClick = onclick;
OnDblClick = ondblclick;
OnMouseDown = onmousedown;
OnMouseUp = onmouseup;
OnMouseOver = onmouseover;
OnMouseMove = onmousemove;
OnMouseOut = onmouseout;
OnKeyPress = onkeypress;
OnKeyDown = onkeydown;
OnKeyUp = onkeyup;
Align = align;
Char = @char;
CharOff = charoff;
Valign = valign;
return this;
}
示例4: IfNoCorridor_ShouldSucceed_IfCorridorExists
public void IfNoCorridor_ShouldSucceed_IfCorridorExists(Dir dir)
{
var cell = new MapCell();
cell.Sides[dir] = Side.Empty;
Assert.That(() => ThrowD.IfNoCorridor(cell, dir), Throws.Nothing);
}
示例5: HasDir
public bool HasDir(CellLocation location, Dir dir)
{
CellType testType;
if (dir == Dir.North)
testType = caveCellGrid[location.x, location.y, location.z + 1];
else if (dir == Dir.South)
testType = caveCellGrid[location.x, location.y, location.z - 1];
else if (dir == Dir.East)
testType = caveCellGrid[location.x + 1, location.y, location.z];
else if (dir == Dir.West)
testType = caveCellGrid[location.x - 1, location.y, location.z];
else if (dir == Dir.NorthEast)
testType = caveCellGrid[location.x + 1, location.y, location.z + 1];
else if (dir == Dir.NorthWest)
testType = caveCellGrid[location.x - 1, location.y, location.z + 1];
else if (dir == Dir.SouthEast)
testType = caveCellGrid[location.x + 1, location.y, location.z - 1];
else
testType = caveCellGrid[location.x - 1, location.y, location.z - 1];
if (testType == CellType.RockFloor) {
return true;
}
return false;
}
示例6: ComparisonTest
public void ComparisonTest(DnxSdk sdk)
{
var file1a = new JObject
{
["info"] = "foo"
};
var file1b = new JObject
{
["info"] = "bar1"
};
var project1 = new Dir
{
["file1"] = file1a,
["file2"] = file1b
};
var file2a = new JObject
{
["info"] = "foo"
};
var file2b = new JObject
{
["info"] = "bar2"
};
var project2 = new Dir
{
["file1"] = file2a,
["file2"] = file2b
};
var project3 = new Dir
{
["file1"] = file2a,
["file2"] = new DirItem(Dir.EmptyFile, skipComparison: true)
};
var project4 = new Dir
{
["subdir1"] = project1,
["subdir2"] = project1
};
var project5 = new Dir
{
["subdir1"] = new DirItem(project2, skipComparison: true),
["subdir2"] = project2
};
DirAssert.Equal(project1, project2, compareContents: false);
DirAssert.Equal(project1, project3, compareContents: false);
DirAssert.Equal(project1, project3);
DirAssert.Equal(project2, project3);
//DirAssert.Equal(project4, project5); // this should fail, but only subdir2 should be different
TestUtils.CleanUpTestDir<DnuPublishTests>(sdk);
}
示例7: SwapSkyBox_Cor
// 스카이 박스 스왑
IEnumerator SwapSkyBox_Cor(Dir dir)
{
float time = 0;
// 오른쪽으로 갈때
while (Dir.RIGHT == dir && time < 1)
{
time += Time.smoothDeltaTime / durationTime;
blend = Mathf.Lerp(blend, 1f, time);
RenderSettings.skybox.SetFloat("_Blend", blend);
if (blend >= 0.99)
{
break;
}
yield return null;
}
// 왼쪽으로 갈때
while (Dir.LEFT == dir && time < 1)
{
time += Time.smoothDeltaTime / durationTime;
blend = Mathf.Lerp(blend, 0f, time);
RenderSettings.skybox.SetFloat("_Blend", blend);
if (blend <= 0.01)
{
break;
}
yield return null;
}
}
示例8: MoveInDirection_MovesInCorrectDirection
public void MoveInDirection_MovesInCorrectDirection(int newWidth, int newHeight, Dir dir)
{
var point = new Point(5, 5);
Assert.That(DirHelper.MoveInDir(point, dir),
Is.EqualTo(new Point(newWidth, newHeight)));
}
示例9: Moveing
public IEnumerator Moveing(Transform startTr, Dir moveDir, float speed )
{
StartCoroutine(OffActive());
gameObject.transform.position = startTr.position;
thisTr = gameObject.transform;
moveVector = startTr.position;
while (true)
{
if (!gameObject.activeSelf)
break;
switch (moveDir)
{
case Dir.LEFT:
moveVector.x = thisTr.position.x + (-1 * speed * Time.deltaTime);
break;
case Dir.RIGHT:
moveVector.x = thisTr.position.x + (speed * Time.deltaTime);
break;
case Dir.UP:
moveVector.y = thisTr.position.y + (speed * Time.deltaTime);
break;
case Dir.DOWN:
moveVector.y = thisTr.position.y + (-1 * speed * Time.deltaTime);
break;
}
thisTr.position = moveVector;
yield return null;
}
}
示例10: Update
// Update is called once per frame
void Update()
{
if(Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android){//平台为IOS或者android时
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved){//输入触点大于0且移动时
if(Input.GetTouch(0).deltaPosition.x < 0 - Mathf.Epsilon)_touchDir = Dir.Left;else _touchDir = Dir.Right;
}
// 当输入的触点数量大于0,且手指不动时
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Stationary){
_touchDir = Dir.Stop;
}
}
// 根据手势顺序或逆序换图
if(_touchDir != Dir.Stop){
if(_touchDir == Dir.Left){
curTime += Time.deltaTime;
if(curTime > duration){
curTime = 0;
index = index == 0 ? texAll.Length - 1 : index ;
plane.renderer.material.mainTexture = texAll[index--];
}
}else{
curTime += Time.deltaTime;
if(curTime > duration){
curTime = 0;
index = index == texAll.Length - 1 ? 0 : index ;
plane.renderer.material.mainTexture = texAll[index++];
}
}
}
}
示例11: NextStep
/// <summary>Выполняет один шаг алгоритма поведения мыши.</summary>
/// <returns>Направление следующего шага мыши.</returns>
public override Dir NextStep()
{
// Находим все доступные направления куда может пойти мышь из текущей клетки
var canGoDirs = Context.GetCanGoDirs();
// Если нет направлений в которые можно идти, то мышь окружена стенами. А-а-а!!!
if(canGoDirs.Count() == 0)
{
Context.Write("Некуда идти! Мышь окружена.", Color.Coral);
return Dir.None;
}
if(_prevDir != Dir.None && _status != Status.Back && Context.GetStones() != 0 && _prevStones < 4)
{
_status = Status.Back;
return _prevDir.Reverse();
}
var index = _rnd.Next(canGoDirs.Count());
_prevDir = canGoDirs.ElementAt(index);
var stones = Context.GetStones();
if(stones < 4) ++stones;
Context.PutStones(stones);
_prevStones = stones;
_status = Status.Forward;
return _prevDir;
}
示例12: GetFile
/// <summary>
/// Returns the complete path for the specified file in the specified MP directory.
/// </summary>
/// <param name="directory">A <see cref="Dir"/> value, indicating the directory where the file should be located</param>
/// <param name="fileName">The name of the file for which to return the complete path.</param>
/// <returns>A string containing the complete path.</returns>
public static string GetFile(Dir directory, string fileName)
{
if (fileName.StartsWith(@"\") || fileName.StartsWith("/"))
{
throw new ArgumentException("The passed file name cannot start with a slash or backslash", "fileName");
}
return Path.Combine(Get(directory), fileName);
}
示例13: IfNoCorridor_ShouldThrow_IfOutsideMap
public void IfNoCorridor_ShouldThrow_IfOutsideMap(Dir dir)
{
var cell = new MapCell();
cell.Sides[dir] = Side.Wall;
Assert.That(() => ThrowD.IfNoCorridor(cell, dir),
Throws.InstanceOf<InvalidOperationException>());
}
示例14: SwapSkyBoxAndLight
// 스카이 박스와 라이팅 변경 ( 외부 호출 )
public void SwapSkyBoxAndLight(int skyboxNumber, Dir dir)
{
Debug.Log(111);
RenderSettings.skybox = skies[skyboxNumber];
StopAllCoroutines();
StartCoroutine(SwapLight(skyboxNumber, dir));
StartCoroutine(SwapSkyBox_Cor(dir));
}
示例15: changeRoom
public void changeRoom(DungeonModel model, Dir direction)
{
Dir oppositeDir = Positions.opposite(direction);
currentRoom.exitAndDestroy(oppositeDir);
currentRoom = makeCurrent(model.currentRoom);
currentRoom.enterAndEnable(direction);
}