Пример #1
0
        private void ProcessSingleCommand_click(object sender, RoutedEventArgs e)
        {
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(CommandVM, Newtonsoft.Json.Formatting.Indented);
            CommandVM.SelectedCommand.TypeMapping = CommandVM.CSharpTypeMapping;
            var tt = new CommandGeneratorCS(CommandVM.SelectedCommand);
            using (var sw = new System.IO.StreamWriter(string.Format("C:\\Logfiles\\{0}.cs", tt.ClassName)))
            {
                sw.Write(tt.TransformText());
            }
            CommandVM.SelectedCommand.TypeMapping = CommandVM.CppTypeMapping;
            var ttCpp = new CommandGeneratorCpp(CommandVM.SelectedCommand);
            var ttH = new CommandGeneratorH(CommandVM.SelectedCommand);

            using (var sw = new System.IO.StreamWriter(string.Format("C:\\Logfiles\\{0}.cpp", ttCpp.ClassName)))
            {
                sw.Write(ttCpp.TransformText());
            }
            using (var sw = new System.IO.StreamWriter(string.Format("C:\\Logfiles\\{0}.h", ttH.ClassName)))
            {
                sw.Write(ttH.TransformText());
            }
        }
Пример #2
0
 private void ProcessAllCommands_Click(object sender, RoutedEventArgs e)
 {
     int[] commandNumbers = new int[CommandVM.NetworkCommands.Count];
     for (int i = 0; i < CommandVM.NetworkCommands.Count; i++)
     {
         commandNumbers[i] = CommandVM.NetworkCommands[i].NetworkCommand.Code;
     }
     if (commandNumbers.Distinct().Count() != CommandVM.NetworkCommands.Count)
     {
         MessageBox.Show("You have a duplicate number in your commands. Please verify.");
     }
     else
     {
         foreach (var item in CommandVM.NetworkCommands)
         {
             item.NetworkCommand.TypeMapping = CommandVM.CSharpTypeMapping;
             var tt = new CommandGeneratorCS(item.NetworkCommand);
             using (var sw = new System.IO.StreamWriter(string.Format("C:\\Logfiles\\{0}.cs", tt.ClassName)))
             {
                 sw.Write(tt.TransformText());
             }
         }
     }
 }