예제 #1
0
        public static void FromPathmapFile(string file)
        {
            DeltinScript deltinScript = Generate(PathMap.ImportFromXMLFile(file), OutputLanguage.enUS);

            string code = deltinScript.WorkshopCode;

            if (code != null)
            {
                Program.WorkshopCodeResult(code);
            }
            else
            {
                Log.Write(LogLevel.Normal, new ColorMod("Build Failed.", ConsoleColor.Red));
                deltinScript.Diagnostics.PrintDiagnostics(Log);
            }
        }
        public override object Validate(ScriptFile script, IExpression value, DocRange valueRange)
        {
            string filepath = base.Validate(script, value, valueRange) as string;

            if (filepath == null)
            {
                return(null);
            }

            PathMap map;

            try
            {
                map = PathMap.ImportFromXMLFile(filepath);
            }
            catch (InvalidOperationException)
            {
                script.Diagnostics.Error("Failed to deserialize the PathMap.", valueRange);
                return(null);
            }

            return(map);
        }