Exemplo n.º 1
0
        public static string Resolve(string path, string [] searchPaths)
        {
            if (String.IsNullOrEmpty(path))
            {
                return(path);
            }

            if (_envVariables == null)
            {
                UpdateEnvironmentVariables();
            }

            path = TextVariables.Substitute(path, _envVariables);

            if (Path.IsPathRooted(path))
            {
                return(path);
            }

            if (searchPaths != null)
            {
                for (int i = 0; i < searchPaths.Length; ++i)
                {
                    string mergedPath = Path.Combine(searchPaths[i], path);
                    if (File.Exists(mergedPath) || Directory.Exists(mergedPath))
                    {
                        return(mergedPath);
                    }
                }
            }
            return(path);
        }
Exemplo n.º 2
0
 public void AddLanguageString(string key, XmlString value, string writingSystemId, bool isCollectionValue)
 {
     if (!TextVariables.ContainsKey(key))
     {
         var text = new MultiTextBase();
         TextVariables.Add(key, new DataSetElementValue(text, isCollectionValue));
     }
     TextVariables[key].TextAlternatives.SetAlternative(writingSystemId, value?.Xml);
 }
Exemplo n.º 3
0
        public void UpdateGenericLanguageString(string key, XmlString value, bool isCollectionValue)
        {
            var text = new MultiTextBase();

            text.SetAlternative("*", value?.Xml);
            if (TextVariables.ContainsKey(key))
            {
                TextVariables.Remove(key);
            }
            TextVariables.Add(key, new DataSetElementValue(text, isCollectionValue));
        }
Exemplo n.º 4
0
        public void UpdateLanguageString(string key, string value, string writingSystemId, bool isCollectionValue)
        {
            DataSetElementValue dataSetElementValue;
            MultiTextBase       text;

            if (TextVariables.TryGetValue(key, out dataSetElementValue))
            {
                text = dataSetElementValue.TextAlternatives;
            }
            else
            {
                text = new MultiTextBase();
            }
            text.SetAlternative(DealiasWritingSystemId(writingSystemId), value);
            TextVariables.Remove(key);
            if (text.Count > 0)
            {
                TextVariables.Add(key, new DataSetElementValue(text, isCollectionValue));
            }
        }
Exemplo n.º 5
0
        public void UpdateLanguageString(string key, XmlString value, string writingSystemId, bool isCollectionValue)
        {
            Debug.Assert(writingSystemId != "V" && writingSystemId != "N1" && writingSystemId != "N2",
                         "UpdateLanguageString may no longer be passed an alias writing system ID");
            DataSetElementValue dataSetElementValue;
            MultiTextBase       text;

            if (TextVariables.TryGetValue(key, out dataSetElementValue))
            {
                text = dataSetElementValue.TextAlternatives;
            }
            else
            {
                text = new MultiTextBase();
            }
            text.SetAlternative(writingSystemId, value?.Xml);
            TextVariables.Remove(key);
            if (text.Count > 0)
            {
                TextVariables.Add(key, new DataSetElementValue(text, isCollectionValue));
            }
        }
 public LocaleChangedEventArgs(TextVariables theVariables)
 {
     this.TheNewVariables = theVariables;
 }
 public LocaleChangedEventArgs(TextVariables theVariables)
 {
     this.TheNewVariables = theVariables;
 }