Example #1
0
 private static void ThrowException1a()
 {
     using (FL.Scope())
     {
         ThrowException1b();
     }
 }
Example #2
0
        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++)
                        {
                        }
                    }
                }
            }
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
    }
Example #7
0
        /// <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();
        }
Example #8
0
 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
     }
 }
Example #9
0
    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);
        }
    }
Example #10
0
        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();
        }
Example #11
0
 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);
 }
Example #12
0
        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();
        }
Example #13
0
        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();
        }
Example #14
0
 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")));
     }
 }
Example #15
0
        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();
        }
Example #16
0
        /// <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;
        }
Example #17
0
 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);
             }
         }
 }
Example #18
0
        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());
        }
Example #19
0
 public RBasic Untaint()
 {
     ////ruby.Secure(3);
     if ((flags & FL.TAINT) != 0)
     {
         if ((flags & FL.FREEZE) != 0)
         {
             ruby.ErrorFrozen("object");
         }
         flags &= ~FL.FREEZE;
     }
     return(this);
 }
Example #20
0
 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);
     }
 }
Example #21
0
        void Set(FL value, bool toSet)
        {
            if (toSet)
            {
                flags |= value;
            }
            else
            {
                flags &= ~value;
            }

            changed();
        }
Example #22
0
 public RBasic Taint()
 {
     ////ruby.Secure(4);
     if ((flags & FL.TAINT) == 0)
     {
         if ((flags & FL.FREEZE) != 0)
         {
             ruby.ErrorFrozen("object");
         }
         flags |= FL.TAINT;
     }
     return(this);
 }
Example #23
0
        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);
            }
        }
Example #24
0
        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);
         }
     }
 }
Example #26
0
        /// <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);
        }
Example #27
0
 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");
         }
     }
 }
Example #28
0
 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);
         }
     }
 }
Example #29
0
        /// <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;
        }
Example #30
0
        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);
                }
            }
        }
Example #31
0
 internal void Unset(FL f)
 {
     flags &= ~f;
 }
Example #32
0
 public RBasic Freeze()
 {
     flags |= FL.FREEZE;
     return this;
 }
Example #33
0
 public RBasic Taint()
 {
     ////ruby.Secure(4);
     if ((flags & FL.TAINT) == 0)
     {
         if ((flags & FL.FREEZE) != 0)
         {
             ruby.ErrorFrozen("object");
         }
         flags |= FL.TAINT;
     }
     return this;
 }
Example #34
0
 public RBasic Untaint()
 {
     ////ruby.Secure(3);
     if ((flags & FL.TAINT) != 0)
     {
         if ((flags & FL.FREEZE) != 0)
         {
             ruby.ErrorFrozen("object");
         }
         flags &= ~FL.FREEZE;
     }
     return this;
 }
Example #35
0
 internal void Set(FL f)
 {
     flags |= f;
 }
Example #36
0
 public void Infect(RBasic o)
 {
     if (o.IsSpecialConst == false && IsSpecialConst == false)
     {
         flags |= (o.flags & FL.TAINT);
     }
 }
Example #37
0
 public bool Test(FL f)
 {
     return ((flags & f) == 0) ? false : true;
 }