Beispiel #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));
            }
        }
Beispiel #2
0
 public async Task <M <Source> > TryGetSourceAsync(ModelPaths modelPaths, DataNodeName nodeName) =>
 await parserService.GetSourceAsync(modelPaths, nodeName);
Beispiel #3
0
 public void Set(DataNodeName val, int data)
 {
     this.name = val;
     this.x    = data;
 }
Beispiel #4
0
 public DataNode(DataNodeName val, int data)
 {
     this.Set(val, data);
 }