public void SetContextMenu() { MenuItem menuDelete = new MenuItem() { Header = App.Current.FindResource("win_delete") as string }; menuDelete.Click += (p1, p2) => { T item = View.SelectedItem as T; Source.Remove(item); Delete?.Invoke(p1, item); }; MenuItem menuClone = new MenuItem() { Header = App.Current.FindResource("win_clone") as string }; menuClone.Click += (p1, p2) => { T item = View.SelectedItem as T; Clone?.Invoke(p1, item); }; ContextMenu menu = new ContextMenu(); menu.Items.Add(menuDelete); menu.Items.Add(menuClone); if (View != null) { View.ContextMenu = menu; } }
IEnumerator Spawn() { while (!Player.lose) { float ran2 = Random.Range(1, 102); if (ran2 < 100 && ran2 > 95) { randomStuff = life; } else if (ran2 > 100) { randomStuff = time; } else { randomStuff = bomb; } if (interval > .1) { interval -= .003f; } GameObject newStuff = randomStuff.GetClone(); newStuff.transform.position = new Vector2(Random.Range(-2.5f, 2.5f), 5.9f); newStuff.transform.rotation = Quaternion.identity; newStuff.SetActive(true); yield return(new WaitForSeconds(interval)); } }
public override void useTool() { // Set the plant prefab to be the base one PlantPrefab = bPrefab; Dictioary = GameObject.FindGameObjectWithTag("TileMapManager").GetComponent <TileDictionaryClass>(); //TODO - when we add more grids and tilemaps, this will break // Convert mouse to world point pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector3Int posInt = grid.LocalToCell(pos); // Check that point doesn't have a plant and contains the key if (Dictioary.TileMapData.ElementAt(0).Value.ContainsKey(posInt) && !Dictioary.TileMapData.ElementAt(0).Value[posInt].HasPlant()) { /*Subtract one as we only use 1 seed at a time, if it drops below 0 then remove the item*/ this.SubstractAmount(1); HotBarClass HotBar = GameObject.FindGameObjectWithTag("InventoryManager").GetComponent <HotBarClass>(); if (this.GetAmount() <= 0) { HotBar.RemoveItem(this.GetName()); } /********************************************************************************************/ ID = posInt; /*Get the audio the play it*/ AudioSource Audio = gameObject.GetComponentInParent <AudioSource>(); Audio.clip = GetSoundEffect(); Audio.Play(); /***************************/ Debug.Log("Seed Planted"); ToolUsed = true; /*Create a clone and instantiate it*/ GameObject Clone; Clone = Instantiate(PlantPrefab, new Vector3(posInt.x + 0.5f, posInt.y + 0.5f, posInt.z), Quaternion.identity); /*****************************/ /* Set up the plant for the clone on that spot in the database */ PlantAbstractClass TempPlant = Clone.GetComponent <PlantAbstractClass>(); TempPlant.ID = ID; TempPlant.pos = pos; TempPlant.AddAmount(1); Dictioary.TileMapData.ElementAt(0).Value[posInt].SetPlant(TempPlant); Dictioary.TileMapData.ElementAt(0).Value[posInt].Clone = Clone; if (Dictioary.TileMapData.ElementAt(0).Value[posInt].IsWatered()) { TempPlant.mWatered = true; } else { TempPlant.mWatered = false; } HotBar.UpdateUI(); /*******************************************************************/ } else { Debug.Log(tileMap.GetTile(posInt).name); Debug.Log("Plot already has a plant placed there"); } }
List <T> Convert <T>(List <T> list1, ConvertFunc action, Clone <T> clone) where T : class, IQueryElement { List <T> list2 = null; for (int i = 0; i < list1.Count; i++) { T elem1 = list1[i]; T elem2 = (T)ConvertInternal(elem1, action); if (elem2 != null && !ReferenceEquals(elem1, elem2)) { if (list2 == null) { list2 = new List <T>(list1.Count); for (int j = 0; j < i; j++) { list2.Add(clone == null ? list1[j] : clone(list1[j])); } } list2.Add(elem2); } else if (list2 != null) { list2.Add(clone == null ? elem1 : clone(elem1)); } } return(list2); }
private static void AddCloneCommand(CommandLineApplication app) { app.Command("clone", cmd => { var organization = cmd.Option("--organization", "", CommandOptionType.SingleValue).IsRequired(); var areaPaths = cmd.Option("-a|--area-path", "", CommandOptionType.MultipleValue).IsRequired(); var token = cmd.Option("-t|--token", "", CommandOptionType.SingleValue).IsRequired(); var output = cmd.Option("-o|--output", "", CommandOptionType.SingleValue).IsRequired(); cmd.HelpOption(); cmd.OnExecuteAsync(async c => { var progress = new Progress <Clone.Progress>(); progress.ProgressChanged += (_, p) => { SetCursorPosition(0, CursorTop); Write($"Downloaded {p.Updates} work item updates and {p.Attachments} attachments...".PadRight(BufferWidth - 1)); }; await Clone.Run(organization.Value(), token.Value(), areaPaths.Values, output.Value(), progress); }); }); }
static public GameObject CreateCard() { GameObject Clone; Clone = GameObject.CreatePrimitive(PrimitiveType.Quad); Clone.GetComponent <Renderer> ().material.color = new Color(0.05f, 0.05f, 0.05f); Clone.name = "Card"; GameObject Clone2 = GameObject.CreatePrimitive(PrimitiveType.Quad); Clone2.transform.parent = Clone.transform; Clone2.transform.localScale = new Vector3(0.9f, 0.9f * CardSizeX, 1); Clone2.transform.localPosition = new Vector3(0, -0.12f, -0.01f); Clone2.name = "AbilityArea"; Destroy(Clone2.GetComponent <Collider> ()); Clone2 = GameObject.CreatePrimitive(PrimitiveType.Quad); Clone2.transform.localScale = new Vector3(0.325f, 0.325f * CardSizeX, 1); Clone2.transform.parent = Clone.transform; Clone2.transform.localPosition = new Vector3(0.2875f, 0.339f, -0.01f); Clone2.name = "AbilityType"; Destroy(Clone2.GetComponent <Collider> ()); Clone2 = GameObject.CreatePrimitive(PrimitiveType.Quad); Clone2.GetComponent <Renderer> ().material.color = new Color(0.5f, 0.5f, 0.5f); Clone2.transform.localScale = new Vector3(0.9f, 0.325f * CardSizeX, 1); Clone2.transform.parent = Clone.transform; Clone2.transform.localPosition = new Vector3(0, 0.34f, -0.005f); Clone2.name = "TextBackground"; Destroy(Clone2.GetComponent <Collider> ()); Clone2 = Instantiate(Resources.Load("PreText")) as GameObject; Clone2.GetComponent <TextMesh> ().text = ""; Clone2.transform.localScale = new Vector3(0.325f, 0.325f * CardSizeX, 1); Clone2.transform.parent = Clone.transform; Clone2.transform.localPosition = new Vector3(-0.3f, 0.35f, -0.02f); Clone2.name = "ValueText"; return(Clone); }
T[] Convert <T>(T[] arr1, ConvertFunc action, Clone <T> clone) where T : class, IQueryElement { T[] arr2 = null; for (int i = 0; i < arr1.Length; i++) { T elem1 = arr1[i]; T elem2 = (T)ConvertInternal(elem1, action); if (elem2 != null && !ReferenceEquals(elem1, elem2)) { if (arr2 == null) { arr2 = new T[arr1.Length]; for (int j = 0; j < i; j++) { arr2[j] = clone == null ? arr1[j] : clone(arr1[j]); } } arr2[i] = elem2; } else if (arr2 != null) { arr2[i] = clone == null ? elem1 : clone(elem1); } } return(arr2); }
// Applies clones of the shared materials as the instanced materials. Clones // are instantiated only once and are therefore themselves shared between any // object instances that clone the same shared materials. public void ApplySharedMaterialClones() { LazyInitAll(); DestroyInstancedMaterials(); foreach (Renderer renderer in gameObject.GetComponentsInChildren <Renderer>()) { Material[] sharedMaterials = s_sharedMaterialsByRenderer[renderer]; Material[] cloneMaterials = new Material[sharedMaterials.Length]; for (int i = 0; i < sharedMaterials.Length; i++) { Material sharedMaterial = sharedMaterials[i]; Clone clone = null; if (!s_clonesBySharedMaterial.TryGetValue(sharedMaterial, out clone)) { // Create new clone clone = new Clone(sharedMaterial); s_clonesBySharedMaterial.Add(sharedMaterial, clone); //Debug.Log("Created clone of " + sharedMaterial.GetInstanceID() + ": " + clone.cloneMaterial.GetInstanceID()); } else { //Debug.Log("Retrieved clone of " + sharedMaterial.GetInstanceID() + ": " + clone.cloneMaterial.GetInstanceID()); } if (SetInsert(m_ourClones, clone)) { // Reference count incremented only once for each gameObject that // uses a cloned material IncrementReferenceCount(clone); } cloneMaterials[i] = clone.cloneMaterial; } renderer.materials = cloneMaterials; } }
private void OnSwitchingComplete() { if (!IsRemoteControlled) { Clone?.Delete(); Clone = null; } }
/// <summary> /// Inicializa uma nova instância como cópia de outro ComponentGroup. /// </summary> /// <param name="source">O ComponentGroup a ser copiado.</param> public ComponentGroup(ComponentGroup source) { foreach (ActorComponent c in source.List) { var clone = Clone.Get(c, c); this.List.Add(clone); } }
public static string FormatCloneForMenu(Clone clone) { int cloneClassId = clone.CloneClass.Id; int startLine = clone.StartLine; int finishLine = clone.StartLine + clone.LineCount; return(String.Format(CultureInfo.CurrentCulture, Res.MenuClone, cloneClassId, startLine, finishLine)); }
void FixedUpdate() { int layerMask = 1 << 8; layerMask = ~layerMask; cloneComponent = (Clone)SeedsGenerator.characterDetection <Clone>(transform.position, transform.TransformDirection(Vector3.forward), swapDistance, layerMask); }
private void DestroyExistingCloneAndCreateNewOne() { Clone existingClone = FindObjectOfType <Clone>(); Destroy(existingClone.gameObject); Instantiate(clonePrefab, transform.position, Quaternion.identity); Player.hasActiveClone = true; }
public ActionResult DeleteConfirmed(int id) { Clone clone = db.Clones.Find(id); db.Clones.Remove(clone); db.SaveChanges(); return(RedirectToAction("Index")); }
// Swap seed string between Player and Clone public static string SeedSwap(Clone clone, string seed) { string tempSeed = clone.Seed; clone.Seed = seed; clone.ChangeSkin(); return(tempSeed); }
public TodoDetailData GetTodoDetailData([FromRoute] int UserId, [FromRoute] int DataId) { { var data = _context.TodoDetailDataTmpPgs.Where(x => x.UserId == UserId && x.DataId == DataId); var result = Clone.Convert <TodoDetailData>(data); return(result); } }
public SimulationParameters(Clone clone, int elevatorsToBuild, int nbTotalClones) { CloneFloor = clone.CloneFloor; ClonePos = clone.ClonePos; Direction = clone.Direction; ElevatorsToBuild = elevatorsToBuild; NbTotalClones = nbTotalClones; }
private void Awake() { cl_1 = (new GameObject("Clone_class").AddComponent <Clone>()); bgWhite_anim = bgWhite.GetComponent <Animator>(); player = gameObject.AddComponent <Player>(); player.Load(); moneyCloud.text = player.money.ToString(); }
// Instantiates a clone that dies after a duration public void Clone() { AudioManager.instance.PlaySound("dash"); Clone c = Instantiate(clonePrefab, transform.position, Quaternion.identity).GetComponent <Clone>(); c.owner = this; Dash(movingDirection); }
static void TestTypeAliases <T, U>(T from) where T : class { Util.AllSerializeDeserialize <T, T>(from); var to = Clone <T> .From(Clone <U> .From(from)); Assert.IsTrue(from.IsEqual <T>(to)); }
public void OnEventRaised(LNSClient from, ushort eventCode, LNSReader reader, DeliveryMethod deliveryMethod) { if (eventCode == 0) { Color color = reader.GetColor(); if (others.ContainsKey(from.id)) { Clone o = others[from.id]; o.GetComponent <Clone>().SetColor(color); o.gameObject.name = from.id + "_" + from.displayName; } else { GameObject o = Instantiate(clonePrefab); o.GetComponent <Clone>().SetColor(color); o.name = from.id + "_" + from.displayName; others.Add(from.id, o.GetComponent <Clone>()); } } else if (eventCode == 1) { string playerid = from.id; Vector3 pos = reader.GetVector3(); Quaternion rot = reader.GetQuaternion(); //long timestamp = reader.GetLong(); //Debug.Log(timestamp); //float delay = (float)(System.DateTime.UtcNow - System.DateTime.FromFileTimeUtc(timestamp)).TotalMilliseconds; //if (delay > 400) //{ // //Discard old packet // return; //} if (others.ContainsKey(playerid)) { others[playerid].SetTarget(pos, rot); } } else if (eventCode == 2) { if (others.ContainsKey(from.id)) { Vector3 pos = reader.GetVector3(); Quaternion rot = reader.GetQuaternion(); others[from.id].ShootBulletAt(pos, rot); } } else if (eventCode == 3) { player.transform.position += Vector3.up; } else if (eventCode == 10) { if (others.ContainsKey(from.id)) { others[from.id].audioReceiver.Play(reader.GetInt(), reader.GetInt(), reader.GetRemainingBytes()); } } }
static void Main(string[] args) { List <string> list = new List <string> { "Bewba", "Boomer", "Bronsky", "Bobert", "Booger" }; MyStack <string> stack = new MyStack <string>(list.Count); foreach (var x in list) { stack.Push(x); Console.WriteLine($"Current stack peek: {stack.Peek()}"); } Console.WriteLine($"\n\nStack count: {stack.Count}\n"); for (int i = 0; i < list.Count; i++) { Console.WriteLine($"Stack Count: {stack.Count}, Element: {stack.Pop()}"); } Console.WriteLine("\n\n\n\n"); //foreach(var x in ss) //{ // //Console.WriteLine(x); // switch(x) // { // case "ME": // Console.WriteLine($"this element contains: {ss[4]}"); // break; // } //} Clone clone = new Clone(); clone.Id = 2; clone.Programs.Push("Delta Force"); clone.Programs.Push("213123"); clone.Programs.Push("Bananoid"); clone.Programs.Push("32423"); clone.Programs.Pop(); Console.WriteLine($"{clone.Programs.Peek()}"); var s = "ME IS CHIEF OF BEWBA TRIBE"; var ss = s.Split(' '); switch (ss[3]) { case "OF": clone.Programs.Push(ss[2]); Console.WriteLine(clone.Programs.Pop()); break; } }
public async Task <IActionResult> GetTodoDetailDataUsers([FromRoute] int UserId) { { List <TodoDetailData> result; var dataList = _context.TodoDetailDataTmpPgs.Where(x => x.UserId == UserId).ToList(); result = Clone.Convert <TodoDetailData, TodoDetailDataTmpPg> (dataList); return(Ok(result)); } }
ConcreteClass InvokeDelegateParameter(Clone <ConcreteClass> clone) { try { return(clone(this)); // invoking delegate } catch (Exception ex) { throw new InvalidOperationException("Error when calling delegate", ex); } }
public JsonResult DataTable_IgnoreGroups(jQueryDataTableParamModel param, List <String> SubjectID = null, List <String> Class = null, List <String> Check = null, String Search = null, String ShowIgnore = null, String ShowNotIgnore = null) { if (SubjectID != null && Class != null && Check != null) { OutputHelper.SaveIgnoreGroups(SubjectID, Class, Check, false); } Dictionary <String, Group> dbGroups = Clone.Dictionary <String, Group>((Dictionary <String, Group>)(CurrentSession.Get("IgnoreGroups") ?? InputHelper.Groups)); var Groups = from m in dbGroups.Values select m; var total = Groups.Count(); if (!string.IsNullOrEmpty(Search)) { Groups = Groups.Where(m => m.MaMonHoc.ToLower().Contains(Search.ToLower()) || m.TenMonHoc.ToLower().Contains(Search.ToLower())); } if (ShowIgnore != null && ShowNotIgnore != null) { if (ShowIgnore == "checked" && ShowNotIgnore != "checked") { Groups = Groups.Where(m => m.IsIgnored == true); } if (ShowIgnore != "checked" && ShowNotIgnore == "checked") { Groups = Groups.Where(m => m.IsIgnored == false); } if (ShowIgnore != "checked" && ShowNotIgnore != "checked") { Groups = Groups.Where(m => false); } } var Result = new List <string[]>(); foreach (var su in Groups.OrderBy(m => m.TenMonHoc).Skip(param.iDisplayStart).Take(param.iDisplayLength)) { Result.Add(new string[] { su.MaMonHoc, su.TenMonHoc, su.TenBoMon, su.TenKhoa, su.Nhom.ToString(), su.SoLuongDK.ToString(), su.IsIgnored?"checked":"", //"Xoá" } ); } return(Json(new { sEcho = param.sEcho, iTotalRecords = total, iTotalDisplayRecords = Groups.Count(), //iTotalDisplayedRecords = Subjects.Count(), aaData = Result }, JsonRequestBehavior.AllowGet )); }
public void ShouldCloneCircularLists() { var circularList = CircularList.CreateStartingFrom0("a", "b", "c"); var clone = Clone.Of(circularList); XAssert.Alike(circularList, clone); XAssert.NotSame(circularList, clone); }
public void TestCloning <T, U>() where T : class where U : class { var source = Random.Init <T>(); var target = Clone <U> .From(source); Assert.IsTrue(source.IsEqual(target)); }
void OnShoot() { GameObject Clone; Clone = (Instantiate(bulletPrefab, transform.position, transform.rotation)) as GameObject; Clone.GetComponent <Transform>().parent = null; Clone.GetComponent <Rigidbody2D>().AddRelativeForce(new Vector3(0, bulletSpeed, 0)); Debug.Log("Bullet has been found"); }
} // end main public CritViewer() { Clone myClone = new Clone(); myClone.name = "Dolly"; Console.WriteLine(myClone.talk()); Console.WriteLine("Please press Enter to continue"); Console.ReadLine(); } // end constructor
public void Clone_VraćaNoviObjektSIstimSadržajem() { Clone.Jednakost(); Assert.IsTrue(cw.GetString().EndsWith("False")); Assert.IsTrue(cw.GetString().EndsWith("True")); Assert.IsTrue(cw.GetString().EndsWith("False")); Assert.IsTrue(cw.GetString().EndsWith("False")); Assert.IsTrue(cw.GetString().EndsWith("False")); Assert.IsTrue(cw.GetString().EndsWith("True")); }
public void CloneRepository() { // Arrange var mock = new Mock<IGitFacade>(); var msbuildCloneTask = new Clone(mock.Object) { // Mock away IBuildEngine cause we are not interested in the logging functionality. BuildEngine = new Mock<IBuildEngine>().Object, RepositoryToClone = string.Empty, TargetDirectory = string.Empty }; // Act Assert.IsTrue(msbuildCloneTask.Execute()); // Assert mock.Verify(git => git.Clone(msbuildCloneTask.RepositoryToClone, msbuildCloneTask.TargetDirectory), Times.Once()); mock.Verify(git => git.GetLatestSha(msbuildCloneTask.TargetDirectory), Times.Once()); }
// Use this for initialization void Start () { clone = this; playback = new CloneData[Main.MCU.rewindMax]; int length = Main.MCU.rewindStart - Main.MCU.currentFrame; for (int i = 0; i < Main.MCU.rewindMax; i++) { if (i < length) { playback[i].position = PlayerControl.player.Moments[Main.MCU.currentFrame + i].position; playback[i].type = PlayerControl.player.Moments[Main.MCU.currentFrame + i].type; } else { playback[i].position = PlayerControl.player.Moments[Main.MCU.rewindStart - 1].position; playback[i].type = PlayerControl.player.Moments[Main.MCU.rewindStart - 1].type; } } absOffset = Main.MCU.currentFrame; }
public Clone(Clone source, string value) { }
public void ShouldReturnFalseWhenExceptionOccurs() { // Arrange var gitMock = new Mock<IGitFacade>(); var msbuildCloneTask = new Clone(gitMock.Object) { BuildEngine = new Mock<IBuildEngine>().Object, RepositoryToClone = string.Empty, TargetDirectory = string.Empty }; gitMock.Setup(git => git.Clone(msbuildCloneTask.RepositoryToClone, msbuildCloneTask.TargetDirectory)).Throws<InvalidOperationException>(); // Act bool result = msbuildCloneTask.Execute(); // Assert Assert.IsFalse(result); }
public void CreateClickedCloneAnimation(ClutterFlowBaseActor actor, uint delay) { if (actor.Parent!=null) { Clone clone = new Clone(actor); MoveAndRotateActorCentrally (clone, 0); double scaleX, scaleY; actor.GetScale (out scaleX, out scaleY); clone.SetScale (scaleX, scaleY); ((Container) actor.Parent).Add (clone); clone.Hide (); clone.Opacity = 255; clone.Depth = ZNear+1; Timeline timeline = new Timeline (CoverManager.MaxAnimationSpan*4); timeline.Delay = delay; timeline.AddMarkerAtTime ("start", 1); timeline.MarkerReached += delegate { clone.ShowAll (); }; Animation anmn = clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "opacity" }, new GLib.Value ((byte) 50)); clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "scale-x" }, new GLib.Value (scaleX*2)); clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "scale-y" }, new GLib.Value (scaleY*2)); clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "fixed::anchor-x" }, new GLib.Value (clone.Width/2)); clone.AnimateWithTimelinev ((ulong) AnimationMode.EaseInExpo.value__, timeline, new string[] { "fixed::anchor-y" }, new GLib.Value (clone.Height/4)); anmn.Completed += HandleClickedCloneCompleted; } }
static WmiNetUtilsHelper() { myDllPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() + "\\wminet_utils.dll"; IntPtr procAddr = IntPtr.Zero; IntPtr loadLibrary = IntPtr.Zero; loadLibrary = LoadLibrary(myDllPath); if( loadLibrary != IntPtr.Zero) { procAddr = GetProcAddress(loadLibrary, "ResetSecurity"); if( procAddr != IntPtr.Zero) { ResetSecurity_f =(ResetSecurity) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ResetSecurity)); } procAddr = GetProcAddress(loadLibrary, "SetSecurity"); if( procAddr != IntPtr.Zero) { SetSecurity_f =(SetSecurity) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SetSecurity)); } procAddr = GetProcAddress(loadLibrary, "BlessIWbemServices"); if( procAddr != IntPtr.Zero) { BlessIWbemServices_f =(BlessIWbemServices) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BlessIWbemServices)); } procAddr = GetProcAddress(loadLibrary, "BlessIWbemServicesObject"); if( procAddr != IntPtr.Zero) { BlessIWbemServicesObject_f =(BlessIWbemServicesObject) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BlessIWbemServicesObject)); } procAddr = GetProcAddress(loadLibrary, "GetPropertyHandle"); if( procAddr != IntPtr.Zero) { GetPropertyHandle_f27=(GetPropertyHandle) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyHandle)); } procAddr = GetProcAddress(loadLibrary, "WritePropertyValue"); if( procAddr != IntPtr.Zero) { WritePropertyValue_f28=(WritePropertyValue) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(WritePropertyValue)); } procAddr = GetProcAddress(loadLibrary, "Clone"); if( procAddr != IntPtr.Zero) { Clone_f12=(Clone) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Clone)); } procAddr = GetProcAddress(loadLibrary, "VerifyClientKey"); if( procAddr != IntPtr.Zero) { VerifyClientKey_f =(VerifyClientKey) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(VerifyClientKey)); } procAddr = GetProcAddress(loadLibrary, "GetQualifierSet"); if( procAddr != IntPtr.Zero) { GetQualifierSet_f =(GetQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetQualifierSet)); } procAddr = GetProcAddress(loadLibrary, "Get"); if( procAddr != IntPtr.Zero) { Get_f =(Get) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Get)); } procAddr = GetProcAddress(loadLibrary, "Put"); if( procAddr != IntPtr.Zero) { Put_f =(Put) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Put)); } procAddr = GetProcAddress(loadLibrary, "Delete"); if( procAddr != IntPtr.Zero) { Delete_f =(Delete) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Delete)); } procAddr = GetProcAddress(loadLibrary, "GetNames"); if( procAddr != IntPtr.Zero) { GetNames_f =(GetNames) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetNames)); } procAddr = GetProcAddress(loadLibrary, "BeginEnumeration"); if( procAddr != IntPtr.Zero) { BeginEnumeration_f =(BeginEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BeginEnumeration)); } procAddr = GetProcAddress(loadLibrary, "Next"); if( procAddr != IntPtr.Zero) { Next_f =(Next) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Next)); } procAddr = GetProcAddress(loadLibrary, "EndEnumeration"); if( procAddr != IntPtr.Zero) { EndEnumeration_f =(EndEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(EndEnumeration)); } procAddr = GetProcAddress(loadLibrary, "GetPropertyQualifierSet"); if( procAddr != IntPtr.Zero) { GetPropertyQualifierSet_f =(GetPropertyQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyQualifierSet)); } procAddr = GetProcAddress(loadLibrary, "Clone"); if( procAddr != IntPtr.Zero) { Clone_f =(Clone) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(Clone)); } procAddr = GetProcAddress(loadLibrary, "GetObjectText"); if( procAddr != IntPtr.Zero) { GetObjectText_f =(GetObjectText) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetObjectText)); } procAddr = GetProcAddress(loadLibrary, "SpawnDerivedClass"); if( procAddr != IntPtr.Zero) { SpawnDerivedClass_f =(SpawnDerivedClass) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SpawnDerivedClass)); } procAddr = GetProcAddress(loadLibrary, "SpawnInstance"); if( procAddr != IntPtr.Zero) { SpawnInstance_f =(SpawnInstance) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(SpawnInstance)); } procAddr = GetProcAddress(loadLibrary, "CompareTo"); if( procAddr != IntPtr.Zero) { CompareTo_f =(CompareTo) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CompareTo)); } procAddr = GetProcAddress(loadLibrary, "GetPropertyOrigin"); if( procAddr != IntPtr.Zero) { GetPropertyOrigin_f =(GetPropertyOrigin) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetPropertyOrigin)); } procAddr = GetProcAddress(loadLibrary, "InheritsFrom"); if( procAddr != IntPtr.Zero) { InheritsFrom_f =(InheritsFrom) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(InheritsFrom)); } procAddr = GetProcAddress(loadLibrary, "GetMethod"); if( procAddr != IntPtr.Zero) { GetMethod_f =(GetMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethod)); } procAddr = GetProcAddress(loadLibrary, "PutMethod"); if( procAddr != IntPtr.Zero) { PutMethod_f =(PutMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutMethod)); } procAddr = GetProcAddress(loadLibrary, "DeleteMethod"); if( procAddr != IntPtr.Zero) { DeleteMethod_f =(DeleteMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(DeleteMethod)); } procAddr = GetProcAddress(loadLibrary, "BeginMethodEnumeration"); if( procAddr != IntPtr.Zero) { BeginMethodEnumeration_f =(BeginMethodEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(BeginMethodEnumeration)); } procAddr = GetProcAddress(loadLibrary, "NextMethod"); if( procAddr != IntPtr.Zero) { NextMethod_f =(NextMethod) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(NextMethod)); } procAddr = GetProcAddress(loadLibrary, "EndMethodEnumeration"); if( procAddr != IntPtr.Zero) { EndMethodEnumeration_f =(EndMethodEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(EndMethodEnumeration)); } procAddr = GetProcAddress(loadLibrary, "GetMethodQualifierSet"); if( procAddr != IntPtr.Zero) { GetMethodQualifierSet_f =(GetMethodQualifierSet) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethodQualifierSet)); } procAddr = GetProcAddress(loadLibrary, "GetMethodOrigin"); if( procAddr != IntPtr.Zero) { GetMethodOrigin_f =(GetMethodOrigin) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetMethodOrigin)); } procAddr = GetProcAddress(loadLibrary, "QualifierSet_Get"); if( procAddr != IntPtr.Zero) { QualifierGet_f=(QualifierSet_Get) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Get)); } procAddr = GetProcAddress(loadLibrary, "QualifierSet_Put"); if( procAddr != IntPtr.Zero) { QualifierPut_f=(QualifierSet_Put) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Put)); } procAddr = GetProcAddress(loadLibrary, "QualifierSet_Delete"); if( procAddr != IntPtr.Zero) { QualifierDelete_f=(QualifierSet_Delete) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Delete)); } procAddr = GetProcAddress(loadLibrary, "QualifierSet_GetNames"); if( procAddr != IntPtr.Zero) { QualifierGetNames_f=(QualifierSet_GetNames) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_GetNames)); } procAddr = GetProcAddress(loadLibrary, "QualifierSet_BeginEnumeration"); if( procAddr != IntPtr.Zero) { QualifierBeginEnumeration_f=(QualifierSet_BeginEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_BeginEnumeration)); } procAddr = GetProcAddress(loadLibrary, "QualifierSet_Next"); if( procAddr != IntPtr.Zero) { QualifierNext_f=(QualifierSet_Next) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_Next)); } procAddr = GetProcAddress(loadLibrary, "QualifierSet_EndEnumeration"); if( procAddr != IntPtr.Zero) { QualifierEndEnumeration_f=(QualifierSet_EndEnumeration) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(QualifierSet_EndEnumeration)); } procAddr = GetProcAddress(loadLibrary, "GetCurrentApartmentType"); if( procAddr != IntPtr.Zero) { GetCurrentApartmentType_f =(GetCurrentApartmentType) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetCurrentApartmentType)); } procAddr = GetProcAddress(loadLibrary, "GetDemultiplexedStub"); if( procAddr != IntPtr.Zero) { GetDemultiplexedStub_f =(GetDemultiplexedStub) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(GetDemultiplexedStub)); } procAddr = GetProcAddress(loadLibrary, "CreateInstanceEnumWmi"); if( procAddr != IntPtr.Zero) { CreateInstanceEnumWmi_f =(CreateInstanceEnumWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CreateInstanceEnumWmi)); } procAddr = GetProcAddress(loadLibrary, "CreateClassEnumWmi"); if( procAddr != IntPtr.Zero) { CreateClassEnumWmi_f =(CreateClassEnumWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CreateClassEnumWmi)); } procAddr = GetProcAddress(loadLibrary, "ExecQueryWmi"); if( procAddr != IntPtr.Zero) { ExecQueryWmi_f =(ExecQueryWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ExecQueryWmi)); } procAddr = GetProcAddress(loadLibrary, "ExecNotificationQueryWmi"); if( procAddr != IntPtr.Zero) { ExecNotificationQueryWmi_f =(ExecNotificationQueryWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ExecNotificationQueryWmi)); } procAddr = GetProcAddress(loadLibrary, "PutInstanceWmi"); if( procAddr != IntPtr.Zero) { PutInstanceWmi_f =(PutInstanceWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutInstanceWmi)); } procAddr = GetProcAddress(loadLibrary, "PutClassWmi"); if( procAddr != IntPtr.Zero) { PutClassWmi_f =(PutClassWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(PutClassWmi)); } procAddr = GetProcAddress(loadLibrary, "CloneEnumWbemClassObject"); if( procAddr != IntPtr.Zero) { CloneEnumWbemClassObject_f =(CloneEnumWbemClassObject) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(CloneEnumWbemClassObject)); } procAddr = GetProcAddress(loadLibrary, "ConnectServerWmi"); if( procAddr != IntPtr.Zero) { ConnectServerWmi_f =(ConnectServerWmi) Marshal.GetDelegateForFunctionPointer(procAddr, typeof(ConnectServerWmi)); } } }
public void ShouldLogErrorWhenExceptionErrors() { // Arrange var gitMock = new Mock<IGitFacade>(); var buildengineMock = new Mock<IBuildEngine>(); var msbuildCloneTask = new Clone(gitMock.Object) { BuildEngine = buildengineMock.Object, RepositoryToClone = string.Empty, TargetDirectory = string.Empty }; gitMock.Setup(git => git.Clone(msbuildCloneTask.RepositoryToClone, msbuildCloneTask.TargetDirectory)).Throws<InvalidOperationException>(); // Act msbuildCloneTask.Execute(); // Assert buildengineMock.Verify(msbuild => msbuild.LogErrorEvent(It.IsAny<BuildErrorEventArgs>())); }
public void ShouldReturnTrueWhenCalled() { // Arrange var msbuildCloneTask = new Clone(new Mock<IGitFacade>().Object) { // Mock away IBuildEngine cause we are not interested in the logging functionality. BuildEngine = new Mock<IBuildEngine>().Object, RepositoryToClone = string.Empty, TargetDirectory = string.Empty }; // Act bool result = msbuildCloneTask.Execute(); // Assert Assert.IsTrue(result); }
public CloneAI( Clone m ) : base(m) { m.CurrentSpeed = m.ActiveSpeed; }
public Clone(Clone source) { }