Esempio n. 1
0
 public FileSystemProject(string path)
 {
     _indexPath = path;
     BasePath   = Path.GetDirectoryName(_indexPath) !;
     _baseUri   = "file:///" + BasePath.Replace("\\", "/");
     Index      = Json.Defrost <TemplateProject>(File.ReadAllText(_indexPath) !) !;
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            if (args.Length > 0 && args[0] == "expand")
            {
                Console.WriteLine("expand mode");
                string expandedCode = null;
#if DEBUG
                expandedCode = GetSourceCode(BasePath.Replace("HandMadeMain.cs", "Program.cs"))
                               ?.Code
                               ?.Replace("\r\n", "\n")
                               ?.Replace("using MI=System.Runtime.CompilerServices.MethodImplAttribute;", "");
                expandedCode = ReplaceMethodImpl(expandedCode);
        public override bool Execute()
        {
            if (string.IsNullOrWhiteSpace(BasePath))
            {
                Log.LogError($"Base path '{BasePath ?? "(null)"}' must contain non-whitespace characters.");
                return(!Log.HasLoggedErrors);
            }

            var safeBasePath = BasePath
                               .Replace(" ", "")
                               .Replace(".", "")
                               .ToLowerInvariant();

            if (safeBasePath == "")
            {
                Log.LogError($"Base path '{BasePath}' must contain non '.' characters.");
                return(!Log.HasLoggedErrors);
            }
            SafeBasePath = safeBasePath;

            return(!Log.HasLoggedErrors);
        }