コード例 #1
0
        private void SkinIniProperty_MouseEnter(object sender, MouseEventArgs e)
        {
            TextBoxToolTips.Text = "";
            string[] ToToolTip = SkinIniParser.GetToolTipLines(sender, ToolTipLines);
            foreach (string elem in ToToolTip)
            {
                TextBoxToolTips.Text += elem + "\n";
            }
            Type SenderType = sender.GetType();

            if (SenderType.Name == "TextBox")
            {
                LabelToolTipSkinIniCurrentProp.Content = $"Current: {((TextBox)sender).Text}";
                return;
            }
            if (SenderType.Name == "CheckBox")
            {
                LabelToolTipSkinIniCurrentProp.Content = $"Current: {((CheckBox)sender).IsChecked.ToString()}";
                return;
            }
            if (SenderType.Name == "Frame")
            {
                LabelToolTipSkinIniCurrentProp.Content = $"Current: {((Frame)sender).Background}";
                return;
            }
        }
コード例 #2
0
        private void GetCurrentColor()
        {
            byte[] Colours = SkinIniParser.GetRgbColours(BackgroundColour);

            TextBoxColourR.Text   = Colours[0].ToString();
            TextBoxColourG.Text   = Colours[1].ToString();
            TextBoxColourB.Text   = Colours[2].ToString();
            TextBoxColourHEX.Text = BackgroundColour.ToString().Remove(1, 2);
            RectangleColour.Fill  = new SolidColorBrush(Color.FromRgb(Colours[0], Colours[1], Colours[2]));
        }
コード例 #3
0
 private void Version_TextChanged(object sender, TextChangedEventArgs e)
 {
     Version.ToolTip = SkinIniParser.VersionValidator(Version.Text);
     if (!SkinIniParser.IsVersionValid)
     {
         Version.Background = Brushes.Red;
     }
     else
     {
         Version.Background = Brushes.Green;
     }
 }
コード例 #4
0
        private void ButtonSkinIni_Click(object sender, RoutedEventArgs e)
        {
            string SkinIniPath = SkinIniParser.SkinIniInit(ComboBoxExistingSkin.SelectedValue as string);

            foreach (object elem in SkinIniPropertiesObj)
            {
                Type temp = elem.GetType();
                if (temp.Name == "TextBox")
                {
                    ((TextBox)elem).Text = SkinIniParser.GetPropertyBySenderName(((TextBox)elem).Name);
                }
                else if (temp.Name == "CheckBox")
                {
                    string tempstring = SkinIniParser.GetPropertyBySenderName(((CheckBox)elem).Name);
                    if (tempstring != "")
                    {
                        int tempf = int.Parse(tempstring);
                        ((CheckBox)elem).IsChecked = Convert.ToBoolean(tempf);
                    }
                    else
                    {
                        ((CheckBox)elem).IsChecked  = Convert.ToBoolean(0); //костыль
                        ((CheckBox)elem).Background = Brushes.Yellow;
                        ((CheckBox)elem).ToolTip    = "skin.ini does not contain this line";
                    }
                }
                else
                {
                    string colours   = SkinIniParser.GetPropertyBySenderName(((Frame)elem).Name);
                    var    TempFrame = elem as Frame;
                    if (colours == "")
                    {
                        TempFrame.ToolTip            = "no value to work with";
                        TempFrame.Background         = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                        TempFrame.Background.Opacity = 0.01;
                    }
                    else
                    {
                        string[] RgbColours = colours.Split(',');
                        byte     r          = byte.Parse(RgbColours[0]);
                        byte     g          = byte.Parse(RgbColours[1]);
                        byte     b          = byte.Parse(RgbColours[2]);
                        TempFrame.Background         = new SolidColorBrush(Color.FromRgb(r, g, b));
                        TempFrame.Background.Opacity = 1;
                        TempFrame.ToolTip            = "everything is ok!";
                    }
                }
            }
            Directory.CreateDirectory("export");
            File.Copy(SkinIniPath, "export\\" + "skin.ini", true); //сделать балдежное окно с галочками при экспорте этого файла
        }
コード例 #5
0
 private void ButtonSkinExport_Click(object sender, RoutedEventArgs e)
 {
     ProgressBarExport.Value = 0;
     File.WriteAllLines("export\\skin.ini", SkinIniParser.SkinIniToExport());
     Directory.CreateDirectory("export");
     foreach (Image elem in OnScreenImages)
     {
         File.Copy(elem.Source.ToString().Remove(0, 8), "export\\" + SkinWorker.Name2FileNameConv(elem.Source.ToString(), false), true);
         ZipExporter.AddFileToZip(TextBoxExportSkinName.Text + ".osk", elem.Source.ToString().Remove(0, 8)); //it just works
         ProgressBarExport.Value++;                                                                          //factory new
     }
     ZipExporter.AddFileToZip(TextBoxExportSkinName.Text + ".osk", "export\\skin.ini");
     Process.Start("export\\");
 }
コード例 #6
0
        private void TextBoxColour_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (((TextBox)sender).Name.Contains("HEX"))
            {
                if (TextBoxColourHEX.Text.Length == 7)
                {
                    try
                    {
                        string HexColour = TextBoxColourHEX.Text.Insert(1, "FF");
                        byte[] Colours   = SkinIniParser.GetRgbColours(HexColour);

                        TextBoxColourR.Text = Colours[0].ToString();
                        TextBoxColourG.Text = Colours[1].ToString();
                        TextBoxColourB.Text = Colours[2].ToString();

                        RectangleColour.Fill = new SolidColorBrush(Color.FromRgb(Colours[0], Colours[1], Colours[2]));
                        return;
                    }
                    catch (FormatException)
                    {
                        return;
                    }
                }
                return;
            }

            byte R, G, B;
            var  Sender = sender as TextBox;

            if (Sender.Text != "" && int.Parse(Sender.Text) > 256)
            {
                Sender.Background = Brushes.Red;
                return;
            }
            Sender.Background = Brushes.White;

            R = SkinIniParser.GetSingleChannel(TextBoxColourR.Text);
            G = SkinIniParser.GetSingleChannel(TextBoxColourG.Text);
            B = SkinIniParser.GetSingleChannel(TextBoxColourB.Text);

            RectangleColour.Fill = new SolidColorBrush(Color.FromRgb(R, G, B));

            TextBoxColourHEX.Text = RectangleColour.Fill.ToString().Remove(1, 2);
        }