private static void ThrowException1a() { using (FL.Scope()) { ThrowException1b(); } }
private static void TestTimerPrecision() { Console.WriteLine("Timer precision test..."); int[] iterationValues = { 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000 }; Thread.Sleep(1000); foreach (int iterations in iterationValues) { for (int j = 0; j < 20; j++) { using (FL.Timer("Loop " + iterations, true, j == 19)) { for (int i = 0; i < iterations; i++) { } } } } }
public static bool YesNoInformation(string message) { FL.Info(message); var result = MessageBox.Show(message, messageBoxTitle, MessageBoxButton.YesNo, MessageBoxImage.Information); FL.Trace("Answer: " + result); return(result == MessageBoxResult.Yes); }
public static bool YesNoWarning(string message) { FL.Warning(message); var result = MessageBox.Show(message, messageBoxTitle, MessageBoxButton.YesNo, MessageBoxImage.Warning); FL.Trace("Answer: " + result); return(result == MessageBoxResult.Yes); }
private static void Main() { FL.AcceptLogFileBasePath(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
void set_mid_wheels() { Vector3 pos_1, pos_2; Quaternion rot; FR.GetWorldPose(out pos_1, out rot); RR.GetWorldPose(out pos_2, out rot); FR_wheel.transform.position = Vector3.Lerp(pos_1, pos_2, .5f); FL.GetWorldPose(out pos_1, out rot); RL.GetWorldPose(out pos_2, out rot); FL_wheel.transform.position = Vector3.Lerp(pos_1, pos_2, .5f); }
/// <summary> /// Runs the tests. /// </summary> private void Run() { Console.WriteLine("Log benchmark"); Console.WriteLine(); // Delete all files in the log directory Console.WriteLine("Deleting old log files..."); Console.WriteLine(); string logPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "log"); if (Directory.Exists(logPath)) { foreach (string file in Directory.GetFiles(logPath)) { File.Delete(file); } } FL.AcceptLogFileBasePath(); // Wait a bit for the system to calm down from starting this program System.Threading.Thread.Sleep(1000); // For correct-in-context number formatting, if used //Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); RunEmptyLoop(100000000); RunLock(100000000); PressEnterToContinue(); // This test setup can either test text messages or scopes. if (!flScope) { RunFieldLogText(1000000); PressEnterToContinue(); } else { RunFieldLogScope(500000); PressEnterToContinue(); } //RunDebugOutputString(100000); PressEnterToContinue(); RunFileAppend(1000000); PressEnterToContinue(); RunFileOpenAppend(2000); #if WITH_NLOG PressEnterToContinue(); RunNLog(1000000); #endif Console.WriteLine("Benchmark finished. Press the Enter key to quit."); Console.ReadLine(); }
private void scanBw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { OnPropertyChanged(() => SpinnerVisibility); if (e.Error != null) { FL.Error(e.Error); // TODO: Show the error in a user message box } }
public void wheelsAnimation() { if (frontWheelsMesh != null && rearWheelsMesh != null) { float rotation_angle = 0; Transform FR, FL, RL, RR; //Meshes WheelCollider WFR, WFL, WRL, WRR; //Wheelcolliders //Gets the mesh wheels FL = frontWheelsMesh[LEFT].GetComponent <Transform>(); FR = frontWheelsMesh[RIGHT].GetComponent <Transform>(); RL = rearWheelsMesh[LEFT].GetComponent <Transform>(); RR = rearWheelsMesh[RIGHT].GetComponent <Transform>(); //Gets the WheelColliders WFL = frontWheels[LEFT].GetComponent <WheelCollider>(); WFR = frontWheels[RIGHT].GetComponent <WheelCollider>(); WRL = rearWheels[LEFT].GetComponent <WheelCollider>(); WRR = rearWheels[RIGHT].GetComponent <WheelCollider>(); /*Wheels rotation*/ //Sets the new steering float aux_oldsteer, aux_steer, angle; aux_oldsteer = oldSteering + maxSteeringAngle; aux_steer = currentSteering + maxSteeringAngle; angle = aux_steer - aux_oldsteer; FL.Rotate(Vector3.up, angle); //rotates for the steering FR.Rotate(Vector3.up, angle); oldSteering = currentSteering; //Updates the old steering for the next reajust //Calculates the angle for rotate the rear wheels float rpm = (rearWheels[LEFT].rpm + rearWheels[RIGHT].rpm) / 2; rotation_angle = (-rpm * 360) / 60 * Time.deltaTime; //Rotates the rear wheels RL.Rotate(Vector3.right, rotation_angle, Space.Self); RR.Rotate(Vector3.right, rotation_angle, Space.Self); FLL.transform.Rotate(Vector3.right, rotation_angle, Space.Self); //rotates for the speed FRR.transform.Rotate(Vector3.right, rotation_angle, Space.Self); /*Suspension effects*/ suspensionEffect(WFL, FL); suspensionEffect(WFR, FR); suspensionEffect(WRL, RL); suspensionEffect(WRR, RR); } }
private async void ListView_ItemClick(object sender, ItemClickEventArgs e) { var clk = e.ClickedItem as MenuClass; var Gr = MainPage.Grid; switch (clk.Tag) { case "Settings": MainPage.RootFrame.Navigate(typeof(SettingsMainView)); break; case "Offline Maps": MainPage.RootFrame.Navigate(typeof(MapDownloaderView)); break; case "Saved Locations": var FavPlaces = Gr.FindName("FavPlaces") as SavedPlacesUserControl; if (FavPlaces == null) { if (MapView.MapControl.FindName("OrDesSelector") as DraggablePin == null) { Gr.Children.Add(new SavedPlacesUserControl() { Name = "FavPlaces", Width = 180, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 0, 80) }); } } else { Gr.Children.Remove(FavPlaces); } break; case "Directions": var dir = Gr.FindName("DirectionUC") as View.DirectionsControls.DirectionsMainUserControl; if (dir == null) { if (MapView.MapControl.FindName("OrDesSelector") as DraggablePin == null) { Gr.Children.Add(new View.DirectionsControls.DirectionsMainUserControl() { Name = "DirectionUC", VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left }); await new MessageDialog("Navigate the point added on your screen to the Origin point and click on it. Then move it to Destination point and click on it again. Select navigation mode from top left menu and hit the navigate button.").ShowAsync(); } } else { Gr.Children.Remove(dir); } break; default: break; } FL.Hide(); }
void FixedUpdate() { //forceVector = carBodyRB.transform.rotation * Vector3.forward * Torque * axisVertical * 10f; //carBodyRB.AddForce(forceVector); FR.AddTorque(Torque * axisVertical * Time.fixedDeltaTime, 0f, 0f); BR.AddTorque(Torque * axisVertical * Time.fixedDeltaTime, 0f, 0f); FL.AddTorque(Torque * axisVertical * Time.fixedDeltaTime, 0f, 0f); BL.AddTorque(Torque * axisVertical * Time.fixedDeltaTime, 0f, 0f); }
private void Combined_Value_Button_Click(object sender, RoutedEventArgs e) { FL fl = new FL(); Item item = new Item(); DataTable dTable = new DataTable(); dTable = fl.GetTotalPrice(); Data_Grid.ItemsSource = dTable.AsDataView(); }
private void Show_All_Button_Click(object sender, RoutedEventArgs e) { FL itemFL = new FL(); Item item = new Item(); DataTable dTable = new DataTable(); dTable = itemFL.GetAllItems(item); Data_Grid.ItemsSource = dTable.AsDataView(); }
private static void ThrowException1b() { using (FL.Scope()) { throw new InvalidOperationException( "You can't do that!", new ApplicationException("An inner message 1", new ApplicationException("An inner message 2"))); } }
private void Search_ID_Button_Click(object sender, RoutedEventArgs e) { int id = int.Parse(id_TextBox.Text); FL itemFL = new FL(); Item item = new Item(); DataTable dTable = new DataTable(); dTable = itemFL.GetItemByID(id); Data_Grid.ItemsSource = dTable.AsDataView(); }
/// <summary> /// Initialises the application settings. /// </summary> public static void InitializeSettings() { if (Settings != null) { return; // Already done } Settings = SettingsAdapterFactory.New <IAppSettings>( new FileSettingsStore( SettingsHelper.GetAppDataPath(@"Unclassified\FieldLog", "FieldLogViewer.conf"))); // The settings ShowThreadIdColumn and ShowWebRequestIdColumn are mutually exclusive Settings.OnPropertyChanged( s => s.ShowThreadIdColumn, () => { if (Settings.ShowThreadIdColumn) { Settings.ShowWebRequestIdColumn = false; } }, true); Settings.OnPropertyChanged( s => s.ShowWebRequestIdColumn, () => { if (Settings.ShowWebRequestIdColumn) { Settings.ShowThreadIdColumn = false; } }, true); // Update settings format from old version FL.TraceData("LastStartedAppVersion", Settings.LastStartedAppVersion); if (string.IsNullOrEmpty(Settings.LastStartedAppVersion)) { Settings.SettingsStore.Rename("LastAppVersion", "LastStartedAppVersion"); Settings.SettingsStore.Rename("Window.MainLeft", "MainWindowState.Left"); Settings.SettingsStore.Rename("Window.MainTop", "MainWindowState.Top"); Settings.SettingsStore.Rename("Window.MainWidth", "MainWindowState.Width"); Settings.SettingsStore.Rename("Window.MainHeight", "MainWindowState.Height"); Settings.SettingsStore.Rename("Window.MainIsMaximized", "MainWindowState.IsMaximized"); Settings.SettingsStore.Rename("Window.ToolBarInWindowFrame", "ToolBarInWindowFrame"); Settings.SettingsStore.Rename("Window.SettingsLeft", "SettingsWindowState.Left"); Settings.SettingsStore.Rename("Window.SettingsTop", "SettingsWindowState.Top"); Settings.SettingsStore.Rename("Window.SettingsWidth", "SettingsWindowState.Width"); Settings.SettingsStore.Rename("Window.SettingsHeight", "SettingsWindowState.Height"); } // Remember the version of the application. // If we need to react on settings changes from previous application versions, here is // the place to check the version currently in the settings, before it's overwritten. Settings.LastStartedAppVersion = FL.AppVersion; }
private static void DoSomeMaths() { using (FL.Scope()) using (FL.Timer("DoSomeMaths")) { for (int i = 1; i <= 10; i++) { FL.InfoData("i", i); Thread.Sleep(31); } } }
static void Main() { // Set up FieldLog FL.AcceptLogFileBasePath(); // Keep the setup away GlobalMutex.Create("Unclassified.EasyPdfSigning"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new EasyForm()); }
public RBasic Untaint() { ////ruby.Secure(3); if ((flags & FL.TAINT) != 0) { if ((flags & FL.FREEZE) != 0) { ruby.ErrorFrozen("object"); } flags &= ~FL.FREEZE; } return(this); }
public static void ErrorMessage(string message, Exception ex, string context) { FL.Error(ex, context); FieldLogScreenshot.CreateForMainWindow(); if (message != null) { FL.ShowErrorDialog(message, ex); } else { FL.ShowErrorDialog(ex); } }
void Set(FL value, bool toSet) { if (toSet) { flags |= value; } else { flags &= ~value; } changed(); }
public RBasic Taint() { ////ruby.Secure(4); if ((flags & FL.TAINT) == 0) { if ((flags & FL.FREEZE) != 0) { ruby.ErrorFrozen("object"); } flags |= FL.TAINT; } return(this); }
private static void BatchActivity() { Console.WriteLine("Batch test pattern..."); for (int i = 1; i <= 200; i++) { FL.Trace("Batch test - " + i); if ((i % 10) == 0) { Console.WriteLine(" now at " + i); } Thread.Sleep(8000); } }
public static bool?YesNoCancelQuestion(string message) { FL.Trace(message); var result = MessageBox.Show(message, messageBoxTitle, MessageBoxButton.YesNoCancel, MessageBoxImage.Question); FL.Trace("Answer: " + result); if (result == MessageBoxResult.Yes) { return(true); } if (result == MessageBoxResult.No) { return(false); } return(null); }
void OnTriggerStay(Collider other) //Uses physics time { if (other.tag == "Player") { if (FL.ReturnIsEnemyCustomPlayer(ETM.Return_FactionEnum(), ETM.Return_customReputation())) { shove(other); } } else if (other.tag == "BasicEnemy" && other.transform != thisHitbox) { if (FL.ReturnIsEnemy(ETM.Return_FactionEnum(), other.gameObject.GetComponentInParent <EnemyTemplateMaster>().Return_FactionEnum())) { shove(other); } } }
/// <summary> /// Deobfuscates a stack frame. /// </summary> /// <param name="module">The name of the module to look up.</param> /// <param name="typeName">The full name of the type of the method to look up.</param> /// <param name="methodName">The name of the method to look up.</param> /// <param name="signature">The signature of the method.</param> /// <param name="token">The metadata token of the method.</param> /// <param name="originalName">The deobfuscated method name.</param> /// <param name="originalNameWithSignature">The deobfuscated method name with signature.</param> /// <param name="originalToken">The original metadata token of the method.</param> /// <returns>true if the item was found; otherwise, false.</returns> public bool Deobfuscate( string module, string typeName, string methodName, string signature, int token, out string originalName, out string originalNameWithSignature, out int originalToken) { // Initialise return values originalName = null; originalNameWithSignature = null; originalToken = 0; if (module == null) { return(false); } if (!module.Contains("<")) { try { module = Path.GetFileNameWithoutExtension(module); } catch (ArgumentException ex) { FL.Warning(ex); } } module = module.ToLowerInvariant(); Dictionary <int, Tuple <string, int> > dict; Tuple <string, int> tuple; if (data.TryGetValue(module, out dict) && dict.TryGetValue(token, out tuple)) { originalName = tuple.Item1; originalNameWithSignature = originalName; originalToken = tuple.Item2; return(true); } return(false); }
private void scanBw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs args) { OnPropertyChanged(() => SpinnerVisibility); if (args.Error != null) { FL.Error(args.Error); // TODO: Show the error in a user message box } else { if (FoundFiles.Count == 1) { // Automatically load the only found file ViewCommandManager.Invoke("LoadSingleFile"); } } }
private void OnTriggerExit(Collider other) { if (other.tag == "Player") { if (FL.ReturnIsEnemyCustomPlayer(ETM.Return_FactionEnum(), ETM.Return_customReputation())) { TargetsInMeleeRange.Remove(other.transform); } } else if (other.tag == "BasicEnemy" && other.transform != thisHitbox) { if (FL.ReturnIsEnemy(ETM.Return_FactionEnum(), other.gameObject.GetComponentInParent <EnemyTemplateMaster>().Return_FactionEnum())) { TargetsInMeleeRange.Add(other.transform); } } }
/// <summary> /// Initialises the application settings. /// </summary> public static void InitializeSettings() { if (Settings != null) { return; // Already done } Settings = SettingsAdapterFactory.New <IAppSettings>( new FileSettingsStore( SettingsHelper.GetAppDataPath(@"Unclassified\TxTranslation", "TxEditor.conf"))); // Update settings format from old version FL.TraceData("LastStartedAppVersion", Settings.LastStartedAppVersion); if (string.IsNullOrEmpty(Settings.LastStartedAppVersion)) { Settings.SettingsStore.Rename("app-culture", "AppCulture"); Settings.SettingsStore.Rename("file.ask-save-upgrade", "File.AskSaveUpgrade"); Settings.SettingsStore.Rename("input.charmap", "Input.CharacterMap"); Settings.SettingsStore.Rename("view.comments", "View.ShowComments"); Settings.SettingsStore.Rename("view.monospace-font", "View.MonospaceFont"); Settings.SettingsStore.Rename("view.hidden-chars", "View.ShowHiddenChars"); Settings.SettingsStore.Rename("view.charmap", "View.ShowCharacterMap"); Settings.SettingsStore.Rename("view.font-scale", "View.FontScale"); Settings.SettingsStore.Rename("view.native-culture-names", "View.NativeCultureNames"); Settings.SettingsStore.Rename("view.suggestions", "View.ShowSuggestions"); Settings.SettingsStore.Rename("view.suggestions.horizontal-layout", "View.SuggestionsHorizontalLayout"); Settings.SettingsStore.Rename("view.suggestions.width", "View.SuggestionsWidth"); Settings.SettingsStore.Rename("view.suggestions.height", "View.SuggestionsHeight"); Settings.SettingsStore.Rename("wizard.source-code", "Wizard.SourceCode"); Settings.SettingsStore.Rename("wizard.remember-location", "Wizard.RememberLocation"); Settings.SettingsStore.Rename("wizard.hotkey-in-visual-studio-only", "Wizard.HotkeyInVisualStudioOnly"); Settings.SettingsStore.Rename("window.left", "View.MainWindowState.Left"); Settings.SettingsStore.Rename("window.top", "View.MainWindowState.Top"); Settings.SettingsStore.Rename("window.width", "View.MainWindowState.Width"); Settings.SettingsStore.Rename("window.height", "View.MainWindowState.Height"); Settings.View.MainWindowState.IsMaximized = Settings.SettingsStore.GetInt("window.state") == 2; Settings.SettingsStore.Remove("window.state"); Settings.SettingsStore.Rename("wizard.window.left", "Wizard.WindowLeft"); Settings.SettingsStore.Rename("wizard.window.top", "Wizard.WindowTop"); } // Remember the version of the application. // If we need to react on settings changes from previous application versions, here is // the place to check the version currently in the settings, before it's overwritten. Settings.LastStartedAppVersion = FL.AppVersion; }
private static void LoadTest() { Console.WriteLine("Load test pattern..."); for (int i = 1; i <= 50000; i++) { FL.Trace("Load test - " + i); if ((i % 100) == 0) { FL.Error("Load test error message"); } if ((i % 10000) == 0) { Console.WriteLine(" now at " + i); } } }
internal void Unset(FL f) { flags &= ~f; }
public RBasic Freeze() { flags |= FL.FREEZE; return this; }
public RBasic Taint() { ////ruby.Secure(4); if ((flags & FL.TAINT) == 0) { if ((flags & FL.FREEZE) != 0) { ruby.ErrorFrozen("object"); } flags |= FL.TAINT; } return this; }
public RBasic Untaint() { ////ruby.Secure(3); if ((flags & FL.TAINT) != 0) { if ((flags & FL.FREEZE) != 0) { ruby.ErrorFrozen("object"); } flags &= ~FL.FREEZE; } return this; }
internal void Set(FL f) { flags |= f; }
public void Infect(RBasic o) { if (o.IsSpecialConst == false && IsSpecialConst == false) { flags |= (o.flags & FL.TAINT); } }
public bool Test(FL f) { return ((flags & f) == 0) ? false : true; }