public override int Id => 0x18;//24 public override void Handle(EzClient client, EzPacket packet) { KeySettings keySettings = client.Setting.GetKeySettings(client.Mode); keySettings.KeyOn1 = packet.Data.ReadByte(); keySettings.KeyOn2 = packet.Data.ReadByte(); keySettings.KeyOn3 = packet.Data.ReadByte(); keySettings.KeyOn4 = packet.Data.ReadByte(); keySettings.KeyOn5 = packet.Data.ReadByte(); keySettings.KeyOn6 = packet.Data.ReadByte(); keySettings.KeyAc1 = packet.Data.ReadByte(); keySettings.KeyAc2 = packet.Data.ReadByte(); keySettings.KeyAc3 = packet.Data.ReadByte(); keySettings.KeyAc4 = packet.Data.ReadByte(); keySettings.KeyAc5 = packet.Data.ReadByte(); keySettings.KeyAc6 = packet.Data.ReadByte(); client.Setting.VolumeMenuMusic = packet.Data.ReadByte(); client.Setting.VolumeMenuSFX = packet.Data.ReadByte(); client.Setting.VolumeGameMusic = packet.Data.ReadByte(); client.Setting.VolumeGameSFX = packet.Data.ReadByte(); client.Setting.BgaSettings = new BgaSettings(packet.Data.ReadByte()); client.Setting.SkinPosition = packet.Data.ReadByte(); IBuffer settings = SettingsPacket.Create(client.Setting, client.Mode); Send(client, 0x2D, settings); //45 }
public void Properties() { KeySettings settings = new KeySettings(new SymmetricAlgorithmKeyCreator(typeof(RijndaelManaged).AssemblyQualifiedName)); settings.Key = settings.KeyCreator.GenerateKey(); Assert.AreEqual(32, settings.Key.Length); }
/* Function: ReadStringSet * An extension method to <BinaryFile> which reads a string set from it. Call with * "stringSet = binaryFile.ReadStringSet(ignoreCase, normalizeUnicode);" */ static public StringSet ReadStringSet(this BinaryFile binaryFile, KeySettings keySettings = KeySettings.Literal) { StringSet stringSet = new StringSet(keySettings); stringSet.ReadFrom(binaryFile); return(stringSet); }
protected override void ExecuteCore(ConfigurationNode node) { TypeSelectorUI selector = new TypeSelectorUI( typeof(RijndaelManaged), typeof(SymmetricAlgorithm), TypeSelectorIncludeFlags.Default ); DialogResult typeResult = selector.ShowDialog(); if (typeResult == DialogResult.OK) { KeySettings keySettings = new KeySettings(new SymmetricAlgorithmKeyCreator(selector.SelectedType.AssemblyQualifiedName)); KeyManagerEditorUI keyManager = new KeyManagerEditorUI(keySettings); DialogResult keyResult = keyManager.ShowDialog(); if (keyResult == DialogResult.OK) { INodeNameCreationService service = GetService(typeof(INodeNameCreationService)) as INodeNameCreationService; Debug.Assert(service != null, "Could not find the INodeNameCreationService"); base.ExecuteCore(node); SymmetricAlgorithmProviderNode providerNode = (SymmetricAlgorithmProviderNode)ChildNode; providerNode.AlgorithmType = selector.SelectedType.AssemblyQualifiedName; providerNode.Name = service.GetUniqueDisplayName(providerNode.Parent, selector.SelectedType.Name); providerNode.Key = keyManager.KeySettings; } } }
// Group: Functions // __________________________________________________________________________ /* Function: Manager * * Creates a new IDObject manager. * * Parameters: * * keySettings - The <KeySettings> that should apply when referencing objects by name. * * sparse - If false, it assumes the manager will be handling objects with low and mostly consecutive ID numbers. * This allows it to store them in an array where the index maps directly to the ID number, which is very * fast. However, if there are going to be large gaps in the IDs stored this will waste a lot of memory. * * If true, it assumes the manager will be handling objects with high and/or non-consecutive ID numbers * with large gaps between the values. This means it will store them in a sorted array and use a binary * search for lookups and insertions. This is slower but more memory efficient. */ public Manager(KeySettings keySettings, bool sparse) { usedIDs = new IDObjects.NumberSet(); objectsByID = new List <IDObjectType>(); objectsByName = new StringTable <IDObjectType>(keySettings); this.sparse = sparse; }
/// <summary> /// See <see cref="UITypeEditor.EditValue"/>. /// </summary> /// <param name="context">See <see cref="UITypeEditor.EditValue"/>.</param> /// <param name="provider">See <see cref="UITypeEditor.EditValue"/>.</param> /// <param name="value">See <see cref="UITypeEditor.EditValue"/>.</param> /// <returns>See <see cref="UITypeEditor.EditValue"/>.</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { Debug.Assert(provider != null, "No service provider; we cannot edit the value"); if (provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); Debug.Assert(edSvc != null, "No editor service; we cannot edit the value"); if (edSvc != null) { IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); KeySettings keySettings = value as KeySettings; if (keySettings == null) { throw new ArgumentException(SR.KeyManagerEditorRequiresKeyInfoProperty); } KeyManagerEditorUI dialog = new KeyManagerEditorUI(keySettings.Clone()); DialogResult dialogResult = service.ShowDialog(dialog); if (dialogResult == DialogResult.Cancel) { return(keySettings); } else { return(dialog.KeySettings); } } } return(value); }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } SetKey.keys.Add(Keys.UP, (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("UP", "W"))); SetKey.keys.Add(Keys.DOWN, (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("DOWN", "S"))); SetKey.keys.Add(Keys.LEFT, (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("LEFT", "A"))); SetKey.keys.Add(Keys.RIGHT, (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("RIGHT", "D"))); SetKey.keys.Add(Keys.COMBINE, (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("COMBINE", "Space"))); SetKey.keys.Add(Keys.DROP, (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("DROP", "Q"))); SetKey.keys.Add(Keys.USE, (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("USE", "E"))); SetKey.keys.Add(Keys.MAP, (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("MAP", "Tab"))); SetKey.keys.Add(Keys.RELOAD, (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("RELOAD", "R"))); for (int i = 0; i < SetKey.keys.Count; i++) { PlayerPrefs.SetString(keys[i], SetKey.keys[(Keys)i].ToString()); } }
public void InitializeButtonState(Mubox.Configuration.KeySettingCollection keySettings, Predicate <Mubox.Configuration.KeySetting> filterCallback, Action <Mubox.Configuration.KeySetting> enableCallback, Action <Mubox.Configuration.KeySetting> disableCallback) { this.KeySettings = keySettings; this.FilterCallback = filterCallback; this.EnableCallback = enableCallback; this.DisableCallback = disableCallback; ProcessFrameworkElementTree(this, (Action <FrameworkElement>) delegate(FrameworkElement frameworkElement) { try { System.Windows.Controls.Primitives.ToggleButton toggleButton = frameworkElement as System.Windows.Controls.Primitives.ToggleButton; if (toggleButton != null) { Mubox.Configuration.KeySetting keySetting; toggleButton.IsChecked = KeySettings.TryGetKeySetting((Win32.VK)Enum.Parse(typeof(Win32.VK), toggleButton.Tag as string, true), out keySetting) && FilterCallback(keySetting); } } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); } }); }
Action ResetInputPanel(Widget panel) { var gs = Game.Settings.Game; var ks = Game.Settings.Keys; var dgs = new GameSettings(); var dks = new KeySettings(); return(() => { gs.UseClassicMouseStyle = dgs.UseClassicMouseStyle; gs.MouseScroll = dgs.MouseScroll; gs.LockMouseWindow = dgs.LockMouseWindow; gs.ViewportEdgeScroll = dgs.ViewportEdgeScroll; gs.ViewportEdgeScrollStep = dgs.ViewportEdgeScrollStep; gs.UIScrollSpeed = dgs.UIScrollSpeed; foreach (var f in ks.GetType().GetFields()) { var value = (Hotkey)f.GetValue(dks); f.SetValue(ks, value); panel.Get(f.Name).Get <HotkeyEntryWidget>("HOTKEY").Key = value; } panel.Get <SliderWidget>("SCROLLSPEED_SLIDER").Value = gs.ViewportEdgeScrollStep; panel.Get <SliderWidget>("UI_SCROLLSPEED_SLIDER").Value = gs.UIScrollSpeed; MakeMouseFocusSettingsLive(); }); }
public GeneralService(IConfiguration configuration) { JwtSettings = new JwtSettings(); KeySettings = new KeySettings(); configuration.Bind("JwtSettings", JwtSettings); configuration.Bind("KeySettings", KeySettings); }
/// <summary> /// Initializes with a <c>KeyInfo</c>. /// </summary> /// <param name="keySettings">The key to manage.</param> public KeyManagerEditorUI(KeySettings keySettings) { this.keySettings = keySettings; InitializeComponent(); keyEditor.TextChanged += new EventHandler(keyEditor_TextChanged); keyEditor.KeySettings = keySettings; }
/* Function: StringSet * Creates a set with the passed strings as members. */ public StringSet(KeySettings keySettings, params string[] members) { this.keySettings = keySettings; foreach (string member in members) { Add(member); } }
public UserValidationService(IOptions <KeySettings> appSettings) { this.key = appSettings.Value; this.users = new List <UserEntity> { new UserEntity { Id = 1, FirstName = "Sachin", LastName = "Tendulkar", Email = "*****@*****.**", Username = "******", Password = "******" } }; }
public void Clone() { SymmetricAlgorithmKeyCreator keyCreator = new SymmetricAlgorithmKeyCreator(typeof(RijndaelManaged).AssemblyQualifiedName); byte[] key = keyCreator.GenerateKey(); KeySettings settings = new KeySettings(keyCreator); settings.Key = key; KeySettings settingsClone = settings.Clone(); Assert.AreSame(keyCreator, settingsClone.KeyCreator); Assert.AreEqual(key, settingsClone.Key); }
private void SetKeySetting(int key, Commands cmd) { KeySettingViewModel keySetting = KeySettings.FirstOrDefault(x => x.Command == cmd); if (keySetting != null) { keySetting.Key = (Key)key; } else { KeySettings.Add(new KeySettingViewModel((Key)key, cmd)); } }
private void ToggleButton_Unchecked(object sender, RoutedEventArgs e) { try { WinAPI.VK vk = (WinAPI.VK)Enum.Parse(typeof(WinAPI.VK), (e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton).Tag as string, true); Mubox.Configuration.KeySetting keySetting; if (KeySettings.TryGetKeySetting(vk, out keySetting)) { this.DisableCallback(keySetting); } } catch (Exception ex) { ex.Log(); } }
/* Function: FromBinaryFile * Reads the contents of the string set from the passed binary file. */ static public StringSet FromBinaryFile(BinaryFile binaryFile, KeySettings keySettings = KeySettings.Literal) { StringSet stringSet = new StringSet(keySettings); // [String: member] // [String: member] // ... // [String: null] for (string member = binaryFile.ReadString(); member != null; member = binaryFile.ReadString()) { stringSet.Add(member); } return(stringSet); }
private void ToggleButton_Checked(object sender, RoutedEventArgs e) { try { Win32.VK vk = (Win32.VK)Enum.Parse(typeof(Win32.VK), (e.OriginalSource as System.Windows.Controls.Primitives.ToggleButton).Tag as string, true); Mubox.Configuration.KeySetting keySetting; if (!KeySettings.TryGetKeySetting(vk, out keySetting)) { keySetting = KeySettings.CreateNew(vk); } this.EnableCallback(keySetting); } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); } }
public GameForm(GameState state, SoundsBase sounds, KeySettings keySettings) { elementSizeHeight = keySettings.Height; elementSizeWidth = keySettings.Width; DoubleBuffered = true; this.state = state; this.sounds = sounds; var map = state.Map; ClientSize = new Size(map.Width * elementSizeWidth, map.Height * elementSizeHeight); FormBorderStyle = FormBorderStyle.FixedDialog; timer = new Timer(); timer.Tick += TimerTick; timer.Interval = 17; sw = new Stopwatch(); state.NoteClick += PlayNote; state.Start += Start; }
/* Function: StringToStringTable (strings) * Creates a table initialized with the key value pairs in the passed array. */ public StringToStringTable(KeySettings keySettings, params string[] keyvalues) : base(keySettings) { if (keyvalues.Length % 2 != 0) { throw new Exceptions.ArrayDidntHaveEvenLength("keyvalues"); } int index = 0; while (index < keyvalues.Length) { string key = keyvalues[index]; string value = keyvalues[index + 1]; Add(key, value); index += 2; } }
static void BindHotkeyPref(KeyValuePair <string, string> kv, KeySettings ks, Widget template, Widget parent) { var key = template.Clone() as Widget; key.Id = kv.Key; key.IsVisible = () => true; var field = ks.GetType().GetField(kv.Key); if (field == null) { throw new InvalidOperationException("Game.Settings.Keys does not contain {1}".F(kv.Key)); } key.Get <LabelWidget>("FUNCTION").GetText = () => kv.Value + ":"; var textBox = key.Get <HotkeyEntryWidget>("HOTKEY"); textBox.Key = (Hotkey)field.GetValue(ks); textBox.OnLoseFocus = () => field.SetValue(ks, textBox.Key); parent.AddChild(key); }
public static void Write(IBuffer buffer, Setting setting, ModeType modeType) { KeySettings keySettings = setting.GetKeySettings(modeType); buffer.WriteByte(keySettings.KeyOn1); buffer.WriteByte(keySettings.KeyOn2); buffer.WriteByte(keySettings.KeyOn3); buffer.WriteByte(keySettings.KeyOn4); buffer.WriteByte(keySettings.KeyOn5); buffer.WriteByte(keySettings.KeyOn6); buffer.WriteByte(keySettings.KeyAc1); buffer.WriteByte(keySettings.KeyAc2); buffer.WriteByte(keySettings.KeyAc3); buffer.WriteByte(keySettings.KeyAc4); buffer.WriteByte(keySettings.KeyAc5); buffer.WriteByte(keySettings.KeyAc6); buffer.WriteByte(setting.VolumeMenuMusic); buffer.WriteByte(setting.VolumeMenuSFX); buffer.WriteByte(setting.VolumeGameMusic); buffer.WriteByte(setting.VolumeGameSFX); buffer.WriteByte(setting.BgaSettings.ToByte()); buffer.WriteByte(setting.SkinPosition); }
/* Function: StringToStringTable * Creates an empty table. */ public StringToStringTable(KeySettings keySettings = KeySettings.Literal) : base(keySettings) { }
/* Function: SortedStringTable * Creates an empty table with a custom string comparer. */ public SortedStringTable(IComparer <string> comparer, KeySettings keySettings = KeySettings.Literal) : base(comparer) { this.keySettings = keySettings; }
static void Main(string[] args) { FotoAppRAll all = FotoAppRAll.Ins; // foreach (OrderFotos o in all.OrderFotos.GetFotoInOrder(new Fotos() { FotoID = 2 })) Console.WriteLine(o.Quantity.ToString()); KeySettings s = new KeySettings(); //s._null = new byte[] { 0x00 }; s.BlockAll(); s.Delete(); // s.Delete(); //foreach (OrderFotos o in all.OrderFotos.GetAllFotosInOrder(new Orders() { OrderID = 1 })) Console.WriteLine(o.FotoID.ToString()); //foreach (Orders o in all.Orders.GetAll()) foreach (OrderRaport or in all.Orders.OrderRaport(o)) // { // Console.WriteLine(o.OrderID + " " + or.Paper.Height/100 + "x" + or.Paper.Width/100 + " " + or.Paper.TypeID + " price " + or.Price + " " + or.Quantity ); // } //Stopwatch stopWatch = new Stopwatch(); //stopWatch.Start(); //Int64? test = 0; ////for (int i = 0;i<100; i++) //foreach (Orders o in all.Orders.GetAll()) // foreach (OrderRaport or in all.Orders.OrderRaport(o)) // { // //test += or.Price; // Console.WriteLine(o.OrderID + " " + or.Paper.Height / 100 + "x" + or.Paper.Width / 100 + " " + or.Paper.TypeID + " price " + or.Price + " " + or.Quantity); // } //TimeSpan ts = stopWatch.Elapsed; //string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", // ts.Hours, ts.Minutes, ts.Seconds, // ts.Milliseconds / 10); //Console.WriteLine(elapsedTime); //Console.WriteLine(test.ToString()); //Stopwatch stopWatch2 = new Stopwatch(); //stopWatch2.Start(); //Int64? test2 = 0; //for (int i = 0; i < 100; i++) foreach (Orders o in all.Orders.GetAll()) // foreach (OrderRaport or in all.Orders.OrderRaport2(o)) // { // test2 += or.Price; // //Console.WriteLine(o.OrderID + " " + or.Paper.Height / 100 + "x" + or.Paper.Width / 100 + " " + or.Paper.TypeID + " price " + or.Price + " " + or.Quantity); // } //TimeSpan ts2 = stopWatch2.Elapsed; //string elapsedTime2 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", // ts2.Hours, ts2.Minutes, ts2.Seconds, // ts2.Milliseconds / 10); //Console.WriteLine(elapsedTime2); //Console.WriteLine(test2.ToString()); // var o = new Orders() { OrderID = 2 }; //foreach (OrderRaport or in all.Orders.OrderRaport(o)) Console.WriteLine(o.OrderID + " " + or.Paper.Height/100 + "x" + or.Paper.Width/100 + " " + or.Paper.TypeID + " price " + or.Price + " " + or.Quantity ); //Console.WriteLine("----------------"); //foreach (OrderRaport or in all.Orders.OrderRaport2(o)) Console.WriteLine(o.OrderID + " " + or.Paper.Height / 100 + "x" + or.Paper.Width / 100 + " " + or.Paper.TypeID + " price " + or.Price + " " + or.Quantity); //var order = all.Orders.Get(new Orders() { OrderID = 2 }); //Console.WriteLine(all.Sizes.Context // .OrderFoto // .Where(o => o.Fotos.OrderID == order.OrderID) // .Join(all.Sizes.Context.Type, // a => a.TypeID, // b => b.TypeID, // (a, b) => new // { // OrderID = a.Fotos.OrderID, // Height = a.Height, // Width = a.Width, // TypeID = a.TypeID, // Quantity = a.Quantity, // Connect = b.Connect // }) // .GroupBy(a => new // { // OrderID = a.OrderID, // Height = a.Height, // Width = a.Width, // Connect = ((a.Connect == null) ? a.TypeID : a.Connect) // }) // .Select(a => new // { // OrderID = a.Key.OrderID, // Height = a.Key.Height, // Width = a.Key.Width, // Connect = a.Key.Connect, // TypeID = a.Min(b => b.TypeID), // Sum = a.Sum(b => b.Quantity) // }) // .Join(all.Sizes.Context.Price, // a => a.Height, // b => b.Height, // (a, b) => new // { // paper = a, // price = b // }) // .Where(c => // c.paper.Connect == c.price.TypeID && // c.price.Height == c.paper.Height && // c.paper.Width == c.price.Width && // c.paper.Sum > c.price.Quantity) // .GroupBy(a => new // { // OrderID = a.paper.OrderID, // Height = a.paper.Height, // Width = a.paper.Width, // Sum = a.paper.Sum, // Connect = a.price.TypeID, // TypeID = a.paper.TypeID // }) // .Select(a => new // { // OrderID = a.Key.OrderID, // Height = a.Key.Height, // Width = a.Key.Width, // Sum = a.Key.Sum, // Connect = a.Key.Connect, // TypeID = a.Key.TypeID, // Quantity = a.Max(b => b.price.Quantity) // }) // .Join(all.Sizes.Context.Price, // a => a.Height, // b => b.Height, // (a, b) => new // { // paper = a, // price = b // }) // .Where(c => // c.paper.Connect == c.price.TypeID && // c.price.Height == c.paper.Height && // c.paper.Width == c.price.Width && // c.paper.Quantity == c.price.Quantity) // .Select(a => new // { // OrderID = a.paper.OrderID, // TypeID = a.paper.TypeID, // Connect = a.paper.Connect, // Height = a.paper.Height, // Width = a.paper.Width, // Price = a.price.Price // }) // .Join(all.Sizes.Context.OrderFoto, // a => a.OrderID, // b => b.Fotos.OrderID, // (a, b) => new // { // cost = a, // fotos = b // }) // .Where(a => // a.fotos.Fotos.OrderID == a.cost.OrderID && // a.fotos.Height == a.cost.Height && // a.fotos.Width == a.cost.Width && // (a.cost.Connect == a.fotos.TypeID || // a.cost.TypeID == a.fotos.TypeID)) // .GroupBy(a => new // { // Height = a.fotos.Height, // Width = a.fotos.Width, // TypeID = a.fotos.TypeID, // Price = a.cost.Price, // Connect = a.cost.Connect // }) // .Select(a => new // { // Height = a.Key.Height, // Width = a.Key.Width, // TypeID = a.Key.TypeID, // Price = (Int64)a.Sum(z => z.fotos.Quantity) * (Int64)a.Key.Price, // Connect = a.Key.Connect, // Quantity = a.Sum(z => z.fotos.Quantity) // }).ToString()); //Console.WriteLine("-------------------------------------"); //Console.WriteLine("-------------------------------------"); //Console.WriteLine("-------------------------------------"); //Console.WriteLine("-------------------------------------"); //Console.WriteLine("-------------------------------------"); //Console.WriteLine(all.Sizes.Context.OrderFoto.Where(o => o.Fotos.OrderID == order.OrderID).Select(a => new //{ // OrderID = order.OrderID, // Height = a.Height, // Width = a.Width, // TypeID = a.TypeID, // Quantity = a.Quantity, // Connect = (a.Papers.Types.Connect == null) ? a.TypeID : a.Papers.Types.Connect, //}).GroupBy(a => new //{ // OrderID = a.OrderID, // Height = a.Height, // Width = a.Width, // TypeID = a.TypeID, // Connect = a.Connect, // // SPrice = a.SPrice //} // ).Select(a => new // { // OrderID = a.Key.OrderID, // Height = a.Key.Height, // Width = a.Key.Width, // Connect = a.Key.Connect, // TypeID = a.Key.TypeID, // SumSingle = a.Sum(b => b.Quantity), // // SPrice = a.Key.SPrice, // //Price = a.Key. // }).GroupBy(a => new // { // OrderID = a.OrderID, // Height = a.Height, // Width = a.Width, // //TypeID = a.TypeID, // Connect = a.Connect, // //SPrice = a.SPrice // }).Select(a => new // { // OrderID = a.Key.OrderID, // Height = a.Key.Height, // Width = a.Key.Width, // Connect = a.Key.Connect, // TypeID = a.Min(b => b.TypeID), // SumSingle = a.Min(b => b.SumSingle), // //Sum = a.Sum(b => b.SumSingle), // Cost = (Int64)a.Min(b => b.SumSingle) * (Int64)(all.Sizes.Context.Price.Where(d => d.Height == a.Key.Height && d.Width == a.Key.Width && d.TypeID == a.Key.Connect && d.Quantity >= a.Min(b => b.SumSingle)).OrderBy(g=>g.Quantity).FirstOrDefault().Price) // }) //.ToString()); //foreach(OrderFotos o in all.OrderFotos.AllFotosInOrder(new Orders() {OrderID = 1 })) //Console.WriteLine(o.Quantity.ToString()); //System.Console.WriteLine(all.Sizes.Context.OrderFoto.Where(a => a.Fotos.OrderID == 1)); //foreach (Fotos f in all.Fotos.GetAll()) //{ // Console.WriteLine( all.Fotos.SumFoto(f)+ " " + f.FotoID.ToString()); //} // Orders nowy = new Orders(); // all.Orders.Add(nowy ); // all.Save(); // Console.WriteLine( nowy.OrderID.ToString()); // nowy.Description = "jakis napis"; // nowy.Date = DateTime.Now; //all.Orders.Update(nowy); // all.Save(); // Console.WriteLine(nowy.Date.ToString()); //Stopwatch stopWatch = new Stopwatch(); //stopWatch.Start(); //for (int i = 0; i < 100; i++) // foreach (Orders o in all.Orders.Context.Order) // { // //Console.WriteLine("zamownie nr " + o.OrderID.ToString()); // foreach (PaperQuantity q in all.Papers.SumPapersInOrder3(o)) // { // //Console.WriteLine("rozmiar " + (q.Paper.Height / 100).ToString() + "x" + (q.Paper.Width / 100).ToString() + " typu " + q.Paper.TypeID.ToString() + " ilosc: " + q.Quantity.ToString()); // } // } //TimeSpan ts = stopWatch.Elapsed; //string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", // ts.Hours, ts.Minutes, ts.Seconds, // ts.Milliseconds / 10); //Console.WriteLine("RunTime " + elapsedTime); //Stopwatch stopWatch1 = new Stopwatch(); //stopWatch1.Start(); //for (int i = 0; i < 100; i++) // foreach (Orders o in all.Orders.Context.Order) // { // //Console.WriteLine("zamownie nr " + o.OrderID.ToString()); // foreach (PaperQuantity q in all.Papers.SumPapersInOrder2(o)) // { // //Console.WriteLine("rozmiar " + (q.Paper.Height / 100).ToString() + "x" + (q.Paper.Width / 100).ToString() + " typu " + q.Paper.TypeID.ToString() + " ilosc: " + q.Quantity.ToString()); // } // } //TimeSpan ts1 = stopWatch1.Elapsed; //string elapsedTime1 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", // ts1.Hours, ts1.Minutes, ts1.Seconds, // ts1.Milliseconds / 10); //Console.WriteLine("RunTime " + elapsedTime1); ////Console.WriteLine(all.Contacts.Context.Database.Connection.ConnectionString); ////Console.WriteLine(all.Fotos.Context.Foto.First().FotoID.ToString()); //Stopwatch stopWatch2 = new Stopwatch(); //stopWatch2.Start(); ////for (int i= 0; i<100;i++) //all.Types.Update(new Types() { TypeID = 1, Connect = 4 }); //all.Save(); //foreach (Orders o in all.Orders.Context.Order) //{ // Console.WriteLine("zamownie nr " + o.OrderID.ToString()); // foreach (OrderRaport q in all.Orders.OrderRaport(o)) // { // Console.WriteLine("rozmiar " + (q.Paper.Height / 100).ToString() + "x" + (q.Paper.Width / 100).ToString() + " typu " + q.Paper.TypeID.ToString() + " ilosc: " + q.Quantity.ToString() + " cena z typu: " +q.Connect.ToString()+ " koszt "+q.Price.ToString()+ " cena za sztuke " +(q.Price/q.Quantity).ToString()); // } //} //TimeSpan ts2 = stopWatch2.Elapsed; // string elapsedTime2 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", // ts2.Hours, ts2.Minutes, ts2.Seconds, // ts2.Milliseconds / 10); // Console.WriteLine("RunTime " + elapsedTime2); // Console.WriteLine(all.Sizes.Context // .OrderFoto // .Where(o => o.OrderID == 1) // .GroupBy(a => new { Height = a.Height, Width = a.Width, TypeID = a.TypeID }) // .Join(all.Sizes.Context.Paper, s => new { s.Key.Height, s.Key.Width, s.Key.TypeID }, b => new { b.Height, b.Width, b.TypeID }, (s, b) => new { first = s, paper = b }) // .Select(a => new PaperQuantity { Paper = a.paper, Quantity = a.first.Sum(z => z.Quantity) })); //string a = "pl_PL"; //string b = "pl"; //string c = "pl2"; //string d = "pl3"; //string e = "pl4"; //string f = "pl5"; //all.Languages.AddOrUpdate(new Languages() { Language = a, Base = a }); //all.Languages.AddOrUpdate(new Languages() { Language = b, Base = f }); //all.Languages.AddOrUpdate(new Languages() { Language = c, Base = d }); //all.Languages.AddOrUpdate(new Languages() { Language = d, Base = c }); //all.Languages.AddOrUpdate(new Languages() { Language = e, Base = b }); //all.Languages.AddOrUpdate(new Languages() { Language = f, Base = e }); //all.Save(); //all.Languages.CheckAndFixBase(); //var bf = new FotoAppDbContext(new SeachConnectionString().connectionString); ////bf.Language.Add(new Languages() { Language = "eneea" }); ////bf.SaveChanges(); //var aa = bf.Language.First(); //Console.WriteLine(aa.Language.ToString()); // bf.Language.First(); //string aaa = "eneee"; // aa = bf.Language.Find(aaa); // Languages aaa = FotoAppRAll.Ins.Languages.Get(new Languages() { Language = "en" }); //Console.WriteLine( FotoAppRAll.Ins.Languages.Is(new Languages() { Language = "en"}).ToString()); //Console.WriteLine(FotoAppRAll.Ins.Types.Is(new Types() { TypeID = 1 }).ToString()); // FotoAppRAll.Ins.Orders.Add(new Orders()); //FotoAppRAll.Ins.Save(); //FotoAppRAll.Ins.Languages.CheckAndFixBase(); // var bf = new FotoAppDbContext(new SeachConnectionString().connectionString); //bf.Type.AddOrUpdate(new Types()); // bf.SaveChanges(); //all.Sizes. //var a = all.Types.GetAllTypes(true); //foreach (Types aa in a) Console.WriteLine(aa.TypeID.ToString()); //Console.WriteLine(all.SizeTexts.GetSizeTextBySizeALang(new Sizes() { Height = 1500, Width = 21000 }, new Languages() { Language = "en" }).Text); //all.Settings.AddOrUpdate(); //Settings s = new Settings() { Area = "lang", Target = "pl_en", Value = "pl_PL" }; ////s.Value += "aaa"; //Console.WriteLine(s.Value); //all.Settings.Add(s); //s.Value += "error"; //FotoAppRAll.Ins.Settings.CheckLangSettings(); //FotoAppRAll.Ins.Types.Update(new Types() { TypeID = 1, Connect = 1 }); //FotoAppRAll.Ins.Types.Update(new Types() { TypeID = 2, Connect = 7 }); //FotoAppRAll.Ins.Types.Update(new Types() { TypeID = 3, Connect = 2 }); //FotoAppRAll.Ins.Types.Update(new Types() { TypeID = 4, Connect = 3 }); //FotoAppRAll.Ins.Types.Update(new Types() { TypeID = 5, Connect = 4 }); //FotoAppRAll.Ins.Types.Update(new Types() { TypeID = 6, Connect = 5 }); //FotoAppRAll.Ins.Types.Update(new Types() { TypeID = 7, Connect = 2 }); //FotoAppRAll.Ins.Types.Update(new Types() { TypeID = 8, Connect = 9 }); //FotoAppRAll.Ins.Save(); //FotoAppRAll.Ins.Types.CheckAndFixConnect(); //Console.WriteLine(s.Value); //all.Settings.Update(s); //all.Save(); //Console.WriteLine(s.Value); //all.Settings.CheckLangSettings(); //all.Save(); //all.Settings.CheckLangSettings(); // all.SizeTexts.GetSizeTextBySizeALang(new Sizes() { Height = 900, Width = 1300 }, new Languages() { Language = "pl" }); //Console.WriteLine(all.Types.GetAllTypes(false).Count().ToString()); //Console.WriteLine(all.Types.GetAllTypes(true).Count().ToString()); //Console.WriteLine(all.Types.GetAll().Count().ToString()); //Sizes s = new Sizes { Height = 900, Width = 1300 }; //Console.WriteLine(all.Types.GetTypesBySize(s).Count().ToString()); //Console.WriteLine(all.Types.GetTypesBySize(s,true).Count().ToString()); //Console.WriteLine(all.Types.GetTypesBySize(s, false).Count().ToString()); //Stopwatch stopWatch = new Stopwatch(); //FotoAppR<FotoAppDbContext, Types> t = new TypesR(); //t.Context = new FotoAppDbContext(new SeachConnectionString().connectionString); //Stopwatch stopWatch2 = new Stopwatch(); //stopWatch2.Start(); //for (int i = 0; i < 5000; i++) //{ // t.Add(new Types()); // t.Save(); //} //TimeSpan ts2 = stopWatch2.Elapsed; //string elapsedTime2 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", // ts2.Hours, ts2.Minutes, ts2.Seconds, // ts2.Milliseconds / 10); //Console.WriteLine("RunTime " + elapsedTime2); //// Console.WriteLine(new SeachConnectionString().connectionString); //var bf = new FotoAppDbContext(new SeachConnectionString().connectionString); ////bf.Type.AddOrUpdate(new Types()); //// bf.SaveChanges(); //FotoAppRAll all = new FotoAppRAll(); //Stopwatch stopWatch = new Stopwatch(); //stopWatch.Start(); //for (int i = 0; i < 5000; i++) //{ // all.Types.Add(new Types()); // all.Save(); //} //TimeSpan ts = stopWatch.Elapsed; //string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", // ts.Hours, ts.Minutes, ts.Seconds, // ts.Milliseconds / 10); //Console.WriteLine("RunTime " + elapsedTime); Console.WriteLine("koniec"); Console.ReadKey(); }
Action ResetInputPanel(Widget panel) { var gs = Game.Settings.Game; var ks = Game.Settings.Keys; var dgs = new GameSettings(); var dks = new KeySettings(); return () => { gs.UseClassicMouseStyle = dgs.UseClassicMouseStyle; gs.MouseScroll = dgs.MouseScroll; gs.LockMouseWindow = dgs.LockMouseWindow; gs.ViewportEdgeScroll = dgs.ViewportEdgeScroll; gs.ViewportEdgeScrollStep = dgs.ViewportEdgeScrollStep; gs.UIScrollSpeed = dgs.UIScrollSpeed; gs.AllowZoom = dgs.AllowZoom; gs.ZoomModifier = dgs.ZoomModifier; foreach (var f in ks.GetType().GetFields()) { var value = (Hotkey)f.GetValue(dks); f.SetValue(ks, value); panel.Get(f.Name).Get<HotkeyEntryWidget>("HOTKEY").Key = value; } panel.Get<SliderWidget>("SCROLLSPEED_SLIDER").Value = gs.ViewportEdgeScrollStep; panel.Get<SliderWidget>("UI_SCROLLSPEED_SLIDER").Value = gs.UIScrollSpeed; MakeMouseFocusSettingsLive(); }; }
static void BindHotkeyPref(KeyValuePair<string, string> kv, KeySettings ks, Widget template, Widget parent) { var key = template.Clone() as Widget; key.Id = kv.Key; key.IsVisible = () => true; var field = ks.GetType().GetField(kv.Key); if (field == null) throw new InvalidOperationException("Game.Settings.Keys does not contain {1}".F(kv.Key)); key.Get<LabelWidget>("FUNCTION").GetText = () => kv.Value + ":"; var textBox = key.Get<HotkeyEntryWidget>("HOTKEY"); textBox.Key = (Hotkey)field.GetValue(ks); textBox.OnLoseFocus = () => field.SetValue(ks, textBox.Key); parent.AddChild(key); }
/* Function: ReadStringSet * An extension method to <BinaryFile> which reads a string set from it. Call with * "stringSet = binaryFile.ReadStringSet(ignoreCase, normalizeUnicode);" */ static public StringSet ReadStringSet(this BinaryFile binaryFile, KeySettings keySettings = KeySettings.Literal) { return(StringSet.FromBinaryFile(binaryFile, keySettings)); }
/* Function: StringTable * Creates an empty table. */ public StringTable(KeySettings keySettings = KeySettings.Literal) : base() { this.keySettings = keySettings; }