コード例 #1
0
        //Paste to from the Clipboard
        private void Button_PasteFromClipboard(object sender, RoutedEventArgs e)
        {
            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Get Item from the ComboBox
            string MyEncoding = ReturnEncoding();

            if (MyEncoding != null)
            {
                Encoding encoding = Encoding.Default;

                //Get Encoding
                encoding = DesignUtils.GetEncodingIDText(MyIDText);

                //Paste Argument from the Clipboard
                string OutputText = DesignUtils.PasteArgumentFromClipboard();

                //Update Control
                UpdateControl(MyArgument.Replace(" ", ""), OutputText);

                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, OutputText, encoding);
            }
        }
        //Regex Parameter Update Event
        private void MyRegexParameterComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Update IDText
            UpdateIDText();

            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            if (MyIDTextParent != null)
            {
                //Get Encoding
                encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

                //Fill in Global Variable
                MyArgument = "Regex Parameter";

                //Get ITem from the ComboBox
                string MyRegexParameterComboBox = this.RegexParameterComboBox.SelectedItem.ToString();

                //Log ComboBox
                DesignUtils.CallLogComboBox(MyIDText, MyArgument, MyRegexParameterComboBox, encoding);
            }
        }
コード例 #3
0
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            string   FilePath    = null;
            string   Source      = null;
            double   PercResults = 0;
            Encoding encoding    = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get the Current File
            FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFile.txt";
            Source   = System.IO.File.ReadAllText(FilePath);
            string inputText = System.IO.File.ReadAllText(Source, encoding);

            //Get File Path
            FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";
            Source   = System.IO.File.ReadAllText(FilePath, encoding);

            //Check if all Parameters are in the File
            string[] searchWords = { "Search Words" + Utils.DefaultSeparator() };
            PercResults = Utils.FindWordsInString(Source, searchWords, false);

            //Case it is found
            if (PercResults == 1)
            {
                //Split the Line
                string[] MyArray = Strings.Split(Source, Utils.DefaultSeparator());

                //Fill in the Variables
                string MyArgument = MyArray[0];
                string MyValue    = MyArray[1];

                //'Convert' Array to String
                string[] SearchWords = DesignUtils.ConvertStringToArray(MyValue, false);

                //Find Words in String
                PercResults = Utils.FindWordsInString(inputText, SearchWords, false);

                //Display Result
                MessageBox.Show($"Percentage: {PercResults.ToString("P", CultureInfo.InvariantCulture)}", "Count Words in String");
            }
            else
            {
                //Delete Argument in case it is null
                MyArgument = "Search Words";
                DesignUtils.DeleteTextFileRowArgument(FilePath, MyArgument, encoding);

                //Error Message
                MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            Encoding encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Open Form Preview Extraction
            DesignUtils.CallformPreviewExtraction(null, "Split Text By Blank Lines", MyIDTextParent, encoding);
        }
コード例 #5
0
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Occurence Position
            MyArgument = "Occurence Position";
            string OccurencePosition = ReturnOccurrenceNumber();

            if (OccurencePosition != null)
            {
                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, OccurencePosition, encoding);
            }
            else
            {
                //Delete Argument in case it is null
                DesignUtils.DeleteTextFileRowArgument(FilePath, MyArgument, encoding);
            }

            #region Open Preview Extraction

            //Read Text File
            string Source = System.IO.File.ReadAllText(FilePath, encoding);

            //Check if all Parameters are in the File
            string[] searchWords = { "Words" + Utils.DefaultSeparator(), "Occurence Parameter" + Utils.DefaultSeparator() };
            double   PercResults = Utils.FindWordsInString(Source, searchWords, false);

            //Case all Parameters are found
            if (PercResults == 1)
            {
                //Open Form Preview Extraction
                DesignUtils.CallformPreviewExtraction(MyIDText, "Remove Words", MyIDTextParent, encoding);
            }
            else
            {
                //Error Message
                MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            #endregion
        }
コード例 #6
0
        //Anchor Words Parameter Update Event
        private void AnchorWordsParamComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Update IDText
            UpdateIDText();

            //Get Encoding
            Encoding encoding = DesignUtils.GetEncodingIDText(MyIDText);

            //Fill in Global Variable
            MyArgument = "Anchor Words Parameter";

            //Get ITem from the ComboBox
            string MyAnchorTextParamComboBox = this.AnchorWordsParamComboBox.SelectedItem.ToString();

            //Log ComboBox
            DesignUtils.CallLogComboBox(MyIDText, MyArgument, MyAnchorTextParamComboBox, encoding);
        }
コード例 #7
0
        //Occurences Update Event
        private void OccurrencesComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Update IDText
            UpdateIDText();

            string MyOccurenceParameter = null;

            //Fill in Global Variable
            MyArgument = "Occurence Parameter";

            //Get IDText, if there is
            MyIDText = ReturnIDText();

            //Get item from the ComboBox
            MyOccurenceParameter = (string)OccurrencesComboBox.SelectedValue;

            //Log ComboBox
            DesignUtils.CallLogComboBox(MyIDText, MyArgument, MyOccurenceParameter, encoding);

            //Hide / Display Occurence Number Control
            if (MyOccurenceParameter == "Custom")
            {
                //Visible
                this.OccurrenceNumber.Visibility = Visibility.Visible;
            }
            else
            {
                //Hidden
                this.OccurrenceNumber.Visibility = Visibility.Collapsed;

                //Clear Field Value
                ModelProperty property = this.ModelItem.Properties["OccurrenceNumber"];
                property.SetValue(null);
            }
        }
コード例 #8
0
        //Button Open Wizard
        private void Button_OpenFormSelectData(object sender, RoutedEventArgs e)
        {
            //Show Update Call Control
            this.Words.Visibility      = Visibility.Hidden;
            this.UpdateCall.Visibility = Visibility.Visible;
            this.UpdateCall.Content    = Utils.DefaultUpdateControl();

            //Get File Path
            string FilePath = System.IO.File.ReadAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/CurrentFile.txt");

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            Encoding encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Open Form Select Data
            DesignUtils.CallformSelectDataOpen(MyArgument, MyIDText, FilePath, MyIDTextParent, encoding);
        }
コード例 #9
0
        //Create New TextID
        private void CreateNewIDText(object sender, RoutedEventArgs e)
        {
            string FilePath = null;

            //Get Encoding Parent

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            Encoding encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get Data from Current Text File

            MyIDText = ReturnIDText();

            //Get the File Path
            FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Check if file exists
            if (File.Exists(FilePath) == true)
            {
                //Get Data from Text File
                string Source = System.IO.File.ReadAllText(FilePath, encoding);

                //New IDText

                //Clear the Current IDText
                ModelProperty property = this.ModelItem.Properties["IDText"];
                property.SetValue(null);

                //Update IDText
                UpdateIDText();

                //Set the New File Path
                FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

                //Write New Text File
                System.IO.File.WriteAllText(FilePath, Source);
            }
        }
        //Remove End Words Argument
        private void Button_RemoveEndWordsArgument(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Clear the Control
            ModelProperty p2 = this.ModelItem.Properties["EndWords"];

            p2.SetValue(null);

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Delete Argument in case it is null
            DesignUtils.DeleteTextFileRowArgument(FilePath, MyArgument, encoding);
        }
コード例 #11
0
        //Paste to from the Clipboard
        private void Button_PasteFromClipboard(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Paste Argument from the Clipboard
            string OutputText = DesignUtils.PasteArgumentFromClipboard();

            //Update Control
            UpdateControl("SearchWord", OutputText);

            //Update Text File Row Argument
            DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, OutputText, encoding);
        }
コード例 #12
0
        //Create New TextID
        private void CreateNewIDText(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDText);

            //Clear the Current IDText
            ModelProperty property = this.ModelItem.Properties["IDText"];

            property.SetValue(null);

            //Update IDText
            UpdateIDText();

            //Copy the Arguments, in case there is
            string FilePathPreview = ReturnCurrentFile();

            //File Name
            if (FilePath != null)
            {
                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, "FileName", FilePathPreview, encoding);
            }

            //Encoding
            string MyEncoding = ReturnEncoding();

            if (MyEncoding != null)
            {
                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, "Encoding", MyEncoding, encoding);
            }
        }
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            #region Open Preview Extraction

            //Read Text File
            string Source = System.IO.File.ReadAllText(FilePath, encoding);

            //Check if all Parameters are in the File
            string[] searchWords = { "Beg Words" + Utils.DefaultSeparator(), "Regex Parameter" + Utils.DefaultSeparator() };
            double   PercResults = Utils.FindWordsInString(Source, searchWords, false);

            //Case all Parameters are found
            if (PercResults == 1)
            {
                //Open Form Preview Extraction
                DesignUtils.CallformPreviewExtraction(MyIDText, "Extract Text Between Two Anchor Words", MyIDTextParent, encoding);
            }
            else
            {
                //Error Message
                MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            #endregion
        }
        //Button Open Preview
        private void Button_OpenPreview(object sender, RoutedEventArgs e)
        {
            Encoding encoding = Encoding.Default;

            //Return IDText Parent
            string MyIDTextParent = DesignUtils.ReturnCurrentFileIDText();

            //Get Encoding
            encoding = DesignUtils.GetEncodingIDText(MyIDTextParent);

            //Get the File Path
            string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

            //Lines Below
            MyArgument = "Lines Below";
            string LinesAbove = ReturnLinesBelow();

            if (LinesAbove != null)
            {
                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, LinesAbove, encoding);
            }
            else
            {
                //Delete Argument in case it is null
                DesignUtils.DeleteTextFileRowArgument(FilePath, MyArgument, encoding);
            }

            //Number of Lines
            MyArgument = "Number of Lines";
            string NumberofLines = ReturnNumberofLines();

            if (NumberofLines != null)
            {
                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, NumberofLines, encoding);
            }
            else
            {
                //Delete Argument in case it is null
                DesignUtils.DeleteTextFileRowArgument(FilePath, MyArgument, encoding);
            }

            //Anchor Words Parameter
            MyArgument = "Anchor Words Parameter";
            string MyAnchorWordsParameter = ReturnAnchorTextParam();

            if (MyAnchorWordsParameter != null)
            {
                //Update Text File Row Argument
                DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, MyAnchorWordsParameter, encoding);
            }
            else
            {
                //Delete Argument in case it is null
                DesignUtils.DeleteTextFileRowArgument(FilePath, MyArgument, encoding);
            }

            #region Open Preview Extraction

            //Read Text File
            string Source = System.IO.File.ReadAllText(FilePath, encoding);

            //Check if all Parameters are in the File
            string[] searchWords = { "Anchor Words" + Utils.DefaultSeparator(), "Lines Below" + Utils.DefaultSeparator(), "Number of Lines" + Utils.DefaultSeparator(), "Anchor Words Parameter" + Utils.DefaultSeparator() };
            double   PercResults = Utils.FindWordsInString(Source, searchWords, false);

            //Case all Parameters are found
            if (PercResults == 1)
            {
                //Open Form Preview Extraction
                DesignUtils.CallformPreviewExtraction(MyIDText, "Extract Text Below Anchor Words", MyIDTextParent, encoding);
            }
            else
            {
                //Error Message
                MessageBox.Show("Please fill in all arguments", "Validation Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            #endregion
        }
コード例 #15
0
        public void Button_RefreshCurrentFile()
        {
            //Get Data from Control
            //string CurrentExcelFilePath = this.FilePath.Expression.ToString();
            string CurrentTextFilePath = ReturnCurrentFile();

            //Case it is a Variable
            if (CurrentTextFilePath == "1.5: VisualBasicValue<String>")
            {
                MessageBox.Show("File Path as Variable" + Environment.NewLine + "Please select Text file to use functionality ", "Select Text File", MessageBoxButton.OK, MessageBoxImage.Warning);

                //Exit the Procedure
                return;
            }

            //If Current File is not found, exit the procedure
            if (File.Exists(CurrentTextFilePath) == false)
            {
                //Error Message
                MessageBox.Show("The Preview file cannt be found:" + Environment.NewLine + CurrentTextFilePath, "Validation Error", MessageBoxButton.OK, MessageBoxImage.Warning);

                //Exit the Procedure
                return;
            }

            //In case file is found
            if (CurrentTextFilePath != null)
            {
                #region Update Text Files
                //Get the full file path
                string filePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/FileNames/" + Path.GetFileNameWithoutExtension(CurrentTextFilePath) + ".txt";

                //Check if file exists
                bool bExists = File.Exists(filePath);

                //Case File Exists
                switch (bExists)
                {
                //File Exists
                case true:

                    //Get the File Path
                    string FilePath = Directory.GetCurrentDirectory() + "/StorageTextToolbox/Infos/" + MyIDText + ".txt";

                    //Get Current File
                    string CurrentFile = System.IO.File.ReadAllText(Directory.GetCurrentDirectory() + "/StorageTextToolbox/FileNames/" + Path.GetFileNameWithoutExtension(CurrentTextFilePath) + ".txt");

                    //Get Encoding
                    Encoding encoding = DesignUtils.GetEncodingIDText(MyIDText);

                    //Update Text File Row Argument
                    MyArgument = "FileName";
                    DesignUtils.CallUpdateTextFileRowArgument(FilePath, MyArgument, CurrentFile, encoding);

                    break;

                //Case File does not exists
                case false:
                    //Warning Message
                    MessageBox.Show("This funcionality is not available", "File does not exists", MessageBoxButton.OK, MessageBoxImage.Warning);
                    break;
                }
            }
            #endregion
            else
            {
                //Error Message
                MessageBox.Show("Please select template file", "Select Text File", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }