~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonBindingAddInFile.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.IO;
 
6
using System.Reflection;
 
7
using System.Xml;
 
8
 
 
9
namespace PythonBinding.Tests.Utils
 
10
{
 
11
        /// <summary>
 
12
        /// Utility class that reads the PythonBinding.addin file
 
13
        /// that has been embedded as a resource into the test assembly.
 
14
        /// </summary>
 
15
        public sealed class PythonBindingAddInFile
 
16
        {
 
17
                PythonBindingAddInFile()
 
18
                {
 
19
                }
 
20
                
 
21
                /// <summary>
 
22
                /// Returns the PythonBinding.addin file.
 
23
                /// </summary>
 
24
                public static TextReader ReadAddInFile()
 
25
                {
 
26
                        Assembly assembly = Assembly.GetAssembly(typeof(PythonBindingAddInFile));
 
27
                        string resourceName = String.Concat("PythonBinding.Tests.PythonBinding.addin");
 
28
                        Stream resourceStream = assembly.GetManifestResourceStream(resourceName);
 
29
                        if (resourceStream != null) {
 
30
                                return new StreamReader(resourceStream);
 
31
                        }
 
32
                        return null;
 
33
                }
 
34
        }
 
35
}