public static byte[] CustomStringWrite(int left, int top, CustomString customString) { stringCounter++; var name = "SZT" + string.Format("{0:00000}", stringCounter); var res = new List<byte>(); res.AddRange(GraphicStore(customString.CustomImage, printerSettings.RamDrive, name)); res.AddRange(GraphicWrite(left, top, name, printerSettings.RamDrive)); return res.ToArray(); }
/// <summary> /// Initializes a new instance of the <see cref="PowershellService" /> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="customImports">The custom imports. This should be everything you need minus the & to start and the ending semi-colon.</param> public PowershellService(IFileSystem fileSystem, CustomString customImports) { _fileSystem = fileSystem; _customImports = customImports; }
private List<string> CustomStringToListOfString(CustomString input) { return new List<string>() { "one", "two", "three", input.str }; }
private object[] testMultipleParameters(string one, int two, float three, CustomString four) { return new object[] { one, two, three, four }; }
private static void AddStringToFrequencies(Dictionary <CustomString, int> frequencies, CustomString str) { if (str == CustomString.Empty) { return; } if (frequencies.ContainsKey(str)) { frequencies[str]++; } else { frequencies.Add(str, 1); } }
public void Test7() { Assert.IsFalse(CustomString.IsNullOrWhiteSpace("a")); }
public void Test6() { Assert.IsTrue(CustomString.IsNullOrWhiteSpace("\r")); }
/// <summary> /// Write any windows-supported text in any windows-supported font style to the printer - including international characters! /// Note that if your printer's RAM drive letter is something other than 'E', you must set it in printer settings before calling ZPLCommands.ClearPrinter! /// </summary> /// <param name="left"></param> /// <param name="top"></param> /// <param name="rotation"></param> /// <param name="font"></param> /// <param name="text"></param> /// <returns></returns> public static byte[] CustomStringWrite(int left, int top, ElementDrawRotation rotation, Font font, string text) { var s = new CustomString {Font = font, Rotation = rotation, Text = text}; return CustomStringWrite(left, top, s); }
public Channel() { _channeltype = ChannelType.单通道; _channel = new CustomString(); }
private static extern void CustomStringClear(ref CustomString strRef);
private static extern void CustomStringSet(ref CustomString strRef, IntPtr data, int dataLen);
private static extern IntPtr CustomStringGet(ref CustomString strRef, IntPtr buffer, int bufLen);
private static extern int CustomStringLength(ref CustomString strRef);
private object[] testMultipleParameters(string one, int two, float three, CustomString four) { return(new object[] { one, two, three, four }); }
public void TestMultipleParameters() { AutoResetEvent are = new AutoResetEvent(false); var rpc = new JsonRpcClient(remoteUri); string method = "testMultipleParameters"; var anon = new CustomString { str = "Hello" }; var input = new object[] {"one", 2, 3.3f, anon}; JsonResponse<object[]> result = null; var myObs = rpc.Invoke<object[]>(method, input, Scheduler.TaskPool); myObs.Subscribe( onNext: _ => { result = _; are.Set(); }, onError: _ => { are.Set(); }, onCompleted: () => { are.Set(); } ); are.WaitOne(); Assert.IsTrue(result != null); Assert.IsTrue(result.Result != null); var res = result.Result; Assert.IsTrue(res.Length == 4); Assert.IsTrue((string)res[0] == (string)input[0]); Assert.IsTrue((long)res[1] == (long)(int)input[1]); Assert.IsTrue((double)res[2] == Double.Parse(input[2].ToString())); Assert.IsTrue(Newtonsoft.Json.JsonConvert.DeserializeObject<CustomString>(res[3].ToString()).str == anon.str); }
public void TabShouldBeWhitespace() { Assert.IsTrue(CustomString.IsNullOrWhiteSpace("\t")); }
public bool ViewCard(DbCard c) { int type = c.type; c.name = EditorGUILayout.TextField("Name:", c.name, GUILayout.MaxWidth(500)); GUILayout.BeginHorizontal(); int temptype = EditorGUILayout.IntPopup("Type: ", c.type, cardtypenames, cardtypeints, GUILayout.Width(300)); if (temptype != c.type) //if the type has been changed c.effects.Clear (); c.type = temptype; if (c.type == 1) { tempsubtype = c.subtype+1; //-1 becomes 0 tempsubtype = EditorGUILayout.IntPopup("Subtype: ", tempsubtype, subtypenamesnone, subtypeintsnone, GUILayout.Width(300)); c.subtype = tempsubtype-1; //0 ("none") becomes -1 } GUILayout.EndHorizontal(); if (colornames != null) //we allow to choose a color even if we don't use mana colors: for aestetic purposes: card frames, etc { if (c.color == null) c.color = MainMenu.TCGMaker.core.colors[0]; color_int = 0; for (int i=0; i<colornames.Length; i++) if (colornames[i] == c.color.name) color_int = colorints[i]; //if (MainMenu.TCGMaker.core.colors.Contains(c.color)) color_int = MainMenu.TCGMaker.core.colors.IndexOf(c.color); color_int = EditorGUILayout.IntPopup("Color: ", color_int, colornames, colorints, GUILayout.Width(300)); c.color = MainMenu.TCGMaker.core.colors[color_int]; } foreach (CustomStat customstat in MainMenu.TCGMaker.stats.CustomInts) { //we can't serialize dictionaries so going to use linq.. CustomInt intstat = c.CustomInts.Where(x => x.h_name == customstat.h_name).SingleOrDefault(); if (intstat == null) { intstat = new CustomInt(customstat.h_name); c.CustomInts.Add(intstat); } intstat.value = EditorGUILayout.IntField (customstat.h_name+": ", intstat.value); } foreach (CustomStat customstat in MainMenu.TCGMaker.stats.CustomStrings) { //we can't serialize dictionaries so going to use linq.. CustomString stringstat = c.CustomStrings.Where(x => x.h_name == customstat.h_name).SingleOrDefault(); if (stringstat == null) { stringstat = new CustomString(customstat.h_name); c.CustomStrings.Add(stringstat); } stringstat.value = EditorGUILayout.TextField (customstat.h_name+": ", stringstat.value); } if (type != 0) { GUILayout.BeginHorizontal (); if (MainMenu.TCGMaker.core.UseManaColors) { GUILayout.Label("Cost: "); if (c.cost.Count == 0) GUILayout.Label("<none>"); ManaColor color_to_delete = null; foreach (ManaColor foundcolor in c.cost) { GUILayout.BeginHorizontal (); if (foundcolor.icon) //if there is an icon, display it { if (!foundcolor.icon_texture) foundcolor.icon_texture = SpriteToTexture(foundcolor.icon); GUILayout.Label (foundcolor.icon_texture, GUILayout.Width(25), GUILayout.Height(25)); } else GUILayout.Label(foundcolor.name); if (GUILayout.Button("X")) color_to_delete = foundcolor; GUILayout.EndHorizontal (); } if (color_to_delete != null) c.cost.Remove(color_to_delete); GUILayout.BeginHorizontal (); mana_type = EditorGUILayout.IntPopup(mana_type, colornames, colorints); if (GUILayout.Button("Add cost")) c.cost.Add(MainMenu.TCGMaker.core.colors[mana_type]); GUILayout.EndHorizontal (); } else { cost_int = c.cost.Count; cost_int = EditorGUILayout.IntField ("Cost: ", cost_int); if (c.cost.Count != cost_int) { c.cost.Clear(); for (int i=0; i< cost_int; i++) c.cost.Add(MainMenu.TCGMaker.core.colors[0]); //add 1 colorless mana to cost } } bool has_discard_cost = (c.discardcost > 0)? true : false; GUILayout.EndHorizontal (); GUILayout.BeginHorizontal (); GUILayout.Label("Has a discard cost: "); has_discard_cost = EditorGUILayout.Toggle(has_discard_cost); if (has_discard_cost && c.discardcost == -1) c.discardcost = 1; if (!has_discard_cost) c.discardcost = -1; if (c.discardcost > 0) c.discardcost = EditorGUILayout.IntField ("Cards to discard: ", c.discardcost); else c.discardcost = -1; GUILayout.EndHorizontal (); } if (type == 1) { //if it's a creature c.hero = EditorGUILayout.Toggle("Is a hero:", c.hero); c.ranged = EditorGUILayout.Toggle("Ranged:", c.ranged); GUILayout.BeginHorizontal (); c.offense = EditorGUILayout.IntField ("Offense: ", c.offense); c.defense = EditorGUILayout.IntField ("Defense: ", c.defense); GUILayout.EndHorizontal (); GUI.skin.label.fontStyle = FontStyle.Bold; GUILayout.BeginHorizontal (); GUILayout.Label("Specials:"); GUILayout.EndHorizontal(); GUI.skin.label.fontStyle = FontStyle.Normal; GUILayout.BeginVertical ("box",GUILayout.Width(600)); GUILayout.BeginHorizontal (); c.cant_attack = EditorGUILayout.Toggle("Can't attack:", c.cant_attack); c.takes_no_combat_dmg = EditorGUILayout.Toggle("Takes no combat damage:", c.takes_no_combat_dmg); c.deals_no_combat_dmg = EditorGUILayout.Toggle("Deals no combat damage:", c.deals_no_combat_dmg); GUILayout.EndHorizontal (); GUILayout.BeginHorizontal (); c.no_first_turn_sickness = EditorGUILayout.Toggle("No first turn sickness:", c.no_first_turn_sickness); if (MainMenu.TCGMaker.core.UseGrid) c.extramovement = EditorGUILayout.Toggle("Extra movement:", c.extramovement); c.free_attack = EditorGUILayout.Toggle("First attack doesn't turn:", c.free_attack); GUILayout.EndHorizontal (); GUILayout.BeginHorizontal (); c.less_dmg_from_ranged = EditorGUILayout.Toggle("Less damage from ranged:", c.less_dmg_from_ranged); c.no_dmg_from_ranged = EditorGUILayout.Toggle("No damage from ranged:", c.no_dmg_from_ranged); c.takes_no_spell_dmg = EditorGUILayout.Toggle("No damage from spells:", c.takes_no_spell_dmg); GUILayout.EndHorizontal (); GUILayout.EndVertical(); GUILayout.BeginHorizontal (); c.growid = EditorGUILayout.TextField("Upgrade ID:", c.growid, GUILayout.MaxWidth(500)); if (c.growid != "") c.level = EditorGUILayout.IntField ("Level: ", c.level); GUILayout.EndHorizontal (); foreach (Effect foundeffect in c.effects) foundeffect.creatureability = true; } else if (type == 3 || type == 4 || type == 0) { foreach (Effect foundeffect in c.effects) foundeffect.hastrigger = true; //enchantments, lands and secrets } GUILayout.BeginHorizontal(); c.art = EditorGUILayout.ObjectField ("Art:",c.art, typeof(Sprite), false) as Sprite; GUILayout.EndHorizontal(); if (c.art != null) GUILayout.Label (SpriteToTexture (c.art)); GUILayout.BeginHorizontal(); GUILayout.Label("Text:"); c.text = EditorGUILayout.TextArea(c.text); if (c.effects.Count > 0 && GUILayout.Button ("Generate", GUILayout.Width (100))) GenerateCardText(c); GUILayout.EndHorizontal(); GUI.skin.label.fontStyle = FontStyle.Bold; GUILayout.BeginHorizontal (); GUILayout.Label("Sounds:"); GUILayout.EndHorizontal(); GUI.skin.label.fontStyle = FontStyle.Normal; GUILayout.BeginVertical ("box"); GUILayout.BeginHorizontal(); c.sfxentry = EditorGUILayout.ObjectField ("Entry:",c.sfxentry, typeof(AudioClip), false) as AudioClip; c.sfxability0 = EditorGUILayout.ObjectField ("Ability:",c.sfxability0, typeof(AudioClip), false) as AudioClip; GUILayout.EndHorizontal(); if (MainMenu.TCGMaker.core.UseGrid) { GUILayout.BeginHorizontal(); c.sfxmove1 = EditorGUILayout.ObjectField ("Move 2:",c.sfxmove1, typeof(AudioClip), false) as AudioClip; c.sfxmove0 = EditorGUILayout.ObjectField ("Move 1:",c.sfxmove0, typeof(AudioClip), false) as AudioClip; GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (c.effects.Count > 0 ) { GUI.skin.label.fontStyle = FontStyle.Bold; GUILayout.BeginHorizontal (); if (type == 1) GUILayout.Label("Abilities:"); else GUILayout.Label("Effects:"); GUILayout.EndHorizontal(); GUI.skin.label.fontStyle = FontStyle.Normal; } Effect effect_to_remove = null; foreach (Effect effect in c.effects) { GUILayout.BeginVertical ("box"); if (DrawEffect(effect)) effect_to_remove = effect; //it's the way to do it because otherwise we'll get "collection was modified" error GUILayout.EndVertical (); } if (effect_to_remove != null) c.effects.Remove(effect_to_remove); GUILayout.BeginVertical (); //GUILayout.Label(typestring,GUILayout.Width(150)); if (type == 1 && GUILayout.Button ("Add ability", GUILayout.Width (100))) //creature c.effects.Add (new Effect (false, true)); else if (type == 2 && GUILayout.Button ("Add effect", GUILayout.Width (100))) //spell c.effects.Add (new Effect ()); else if ((type == 3 || type == 4 || type == 0 ) && GUILayout.Button ("Add effect", GUILayout.Width (100))) //enchantment/secret/land c.effects.Add (new Effect (true)); if (GUILayout.Button ("Delete card", GUILayout.Width (100))) return true; GUILayout.EndVertical (); return false; }