VsTeXProject.VisualStudio.Project.ProjectNode.AddFileFromTemplate C# (CSharp) Метод

AddFileFromTemplate() публичный Метод

Called to add a file to the project from a template. Override to do it yourself if you want to customize the file
public AddFileFromTemplate ( string source, string target ) : void
source string Full path of template file
target string Full path of file once added to the project
Результат void
        public virtual void AddFileFromTemplate(string source, string target)
        {
            if (string.IsNullOrEmpty(source))
            {
                throw new ArgumentNullException("source");
            }
            if (string.IsNullOrEmpty(target))
            {
                throw new ArgumentNullException("target");
            }

            try
            {
                var directory = Path.GetDirectoryName(target);
                if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                var fiOrg = new FileInfo(source);
                var fiNew = fiOrg.CopyTo(target, true);

                fiNew.Attributes = FileAttributes.Normal; // remove any read only attributes.
            }
            catch (IOException e)
            {
                Trace.WriteLine("Exception : " + e.Message);
            }
            catch (UnauthorizedAccessException e)
            {
                Trace.WriteLine("Exception : " + e.Message);
            }
            catch (ArgumentException e)
            {
                Trace.WriteLine("Exception : " + e.Message);
            }
            catch (NotSupportedException e)
            {
                Trace.WriteLine("Exception : " + e.Message);
            }
        }
ProjectNode