Esempio n. 1
0
        public async Task <M <Source> > GetSourceAsync(ModelPaths modelPaths, DataNodeName nodeName)
        {
            Log.Debug($"Get source for {nodeName} in model {modelPaths}...");
            try
            {
                if (!TryGetParser(modelPaths, out IParser parser))
                {
                    return(Error.From($"File not supported: {modelPaths}"));
                }

                NodeDataSource source = await parser.GetSourceAsync(modelPaths.ModelPath, (string)nodeName);

                if (source == null)
                {
                    return(M.NoValue);
                }

                return(new Source(source.Path, source.Text, source.LineNumber));
            }
            catch (Exception e)
            {
                return(Error.From(e));
            }
        }
Esempio n. 2
0
 public async Task <M <Source> > TryGetSourceAsync(ModelPaths modelPaths, DataNodeName nodeName) =>
 await parserService.GetSourceAsync(modelPaths, nodeName);
Esempio n. 3
0
 public void Set(DataNodeName val, int data)
 {
     this.name = val;
     this.x    = data;
 }
Esempio n. 4
0
 public DataNode(DataNodeName val, int data)
 {
     this.Set(val, data);
 }