Exemplo n.º 1
0
        private async Task UpdateSourceCode(string updatedSourceCode, int fileIndex)
        {
            while (true)
            {
                try
                {
                    var codeFile = _directoryFactory.GetSourceCodeFile(fileIndex);
                    using (var outputFile = new StreamWriter(codeFile.FullName))
                    {
                        await outputFile.WriteAsync(updatedSourceCode);
                    }

                    break;
                }
                catch (Exception ex)
                {
                    Trace.TraceError("Exception suppressed: {0}", ex);
                    Debug.WriteLine("File is inaccessible....Try again");
                }
            }
        }