From ab8d86940049e9cd193e94a60817d8ac9147bfe8 Mon Sep 17 00:00:00 2001 From: Snick0rz Date: Thu, 18 Nov 2021 10:26:16 +0100 Subject: [PATCH] RC3 Fixes --- EZAction/EZ-Action-Icon-v1.ico | Bin 0 -> 7020 bytes EZAction/EZAction.csproj | 10 +- EZAction/MainWindow.xaml | 29 ++-- EZAction/MainWindow.xaml.cs | 216 ++++++++++++++++++++++++---- EZAction/Properties/AssemblyInfo.cs | 13 +- EZAction/aceEvent.cs | 141 +++++++++--------- 6 files changed, 301 insertions(+), 108 deletions(-) create mode 100644 EZAction/EZ-Action-Icon-v1.ico diff --git a/EZAction/EZ-Action-Icon-v1.ico b/EZAction/EZ-Action-Icon-v1.ico new file mode 100644 index 0000000000000000000000000000000000000000..5560a7472f43458592a2c2c1a9d2eea7716aa082 GIT binary patch literal 7020 zcmdT|=T}qBw>~i#1VT|-LXi#%f=KVZSLuQvMOtVQr~$$ z_6IxbHHHMMht1b%=v9U}E6t|`zw@8G>i^F5XYY>MYi%VFmvG;_)8iEi1 ztFbP*=`biwCe}n;ch{fH5&^>V=|&U`Sq!J{fMF_G$|sTgAFrb{EOdexuSTRXaLlX$ zM9`Smotj9oWT*jiVE}3Fy`)TdNR^_+9}QBVf&vggQ4oLuL@j^~Kt%*b|F`f)_?4su zV7(De5E6!13E(IaRKi&a^9fov!b?Yi=vILB&gY=_86Y=p3%eb%vBX)U@i-DKEM4L( z4{D)!G~v^aDf)pf;2FtdNVB6*^sv6Ik=mVazjkHAeXzzNWBZ?X507PZX(woEu=~_* zVv_94#Aup<*FLc|0ak7&_qpC^xEO6HCJCaS-(g{G-{;bO_GPZ0G3@ruBU>8)`2NDF zH}~0>UGap&`%7V0f~TBoCNKCd@8OCKSx6y(!m~p*2d2uip;Uj~^l%Vhldha1zO>@9 z6#6Kz6MYv30Ef=HCsAHUzsr%D{z*Zmy9t5-AQrjOr_WR2S+lz*b4iY=OqII>1<*>9 z$pY*Zel@$HnqO0f2RqtY0ibIr(?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Esc7+)h~z?HhHX)OQO$LMv+lZ${_iq*=sTm!J&yYNGfVsjiP?B znSFsOzeQD4Li|H{-DZJ*>l< zcckvqOE+UZ!artjf=S~Rt@d;1(4jX!-XgS<_6{7-c&T4o@_wdXA$Om}XG*?a2_ln>d#vr(?yikypzedsS zzQZOP|A0x@**@0QV0w4j4bohYk%9B*fapC;IV2z)}$EXzlBg}CUG*I^#Yv&%c4+da41b$=Si zNVjX%&>2${>q=DLikJ-Z%HLSR`39Nj_`WrcR*TsU*2A6OBT>aOG|v7a-FmHS|H=Q2 zB3nN;8w>rGwC=j%6nEp8LbgKst0SN~0)^O|ZCS#Ps3cZ&v8H@6WaE}flBeCKhNu9M ztoNknZ=ya~)UhXTz+Qe{@ng#qW*Z9rG*Djgvvxm)xlm#zxaXe2ixc$VXbc1YG&M1) zY|8eYlUNSU?W5FnB^_?+;zzc7gC}z$tP{LNiZl+}Eg^`63n{`+qyNv1HT;tJM!fpD TK_vS6)jBj)^;9aAY{LHw;4 true true + false publish\ true Disk @@ -25,8 +26,7 @@ false true 0 - 1.0.0.%2a - false + 0.3.0.%2a false true @@ -49,6 +49,9 @@ prompt 4 + + EZ-Action-Icon-v1.ico + @@ -133,5 +136,8 @@ false + + + \ No newline at end of file diff --git a/EZAction/MainWindow.xaml b/EZAction/MainWindow.xaml index 357281b..c5646eb 100644 --- a/EZAction/MainWindow.xaml +++ b/EZAction/MainWindow.xaml @@ -16,7 +16,7 @@ - + + - + diff --git a/EZAction/MainWindow.xaml.cs b/EZAction/MainWindow.xaml.cs index ea65611..1694dbc 100644 --- a/EZAction/MainWindow.xaml.cs +++ b/EZAction/MainWindow.xaml.cs @@ -12,11 +12,14 @@ using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +//using System.Windows.Threading; using System.Text.Json; using System.Text.Json.Serialization; +//using System.Timers; using Microsoft.Win32; namespace TestAppWPF @@ -36,12 +39,48 @@ public partial class MainWindow : Window string windowTitle_Base = "Easy Action for ArmA 3"; string openedFile = ""; + + // Animation objects + DoubleAnimation fadeOutAnim = new DoubleAnimation(); + Storyboard animPlay; + + /*---------------------------------*/ + /* Constants for the utility label */ + /*---------------------------------*/ + const string labelEmpty = ""; + const string editingMode = "Editing mode active"; + + const string actionCreated = "Action created"; + const string actionEdited = "Action edited"; + const string actionDeleted = "Action deleted"; + + const string validationError = "Action incomplete"; + const string noActionExists = "No actions exist"; + const string noActionSelected = "No action was selected"; + + const string copiedToClipboard = "Copied to clipboard"; + const string actionsWritten = "Actions written to file"; + const string writeAborted = "Action write aborted"; + const string noActionsToWrite = "No actions to write"; + const string errorWrite = "Error during writing"; + + + /*---------------------------------*/ + /* Constants for the save button */ + /*---------------------------------*/ + const string defaultSave = "Save Action"; + const string createAction = "Create Action"; + const string editAction = "Edit Action"; + + + public MainWindow() { //Set up basic settings if (Properties.Settings.Default.defaultSavePath == "") { - Properties.Settings.Default.defaultSavePath = String.Concat(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "\\EZ-Action"); + //MessageBox.Show("Welcome to EZ-Action!" + "\n" + "Please select a working directory. All files generated by this program will be saved there." + "\n" + "You will be able to change this selection later."); + Properties.Settings.Default.defaultSavePath = String.Concat(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)); Properties.Settings.Default.Save(); } if (Properties.Settings.Default.profileDir == "") { @@ -50,25 +89,44 @@ public MainWindow() } InitializeComponent(); + + // Always stays the same, so set as early as possible + fadeOutAnim.From = 1.0; + fadeOutAnim.To = 0.0; + fadeOutAnim.FillBehavior = FillBehavior.Stop; + + Utility_Label.Text = labelEmpty; } private void DelEvent_Button_Click(object sender, RoutedEventArgs e) { object selectedItem = eventList.SelectedItem; + if (eventList.Items.Count == 0) + { + SetUtilityLabel(noActionExists, true); + return; + } if (selectedItem != null) { aceEvent.eventList.RemoveAt(eventList.Items.IndexOf(selectedItem)); eventList.Items.Remove(selectedItem); + + SetUtilityLabel(actionDeleted, true); + } + else + { + SetUtilityLabel(noActionSelected, true); } } private void RegEvent_Button_Click(object sender, RoutedEventArgs e) { // Action Validation - if (validateAction()) + if (ValidateAction()) { + SetUtilityLabel(validationError); return; } @@ -87,6 +145,8 @@ private void RegEvent_Button_Click(object sender, RoutedEventArgs e) targetText.Text = targetCache; targetCache = ""; + SetUtilityLabel(actionEdited, true); + DeactiveEditingMode(); } // When adding, can just straight add and create object @@ -95,13 +155,16 @@ private void RegEvent_Button_Click(object sender, RoutedEventArgs e) aceEvent newEvent = new aceEvent(id, functionText.Text, actionText.Text, progressCheck.IsChecked, intDuration, targetText.Text, classCheck.IsChecked, eventLabelText.Text); aceEvent.eventList.Add(newEvent); + + SetUtilityLabel(actionCreated, true); } + + // Reset all the UI element functionText.Text = ""; classCheck.IsChecked = false; actionText.Text = ""; - //conditionText.Text = ""; eventLabelText.Text = ""; progressCheck.IsChecked = true; @@ -111,15 +174,15 @@ private void RegEvent_Button_Click(object sender, RoutedEventArgs e) private void EventList_MouseDoubleClick(object sender, RoutedEventArgs e) { - ActivateEditingMode(); try { - Editing_Label.Visibility = Visibility.Visible; object selectedItem = eventList.SelectedItem; int index = eventList.Items.IndexOf(selectedItem); aceEvent editAction = aceEvent.eventList[index]; + ActivateEditingMode(); + //Disable the event list so only one thing can be edited at the same time eventList.IsEnabled = false; @@ -139,7 +202,7 @@ private void EventList_MouseDoubleClick(object sender, RoutedEventArgs e) // Catch OutOfRangeExceptions when the user clicks a non-existing item catch (System.ArgumentOutOfRangeException exception) { editing = false; - Editing_Label.Visibility = Visibility.Hidden; + DeactiveEditingMode(); return; } } @@ -147,9 +210,15 @@ private void EventList_MouseDoubleClick(object sender, RoutedEventArgs e) private void ActivateEditingMode() { editing = true; - Editing_Label.Visibility = Visibility.Visible; + //Editing_Label.Visibility = Visibility.Visible; + //Utility_Label.Text = editingMode; + + SetUtilityLabel(editingMode); + + RegEvent_Button.Content = editAction; eventList.IsEnabled = false; + DelEvent_Button.IsEnabled = false; Generate_Button.IsEnabled = false; Clipboard_Button.IsEnabled = false; } @@ -157,14 +226,20 @@ private void ActivateEditingMode() private void DeactiveEditingMode() { editing = false; - Editing_Label.Visibility = Visibility.Hidden; + //Editing_Label.Visibility = Visibility.Hidden; + //Utility_Label.Text = labelEmpty; + + //SetUtilityLabel(labelEmpty); + + RegEvent_Button.Content = createAction; eventList.IsEnabled = true; + DelEvent_Button.IsEnabled = true; Generate_Button.IsEnabled = true; Clipboard_Button.IsEnabled = true; } - private bool validateAction() + private bool ValidateAction() { bool validationFail = false; @@ -188,27 +263,32 @@ private bool validateAction() functionText.Background = Brushes.Transparent; } - if (actionText.Text == "") + if (eventLabelText.Text == "") { validationFail = true; - actionText.Background = Brushes.Salmon; + eventLabelText.Background = Brushes.Salmon; } else { - actionText.Background = Brushes.Transparent; + eventLabelText.Background = Brushes.Transparent; } - if (eventLabelText.Text == "") + + // + // Progress dependant + // + + if (progressCheck.IsChecked == true && actionText.Text == "") { validationFail = true; - eventLabelText.Background = Brushes.Salmon; + actionText.Background = Brushes.Salmon; } else { - eventLabelText.Background = Brushes.Transparent; + actionText.Background = Brushes.Transparent; } - if (durationText.Text == "") + if (progressCheck.IsChecked == true && durationText.Text == "") { validationFail = true; durationText.Background = Brushes.Salmon; @@ -231,7 +311,28 @@ private void Generate_Button_Click(object sender, RoutedEventArgs e) //int varBuild = variableContent.BuildSQF(); int evtBuild = aceEvent.BuildSQF(); - new errorPrint(evtBuild); + //new errorPrint(evtBuild); + + //if (evtBuild == 0) + //{ + // Utility_Label.Text = actionsWritten; + //} + + switch (evtBuild) + { + case 0: + SetUtilityLabel(actionsWritten, true); + break; + case 1: + SetUtilityLabel(writeAborted, true); + break; + case 2: + SetUtilityLabel(noActionsToWrite, true); + break; + case 3: + SetUtilityLabel(errorWrite, true); + break; + } } private void ArmaDir_Button_Click(object sender, RoutedEventArgs e) @@ -257,8 +358,26 @@ private void OpenVarPage_Button_Click(object sender, RoutedEventArgs e) private void Clipboard_Button_Click(object sender, RoutedEventArgs e) { - aceEvent.BuildToClipboard(); - MessageBox.Show("Text copied to clipboard!"); + int result; + result = aceEvent.BuildToClipboard(); + + //if (result == 0) + //{ + // Utility_Label.Text = copiedToClipboard; + //} + + switch (result) + { + case 0: + SetUtilityLabel(copiedToClipboard, true); + break; + case 1: + SetUtilityLabel(noActionsToWrite, true); + break; + case 2: + SetUtilityLabel(errorWrite, true); + break; + } } private void NumberValidationTextBox(object sender, TextCompositionEventArgs e) @@ -277,6 +396,8 @@ private void ResetWindow() this.Title = windowTitle_Base; openedFile = ""; + Utility_Label.Text = labelEmpty; + editing = false; fileOpen = false; @@ -307,7 +428,7 @@ private void OpenFile_Button_Click(object sender, RoutedEventArgs e) int index = 0; - + OpenFileDialog file = new OpenFileDialog { @@ -327,31 +448,31 @@ private void OpenFile_Button_Click(object sender, RoutedEventArgs e) StreamReader readingFile = new StreamReader(file.FileName); string line; - bool first = true; + bool first = true; while ((line = readingFile.ReadLine()) != null) { ran = true; if (first) - { + { metadata data = JsonSerializer.Deserialize(line); - if (!data.validateSelf()) + if (!data.ValidateSelf()) { //metaImported = true; MessageBox.Show("The metadata couldn't be loaded!"); } //else //{ - + //} - + first = false; } else { aceEvent deserializedEvent = JsonSerializer.Deserialize(line); - + if (deserializedEvent.ValidateSelf()) { //actionImported = true; @@ -435,6 +556,49 @@ private void SaveAs() } } + private void SetUtilityLabel(string labelToSet, bool fadeOut = false, int fadeOffset = 1600, int fadeTime = 150) + { + // If animPlay is still active and hasn't been removed, do so + if (animPlay != null) + { + animPlay.Stop(Utility_Label); + //animPlay.Remove(Utility_Label); + + Utility_Label.Opacity = (double)1.0; + + Utility_Label.Visibility = Visibility.Visible; + } + + Utility_Label.Text = labelToSet; + Utility_Label.Visibility = Visibility.Visible; + + Utility_Label.Opacity = (double)1.0; + + if (fadeOut) + { + animPlay = new Storyboard(); + + Utility_Label.Opacity = (double)1.0; + + fadeOutAnim.BeginTime = TimeSpan.FromMilliseconds(fadeOffset); + fadeOutAnim.Duration = new Duration(TimeSpan.FromMilliseconds((double)fadeTime)); + + animPlay.Children.Add(fadeOutAnim); + //Storyboard.SetTarget(fadeOutAnim, Utility_Label); + Storyboard.SetTargetProperty(fadeOutAnim, new PropertyPath(TextBlock.OpacityProperty)); + + animPlay.Completed += CompletedHandler; + animPlay.Begin(Utility_Label, HandoffBehavior.SnapshotAndReplace, true); + } + } + + private void CompletedHandler(object sender, EventArgs e) + { + animPlay.Stop(Utility_Label); + //Utility_Label.Visibility = Visibility.Hidden; + Utility_Label.Opacity = 0.0; + } + private string SetNewTitle(string file) { return String.Concat(windowTitle_Base, ": ", file); diff --git a/EZAction/Properties/AssemblyInfo.cs b/EZAction/Properties/AssemblyInfo.cs index b7820b0..2556739 100644 --- a/EZAction/Properties/AssemblyInfo.cs +++ b/EZAction/Properties/AssemblyInfo.cs @@ -7,12 +7,12 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("TestAppWPF")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyTitle("EZAction")] +[assembly: AssemblyDescription("A program to quickly generate the skeleton code for ArmA 3 ACE Interactions")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TestAppWPF")] -[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyProduct("EZAction")] +[assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -51,5 +51,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] +[assembly: NeutralResourcesLanguage("")] diff --git a/EZAction/aceEvent.cs b/EZAction/aceEvent.cs index c7299a8..9f88b88 100644 --- a/EZAction/aceEvent.cs +++ b/EZAction/aceEvent.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using System.IO; using System.Windows; -//using System.Windows.Forms; using MessageBox = System.Windows.MessageBox; using Microsoft.Win32; @@ -136,7 +135,7 @@ public static int BuildSQF() if (eventList.Count <= 0) { - MessageBox.Show("No actions to declare. Skipping step."); + //MessageBox.Show("No actions to declare. Skipping step."); return 2; } @@ -157,7 +156,7 @@ public static int BuildSQF() } else { - return 3; + return 1; } string targets = DeclareTargets(); @@ -175,10 +174,16 @@ public static int BuildSQF() return 0; } - public static void BuildToClipboard() + public static int BuildToClipboard() { StringBuilder buildBuddy = new StringBuilder(); + if (eventList.Count <= 0) + { + //MessageBox.Show("No actions to declare. Skipping step."); + return 1; + } + string targets = DeclareTargets(); string functions = BuildFunctions(); string actions = CreateActions(); @@ -189,7 +194,16 @@ public static void BuildToClipboard() buildBuddy.Append(actions); buildBuddy.Append(adds); - System.Windows.Clipboard.SetText(buildBuddy.ToString()); + try + { + System.Windows.Clipboard.SetText(buildBuddy.ToString()); + } + catch(Exception e) + { + return 2; + } + + return 0; } // Standard for only base and one thing to add @@ -255,7 +269,7 @@ private static string DeclareTargets() foreach (aceEvent element in eventList) { int index = eventList.IndexOf(element) + 1; - string objectNum = String.Concat("_target", index); + string objectNum = String.Concat("_", element.functionName, "Target"); concat = ConcatWithNewLine(concat, new[] { objectNum, " = ", element.targetEntity, ";" }); } @@ -269,12 +283,13 @@ private static string DeclareTargets() private static string BuildFunctions() { - string concat; + // Initialize cause else C# cries + string concat = ""; foreach (aceEvent element in eventList) { - concat = ConcatWithNewLine("_", new[] { element.functionName, " = {" }); + concat = ConcatWithNewLine(concat, new[] { "_", element.functionName, " = {" }); if (element.progressBar) { @@ -294,11 +309,9 @@ private static string BuildFunctions() concat = ConcatWithNewLine(concat, "};"); concat = ConcatNewLine(concat); concat = ConcatNewLine(concat); - - return concat; } - return "shit"; + return concat; } @@ -335,7 +348,7 @@ private static string AddActions() foreach (aceEvent element in eventList) { int index = eventList.IndexOf(element) + 1; - string objectNum = String.Concat("_target", index); + string objectNum = String.Concat("_", element.functionName, "Target"); if (element.classCheck == true) @@ -367,7 +380,7 @@ public DateTime LastSave public metadata() { } - public bool validateSelf() + public bool ValidateSelf() { if (lastSave.ToString() == "01.01.0001 00:00:00") { @@ -384,58 +397,58 @@ public string ExportMetadata() { - class variableContent { - public static List variableList = new List(); - - private string name; - private string value; - - public variableContent(string varName, string varVal) { - name = varName; - value = varVal; - } - - public static int BuildSQF() - { - if (variableList.Count <= 0) { - MessageBox.Show("No variables to declare. Skipping step."); - return 2; - } - - SaveFileDialog saveDialog = new SaveFileDialog - { - Filter = "ArmA 3 Scripting Files (*.sqf)|*.sqf", - FileName = "output_variables.sqf", - InitialDirectory = Properties.Settings.Default.defaultSavePath - }; - - if (saveDialog.ShowDialog() == true) - { - //Cleanup file before writing - File.Delete(saveDialog.FileName); - - foreach (variableContent element in variableList) - { - string line; - //If it's only numbers OR bool values, treat as such - if (Regex.IsMatch(element.value, "^[0-9]*$") || element.value == "true" || element.value == "false") - { - line = String.Concat(element.name, " = ", element.value, "; publicVariable \"", element.name, "\";"); - } - //Else treat as foreign - else - { - line = String.Concat(element.name, " = \"", element.value, "\"; publicVariable \"", element.name, "\";"); - } - } - return 0; - } - else { - return 1; - } - } + //class variableContent { + // public static List variableList = new List(); + + // private string name; + // private string value; + + // public variableContent(string varName, string varVal) { + // name = varName; + // value = varVal; + // } + + // public static int BuildSQF() + // { + // if (variableList.Count <= 0) { + // MessageBox.Show("No variables to declare. Skipping step."); + // return 2; + // } + + // SaveFileDialog saveDialog = new SaveFileDialog + // { + // Filter = "ArmA 3 Scripting Files (*.sqf)|*.sqf", + // FileName = "output_variables.sqf", + // InitialDirectory = Properties.Settings.Default.defaultSavePath + // }; + + // if (saveDialog.ShowDialog() == true) + // { + // //Cleanup file before writing + // File.Delete(saveDialog.FileName); + + // foreach (variableContent element in variableList) + // { + // string line; + // //If it's only numbers OR bool values, treat as such + // if (Regex.IsMatch(element.value, "^[0-9]*$") || element.value == "true" || element.value == "false") + // { + // line = String.Concat(element.name, " = ", element.value, "; publicVariable \"", element.name, "\";"); + // } + // //Else treat as foreign + // else + // { + // line = String.Concat(element.name, " = \"", element.value, "\"; publicVariable \"", element.name, "\";"); + // } + // } + // return 0; + // } + // else { + // return 1; + // } + // } - } + //} class errorPrint {