Exemple #1
0
        public void WriteSetting(SettingStyle style)
        {
            Horoscope.Properties.Settings ps = Horoscope.Properties.Settings.Default;
            ps.CurrentZodiac = currentZodiac;
            var converter = new BrushConverter();

            ps.Background    = converter.ConvertToString(border.Background);
            ps.WindowOrasity = gridOpacity.Opacity;
            ps.FontSize      = WindowMain.FontSize;
            ps.FontName      = WindowMain.FontFamily.Source;
            ps.FontOpacity   = presentDay.Foreground.Opacity;
            ps.Foreground    = converter.ConvertToString(presentDay.Foreground);

            if (WindowMain.FontStyle == FontStyles.Normal)
            {
                ps.FontStyle = "Normal";
            }
            if (WindowMain.FontStyle == FontStyles.Italic)
            {
                ps.FontStyle = "Italic";
            }

            if (WindowMain.FontWeight == FontWeights.Normal)
            {
                ps.FontWeight = "Normal";
            }
            if (WindowMain.FontWeight == FontWeights.Bold)
            {
                ps.FontWeight = "Bold";
            }
        }
        //In order for it to work you must have BasicConfiguration.xml in the same place where .exe is
        private void SaveCurrentStyle_Click(object sender, RoutedEventArgs e)
        {
            XmlDocument doc = new XmlDocument();

            doc.PreserveWhitespace = true;
            try
            {
                doc.Load("BasicConfiguration.xml");
            }catch (System.IO.FileNotFoundException)
            {
                //If file will not exists create it!
                doc.LoadXml("<style> \n" +
                            "  <fontFamily>Linux Libertine Display G</fontFamily> \n" +
                            "  <fontSize>12</fontSize> \n" +
                            "  <background>FFFFFFFF</background> \n" +
                            "   <foreground>FF000000</foreground> \n" +
                            "</style>");
            }
            XmlNode root = doc.FirstChild;

            if (root.HasChildNodes)
            {
                for (int i = 0; i < root.ChildNodes.Count; i++)
                {
                    var        gg         = root.ChildNodes[i];
                    XmlElement elementXml = root.ChildNodes[i] as XmlElement;

                    //It means that given element is \r\n
                    if (elementXml != null)
                    {
                        BrushConverter c = new BrushConverter();

                        switch (elementXml.LocalName)
                        {
                        case "fontFamily":
                            elementXml.InnerText = txtMainArea.FontFamily.Source;
                            break;

                        case "fontSize":
                            elementXml.InnerText = txtMainArea.FontSize.ToString();
                            break;

                        case "background":
                            elementXml.InnerText = c.ConvertToString(txtMainArea.Background);
                            break;

                        case "foreground":
                            elementXml.InnerText = c.ConvertToString(txtMainArea.Foreground);
                            break;
                        }
                    }
                }
            }
            doc.Save("BasicConfiguration.xml");
            MessageBox.Show("Zmiany zostały zapisane");
        }
Exemple #3
0
 private void WriteNodeStyles(IPropertySetModule <NodeStyle> module)
 {
     myWriter.Write(module.Items.Count());
     foreach (var style in module.Items)
     {
         myWriter.Write(style.OwnerId);
         myWriter.Write(myBrushConverter.ConvertToString(style.BorderColor));
         myWriter.Write(myBrushConverter.ConvertToString(style.FillColor));
         myWriter.Write(style.Shape);
         myWriter.Write(style.Style);
     }
 }
 public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 {
     try
     {
         return(brushConverter.ConvertToString((SolidColorBrush)value));
     }
     catch (FormatException)
     {
         try
         {
             return(brushConverter.ConvertToString((SolidColorBrush)value));
         }
         catch (FormatException) { return(Binding.DoNothing); }
     }
 }
Exemple #5
0
        private FontSettings(MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
            InitializeComponent();


            FontSizeValue.Content = mainWindow.textBox.FontSize;
            slider.Value          = mainWindow.textBox.FontSize;

            FontFamilyCMB.SelectedValue = mainWindow.textBox.FontFamily;
            FontFamilyCMB.ItemsSource   = Fonts.SystemFontFamilies;


            PropertyInfo[] colors       = typeof(Brushes).GetProperties();
            string[]       colorStrings = new string[colors.Length];
            for (int i = 0; i < colors.Length; i++)
            {
                string[] tmpString = colors[i].ToString().Split();
                colorStrings[i] = tmpString[tmpString.Length - 1];
            }
            BrushConverter brushConverter = new BrushConverter();

            brushConverter.ConvertToString(mainWindow.textBox.Foreground);
            FontColorCMB.ItemsSource   = colorStrings;
            FontColorCMB.SelectedValue = "Black";
        }
        public string ShowColorDialog(string title, string currentColorHex)
        {
            BrushConverter brushConverter = new BrushConverter();

            TAlex.WPF.CommonDialogs.ColorPickerDialog diaglog = new TAlex.WPF.CommonDialogs.ColorPickerDialog
            {
                Title = title,
                Owner = Application.Current.MainWindow
            };

            if (!string.IsNullOrWhiteSpace(currentColorHex))
            {
                if (brushConverter.ConvertFromString(currentColorHex) is SolidColorBrush solidColorBrush)
                {
                    diaglog.SelectedColor = solidColorBrush.Color;
                }
            }

            if (diaglog.ShowDialog() == true)
            {
                SolidColorBrush selectedColor = new SolidColorBrush(diaglog.SelectedColor);
                string          colorHex      = brushConverter.ConvertToString(selectedColor);
                return(colorHex);
            }

            return(currentColorHex);
        }
Exemple #7
0
        public void WHEN_EdgeStylesDefined_THEN_EdgeStylesAreSerialized()
        {
            var module = myPresentation.GetPropertySetFor <EdgeStyle>();

            module.Add(new EdgeStyle("a")
            {
                Color = Brushes.Red
            });

            var presentation = SerializeDeserialize(myPresentation);

            module = presentation.GetPropertySetFor <EdgeStyle>();

            Assert.That(module, Is.Not.SameAs(myPresentation.GetPropertySetFor <EdgeStyle>()));
            var converter = new BrushConverter();

            Assert.That(converter.ConvertToString(module.Get("a").Color), Is.EqualTo(converter.ConvertToString(Brushes.Red)));
        }
Exemple #8
0
 /// <summary>
 /// Sets the colour
 /// </summary>
 /// <param name="colour"></param>
 public void Set(SolidColorBrush colour)
 {
     if (colour == null)
     {
         this.colour = Brushes.White;
     }
     this.colour = colour;
     colourName  = converter.ConvertToString(this.colour);
 }
Exemple #9
0
        public static List <PaletteColor> ClassToPalette <T>()
        {
            var lst      = new List <PaletteColor>();
            var tt       = typeof(T);
            var instance = Activator.CreateInstance(tt);

            foreach (var item in tt.GetProperties().Where(X => X.PropertyType == typeof(SolidColorBrush)))
            {
                var brush = (SolidColorBrush)instance.GetValueByProperty(item.Name);
                lst.Add(new PaletteColor
                {
                    Name       = item.Name,
                    Brush      = brush,
                    Hex        = "#" + bc.ConvertToString(brush).TrimStart('#', 'F', 'F'),
                    Foreground = brush.ForegroundFromBrightness()
                });
            }

            return(lst);
        }
Exemple #10
0
        protected virtual void SaveRegistryInfo(RegistryKey regkey)
        {
            regkey.SetValue(strOcrLanguage, dataSource.SelectedLanguagesText);

            regkey.SetValue(strWordWrap, Convert.ToInt32(this.textBox1.TextWrapping));
            regkey.SetValue(strFontFace, this.textBox1.FontFamily);
            regkey.SetValue(strFontSize, this.textBox1.FontSize);
            regkey.SetValue(strFontStyle, this.textBox1.FontStyle.ToString());
            var bc = new BrushConverter();

            regkey.SetValue(strForeColor, bc.ConvertToString(this.textBox1.Foreground));
            regkey.SetValue(strBackColor, bc.ConvertToString(this.textBox1.Background));
            regkey.SetValue(strFilterIndex, filterIndex);
            regkey.SetValue(strUILang, Thread.CurrentThread.CurrentUICulture.Name);
            regkey.SetValue(strSegmentedRegions, Convert.ToInt32(this.segmentedRegionsToolStripMenuItem.IsChecked));
            regkey.SetValue(strSegmentedRegionsPara, Convert.ToInt32(this.toolStripMenuItemPara.IsChecked));
            regkey.SetValue(strSegmentedRegionsTextLine, Convert.ToInt32(this.toolStripMenuItemTextLine.IsChecked));
            regkey.SetValue(strSegmentedRegionsSymbol, Convert.ToInt32(this.toolStripMenuItemSymbol.IsChecked));
            regkey.SetValue(strSegmentedRegionsBlock, Convert.ToInt32(this.toolStripMenuItemBlock.IsChecked));
            regkey.SetValue(strSegmentedRegionsWord, Convert.ToInt32(this.toolStripMenuItemWord.IsChecked));
        }
        public TextFormat(double size, FontType ft, FontStyle fs, FontWeight fw, SolidColorBrush brush, bool useUnderline)
        {
            this.FontSize     = Math.Round(size, 1);
            this.FontType     = ft;
            this.FontFamily   = FontFactory.GetFontFamily(ft);
            this.FontStyle    = fs;
            this.UseUnderline = useUnderline;
            this.FontWeight   = fw;
            this.TextBrush    = brush;
            this.TypeFace     = new Typeface(FontFamily, fs, fw, FontStretches.Normal, FontFactory.GetFontFamily(FontType.STIXGeneral));
            BrushConverter bc = new BrushConverter();

            TextBrushString = bc.ConvertToString(brush);
        }
Exemple #12
0
        public ExploitScreen()
        {
            Cef.EnableHighDPISupport();
            var settings = new CefSettings();

            settings.SetOffScreenRenderingBestPerformanceArgs();
            Cef.Initialize(settings);

            var SLib = Globals.SxLib;

            SLib.SetWindow(this);
            SLib.AttachEvent += async SEvent =>
            {
                switch (SEvent)
                {
                case SxLibBase.SynAttachEvents.CHECKING:
                {
                    showStatusLabel();
                    headerStatusLabel.Content = "Checking...";
                    break;
                }

                case SxLibBase.SynAttachEvents.INJECTING:
                {
                    headerStatusLabel.Content = "Injecting...";
                    break;
                }

                case SxLibBase.SynAttachEvents.CHECKING_WHITELIST:
                {
                    headerStatusLabel.Content = "Checking Whitelist...";
                    break;
                }

                case SxLibBase.SynAttachEvents.SCANNING:
                {
                    showStatusLabel();
                    headerStatusLabel.Content = "Scanning...";
                    break;
                }

                case SxLibBase.SynAttachEvents.READY:
                {
                    headerStatusLabel.Content = "Ready!";

                    attachNotify.Stop();
                    designMethods.ButtonColor(attachButton, brushConverter.ConvertToString(attachButton.Background), "#FF3C3C3C");
                    await Task.Delay(1000);

                    hideStatusLabel();
                    break;
                }

                case SxLibBase.SynAttachEvents.ALREADY_INJECTED:
                {
                    error("Already injected!");
                    await Task.Delay(1000);

                    hideStatusLabel();
                    break;
                }

                case SxLibBase.SynAttachEvents.FAILED_TO_ATTACH:
                {
                    error("Failed to attach!");
                    await Task.Delay(1000);

                    hideStatusLabel();
                    break;
                }

                case SxLibBase.SynAttachEvents.FAILED_TO_FIND:
                {
                    error("Failed to find Roblox!");
                    await Task.Delay(1000);

                    hideStatusLabel();
                    break;
                }

                case SxLibBase.SynAttachEvents.NOT_RUNNING_LATEST_VER:
                {
                    error("Not running latest version!");
                    await Task.Delay(1000);

                    hideStatusLabel();
                    break;
                }

                case SxLibBase.SynAttachEvents.NOT_INJECTED:
                {
                    error("Not injected!");
                    await Task.Delay(1000);

                    hideStatusLabel();
                    break;
                }

                case SxLibBase.SynAttachEvents.PROC_CREATION:
                {
                    attachNotify.Start();
                    break;
                }

                case SxLibBase.SynAttachEvents.PROC_DELETION:
                {
                    attachNotify.Stop();
                    designMethods.ButtonColor(attachButton, brushConverter.ConvertToString(attachButton.Background), "#FF3C3C3C");
                    await Task.Delay(1000);

                    break;
                }
                }
            };

            SLib.ScriptHubEvent += Entries =>
            {
                scriptHubButton.Content = "Script Hub";
                ScriptHubScreen scriptHub = new ScriptHubScreen(exploitScreen, Entries);
                scriptHub.Show();
                Focus();
            };

            InitializeComponent();

            Title = Globals.RandomString(Globals.Rnd.Next(10, 32));

            designMethods = new InterfaceDesign();
            new Random();
            brushConverter = new BrushConverter();
            openFileDialog = new OpenFileDialog {
                Title = "Load Script from File", Filter = "Script files|*.lua;*.txt"
            };
            attachNotify = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(1)
            };
            attachNotify.Tick += AttachNotify_Tick;

            if (Process.GetProcessesByName("RobloxPlayerBeta").Length != 0)
            {
                attachNotify.Start();
            }

            scriptsDirectory = Path.Combine(Path.Combine(Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName), "scripts");

            foreach (var FilePath in Directory.GetFiles(scriptsDirectory))
            {
                synScripts.Items.Add(Path.GetFileName(FilePath));
            }
        }
        void DrawArc()
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString());
            }


            //
            //  Odd behavior when z is zero and x < zero: points get switched.
            //  this code switches them back.
            if (Z == 0 && X < 0)
            {
                double wrk = RightLineY;
                RightLineY = LeftLineY;
                LeftLineY  = wrk;
            }

            PathGeometry pathGeometry = new PathGeometry();

            PathFigure figure = new PathFigure();

            figure.StartPoint = new Point(RightLineX + CenterX, RightLineY + CenterY);



            Point EndPoint = new Point(LeftLineX + CenterX, LeftLineY + CenterY);

            if (ArcWidth == 1)
            {
                //@@@@

                double relativeX = Math.Atan(CenterWallY / CenterWallX);
                double wrkArc    = 0.999999D;

                double wrkX = WallRatio * Range *
                              Math.Cos(wrkArc * Math.PI + relativeX)
                              * ((CenterWallX < 0 && Math.Cos(relativeX) > 0) ? -1 : 1);

                double wrkY = WallRatio * Range *
                              Math.Sin(wrkArc * Math.PI + relativeX)
                              * (((CenterWallY > 0 && Math.Sin(relativeX) < 0) || (CenterWallY < 0 && Math.Sin(relativeX) > 0)) ? -1 : 1);

                EndPoint = new Point(wrkX + CenterX, wrkY + CenterY);



                wrkX = WallRatio * Range *
                       Math.Cos(-wrkArc * Math.PI + relativeX)
                       * ((CenterWallX < 0 && Math.Cos(relativeX) > 0) ? -1 : 1);

                wrkY = WallRatio * Range *
                       Math.Sin(-wrkArc * Math.PI + relativeX)
                       * (((CenterWallY > 0 && Math.Sin(relativeX) < 0) || (CenterWallY < 0 && Math.Sin(relativeX) > 0)) ? -1 : 1);

                figure.StartPoint = new Point(wrkX + CenterX, wrkY + CenterY);
            }
            Size arcSize  = new Size(Range * WallRatio, Range * WallRatio);
            bool largeArc = (ArcWidth > 0.5);


            if (_log.IsInfoEnabled)
            {
                _log.InfoFormat("~~~~~~~~~~~~~~~~WallRatio={0}, X={1}, Z={2}", WallRatio.ToString(), X.ToString(), Z.ToString());
                _log.InfoFormat("Rendering arc.  RightLineX={0}, RightLineY={1}, LeftLineX={2}, LeftLineY={3}, Range={4}, largeArc={5}, arcWidth={6}",
                                RightLineX.ToString(), RightLineY.ToString(), LeftLineX.ToString(),
                                LeftLineY.ToString(), Range.ToString(), largeArc.ToString(),
                                ArcWidth.ToString());
                _log.InfoFormat("Start Point=({0},{1}), End Point=({2},{3})",
                                figure.StartPoint.X.ToString(),
                                figure.StartPoint.Y.ToString(),
                                EndPoint.X.ToString(),
                                EndPoint.Y.ToString());
            }

            figure.Segments.Add(
                new ArcSegment(
                    EndPoint,
                    arcSize, 0,
                    largeArc,
                    SweepDirection.Clockwise,
                    true));


            Brush  FillBrush       = null;
            double strokeThickness = 1;

            if (Highlighter)
            {
                strokeThickness = 3;
                BrushConverter cnv = new BrushConverter();
                string         wrk = cnv.ConvertToString(this.SideLinesBrush);
                FillBrush = new BrushConverter().ConvertFromString("#70" + wrk.Substring(3)) as Brush;


                List <Point> points = new List <Point>();
                points.Add(new Point(CenterX, CenterY));
                points.Add(new Point(LeftLineX + CenterX, LeftLineY + CenterY));
                points.Add(new Point(RightLineX + CenterX, RightLineY + CenterY));
                myTriangle.Points = new PointCollection(points);

                myTriangle.Fill       = FillBrush;
                myTriangle.Visibility = Visibility.Visible;
            }
            else
            {
                myTriangle.Visibility = Visibility.Collapsed;
            }


            LeftLine.StrokeThickness   = strokeThickness;
            CenterLine.StrokeThickness = strokeThickness;
            RightLine.StrokeThickness  = strokeThickness;
            pathGeometry.Figures.Add(figure);

            myArc.Data = pathGeometry;

            myArc.Fill            = FillBrush;
            myArc.Stroke          = this.SideLinesBrush;
            myArc.StrokeThickness = strokeThickness;
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString());
            }
        }