u/robinredbrain

Sync solution window with gitigore?

First of all a disclaimer. I'm a git moron. And I have only just recently started using it. I don't have the time or the mind to go through the process of learning it.

My question is, is there some way I can make my solution explorer display every file and folder that is going to be uploaded to git / github. Meaning when 'show all files' is not set.

I recently went through the trauma of chatGPT pointing out that I'm an idiot uploading bin and obj folders among other things.

I actually thought that what I see in my SE was everything that is uploaded. Which is what I'd it to be.

Thank you for reading.

reddit.com
u/robinredbrain — 1 day ago
▲ 15 r/csharp

File WriteAllText uncertainty.

Documentation: Creates a new file, write the contents to the file, and then closes the file. If the target file already exists, it is truncated and overwritten.

What exactly does it mean by 'truncated'?

edit - Thanks all. It all makes sense now. Very pertinent info too. I may have imagined it but I thought it used to just say the file is overwritten.

reddit.com
u/robinredbrain — 2 days ago

Where does brave install its extensions?

I want to try to import then into a WebView2 web browser. And I believe Brave uses chromium too.

Trying to get extensions to work in my own browser.

reddit.com
u/robinredbrain — 4 days ago

Is there an animal that could jump of a falling object at the last moment with such a force that it would 'cancel out' for want of a better term, the impact?

Lets say as an example you drive your car of a cliff. It reaches it's terminal velocity before the bottom. What kind of force are we talking about?

Could a human jump up from his convertable like 3 seconds before impact? How about a kangaroo?

The thought arose from a recent action labs YT video.

edit - Specifically asking about animals that would probably be killed.

reddit.com
u/robinredbrain — 4 days ago
▲ 7 r/csharp

Resources for implementing/adding browser extensions in WPF WebView2

From my initial searches I concluded it is possible to do this. However all references I've found are quite old. I'm asking if anyone has tried or accomplished this for any good material links?

reddit.com
u/robinredbrain — 5 days ago

Cannot scroll properly.

Scrolling in Brave the up down keys act the same as the PageUp PageDown keys. So there is no granularity.

Is there a setting or something I'm missing?

reddit.com
u/robinredbrain — 6 days ago

Not something I'd usually ask about but I'm already poking around here for some other questions.

A couple of months ago I followed a link to a reddit post. But I got a message instead of the post as titled. Nothing else. A search seemed to indicate it was a temporary glitch, so I just used a different browser for reddit.

In fact I've used several since all without issue. Except FF. Still blocked out.

What's the deal with that?

reddit.com
u/robinredbrain — 19 days ago
▲ 1 r/csharp

edit - Solved: Control needed a Style. Hesitantly suggesting more precisely a Content presenter.

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:control="clr-namespace:HowTo_ButtonBaseCustomControl">
                    
    <Style x:Key="TButton1"
           TargetType="control:TimeSpanNudgeButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="control:TimeSpanNudgeButton">
                    
                    <Border Width="{TemplateBinding Width}"
                            Height="{TemplateBinding Height}"
                            Background="{TemplateBinding Background}">
                        <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

Original post:

My first custom control. Please excuse my noobness. I have searched web. With no luck.

The text content of the control simply does not appear either at design or runtime. Though it is there and printed by Debug.

Feels like I'm missing something quite remedial. I'm blushing just posting this.

Though the absence of InitializeComponent(); or similar in the control constructor has not escaped me.

using System.Diagnostics;
using System.Windows;

namespace HowTo_ButtonBaseCustomControl;
public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }

    private void TimeSpanNudgeButton_Click(object sender, RoutedEventArgs e)
    {
        Debug.WriteLine(tButton.Content.ToString());
    }
}

using System.Windows;
using System.Windows.Controls.Primitives;

namespace HowTo_ButtonBaseCustomControl;

public class TimeSpanNudgeButton : ButtonBase
{
    static TimeSpanNudgeButton()
    {
        DefaultStyleKeyProperty.OverrideMetadata(typeof(TimeSpanNudgeButton), 
            new FrameworkPropertyMetadata(typeof(TimeSpanNudgeButton)));
    }
}

<Window x:Class="HowTo_ButtonBaseCustomControl.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:HowTo_ButtonBaseCustomControl"
        mc:Ignorable="d"
        Background="#222"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <local:TimeSpanNudgeButton 
            x:Name="tButton"
            Background="#229"
            Width="200"
            Height="40"
            FontSize="20"
            FontWeight="Bold"
            Content="Click Me"
            Foreground="White"
            Click="TimeSpanNudgeButton_Click"/>
    </Grid>
</Window>
reddit.com
u/robinredbrain — 19 days ago
▲ 1 r/csharp

edit - I'm sorry if wasted anyone's time. Got it shortly after posting.

In case you are interested I changed the former line to the latter.

<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Border.CornerRadiusProperty"
                                                               Duration="0:0:0.1"
                                                               AutoReverse="True">


<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="CornerRadius"
                                                               Duration="0:0:0.1"
                                                               AutoReverse="True">

If I run the code I get this InvalidOperationException at BorderStoryboard.Begin();

>

Cannot resolve all property references in the property path '(Border.CornerRadiusProperty)'. Verify that applicable objects support the properties.

I'm not complete noob but new to animation.

xaml

<Window x:Class="HowTo_RockerButton.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:HowTo_RockerButton"
        mc:Ignorable="d"
        Title="MainWindow"
        Height="450"
        Width="800"
        Background="#222"
        ThemeMode="Dark">
    <Grid>
        <StackPanel HorizontalAlignment="Center"
                    VerticalAlignment="Center">
            
            <Border x:Name="Button"
                    BorderThickness="0,0,0,0"
                    Width="150"
                    MouseLeftButtonDown="Button_MouseLeftButtonDown"
                    MouseLeftButtonUp="Button_MouseLeftButtonUp"
                    Height="40"
                    Background="#449"
                    CornerRadius="15, 15, 15, 15">
                <Border.Triggers>
                    <EventTrigger RoutedEvent="Border.MouseUp">
                        <BeginStoryboard>
                            <Storyboard>
                                
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="CornerRadius"
                                                               Duration="0:0:0.1"
                                                               AutoReverse="True">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.05">
                                        <DiscreteObjectKeyFrame.Value>
                                            <CornerRadius BottomLeft="40"
                                                          BottomRight="10"
                                                          TopLeft="40"
                                                          TopRight="10" />
                                    </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.1">
                                        <DiscreteObjectKeyFrame.Value>
                                            <CornerRadius BottomLeft="70"
                                                          BottomRight="5"
                                                          TopLeft="70"
                                                          TopRight="5" />
                                        </DiscreteObjectKeyFrame.Value>
                                    </DiscreteObjectKeyFrame>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Border.Triggers>
                <TextBlock HorizontalAlignment="Center"
                               VerticalAlignment="Top"
                               Text="00:00:00.000"
                               FontSize="20"
                               FontWeight="Bold"
                               Foreground="White"
                               Margin="0,7,0,0"
                               Grid.RowSpan="2" />
                
            </Border>
        </StackPanel>
    </Grid>
</Window>

c#

    private void AnimatePress()
    {
        NameScope scope = new NameScope();
        Storyboard borderStoryboard = new();

        ObjectAnimationUsingKeyFrames animation = new ObjectAnimationUsingKeyFrames();
        animation.BeginTime = TimeSpan.FromSeconds(0);
        animation.Duration = TimeSpan.FromSeconds(0.1);
        Storyboard.SetTarget(animation, Button);
        Storyboard.SetTargetProperty(animation, new PropertyPath("(Border.CornerRadiusProperty)"));
        DiscreteObjectKeyFrame keyFrame1 = new DiscreteObjectKeyFrame
        {
            KeyTime = TimeSpan.FromSeconds(0.05),
            Value = new CornerRadius(40, 10, 10, 40)
        };
        DiscreteObjectKeyFrame keyFrame2 = new DiscreteObjectKeyFrame
        {
            KeyTime = TimeSpan.FromSeconds(0.1),
            Value = new CornerRadius(70, 5, 5, 70)
        };
        animation.KeyFrames.Add(keyFrame1);
        animation.KeyFrames.Add(keyFrame2);
        borderStoryboard.Children.Add(animation);

        borderStoryboard.Begin();// .BeginAnimation();
    }
reddit.com
u/robinredbrain — 19 days ago

Since update before last. FF just all of a sudden starts consuming up to 80% of my CPU.

I've been on FireFox for about 15 years and never had anything close to this.

At first when looking for a pattern I thought it was youtube, then when an google AI was a search result. But but it just seemingly occurs when relatively idling. Like 10 minutes into reading a long article. I have to close it. I'm using brave for the time being which is a pain really, because I usually just leave FF open when I'm coding, but the resource use is maddening and affects whole machine performance.

No new addons or other gizmos or changes.

I know how selfish this sounds but I'm hoping I'm not alone in this.

reddit.com
u/robinredbrain — 19 days ago
▲ 1 r/csharp

I want to emulate a button similar to what you might find on an old world game pad to move left and right.

It is a pure design choice. The practical goal is already met. Which is to adjust a counter up and down.

I don't want 2 buttons. I want to try and get it to look like and actual rocker or seesaw if you will. Looks like it is pressed at one end.

At first I thought I could get away with a sneaky ThicknessAnimation on CornerRadius property and see what that looked like rounding the corners at one side. Ha. Of course that failed.

Then I found ObjectAnimationUsingKeyFrames which I thought should work. Alas it does not. At least my code does not work I should say.

If I try the code below as is I get

(InvalidOperationException(SR.Format(SR.Storyboard_PropertyPathPropertyNotFound, path.Path));

If I change the TargetProperty to CornerRadius I get

AnimationException
  HResult=0x80131501
  Message=Cannot animate the 'CornerRadius' property on a 'System.Windows.Controls.Border' using a 'System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames'. For details see the inner exception.

Inner exception

InvalidOperationException: The animation(s) applied to the 'CornerRadius' property calculate a current value of '5, 5, 5, 5', which is not a valid value for the property.

Any help with this or other ideas appreciated.

<Window x:Class="HowTo_RockerButton.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:HowTo_RockerButton"
        mc:Ignorable="d"
        Title="MainWindow"
        Height="450"
        Width="800"
        Background="#222"
        ThemeMode="Dark">
    <Grid>
        <StackPanel HorizontalAlignment="Center"
                    VerticalAlignment="Center">
            
            <Border x:Name="Button"
                    BorderThickness="0,0,0,0"
                    Width="150"
                    MouseLeftButtonDown="Button_MouseLeftButtonDown"
                    MouseLeftButtonUp="Button_MouseLeftButtonUp"
                    Height="40"
                    Background="#449"
                    CornerRadius="5, 5, 5, 5">
                <Border.Triggers>
                    <EventTrigger RoutedEvent="Border.MouseUp">
                        <BeginStoryboard>
                            <Storyboard>
                                
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="CornerRadiusProperty"
                                                               Duration="0:0:1">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0"
                                                            Value="5, 5, 5, 5" />
                                    <DiscreteObjectKeyFrame KeyTime="0:0:1"
                                                            Value="15, 5, 5, 15" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Border.Triggers>
                <TextBlock HorizontalAlignment="Center"
                               VerticalAlignment="Top"
                               Text="00:00:00.000"
                               FontSize="20"
                               FontWeight="Bold"
                               Foreground="White"
                               Margin="0,7,0,0"
                               Grid.RowSpan="2" />
                
            </Border>
        </StackPanel>
    </Grid>
</Window>
reddit.com
u/robinredbrain — 19 days ago
▲ 4 r/ffmpeg

I do a lot of clipping out small segments of video from longer videos.

I just found out about using hardware acceleration with my on chip AMD radeon gpu.

Using cpu is painfully slow. For example the 3 minute test video using the following command took close to 4 minutes.

ffmpeg -i in.mp4 -c:v h264 outcpu.mp4

But I was excited to see the the next command take more or less 40 seconds

ffmpeg -i in.mp4 -c:v h264_amf outgpu.mp4

Problem is the input file is 55MB and the output of the two commands are vastly different.

CPU = 40MB

GPU = 380MB

Is this just the way it is, or is there something I can do to get the size down?

I'm new to ffmpeg.

ffmpeg version 8.0.1-essentials_build-www.gyan.dev Copyright (c) 2000-2025 the FFmpeg developers
built with gcc 15.2.0 (Rev8, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-openal --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil      60.  8.100 / 60.  8.100
libavcodec     62. 11.100 / 62. 11.100
libavformat    62.  3.100 / 62.  3.100 libavdevice    62.  1.100 / 62.  1.100 libavfilter    11.  4.100 / 11.  4.100 libswscale      9.  1.100 /  9.  1.100 libswresample   6.  1.100 /  6.  1.100
reddit.com
u/robinredbrain — 22 days ago