Add project files.

This commit is contained in:
kagert 2024-10-20 01:43:41 +02:00
parent ac5716048d
commit e09b1779b6
8 changed files with 1336 additions and 0 deletions

63
.gitattributes vendored Normal file
View File

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

363
.gitignore vendored Normal file
View File

@ -0,0 +1,363 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd

444
Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,444 @@
namespace WinSize2Magick
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
lblX = new Label();
lblY = new Label();
lblXplus = new Label();
lblYplus = new Label();
btnWrite = new Button();
txtPathFileName = new TextBox();
chkKeepOnTop = new CheckBox();
btnQuit = new Button();
btnSmallLarge = new Button();
trackBarOpacity = new TrackBar();
btnHideWindow = new Button();
tabControl1 = new TabControl();
tabPage3 = new TabPage();
webViewWeb = new Microsoft.Web.WebView2.WinForms.WebView2();
tabPage1 = new TabPage();
webView1 = new Microsoft.Web.WebView2.WinForms.WebView2();
tabPage2 = new TabPage();
webView2 = new Microsoft.Web.WebView2.WinForms.WebView2();
tabPage4 = new TabPage();
rtbText = new RichTextBox();
openFileDialog1 = new OpenFileDialog();
btnFile1 = new Button();
btnFile2 = new Button();
groupBox1 = new GroupBox();
btnGo = new Button();
btnDown = new Button();
btnOCR = new Button();
btnScreenshot = new Button();
btnFullView = new Button();
((System.ComponentModel.ISupportInitialize)trackBarOpacity).BeginInit();
tabControl1.SuspendLayout();
tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)webViewWeb).BeginInit();
tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)webView1).BeginInit();
tabPage2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)webView2).BeginInit();
tabPage4.SuspendLayout();
groupBox1.SuspendLayout();
SuspendLayout();
//
// lblX
//
lblX.AutoSize = true;
lblX.Location = new Point(8, 9);
lblX.Name = "lblX";
lblX.Size = new Size(25, 20);
lblX.TabIndex = 0;
lblX.Text = "X: ";
//
// lblY
//
lblY.AutoSize = true;
lblY.Location = new Point(61, 9);
lblY.Name = "lblY";
lblY.Size = new Size(24, 20);
lblY.TabIndex = 1;
lblY.Text = "Y: ";
//
// lblXplus
//
lblXplus.AutoSize = true;
lblXplus.Location = new Point(115, 9);
lblXplus.Name = "lblXplus";
lblXplus.Size = new Size(35, 20);
lblXplus.TabIndex = 2;
lblXplus.Text = "+X: ";
//
// lblYplus
//
lblYplus.AutoSize = true;
lblYplus.Location = new Point(178, 9);
lblYplus.Name = "lblYplus";
lblYplus.Size = new Size(34, 20);
lblYplus.TabIndex = 3;
lblYplus.Text = "+Y: ";
//
// btnWrite
//
btnWrite.Location = new Point(8, 65);
btnWrite.Name = "btnWrite";
btnWrite.Size = new Size(94, 29);
btnWrite.TabIndex = 4;
btnWrite.Text = "Write";
btnWrite.UseVisualStyleBackColor = true;
btnWrite.Click += btnWrite_Click;
//
// txtPathFileName
//
txtPathFileName.Location = new Point(8, 32);
txtPathFileName.Name = "txtPathFileName";
txtPathFileName.Size = new Size(270, 27);
txtPathFileName.TabIndex = 5;
txtPathFileName.Text = "D:\\tmp\\sourcedrive\\cropsize.txt";
//
// chkKeepOnTop
//
chkKeepOnTop.AutoSize = true;
chkKeepOnTop.Location = new Point(161, 70);
chkKeepOnTop.Name = "chkKeepOnTop";
chkKeepOnTop.Size = new Size(117, 24);
chkKeepOnTop.TabIndex = 6;
chkKeepOnTop.Text = "Keep On Top";
chkKeepOnTop.UseVisualStyleBackColor = true;
chkKeepOnTop.CheckedChanged += chkKeepOnTop_CheckedChanged;
//
// btnQuit
//
btnQuit.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
btnQuit.Location = new Point(8, 394);
btnQuit.Name = "btnQuit";
btnQuit.Size = new Size(94, 29);
btnQuit.TabIndex = 7;
btnQuit.Text = "Quit";
btnQuit.UseVisualStyleBackColor = true;
btnQuit.Click += btnQuit_Click;
//
// btnSmallLarge
//
btnSmallLarge.Location = new Point(8, 109);
btnSmallLarge.Name = "btnSmallLarge";
btnSmallLarge.Size = new Size(54, 29);
btnSmallLarge.TabIndex = 8;
btnSmallLarge.Text = "<->";
btnSmallLarge.UseVisualStyleBackColor = true;
btnSmallLarge.Click += btnSmallLarge_Click;
//
// trackBarOpacity
//
trackBarOpacity.LargeChange = 1;
trackBarOpacity.Location = new Point(8, 144);
trackBarOpacity.Name = "trackBarOpacity";
trackBarOpacity.Size = new Size(266, 56);
trackBarOpacity.TabIndex = 9;
trackBarOpacity.Value = 8;
trackBarOpacity.ValueChanged += trackBarOpacity_ValueChanged;
//
// btnHideWindow
//
btnHideWindow.Location = new Point(68, 109);
btnHideWindow.Name = "btnHideWindow";
btnHideWindow.Size = new Size(94, 29);
btnHideWindow.TabIndex = 10;
btnHideWindow.Text = "minimize";
btnHideWindow.UseVisualStyleBackColor = true;
btnHideWindow.Click += btnHideWindow_Click;
//
// tabControl1
//
tabControl1.Controls.Add(tabPage3);
tabControl1.Controls.Add(tabPage1);
tabControl1.Controls.Add(tabPage2);
tabControl1.Controls.Add(tabPage4);
tabControl1.Location = new Point(294, -4);
tabControl1.Name = "tabControl1";
tabControl1.SelectedIndex = 0;
tabControl1.Size = new Size(406, 392);
tabControl1.TabIndex = 11;
tabControl1.DoubleClick += tabControl1_DoubleClick;
//
// tabPage3
//
tabPage3.Controls.Add(webViewWeb);
tabPage3.Location = new Point(4, 29);
tabPage3.Name = "tabPage3";
tabPage3.Size = new Size(398, 359);
tabPage3.TabIndex = 2;
tabPage3.Text = "General";
tabPage3.UseVisualStyleBackColor = true;
//
// webViewWeb
//
webViewWeb.AllowExternalDrop = true;
webViewWeb.CreationProperties = null;
webViewWeb.DefaultBackgroundColor = Color.White;
webViewWeb.Dock = DockStyle.Fill;
webViewWeb.Location = new Point(0, 0);
webViewWeb.Name = "webViewWeb";
webViewWeb.Size = new Size(398, 359);
webViewWeb.TabIndex = 1;
webViewWeb.ZoomFactor = 1D;
//
// tabPage1
//
tabPage1.Controls.Add(webView1);
tabPage1.Location = new Point(4, 29);
tabPage1.Name = "tabPage1";
tabPage1.Padding = new Padding(3);
tabPage1.Size = new Size(398, 359);
tabPage1.TabIndex = 0;
tabPage1.Text = "File1";
tabPage1.UseVisualStyleBackColor = true;
//
// webView1
//
webView1.AllowExternalDrop = true;
webView1.CreationProperties = null;
webView1.DefaultBackgroundColor = Color.White;
webView1.Dock = DockStyle.Fill;
webView1.Location = new Point(3, 3);
webView1.Name = "webView1";
webView1.Size = new Size(392, 353);
webView1.TabIndex = 0;
webView1.ZoomFactor = 1D;
//
// tabPage2
//
tabPage2.Controls.Add(webView2);
tabPage2.Location = new Point(4, 29);
tabPage2.Name = "tabPage2";
tabPage2.Padding = new Padding(3);
tabPage2.Size = new Size(398, 359);
tabPage2.TabIndex = 1;
tabPage2.Text = "File2";
tabPage2.UseVisualStyleBackColor = true;
//
// webView2
//
webView2.AllowExternalDrop = true;
webView2.CreationProperties = null;
webView2.DefaultBackgroundColor = Color.White;
webView2.Dock = DockStyle.Fill;
webView2.Location = new Point(3, 3);
webView2.Name = "webView2";
webView2.Size = new Size(392, 353);
webView2.TabIndex = 1;
webView2.ZoomFactor = 1D;
webView2.DoubleClick += webView2_DoubleClick;
//
// tabPage4
//
tabPage4.Controls.Add(rtbText);
tabPage4.Location = new Point(4, 29);
tabPage4.Name = "tabPage4";
tabPage4.Size = new Size(398, 359);
tabPage4.TabIndex = 3;
tabPage4.Text = "OCR";
tabPage4.UseVisualStyleBackColor = true;
//
// rtbText
//
rtbText.Dock = DockStyle.Fill;
rtbText.Location = new Point(0, 0);
rtbText.Name = "rtbText";
rtbText.Size = new Size(398, 359);
rtbText.TabIndex = 0;
rtbText.Text = "";
//
// openFileDialog1
//
openFileDialog1.FileName = "openFileDialog1";
//
// btnFile1
//
btnFile1.Location = new Point(103, 26);
btnFile1.Name = "btnFile1";
btnFile1.Size = new Size(67, 29);
btnFile1.TabIndex = 12;
btnFile1.Text = "File1";
btnFile1.UseVisualStyleBackColor = true;
btnFile1.Click += btnFile1_Click;
//
// btnFile2
//
btnFile2.Location = new Point(170, 26);
btnFile2.Name = "btnFile2";
btnFile2.Size = new Size(67, 29);
btnFile2.TabIndex = 13;
btnFile2.Text = "File2";
btnFile2.UseVisualStyleBackColor = true;
btnFile2.Click += btnFile1_Click;
//
// groupBox1
//
groupBox1.Controls.Add(btnGo);
groupBox1.Controls.Add(btnFile1);
groupBox1.Controls.Add(btnFile2);
groupBox1.Location = new Point(12, 207);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(250, 76);
groupBox1.TabIndex = 14;
groupBox1.TabStop = false;
groupBox1.Text = "Select";
//
// btnGo
//
btnGo.Location = new Point(6, 26);
btnGo.Name = "btnGo";
btnGo.Size = new Size(67, 29);
btnGo.TabIndex = 14;
btnGo.Text = "Go";
btnGo.UseVisualStyleBackColor = true;
btnGo.Click += btnGo_Click;
//
// btnDown
//
btnDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
btnDown.Location = new Point(633, 394);
btnDown.Name = "btnDown";
btnDown.Size = new Size(67, 29);
btnDown.TabIndex = 17;
btnDown.Text = "Down";
btnDown.UseVisualStyleBackColor = true;
btnDown.Click += btnDown_Click;
//
// btnOCR
//
btnOCR.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
btnOCR.Location = new Point(560, 394);
btnOCR.Name = "btnOCR";
btnOCR.Size = new Size(67, 29);
btnOCR.TabIndex = 16;
btnOCR.Text = "OCR";
btnOCR.UseVisualStyleBackColor = true;
btnOCR.Click += btnOCR_Click;
//
// btnScreenshot
//
btnScreenshot.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
btnScreenshot.Location = new Point(487, 394);
btnScreenshot.Name = "btnScreenshot";
btnScreenshot.Size = new Size(67, 29);
btnScreenshot.TabIndex = 15;
btnScreenshot.Text = "Shoot";
btnScreenshot.UseVisualStyleBackColor = true;
btnScreenshot.Click += btnScreenshot_Click;
//
// btnFullView
//
btnFullView.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
btnFullView.Location = new Point(108, 394);
btnFullView.Name = "btnFullView";
btnFullView.Size = new Size(94, 29);
btnFullView.TabIndex = 18;
btnFullView.Text = "Full View";
btnFullView.UseVisualStyleBackColor = true;
btnFullView.Click += btnFullView_Click;
//
// Form1
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(704, 430);
ControlBox = false;
Controls.Add(tabControl1);
Controls.Add(btnFullView);
Controls.Add(btnScreenshot);
Controls.Add(btnOCR);
Controls.Add(btnDown);
Controls.Add(groupBox1);
Controls.Add(btnHideWindow);
Controls.Add(trackBarOpacity);
Controls.Add(btnSmallLarge);
Controls.Add(btnQuit);
Controls.Add(chkKeepOnTop);
Controls.Add(txtPathFileName);
Controls.Add(btnWrite);
Controls.Add(lblYplus);
Controls.Add(lblXplus);
Controls.Add(lblY);
Controls.Add(lblX);
FormBorderStyle = FormBorderStyle.SizableToolWindow;
Name = "Form1";
Text = "WinSize2Magick";
Load += Form1_Load;
SizeChanged += Form1_SizeChanged;
Move += Form1_Move;
((System.ComponentModel.ISupportInitialize)trackBarOpacity).EndInit();
tabControl1.ResumeLayout(false);
tabPage3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)webViewWeb).EndInit();
tabPage1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)webView1).EndInit();
tabPage2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)webView2).EndInit();
tabPage4.ResumeLayout(false);
groupBox1.ResumeLayout(false);
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label lblX;
private Label lblY;
private Label lblXplus;
private Label lblYplus;
private Button btnWrite;
private TextBox txtPathFileName;
private CheckBox chkKeepOnTop;
private Button btnQuit;
private Button btnSmallLarge;
private TrackBar trackBarOpacity;
private Button btnHideWindow;
private TabControl tabControl1;
private TabPage tabPage1;
private TabPage tabPage2;
private Microsoft.Web.WebView2.WinForms.WebView2 webView1;
private TabPage tabPage3;
private Microsoft.Web.WebView2.WinForms.WebView2 webView2;
private OpenFileDialog openFileDialog1;
private Button btnFile1;
private Button btnFile2;
private Microsoft.Web.WebView2.WinForms.WebView2 webViewWeb;
private GroupBox groupBox1;
private Button btnGo;
private Button btnScreenshot;
private Button btnOCR;
private TabPage tabPage4;
private RichTextBox rtbText;
private Button btnDown;
private Button btnFullView;
}
}

285
Form1.cs Normal file
View File

@ -0,0 +1,285 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Tesseract;
///////////////////////////////////////
//
// (c) TK 2024
//
///////////////////////////////////////
namespace WinSize2Magick
{
public partial class Form1 : Form
{
//WebBrowser web1 = new WebBrowser();
int iWidthMax;
int iHeightMax;
//tab control
int iTCLeft;
int iTCRight;
string strCmdText = "D:\\tmp\\sourcedrive\\domystuff.cmd";
string strCMDresamble = @"magick -units PixelsPerInch x.png -resample 300 xx.png";
public Form1()
{
InitializeComponent();
//this.BackColor = Color.LimeGreen;
//this.TransparencyKey = Color.LimeGreen;
this.Opacity = .80;
this.AllowTransparency = true;
webView1.EnsureCoreWebView2Async();
webView2.EnsureCoreWebView2Async();
webViewWeb.EnsureCoreWebView2Async();
}
private void Form1_Load(object sender, EventArgs e)
{
//this.tabPage1.Controls.Add(web1);
//string strhtml = WebUtility.HtmlEncode(@"file:///C:\Users\kagert\Desktop\BWL\03 Buchhaltung und Bilanzierung\Pruefung\Bilanzierung OF.pdf");
//web1.Navigate(strhtml);
}
private void Form1_SizeChanged(object sender, EventArgs e)
{
lblXplus.Text = this.Left.ToString();
lblYplus.Text = this.Top.ToString();
lblX.Text = this.Width.ToString();
lblY.Text = this.Height.ToString();
tabControl1.Width = this.Width - tabControl1.Left - 10;
tabControl1.Height = this.Height - 90;
}
private void Form1_Move(object sender, EventArgs e)
{
Form1_SizeChanged(sender, e);
}
private void btnWrite_Click(object sender, EventArgs e)
{
string text = lblX.Text + "x" + lblY.Text + "+" + lblXplus.Text + "+" + lblYplus.Text;
string docPath = txtPathFileName.Text;
File.WriteAllText(docPath, text);
//string[] lines = { "New line 1", "New line 2" };
// Append new lines
//File.AppendAllLines(Path.Combine(docPath, "WriteFile.txt"), lines);
}
private void chkKeepOnTop_CheckedChanged(object sender, EventArgs e)
{
if (chkKeepOnTop.Checked)
{ this.TopMost = true; }
else
{ this.TopMost = false; }
}
private void btnQuit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void btnSmallLarge_Click(object sender, EventArgs e)
{
//webView1.CoreWebView2.Navigate("file:///C:/Users/kagert/Desktop/BWL/03 Buchhaltung und Bilanzierung/Pruefung/Bilanzierung OF.pdf");
if (this.Width > 170)
{
iWidthMax = this.Width;
this.Width = 86;
}
else
this.Width = iWidthMax;
}
private void trackBarOpacity_ValueChanged(object sender, EventArgs e)
{
if (trackBarOpacity.Value > 2)
this.Opacity = (float)trackBarOpacity.Value / 10;
}
private void btnHideWindow_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void webView2_DoubleClick(object sender, EventArgs e)
{
//webView1.CoreWebView2.Navigate("file:///C:/Users/kagert/Desktop/BWL/03 Buchhaltung und Bilanzierung/Pruefung/Bilanzierung OF.pdf");
}
private async void btnFile1_Click(object sender, EventArgs e)
{
Button dummyButton = (Button)sender;
openFileDialog1.ShowDialog(this);
string strFileName = openFileDialog1.FileName;
if (dummyButton.Name.ToString() == "btnFile1")
webView1.CoreWebView2.Navigate(strFileName);
if (dummyButton.Name.ToString() == "btnFile2")
webView2.CoreWebView2.Navigate(strFileName);
}
private async void btnGo_Click(object sender, EventArgs e)
{
webViewWeb.CoreWebView2.Navigate("http://chatgpt.com");
}
private async void btnScreenshot_Click(object sender, EventArgs e)
{
btnScreenshot.BackColor = Color.Green;
string strArg;
strCmdText = "D:\\tmp\\sourcedrive\\domystuff.cmd";
//startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
Process myprocess = new Process();
myprocess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
myprocess.StartInfo.CreateNoWindow = true;
myprocess.StartInfo.FileName = strCmdText;// "cmd.exe ";
//myprocess.StartInfo.Arguments = strCmdText;
myprocess.Start();
btnScreenshot.BackColor = btnOCR.BackColor;
btnOCR_Click(sender, e);
//System.Diagnostics.Process.Start("CMD.exe", strCmdText);
}
private async void btnOCR_Click(object sender, EventArgs e)
{
btnOCR.BackColor = Color.Green;
rtbText.Clear();
string strResult = "null";
var engine = new TesseractEngine(@"D:\\Development\\tessdata", "deu", EngineMode.LstmOnly);
var image = Pix.LoadFromFile(@"D:\\tmp\\sourcedrive\\x2.png");
var page = engine.Process(image);
string text = page.GetText();
rtbText.Text = text;
//ProseMirror
//var elem = webViewWeb.ExecuteScriptAsync($"document.getElementById('prompt-textarea').innerText = '{text.ToString()}';");
var msg = @"Gib am Ende eine Zusammenfassung mit RICHTIG oder falsch aus.\n\n";
msg += text.Replace("\n", "\\n");
//msg = @"huhuhu\n\nzuzuzuz";
var elem = await webViewWeb.ExecuteScriptAsync($"document.getElementById('prompt-textarea').innerText ='{msg}';");
Debug.Print("...start send");
//Thread.Sleep(1000);
elem = await webViewWeb.ExecuteScriptAsync($"document.querySelector('button[aria-label=\"Send prompt\"]').click();");
Debug.Print("...finished send");
Thread.Sleep(500);
//button class="cursor-pointer absolute z-10 rounded-full
//react-scroll-to-bottom--css-hssfi-1tj0vk3 hidden
//cursor-pointer absolute z-10 rounded-full bg-clip-padding border text-token-text-secondary border-token-border-light right-1/2 translate-x-1/2 bg-token-main-surface-primary w-8 h-8 flex items-center justify-center bottom-5
//'button[class=\"react-scroll-to-bottom--css-yryca-1tj0vk3 hidden\"]'
//Thread.Sleep(5000);
do
{
//strResult = await webViewWeb.ExecuteScriptAsync($"document.querySelector('button[class*=\"react-scroll-to-bottom--css\"]').getAttribute(\"type\") ");
strResult = await webViewWeb.ExecuteScriptAsync($"document.querySelector('button[data-testid=\"send-button\"]').getAttribute(\"aria-label\") ");
Debug.Print("..waitin..." + strResult);
Thread.Sleep(100);
} while (!strResult.Contains("Send prompt"));//Stop streaming
Thread.Sleep(1500);
Debug.Print("...press down");
var meee = webViewWeb.ExecuteScriptAsync($"document.querySelector('button[class*=\"react-scroll-to-bottom--css\"]').click()");
Debug.Print("...after press down" + meee);
//elem = await webViewWeb.ExecuteScriptAsync($"document.getElementsByName('button')[2].click();");
engine.Dispose();
image.Dispose();
btnOCR.BackColor = btnScreenshot.BackColor;
}
private async void btnDown_Click(object sender, EventArgs e)
{
//document.querySelector('button[data-testid="send-button"]').getAttribute('aria-label'); //Send-Button label
//string isscrolling = await webViewWeb.ExecuteScriptAsync($"document.querySelector('button[data-testid=\"send-button\"]').getAttribute(\"aria-label\") ");
//Debug.Print(isscrolling);
//MessageBox.Show(isscrolling);
//if (isscrolling.)
//isscrolling = webViewWeb.ExecuteScriptAsync($"document.querySelector('button[aria-label=\"Stop streaming\"]') ");
var elem = await webViewWeb.ExecuteScriptAsync($"document.querySelector('button[class*=\"react-scroll-to-bottom--css\"]').getAttribute(\"type\") ");
Debug.Print(elem);
elem = await webViewWeb.ExecuteScriptAsync($"document.querySelector('button[class*=\"react-scroll-to-bottom--css\"]').click();");
Debug.Print(elem);
}
private void tabControl1_DoubleClick(object sender, EventArgs e)
{
if (tabControl1.Left > 16)
{
iTCLeft = tabControl1.Left;
tabControl1.Left = 16;
}
else
tabControl1.Left = iTCLeft;
Form1_SizeChanged(sender, e);
}
private void btnFullView_Click(object sender, EventArgs e)
{
tabControl1_DoubleClick( sender,e );
}
}
}

123
Form1.resx Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

17
Program.cs Normal file
View File

@ -0,0 +1,17 @@
namespace WinSize2Magick
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}

16
WinSize2Magick.csproj Normal file
View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2792.45" />
<PackageReference Include="Tesseract" Version="5.2.0" />
</ItemGroup>
</Project>

25
WinSize2Magick.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34616.47
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinSize2Magick", "WinSize2Magick.csproj", "{F4E8E278-C433-4DE6-9CFD-53F52933B3B0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F4E8E278-C433-4DE6-9CFD-53F52933B3B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4E8E278-C433-4DE6-9CFD-53F52933B3B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4E8E278-C433-4DE6-9CFD-53F52933B3B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4E8E278-C433-4DE6-9CFD-53F52933B3B0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6A03569C-24D5-43AF-9865-2DF1C99F67BF}
EndGlobalSection
EndGlobal