Пример #1
0
        public void Prettify(GeneratedFile file)
        {
            if (_disposed)
            {
                throw new TException("This object was disposed");
            }

            using (var process = new Process {
                StartInfo = new ProcessStartInfo {
                    FileName = _uncrustifyFileName,
                    Arguments = "-q -l cpp -c " + _uncrustifyConfigFileName,
                    UseShellExecute = false,
                    RedirectStandardInput = true,
                    RedirectStandardOutput = true,
                    RedirectStandardError = true
                }
            }) {
                process.Start();

                using (var input = process.StandardInput) {
                    input.WriteLine(file.Content);
                }

                process.WaitForExit();

                file.Content = process.StandardOutput.ReadToEnd();
            }
        }
Пример #2
0
        public GenerationUnit(YClass @class)
        {
            Class = @class;

            _header = new GeneratedFile {
                Name = Class.Name,
                Type = GeneratedFile.GeneratedFileType.HEADER
            };

            _source = new GeneratedFile {
                Name = Class.Name,
                Type = GeneratedFile.GeneratedFileType.SOURCE
            };
        }
Пример #3
0
        void UpdateGeneratedFileViews(GeneratedFile file)
        {
            _tvDataSource.UpdateSelectedPosition(file);

            if (file == null)
            {
                Preferences.LastSelectedFilename = null;
                GeneratedFileContent.Value       = "";
            }
            else
            {
                Preferences.LastSelectedFilename = file.ToString();
                GeneratedFileContent.Value       = file.Content;
            }
        }
Пример #4
0
            internal void UpdateSelectedPosition(GeneratedFile file)
            {
                if (files != null)
                {
                    for (var i = 0; i < files.Length; i++)
                    {
                        if (file == files[i])
                        {
                            selectedPosition = i;
                            return;
                        }
                    }
                }

                selectedPosition = -1;
            }