Ejemplo n.º 1
0
        private void WriteSrcSrv(string path, PdbSrcSrvSection section)
        {
            var tempPath = Path.Combine(runner.WorkingPath, Path.GetRandomFileName());

            try
            {
                File.WriteAllText(tempPath, section.ToString());

                runner.Run(
                    output =>
                {
                    throw new Exception(output);
                },
                    error =>
                {
                    throw new Exception(error);
                },
                    new[]
                {
                    "-w",
                    string.Format("-p:{0}", path),
                    string.Format("-i:{0}", tempPath),
                    "-s:srcsrv"
                },
                    false,
                    null,
                    Encoding.UTF8);
            }
            finally
            {
                File.Delete(tempPath);
            }
        }
Ejemplo n.º 2
0
        private PdbSrcSrvSection ReadSrcSrv(string path)
        {
            var builder = new StringBuilder();

            runner.Run(
                output =>
            {
                builder.AppendLine(output);
                return(null);
            },
                error =>
            {
                throw new Exception(error);
            },
                new[]
            {
                "-r",
                string.Format("-p:\"{0}\"", path),
                "-s:srcsrv"
            },
                false,
                null,
                Encoding.UTF8);

            return(PdbSrcSrvSection.Parse(builder.ToString()));
        }
Ejemplo n.º 3
0
        public void WriteSrcSrv(Stream input, Stream output, PdbSrcSrvSection section)
        {
            var tempPath = Path.Combine(runner.WorkingPath, Path.GetRandomFileName());

            try
            {
                using (var tempStream = File.OpenWrite(tempPath))
                    input.CopyTo(tempStream);

                WriteSrcSrv(tempPath, section);

                using (var tempStream = File.OpenRead(tempPath))
                    tempStream.CopyTo(output);
            }
            finally
            {
                File.Delete(tempPath);
            }
        }
Ejemplo n.º 4
0
        public static PdbSrcSrvSection Parse(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(null);
            }

            var result = new PdbSrcSrvSection();

            string ini = text.Remove(0, text.IndexOf(SrcSrvIni) + SrcSrvIni.Length);

            ini = ini.Remove(ini.IndexOf(SrcSrvVariables)).Trim();
            string variables = text.Remove(0, text.IndexOf(SrcSrvVariables) + SrcSrvVariables.Length);

            variables = variables.Remove(variables.IndexOf(SrcSrvSources)).Trim();
            string sources = text.Remove(0, text.IndexOf(SrcSrvSources) + SrcSrvSources.Length);

            sources = sources.Remove(sources.IndexOf(SrcSrvEnd)).Trim();

            foreach (string line in ini.Split('\n').Select(l => l.Trim()).Where(l => !string.IsNullOrEmpty(l)))
            {
                result.Ini.Add(line.Remove(line.IndexOf("=")), line.Substring(line.IndexOf("=") + 1));
            }

            foreach (string line in variables.Split('\n').Select(l => l.Trim()).Where(l => !string.IsNullOrEmpty(l)))
            {
                result.Variables.Add(line.Remove(line.IndexOf("=")), line.Substring(line.IndexOf("=") + 1));
            }

            foreach (string line in sources.Split('\n').Select(l => l.Trim()).Where(l => !string.IsNullOrEmpty(l)))
            {
                result.Sources.Add(new List <string>(line.Split('*')));
            }

            return(result);
        }