예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceLanguage" /> class.
        /// </summary>
        /// <param name="container">The containing resource entity.</param>
        /// <param name="cultureKey">The culture key.</param>
        /// <param name="file">The .resx file having all the localization.</param>
        /// <exception cref="System.InvalidOperationException">
        /// </exception>
        internal ResourceLanguage([NotNull] ResourceEntity container, [NotNull] CultureKey cultureKey, [NotNull] ProjectFile file)
        {
            Container      = container;
            CultureKey     = cultureKey;
            ProjectFile    = file;
            _configuration = container.Container.Configuration;

            try
            {
                _document = file.Load();
            }
            catch (XmlException ex)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidResourceFileError, file.FilePath), ex);
            }

            if (DocumentRoot == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidResourceFileError, file.FilePath));
            }

            var defaultNamespace = DocumentRoot.GetDefaultNamespace();

            _dataNodeName    = defaultNamespace.GetName(@"data");
            _valueNodeName   = defaultNamespace.GetName(@"value");
            _commentNodeName = defaultNamespace.GetName(@"comment");

            UpdateNodes();
        }
예제 #2
0
 public bool IncludeFile(ProjectFile file)
 {
     return(_fileExclusionFilter?.IsMatch(file.RelativeFilePath) != true);
 }
예제 #3
0
 public bool IsSourceFile(ProjectFile file)
 {
     return(_extensions.Contains(file.Extension, StringComparer.OrdinalIgnoreCase));
 }
예제 #4
0
        private void OnChanged()
        {
            ProjectFile.Changed(_document);

            Container.Container.OnLanguageChanged(this);
        }
 public ProjectFileEventArgs([NotNull] ResourceLanguage language, [NotNull] ProjectFile projectFile)
 {
     Language = language;
     ProjectFile = projectFile;
 }
예제 #6
0
 internal CodeReference([NotNull] ProjectFile projectFile, int lineNumber, [NotNull][ItemNotNull] IList <string> lineSegments)
 {
     ProjectFile  = projectFile;
     LineNumber   = lineNumber;
     LineSegments = lineSegments;
 }