Exemplo n.º 1
0
        public MainWindow()
        {
            StringDataJSON stringdata;

            stringdata = new StringDataJSON();
            InitializeComponent();
        }
Exemplo n.º 2
0
        public void button_Click(object sender, RoutedEventArgs e)
        {
            var dict = File.ReadLines("textwords.csv").Select(line => line.Split(',')).ToDictionary(line => line[0], line => line[1]); //Stores the Text Speak CSV file into a dictionary

            //Stores the information from the text boxes into the case files.
            stringdata.sender   = SenderText.Text;
            stringdata.bodytext = BodyText.Text;



            var texts = new List <String> //Creates a new list for the text messages.
            {
                stringdata.bodytext
            };

            foreach (var text in texts)                                                                                                      //For loop to find the text speak info and swap it.
            {
                var result = string.Join(" ", text.Split(' ').Select(i => dict.ContainsKey(i.ToComparable()) ? dict[i.ToComparable()] : i)); //The result is searching the dictionary for the Key and Field - the Key being the shortened Text speech, while the field being the full text.
                Debug.WriteLine(result);                                                                                                     //Debugs the result.
                StringDataJSON stringPass = new StringDataJSON()
                {
                    sender = SenderText.Text, bodytext = result
                };                                                                      //Stores the data into the JSON file
                string outputJSON = ser.Serialize(stringPass);                          //Serializes the JSON file.
                File.WriteAllText(messageidinfo.messageidstring + ".json", outputJSON); //Saves the JSON file.
            }
        }
Exemplo n.º 3
0
        public void button_Click_1(object sender, RoutedEventArgs e)
        {
            String         SMSJSONString = File.ReadAllText(messageidinfo.messageidstring + ".json"); //Loads the JSON file based on the name of the Message ID.
            StringDataJSON stringLoad    = ser.Deserialize <StringDataJSON>(SMSJSONString);           //Deserializes the JSON file.

            Debug.WriteLine(stringLoad);
            SenderText.Text = stringLoad.sender; //Displays the JSON information into the text boxes.
            BodyText.Text   = stringLoad.sender;
        }
Exemplo n.º 4
0
 JavaScriptSerializer ser = new JavaScriptSerializer(); //Begins the JSON Serializer.
 public SMSWindow(string messageidstring)
 {
     stringdata    = new StringDataJSON();
     messageidinfo = new MessageID();
     InitializeComponent();
     messageidinfo.messageidstring = messageidstring;
     this.SenderText.MaxLength     = 11;  //Setting the limit of the sender info box.
     this.BodyText.MaxLength       = 140; //Setting the limit of the body info box.
 }