This commit is contained in:
CreepyCrafter24 2019-12-01 19:41:55 +01:00
parent 705d6be07f
commit 04f7a91416
8 changed files with 309 additions and 16 deletions

212
.gitignore vendored
View File

@ -1,3 +1,8 @@
# Created by https://www.gitignore.io/api/csharp,windows,visualstudio
# Edit at https://www.gitignore.io/?templates=csharp,windows,visualstudio
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
@ -13,6 +18,9 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
@ -39,9 +47,10 @@ Generated\ Files/
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
@ -182,6 +191,8 @@ 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.
@ -206,6 +217,8 @@ BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
@ -255,7 +268,9 @@ ServiceFabricBackup/
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
@ -291,10 +306,6 @@ paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush personal settings
.cr/personal
@ -337,4 +348,191 @@ ASALocalRun/
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
### VisualStudio ###
# User-specific files
# User-specific files (MonoDevelop/Xamarin Studio)
# Mono auto generated files
# Build results
# Visual Studio 2015/2017 cache/options directory
# Uncomment if you have tasks that create the project's static files in wwwroot
# Visual Studio 2017 auto generated files
# MSTest test Results
# NUnit
# Build Results of an ATL Project
# Benchmark Results
# .NET Core
# StyleCop
# Files built by Visual Studio
# Chutzpah Test files
# Visual C++ cache files
# Visual Studio profiler
# Visual Studio Trace Files
# TFS 2012 Local Workspace
# Guidance Automation Toolkit
# ReSharper is a .NET coding add-in
# JustCode is a .NET coding add-in
# TeamCity is a build add-in
# DotCover is a Code Coverage Tool
# AxoCover is a Code Coverage Tool
# Visual Studio code coverage results
# NCrunch
# MightyMoose
# Web workbench (sass)
# Installshield output folder
# DocProject is a documentation generator add-in
# Click-Once directory
# Publish Web Output
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
# 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
# NuGet Packages
# NuGet Symbol Packages
# The packages folder can be ignored because of Package Restore
# except build/, which is used as an MSBuild target.
# Uncomment if necessary however generally it will be regenerated when needed
# NuGet v3's project.json files produces more ignorable files
# Microsoft Azure Build Output
# Microsoft Azure Emulator
# Windows Store app package directories and files
# Visual Studio cache files
# files ending in .cache can be ignored
# but keep track of directories ending in .cache
# Others
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
# RIA/Silverlight projects
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
# SQL Server files
# Business Intelligence projects
# Microsoft Fakes
# GhostDoc plugin setting file
# Node.js Tools for Visual Studio
# Visual Studio 6 build log
# Visual Studio 6 workspace options file
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
# Visual Studio LightSwitch build output
# Paket dependency manager
# FAKE - F# Make
# CodeRush personal settings
# Python Tools for Visual Studio (PTVS)
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
# Telerik's JustMock configuration file
# BizTalk build output
# OpenCover UI analysis results
# Azure Stream Analytics local run output
# MSBuild Binary and Structured Log
# NVidia Nsight GPU debugger configuration file
# MFractors (Xamarin productivity tool) working folder
# Local History for Visual Studio
# BeatPulse healthcheck temp database
# Backup folder for Package Reference Convert tool in Visual Studio 2017
# End of https://www.gitignore.io/api/csharp,windows,visualstudio

View File

@ -5,6 +5,14 @@ VisualStudioVersion = 16.0.29519.87
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GradeCalc", "GradeCalc\GradeCalc.csproj", "{D5948BBB-1F03-497A-A2BA-DD1E6F54A2A8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D467D391-1707-4626-A85A-A4D195DF72AA}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
PostBuild.cs = PostBuild.cs
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU

View File

@ -29,13 +29,16 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Antlr4.Runtime, Version=4.6.0.0, Culture=neutral, PublicKeyToken=09abb75b9ed49849, processorArchitecture=MSIL">
<HintPath>..\packages\Antlr4.Runtime.4.6.4\lib\net45\Antlr4.Runtime.dll</HintPath>
@ -83,6 +86,7 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.manifest" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -106,4 +110,12 @@
<Error Condition="!Exists('..\packages\Antlr4.CodeGenerator.4.6.4\build\Antlr4.CodeGenerator.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.CodeGenerator.4.6.4\build\Antlr4.CodeGenerator.targets'))" />
</Target>
<Import Project="..\packages\Antlr4.CodeGenerator.4.6.4\build\Antlr4.CodeGenerator.targets" Condition="Exists('..\packages\Antlr4.CodeGenerator.4.6.4\build\Antlr4.CodeGenerator.targets')" />
<PropertyGroup>
<PostBuildEvent>cd "$(SolutionDir)"
if $(ConfigurationName)==Release (
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe PostBuild.cs /r:System.IO.Compression.FileSystem.dll
PostBuild "$(TargetDir)\" "$(TargetFileName)"
del PostBuild.exe
)</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@ -79,12 +79,12 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.algorithmBox.FormattingEnabled = true;
this.algorithmBox.Items.AddRange(new object[] {
"totalScore / maxScore"});
"score / maxScore"});
this.algorithmBox.Location = new System.Drawing.Point(357, 8);
this.algorithmBox.Name = "algorithmBox";
this.algorithmBox.Size = new System.Drawing.Size(180, 21);
this.algorithmBox.TabIndex = 3;
this.algorithmBox.Text = "totalScore / maxScore";
this.algorithmBox.Text = "score / maxScore";
//
// tasksNum
//

View File

@ -43,12 +43,19 @@ namespace GradeCalc
totalScore += decimal.Parse((string)cell.FormattedValue);
}
});
Expression ex = new Expression(algorithmBox.Text);
ex.Parameters["score"] = (double)totalScore;
ex.Parameters["maxScore"] = (double)maxScore;
//double gradeVal = (double)totalScore / (double)maxScore;
double grade = 6 - (NCalcDoubleParser.Parse(ex.Evaluate()) * 5);
((DataGridViewTextBoxCell)row.Cells[gradeColumn.Name]).Value = (grade.ToString().Length > 13 ? grade.ToString().Remove(13) : grade.ToString()) + " " + texGrade(grade);
try
{
Expression ex = new Expression(algorithmBox.Text);
ex.Parameters["score"] = (double)totalScore;
ex.Parameters["maxScore"] = (double)maxScore;
//double gradeVal = (double)totalScore / (double)maxScore;
double grade = 6 - (NCalcDoubleParser.Parse(ex.Evaluate()) * 5);
((DataGridViewTextBoxCell)row.Cells[gradeColumn.Name]).Value = (grade.ToString().Length > 13 ? grade.ToString().Remove(13) : grade.ToString()) + " " + texGrade(grade);
}
catch (Exception e1)
{
((DataGridViewTextBoxCell)row.Cells[gradeColumn.Name]).Value = e1.Message;
}
}
dataGridView.Sort(nameColumn, ListSortDirection.Ascending);
}

28
GradeCalc/app.manifest Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

38
PostBuild.cs Normal file
View File

@ -0,0 +1,38 @@
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
public class Program
{
public static void Main(string[] args)
{
//Variables
string TargetDir = args[0].Trim('"').TrimEnd('\\');
string TargetFileName = args[1].Trim('"');
//Copy Data dir
if (File.Exists(TargetDir + ".zip"))
File.Delete(TargetDir + ".zip");
if (File.Exists(TargetDir + @"\package.zip"))
File.Delete(TargetDir + @"\package.zip");
if (Directory.Exists(TargetDir + @"\package"))
Directory.Delete(TargetDir + @"\package", true);
ZipFile.CreateFromDirectory(TargetDir, TargetDir + ".zip");
Directory.CreateDirectory(TargetDir + @"\package\Data");
ZipFile.ExtractToDirectory(TargetDir + ".zip", TargetDir + @"\package\Data");
File.Delete(TargetDir + ".zip");
//Remove useless Files
Directory.GetFiles(TargetDir + @"\package\Data")
.Where(s => new string[] { ".xml", ".pdb" }.Contains(Path.GetExtension(s)))
.ToList().ForEach(s => File.Delete(s));
//Add package scripts
string programName = Path.GetFileNameWithoutExtension(TargetFileName);
File.WriteAllText(TargetDir + @"\package\Install.bat",
"@echo off\r\necho INSTALL\r\npowershell \"$s=(New-Object -COM WScript.Shell).CreateShortcut('%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\" + programName + ".lnk');$s.TargetPath='%cd%\\" + programName + ".exe';$s.Save()\"\r\ntimeout /t 1");
File.WriteAllText(TargetDir + @"\package\Remove.bat",
"@echo off\r\necho REMOVE\r\ndel \"%appdata%\\Microsoft\\Windows\\Start Menu\\Programs\\" + programName + ".lnk\"\r\ntaskkill /f /im \"" + programName + ".exe\"\r\ntimeout /t 1");
//Package up result
ZipFile.CreateFromDirectory(TargetDir + @"\package", TargetDir + @"\package.zip");
Directory.Delete(TargetDir + @"\package", true);
}
}

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# UpTool2-Forms-Template
Windows Forms template with extras