Пример #1
0
        public Optional <AbsoluteFilePath> GetDefaultApplicationForFile(AbsoluteFilePath fileName)
        {
            var pathRes = new StringBuilder();
            var res     = FindExecutable(fileName.ToString(), null, pathRes);

            return(res > 32 ? Optional.Some(AbsoluteFilePath.Parse(pathRes.ToString())) : Optional.None <AbsoluteFilePath>());
        }
Пример #2
0
        private static XmlProject DeserializeProjectFile(AbsoluteFilePath projectFilePath)
        {
            var serializer = CreateXmlSerializer();

            using var fileStream = new FileStream(projectFilePath.ToString(), FileMode.Open);
            XmlProject result = (XmlProject)serializer.Deserialize(fileStream);

            return(result);
        }
Пример #3
0
 private static string GetPathRelativeTo(AbsoluteDirectoryPath projectDirectory, AbsoluteFilePath file)
 {
     return(file.ToString().Replace(projectDirectory.ToString() + Path.DirectorySeparatorChar, ""));
 }
Пример #4
0
 public static CSharpFileSyntaxTree ParseFile(AbsoluteFilePath path)
 {
     return(CSharpFileSyntaxTree.ParseText(File.ReadAllText(path.ToString()), path.ToString()));
 }