Esempio n. 1
0
        public void ReadVersionParameters()
        {
            string[] vParams = new string[0];
            if (IsCore)
            {
                vParams = new[] { "Version", "AssemblyVersion", "FileVersion" }
            }
            ;
            else
            {
                vParams = new[] { "AssemblyTitle", "AssemblyProduct", "AssemblyVersion", "AssemblyFileVersion" }
            };

            contents = RemoveExistingTags(vParams);

            bool added     = false;
            var  nContents = new List <string>();

            for (var i = 0; i < contents.Count; i++)
            {
                nContents.Add(contents[i]);
                if (i >= _targetFrameWorkLine && !added)
                {
                    for (var p = 0; p < vParams.Length; p++)
                    {
                        ParameterValue pValue = new ParameterValue {
                            Name = vParams[p]
                        };
                        if (values.TryGetValue(vParams[p], out ParameterValue ex))
                        {
                            pValue = ex;
                        }
                        else
                        {
                            values[vParams[p]] = pValue;
                        }

                        string line = "    " + string.Format(_tagFormatter, pValue.Name, pValue.Value);
                        pValue.Index = i + p + 1;
                        nContents.Add(line);
                        added = true;
                    }
                }
            }
            contents = nContents;
        }

        bool _isCore(out int targetFrameWorkLine)
        {
            string targ = null;

            targetFrameWorkLine = 0;
            for (var i = 0; i < contents.Count; i++)
            {
                targ = GetTagContent(contents[i], "TargetFramework", "<{0}>(.*?)</{0}>");
                if (targ != null)
                {
                    targetFrameWorkLine = i;
                    break;
                }
            }
            return(targ != null);
        }