Skip to content

Commit e9e258a

Browse files
committed
Initial Commit
1 parent c4be37f commit e9e258a

14 files changed

Lines changed: 659 additions & 2 deletions

File tree

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Workflow to build and release for production
2+
name: Build & Release
3+
4+
# Permissions for the workflow
5+
permissions:
6+
contents: write
7+
8+
# Trigger workflow on push to the main branch
9+
on:
10+
push:
11+
branches:
12+
- main
13+
14+
# Set environment variables
15+
env:
16+
artifactStagingDirectory: ${{ github.workspace }}/artifact_staging
17+
artifactType: 'Production'
18+
binariesDirectory: ${{ github.workspace }}/binaries
19+
buildConfiguration: 'Release'
20+
buildPlatform: 'any cpu'
21+
projectName: CursorCoordinateTracker
22+
23+
# Default settings for all run steps
24+
defaults:
25+
run:
26+
working-directory: src
27+
28+
# Define jobs for the workflow
29+
jobs:
30+
# Job to get the version of the build
31+
new-version:
32+
name: New Version
33+
runs-on: windows-latest
34+
35+
# Outputs of the job
36+
outputs:
37+
buildVersion: ${{ steps.parse-version.outputs.version }}
38+
validVersion: ${{ steps.validate-version.outputs.valid }}
39+
40+
steps:
41+
# Step to checkout the repository
42+
- name: Checkout repository
43+
uses: actions/checkout@v4
44+
45+
# Step to parse the build version for GitHub tag
46+
- name: Parse Build Version for GitHub Tag
47+
id: parse-version
48+
shell: pwsh
49+
run: echo "version=$(Get-Date -UFormat '%Y.%m.%d').${{ github.run_number }}" >> $env:GITHUB_OUTPUT
50+
51+
# Step to validate the parsed version
52+
- name: Validate Version ${{ steps.parse-version.outputs.version }}
53+
id: validate-version
54+
shell: pwsh
55+
run: |
56+
$version = "${{ steps.parse-version.outputs.version }}"
57+
echo "valid=$($version -match '^\d+(\.\d+){3}$')" >> $env:GITHUB_OUTPUT
58+
59+
# Job to build and publish the project
60+
build:
61+
name: Build & Publish Version ${{ needs.new-version.outputs.buildVersion }}
62+
runs-on: windows-latest
63+
needs: new-version
64+
if: ${{ needs.new-version.result == 'success' && needs.new-version.outputs.validVersion == 'True' }}
65+
66+
# Outputs of the job
67+
outputs:
68+
buildVersion: ${{ needs.new-version.outputs.buildVersion }}
69+
70+
# Set environment variables specific to the build job
71+
env:
72+
buildVersion: ${{ needs.new-version.outputs.buildVersion }}
73+
74+
steps:
75+
# Step to checkout the repository
76+
- name: Checkout repository
77+
uses: actions/checkout@v4
78+
79+
# Step to setup .NET Core SDK
80+
- name: Setup .NET Core SDK
81+
uses: actions/setup-dotnet@v4
82+
with:
83+
dotnet-version: 8
84+
85+
# Step to restore packages
86+
- name: Restore Packages
87+
shell: pwsh
88+
run: dotnet restore
89+
90+
# Step to publish the project
91+
- name: Publish
92+
shell: pwsh
93+
run: dotnet publish -c Release --self-contained -r win-x64
94+
95+
# Step to create a build artifact
96+
- name: Create Build Artifact
97+
shell: pwsh
98+
run: |
99+
New-Item -Path "${{ env.artifactStagingDirectory }}" -ItemType Directory
100+
Compress-Archive `
101+
-Path ${{ env.projectName }}/bin/Release/net8.0-windows/win-x64./publish/* `
102+
-DestinationPath ${{ env.artifactStagingDirectory }}/${{ env.projectName }}.${{ env.buildVersion }}-win-x64.zip
103+
104+
# Step to upload the build artifact
105+
- name: Upload a Build Artifact
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: drop
109+
path: ${{ env.artifactStagingDirectory }}/*.zip
110+
111+
# Job to create a GitHub release and tag the new version
112+
create-release:
113+
name: New GitHub Release Version ${{ needs.new-version.outputs.buildVersion }}
114+
runs-on: windows-latest
115+
needs:
116+
- new-version
117+
- build
118+
if: success()
119+
120+
# Set environment variables specific to the release job
121+
env:
122+
buildVersion: ${{ needs.new-version.outputs.buildVersion }}
123+
124+
steps:
125+
# Step to checkout the repository
126+
- name: Checkout repository
127+
uses: actions/checkout@v4
128+
129+
# Step to download build artifacts
130+
- name: Download Build Artifacts
131+
uses: actions/download-artifact@v4
132+
with:
133+
name: drop
134+
135+
# Step to create a GitHub release and tag
136+
- name: Create GitHub Release & Tag v${{ env.buildVersion }}
137+
uses: softprops/action-gh-release@v2
138+
with:
139+
files: ./${{ env.projectName }}.${{ env.buildVersion }}-win-x64.zip
140+
tag_name: v${{ env.buildVersion }}
141+
name: ${{ env.artifactType }} v${{ env.buildVersion }}
142+
generate_release_notes: true
143+
env:
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 g4-api
3+
Copyright (c) 2023 gravity-api
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,48 @@
1-
# cursor-coordinate-tracker
1+
# Cursor Coordinate Tracker v1.0
2+
3+
[![Build & Release](https://github.com/g4-api/cursor-coordinate-tracker/actions/workflows/GithubActions.yml/badge.svg?branch=main)](https://github.com/g4-api/cursor-coordinate-tracker/actions/workflows/GithubActions.yml)
4+
5+
**Cursor Coordinate Tracker** is a simple desktop application built using WPF (Windows Presentation Foundation) that allows users to track and display the current X and Y coordinates of the mouse cursor in real-time.
6+
7+
## Features
8+
9+
- Real-time display of mouse cursor coordinates.
10+
- Start/Stop tracking functionality.
11+
- Set custom coordinates for the mouse cursor.
12+
- Adjustable refresh speed for the coordinate tracking.
13+
14+
## Getting Started
15+
16+
To use the application, simply run the executable file. The main window displays the current X and Y coordinates of the mouse cursor. You can start or stop tracking using the "Start" button, and set custom coordinates using the "Set Position" button. The refresh speed can be adjusted using the slider.
17+
18+
## Prerequisites
19+
20+
- Windows operating system
21+
- .NET Framework
22+
23+
## Installation
24+
25+
1. Download the latest release from the [Releases](https://github.com/gravity-api/cursor-coordinate-tracker/releases) page.
26+
2. Extract the zip file to your desired location.
27+
3. Run the executable file (e.g., `CursorCoordinateTracker.exe`).
28+
29+
## Usage
30+
31+
1. Launch the application.
32+
2. The main window will display the current X and Y coordinates of the mouse cursor.
33+
3. Use the "Start" button to begin tracking the cursor.
34+
4. Use the "Stop" button to pause tracking.
35+
5. Adjust the refresh speed using the slider.
36+
6. Click the "Set Position" button to manually set custom coordinates.
37+
38+
## Screenshots
39+
40+
![Application Screenshot](/screenshots/1.png)
41+
42+
## Contributing
43+
44+
If you have suggestions for improvements, bug reports, or want to contribute to the project, please feel free to create an issue or submit a pull request.
45+
46+
## License
47+
48+
This project is licensed under the [MIT License](LICENSE).

build/AzurePipeline.yaml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: CursorCoordinateTracker.$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
2+
3+
trigger:
4+
- main
5+
6+
pool:
7+
vmImage: 'windows-latest'
8+
9+
variables:
10+
solution: '**/*.sln'
11+
buildPlatform: 'any cpu'
12+
buildConfiguration: 'Release'
13+
14+
stages:
15+
- stage: 'Build'
16+
jobs:
17+
- job: 'BuildAndPublish'
18+
displayName: 'Build, Pack & Publish'
19+
steps:
20+
- task: NuGetToolInstaller@1
21+
displayName: 'Install NuGet Tools'
22+
23+
- task: NuGetCommand@2
24+
displayName: 'Restore Packages'
25+
inputs:
26+
restoreSolution: '$(solution)'
27+
28+
- task: VSBuild@1
29+
displayName: 'Build Solution'
30+
inputs:
31+
solution: '$(solution)'
32+
msbuildArgs: '/target:publish /p:Configuration=Release /p:DeployOnBuild=true /p:PublishDir=$(Build.BinariesDirectory)'
33+
platform: '$(buildPlatform)'
34+
configuration: '$(buildConfiguration)'
35+
clean: true
36+
37+
- task: ArchiveFiles@2
38+
displayName: 'Create Build Artifact'
39+
inputs:
40+
rootFolderOrFile: '$(Build.BinariesDirectory)/*.*'
41+
archiveType: 'zip'
42+
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildNumber)-win-x64.zip'
43+
replaceExistingArchive: true
44+
45+
- task: PublishBuildArtifacts@1
46+
displayName: 'Publish Build Artifact'
47+
inputs:
48+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
49+
ArtifactName: 'drop'
50+
publishLocation: 'Container'
51+
52+
- stage: 'PublishGit'
53+
dependsOn: 'Build'
54+
condition: succeeded()
55+
jobs:
56+
- job: 'CraeteRelease'
57+
displayName: 'Create a GitHub Release & Tag'
58+
steps:
59+
- checkout: none
60+
61+
- task: PowerShell@2
62+
displayName: 'Parse Build Version for GitHub Tag'
63+
inputs:
64+
targetType: 'inline'
65+
script: |
66+
# setup
67+
[regex]$pattern = '(\d+.?)+'
68+
$version = $pattern.Matches('$(Build.BuildNumber)') | foreach-object {$_.Value}
69+
# set value
70+
Write-Host "##vso[task.setvariable variable=buildVersion]$version"
71+
72+
- task: DownloadBuildArtifacts@1
73+
displayName: 'Download Build Artifacts'
74+
inputs:
75+
buildType: 'current'
76+
downloadType: 'specific'
77+
downloadPath: '$(System.ArtifactsDirectory)'
78+
cleanDestinationFolder: true
79+
80+
- task: GitHubRelease@1
81+
displayName: 'Create GitHub Tag'
82+
inputs:
83+
assets: $(Build.ArtifactStagingDirectory)/drop/*
84+
gitHubConnection: 'github.com'
85+
repositoryName: '$(Build.Repository.Name)'
86+
action: 'create'
87+
target: '$(Build.SourceVersion)'
88+
tagSource: 'userSpecifiedTag'
89+
tag: 'v$(buildVersion)'
90+
title: 'Production v$(buildVersion)'
91+
releaseNotesSource: 'inline'
92+
changeLogCompareToRelease: 'lastFullRelease'
93+
changeLogType: 'commitBased'

screenshots/1.png

9.33 KB
Loading

screenshots/2.png

10.2 KB
Loading

src/CursorCoordinateTracker.sln

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34322.80
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CursorCoordinateTracker", "CursorCoordinateTracker\CursorCoordinateTracker.csproj", "{FDA2674F-8AB7-49AB-9693-E8DA2E24F1A1}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{294CD280-BA5D-42A7-910D-6C96433417D1}"
9+
ProjectSection(SolutionItems) = preProject
10+
..\build\AzurePipeline.yaml = ..\build\AzurePipeline.yaml
11+
EndProjectSection
12+
EndProject
13+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{61640856-75DF-45B6-9D0D-0EA8ACFC947E}"
14+
ProjectSection(SolutionItems) = preProject
15+
..\.gitignore = ..\.gitignore
16+
..\LICENSE = ..\LICENSE
17+
..\README.md = ..\README.md
18+
EndProjectSection
19+
EndProject
20+
Global
21+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
22+
Debug|Any CPU = Debug|Any CPU
23+
Release|Any CPU = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
26+
{FDA2674F-8AB7-49AB-9693-E8DA2E24F1A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{FDA2674F-8AB7-49AB-9693-E8DA2E24F1A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{FDA2674F-8AB7-49AB-9693-E8DA2E24F1A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{FDA2674F-8AB7-49AB-9693-E8DA2E24F1A1}.Release|Any CPU.Build.0 = Release|Any CPU
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
GlobalSection(ExtensibilityGlobals) = postSolution
35+
SolutionGuid = {D5553780-4B89-45E0-8D15-E904538F1B0A}
36+
EndGlobalSection
37+
EndGlobal
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="MouseLocationTool.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:MouseLocationTool"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Configuration;
2+
using System.Data;
3+
using System.Windows;
4+
5+
namespace MouseLocationTool
6+
{
7+
/// <summary>
8+
/// Interaction logic for App.xaml
9+
/// </summary>
10+
public partial class App : Application
11+
{
12+
}
13+
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]

0 commit comments

Comments
 (0)