protected virtual void SetUpFixture() { //DateTime start = DateTime.Now; DomSqlMapBuilder builder = new DomSqlMapBuilder(); #if dotnet2 NameValueCollection properties = new NameValueCollection(); properties.Add("collection2Namespace", "IBatisNet.DataMapper.Test.Domain.LineItemCollection2, IBatisNet.DataMapper.Test"); properties.Add("nullableInt", "int?"); builder.Properties = properties; string fileName = "sqlmap" + "_" + ConfigurationManager.AppSettings["database"] + "_" + ConfigurationManager.AppSettings["providerType"] + ".config"; #else NameValueCollection properties = new NameValueCollection(); properties.Add("collection2Namespace", "IBatisNet.DataMapper.Test.Domain.LineItemCollection, IBatisNet.DataMapper.Test"); properties.Add("nullableInt", "int"); builder.Properties = properties; string fileName = "sqlmap" + "_" + ConfigurationSettings.AppSettings["database"] + "_" + ConfigurationSettings.AppSettings["providerType"] + ".config"; #endif try { sqlMap = builder.Configure(fileName); } catch (Exception ex) { Exception e = ex; while (e != null) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace.ToString()); e = e.InnerException; } throw; } if (sqlMap.DataSource.DbProvider.Name.IndexOf("PostgreSql") >= 0) { BaseTest.ConvertKey = new KeyConvert(Lower); } else if (sqlMap.DataSource.DbProvider.Name.IndexOf("oracle") >= 0) { BaseTest.ConvertKey = new KeyConvert(Upper); } else { BaseTest.ConvertKey = new KeyConvert(Normal); } // string loadTime = DateTime.Now.Subtract(start).ToString(); // Console.WriteLine("Loading configuration time :"+loadTime); }
/// <summary> /// Indexer for a string key /// </summary> /// <param name="key">Your key in string form</param> /// <returns>layer stored at this location</returns> public DirectDictionaryLayer <T, Container> this[string key] { get { byte[] byteKey = KeyConvert.ConvertToNibbles(key); return(GetLayer(byteKey)); } set { byte[] byteKey = KeyConvert.ConvertToNibbles(key); SetLayer(byteKey, value, true); } }
protected virtual void SetUpFixture() { //DateTime start = DateTime.Now; configurationSetting = new ConfigurationSetting(); configurationSetting.Properties.Add("collection2Namespace", "Apache.Ibatis.DataMapper.SqlClient.Test.Domain.LineItemCollection2, Apache.Ibatis.DataMapper.SqlClient.Test"); configurationSetting.Properties.Add("nullableInt", "int?"); string resource = "sqlmap.config"; try { IConfigurationEngine engine = new DefaultConfigurationEngine(configurationSetting); engine.RegisterInterpreter(new XmlConfigurationInterpreter(resource)); engine.RegisterModule(new AliasModule()); IMapperFactory mapperFactory = engine.BuildMapperFactory(); sessionFactory = engine.ModelStore.SessionFactory; dataMapper = ((IDataMapperAccessor)mapperFactory).DataMapper; sessionStore = ((IModelStoreAccessor)dataMapper).ModelStore.SessionStore; } catch (Exception ex) { Exception e = ex; while (e != null) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); e = e.InnerException; } throw; } if (sessionFactory.DataSource.DbProvider.Id.IndexOf("PostgreSql") >= 0) { ConvertKey = new KeyConvert(Lower); } else if (sessionFactory.DataSource.DbProvider.Id.IndexOf("oracle") >= 0) { ConvertKey = new KeyConvert(Upper); } else { ConvertKey = new KeyConvert(Normal); } // string loadTime = DateTime.Now.Subtract(start).ToString(); // Console.WriteLine("Loading configuration time :"+loadTime); }
protected virtual void SetUpFixture() { //DateTime start = DateTime.Now; configurationSetting = new ConfigurationSetting(); configurationSetting.Properties.Add("collection2Namespace", "MyBatis.DataMapper.SqlClient.Test.Domain.LineItemCollection2, MyBatis.DataMapper.SqlClient.Test"); configurationSetting.Properties.Add("nullableInt", "int?"); string resource = "sqlmap.config"; try { IConfigurationEngine engine = new DefaultConfigurationEngine(configurationSetting); engine.RegisterInterpreter(new XmlConfigurationInterpreter(resource)); engine.RegisterModule(new AliasModule()); IMapperFactory mapperFactory = engine.BuildMapperFactory(); sessionFactory = engine.ModelStore.SessionFactory; dataMapper = ((IDataMapperAccessor)mapperFactory).DataMapper; sessionStore = ((IModelStoreAccessor) dataMapper).ModelStore.SessionStore; } catch (Exception ex) { Exception e = ex; while (e != null) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); e = e.InnerException; } throw; } if (sessionFactory.DataSource.DbProvider.Id.IndexOf("PostgreSql") >= 0) { ConvertKey = new KeyConvert(Lower); } else if (sessionFactory.DataSource.DbProvider.Id.IndexOf("oracle") >= 0) { ConvertKey = new KeyConvert(Upper); } else { ConvertKey = new KeyConvert(Normal); } // string loadTime = DateTime.Now.Subtract(start).ToString(); // Console.WriteLine("Loading configuration time :"+loadTime); }
public static void Choice() { try { SceneManagementKey = (Keys)KeyConvert.ConvertFromString(InitializeFile().ReadString("Keybindings", "SceneManagementKey", "H")); SceneManagementModifierKey = (Keys)KeyConvert.ConvertFromString(InitializeFile().ReadString("Keybindings", "SceneManagementModifierKey", "LControlKey")); PedManager.GrabPedKey = (Keys)KeyConvert.ConvertFromString(InitializeFile().ReadString("Keybindings", "GrabPedKey", "T")); PedManager.GrabPedModifierKey = (Keys)KeyConvert.ConvertFromString(InitializeFile().ReadString("Keybindings", "GrabPedModifierKey", "LShiftKey")); PedManager.PlacePedInVehicleKey = (Keys)KeyConvert.ConvertFromString(InitializeFile().ReadString("Keybindings", "PlacePedInVehicleKey")); PedManager.TackleKey = (Keys)KeyConvert.ConvertFromString(InitializeFile().ReadString("Keybindings", "TackleKey", "E")); PedManager.TackleButton = InitializeFile().ReadEnum <ControllerButtons>("Keybindings", "TackleButton", ControllerButtons.A); AutoDoorEnabled = IsAutoDoorEnabled(); OfficerAudio = InitializeFile().ReadBoolean("Misc", "OfficerAudio", true); DispatchVoice = InitializeFile().ReadBoolean("Misc", "DispatchAudio", true); string Towtruckcolor = InitializeFile().ReadString("Misc", "TowTruckColorOverride", ""); if (!string.IsNullOrWhiteSpace(Towtruckcolor)) { VehicleManager.TowTruckColor = System.Drawing.Color.FromName(Towtruckcolor); VehicleManager.OverrideTowTruckColour = true; } VehicleManager.TowtruckModel = InitializeFile().ReadString("Misc", "TowTruckModel", "TOWTRUCK"); if (!VehicleManager.TowtruckModel.IsValid) { VehicleManager.TowtruckModel = "TOWTRUCK"; Game.LogTrivial("Invalid Tow Truck Model in Arrest Manager.ini. Setting to TOWTRUCK."); } VehicleManager.FlatbedModel = InitializeFile().ReadString("Misc", "FlatbedModel", "FLATBED"); if (!VehicleManager.FlatbedModel.IsValid) { VehicleManager.FlatbedModel = "FLATBED"; Game.LogTrivial("Invalid Flatbed Model in Arrest Manager.ini. Setting to FLATBED."); } VehicleManager.AlwaysFlatbed = InitializeFile().ReadBoolean("Misc", "AlwaysUseFlatbed", false); VehicleManager.FlatbedModifier = new Vector3(InitializeFile().ReadSingle("Misc", "FlatbedX", -0.5f), InitializeFile().ReadSingle("Misc", "FlatbedY", -5.75f), InitializeFile().ReadSingle("Misc", "FlatbedZ", 1.005f)); AllowWarping = InitializeFile().ReadBoolean("Misc", "AllowWarping", true); CalculateDistanceOfSceneManagement(); VehicleManager.RecruitNearbyTowTrucks = InitializeFile().ReadBoolean("Misc", "RecruitNearbyTowTrucks"); Coroner.CoronerModel = InitializeFile().ReadString("Misc", "CoronerPedModel", "S_M_M_DOCTOR_01"); if (!Coroner.CoronerModel.IsValid) { Coroner.CoronerModel = "S_M_M_DOCTOR_01"; } Coroner.CoronerVehicleModel = InitializeFile().ReadString("Misc", "CoronerVehicleModel", "SPEEDO"); if (!Coroner.CoronerVehicleModel.IsValid || !Coroner.CoronerVehicleModel.IsVehicle) { Game.LogTrivial("Arrest Manager: The specified coroner vehicle is either invalid or not a vehicle. Use at own risk! " + Coroner.CoronerVehicleModel.Name); } UseDisplayNameForVehicle = InitializeFile().ReadBoolean("Misc", "UseDisplayNameForVehicle", true); } catch { SceneManagementKey = Keys.H; SceneManagementModifierKey = Keys.LControlKey; SceneManagementSpawnDistance = 70f; DispatchVoice = true; OfficerAudio = true; AutoDoorEnabled = true; Game.DisplayNotification("~r~~h~ARREST MANAGER+ WARNING~n~~w~Failed to load Arrest Manager+.ini. Using default options!"); } GameFiber.Wait(4000); Game.LogTrivial("AM+: Loaded ArrestManager+ phase 1"); IsLSPDFRPlusRunning = IsLSPDFRPluginRunning("LSPDFR+", new Version("1.7.0.0")); if (IsLSPDFRPluginRunning("PoliceSmartRadio")) { API.SmartRadioFuncs.AddActionToButton(Coroner.CallFromSmartRadio, Coroner.CanBeCalled, "coroner"); API.SmartRadioFuncs.AddActionToButton(VehicleManager.SmartRadioTow, "tow"); } MessageReceived = false; CanChoose = true; CheckForJail = true; namesUsed = new List <string>(); arrestingOfficer = null; suspectsArrestedByPlayer = new List <Ped>(); canIWarpToJail = true; checkingForArrestedByPlayer = false; releaseMessageReceived = false; bool doorsClosed = false; SceneManager.CreateMenus(); IsPlayerArrestingAnyPed(); //Listens for key input and calls appropriate method GameFiber.StartNew(() => { while (true) { Game.LocalPlayer.WantedLevel = 0; var playerPed = Game.LocalPlayer.Character; GameFiber.Yield(); Game.SetRelationshipBetweenRelationshipGroups("PLAYER", "ARRESTEDSUSPECTS", Relationship.Respect); Game.SetRelationshipBetweenRelationshipGroups("ARRESTEDSUSPECTS", "PLAYER", Relationship.Respect); Game.SetRelationshipBetweenRelationshipGroups("COP", "ARRESTEDSUSPECTS", Relationship.Respect); Game.SetRelationshipBetweenRelationshipGroups("ARRESTEDSUSPECTS", "COP", Relationship.Respect); Game.LogTrivial("AM+: Relationship - set"); //while you have the option to choose, listen for input while (CanChoose) { GameFiber.Yield(); playerPed = Game.LocalPlayer.Character; //Check: first for warp, release, then for multi, then for single } if (AutoDoorEnabled) { if (playerPed.IsInAnyVehicle(false)) { if (playerPed.CurrentVehicle.Driver == playerPed && playerPed.CurrentVehicle.Speed > 3f && !doorsClosed) { doorsClosed = true; NativeFunction.Natives.SET_VEHICLE_DOORS_SHUT(playerPed.CurrentVehicle, true); } } else { doorsClosed = false; } } Game.LocalPlayer.WantedLevel = 0; } }, "Choice"); Game.LogTrivial("AM+: Done starting fiber"); }
protected virtual void SetUpFixture() { //DateTime start = DateTime.Now; DomSqlMapBuilder builder = new DomSqlMapBuilder(); #if dotnet2 NameValueCollection properties = new NameValueCollection(); properties.Add("collection2Namespace", "IBatisNet.DataMapper.Test.Domain.LineItemCollection2, IBatisNet.DataMapper.Test"); properties.Add("nullableInt", "int?"); builder.Properties = properties; string fileName = "sqlmap" + "_" + ConfigurationManager.AppSettings["database"] + "_" + ConfigurationManager.AppSettings["providerType"] + ".config"; #else NameValueCollection properties = new NameValueCollection(); properties.Add("collection2Namespace","IBatisNet.DataMapper.Test.Domain.LineItemCollection, IBatisNet.DataMapper.Test"); properties.Add("nullableInt", "int"); builder.Properties = properties; string fileName = "sqlmap" + "_" + ConfigurationSettings.AppSettings["database"] + "_" + ConfigurationSettings.AppSettings["providerType"] + ".config"; #endif try { sqlMap = builder.Configure(fileName); } catch (Exception ex) { Exception e = ex; while (e != null) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace.ToString()); e = e.InnerException; } throw; } if (sqlMap.DataSource.DbProvider.Name.IndexOf("PostgreSql") >= 0) { BaseTest.ConvertKey = new KeyConvert(Lower); } else if (sqlMap.DataSource.DbProvider.Name.IndexOf("oracle") >= 0) { BaseTest.ConvertKey = new KeyConvert(Upper); } else { BaseTest.ConvertKey = new KeyConvert(Normal); } // string loadTime = DateTime.Now.Subtract(start).ToString(); // Console.WriteLine("Loading configuration time :"+loadTime); }
/// <summary> /// Fired when everything has been drawn. /// </summary> /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param> /// <exception cref="Exception">[PermaShow] - MenuItem not supported</exception> private static void Drawing_OnEndScene(EventArgs args) { if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed) { return; } if (!placetosave["enablepermashow"].GetValue <MenuBool>().Value) { Unsub(); return; } PermaArea(); var halfwidth = 0.96f * (PermaShowWidth / 2); var baseposition = new Vector2(BoxPosition.X - halfwidth, BoxPosition.Y); var boxx = BoxPosition.X + (PermaShowWidth / 2) - (SmallBoxWidth / 2); foreach (var permaitem in PermaShowItems) { var index = PermaShowItems.IndexOf(permaitem); var boxpos = new Vector2(boxx, baseposition.Y + (Text.Description.Height * 1.4f * index)); var endpos = new Vector2( BoxPosition.X + (PermaShowWidth / 2), baseposition.Y + (Text.Description.Height * 1.4f * index)); var itempos = new Vector2(baseposition.X, baseposition.Y + (Text.Description.Height * 1.4f * index) + Text.Description.Height * 0.2f); var textpos = (int)(endpos.X - (SmallBoxWidth / 1.25f)); switch (permaitem.ItemType) { case MenuValueType.Boolean: DrawBox(boxpos, permaitem.Item.GetValue <MenuBool>().Value); Text.DrawText( null, permaitem.DisplayName + ":", (int)itempos.X, (int)itempos.Y, permaitem.Color); Text.DrawText( null, permaitem.Item.GetValue <MenuBool>().Value.ToString(), textpos, (int)itempos.Y, permaitem.Color); break; case MenuValueType.Slider: Text.DrawText( null, permaitem.DisplayName + ":", (int)itempos.X, (int)itempos.Y, permaitem.Color); Text.DrawText( null, permaitem.Item.GetValue <MenuSlider>().Value.ToString(), textpos, (int)itempos.Y, permaitem.Color); break; case MenuValueType.KeyBind: DrawBox(boxpos, permaitem.Item.GetValue <MenuKeyBind>().Active); Text.DrawText( null, permaitem.DisplayName + " [" + KeyConvert.KeyToText((uint)permaitem.Item.GetValue <MenuKeyBind>().Key) + "] :", (int)itempos.X, (int)itempos.Y, permaitem.Color); Text.DrawText( null, permaitem.Item.GetValue <MenuKeyBind>().Active.ToString(), textpos, (int)itempos.Y, permaitem.Color); break; case MenuValueType.List: Text.DrawText( null, permaitem.DisplayName + ":", (int)itempos.X, (int)itempos.Y, permaitem.Color); var dimen = Text.MeasureText(sprite, permaitem.Item.GetValue <MenuList <string> >().SelectedValue, FontDrawFlags.Left); Text.DrawText( null, permaitem.Item.GetValue <MenuList <string> >().SelectedValue, (int)(textpos + dimen.Width < endpos.X ? textpos : endpos.X - dimen.Width), (int)itempos.Y, permaitem.Color); break; case MenuValueType.None: break; default: throw new Exception("[PermaShow] - MenuItem not supported"); } } }