コード例 #1
0
ファイル: LiveRunner.cs プロジェクト: junmendoza/designscript
            private void ReportRuntimeWarnings(string code, SynchronizeData syncDataReturn, Dictionary<uint, string> modifiedGuidList, ref GraphUpdateReadyEventArgs retArgs)
            {
                //GraphUpdateReadyEventArgs retArgs = null;

                if (runner.runnerCore.RuntimeStatus.Warnings.Count > 0)
                {
                    if(retArgs == null)
                        retArgs = new GraphUpdateReadyEventArgs(syncDataReturn);

                    foreach (var err in runner.runnerCore.RuntimeStatus.Warnings)
                    {
                        string msg = err.message;
                        int lineNo = err.Line;

                        // TODO: How can the lineNo be invalid ?
                        if (lineNo == ProtoCore.DSASM.Constants.kInvalidIndex)
                        {
                            retArgs.Warnings.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = 0 });
                            continue;
                        }

                        string varName = GetVarNameFromCode(lineNo, code);

                        foreach (var kvp in modifiedGuidList)
                        {
                            // Get the uid recognized by the graphIDE
                            uint guid = kvp.Key;
                            string name = kvp.Value;
                            if(name.Equals(varName))
                            {
                                retArgs.Warnings.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id =  runner.graphCompiler.GetRealUID(guid)});
                                break;
                            }
                        }

                        if (retArgs.Warnings.Count == 0)
                        {
                            LogWarningsFromInputNodes(retArgs, varName, msg);
                        }
                    }
                }
            }
コード例 #2
0
ファイル: LiveRunner.cs プロジェクト: junmendoza/designscript
            private void ReportErrors(string code, SynchronizeData syncDataReturn, Dictionary<uint, string> modifiedGuidList, ref GraphUpdateReadyEventArgs retArgs)
            {
                Dictionary<ulong, ProtoCore.Core.ErrorEntry> errorMap = runner.runnerCore.LocationErrorMap;

                if (errorMap.Count == 0)
                    return;

                retArgs = new GraphUpdateReadyEventArgs(syncDataReturn);
                foreach (var kvp in errorMap)
                {
                    ProtoCore.Core.ErrorEntry err = kvp.Value;
                    string msg = err.Message;
                    int lineNo = err.Line;

                    // If error is a Build error
                    if (err.BuildId != ProtoCore.BuildData.WarningID.kDefault)
                    {
                        // Error comes from imported DS file
                        if (!string.IsNullOrEmpty(err.FileName))
                        {
                            msg += " At line " + err.Line + ", column " + err.Col + ", in " + Path.GetFileName(err.FileName);
                            if (err.Type == ProtoCore.Core.ErrorType.Error)
                            {
                                retArgs.Errors.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = 0 });
                            }
                            else if (err.Type == ProtoCore.Core.ErrorType.Warning)
                            {
                                retArgs.Warnings.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = 0 });
                            }
                            continue;
                        }

                    }

                    string varName = GetVarNameFromCode(lineNo, code);

                    // Errors
                    if (err.Type == ProtoCore.Core.ErrorType.Error)
                    {
                        // TODO: How can the lineNo be invalid ?
                        if (lineNo == ProtoCore.DSASM.Constants.kInvalidIndex || varName == null)
                        {
                            retArgs.Errors.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = 0 });
                            continue;
                        }

                        foreach (var pair in runner.graphCompiler.mapModifiedName)
                        {
                            string name = pair.Key;
                            if (name.Equals(varName))
                            {
                                uint guid = pair.Value;
                                retArgs.Errors.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = runner.graphCompiler.GetRealUID(guid) });
                                break;
                            }

                        }
                    }
                    else if(err.Type == ProtoCore.Core.ErrorType.Warning) // Warnings
                    {
                        // TODO: How can the lineNo be invalid ?
                        if (lineNo == ProtoCore.DSASM.Constants.kInvalidIndex || varName == null)
                        {
                            retArgs.Warnings.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = 0 });
                            continue;
                        }

                        foreach (var pair in modifiedGuidList)
                        {
                            // Get the uid recognized by the graphIDE
                            string name = pair.Value;
                            if (name.Equals(varName))
                            {
                                uint guid = pair.Key;
                                retArgs.Warnings.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = runner.graphCompiler.GetRealUID(guid) });
                                break;
                            }
                        }
                        if (retArgs.Warnings.Count == 0)
                        {
                            foreach (var pair in runner.graphCompiler.mapModifiedName)
                            {
                                string name = pair.Key;
                                if (name.Equals(varName))
                                {
                                    uint guid = pair.Value;
                                    retArgs.Warnings.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = runner.graphCompiler.GetRealUID(guid) });
                                    break;
                                }
                            }
                        }
                    }
                }
            }
コード例 #3
0
ファイル: LiveRunner.cs プロジェクト: junmendoza/designscript
 public UpdateGraphTask(SynchronizeData syncData, LiveRunner runner)
     : base(runner)
 {
     this.syncData = syncData;
 }
コード例 #4
0
ファイル: LiveRunner.cs プロジェクト: junmendoza/designscript
            private void ReportBuildErrorsAndWarnings(string code, SynchronizeData syncDataReturn, Dictionary<uint, string> modifiedGuidList, ref GraphUpdateReadyEventArgs retArgs)
            {
                //GraphUpdateReadyEventArgs retArgs = null;
                if (runner.compileState.BuildStatus.ErrorCount > 0)
                {
                    retArgs = new GraphUpdateReadyEventArgs(syncDataReturn);

                    foreach (var err in runner.compileState.BuildStatus.Errors)
                    {
                        string msg = err.Message;
                        int lineNo = err.Line;

                        // TODO: How can the lineNo be invalid ?
                        if (lineNo == ProtoCore.DSASM.Constants.kInvalidIndex)
                        {
                            retArgs.Errors.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = 0 });
                            continue;
                        }

                        string varName = GetVarNameFromCode(lineNo, code);

                        foreach (var ssnode in syncData.AddedNodes)
                        {
                            if (ssnode.Content.Contains(varName))
                            {
                                uint id = ssnode.Id;

                                retArgs.Errors.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = id });
                                break;
                            }
                        }
                        if (retArgs.Errors.Count == 0)
                        {
                            foreach (var ssnode in syncData.ModifiedNodes)
                            {
                                if (ssnode.Content.Contains(varName))
                                {
                                    uint id = ssnode.Id;

                                    retArgs.Errors.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = id });
                                    break;
                                }
                            }
                        }
                    }
                }
                if (runner.compileState.BuildStatus.WarningCount > 0)
                {
                    if (retArgs == null)
                        retArgs = new GraphUpdateReadyEventArgs(syncDataReturn);

                    foreach (var warning in runner.compileState.BuildStatus.Warnings)
                    {
                        string msg = warning.msg;
                        int lineNo = warning.line;

                        // TODO: How can the lineNo be invalid ?
                        if (lineNo == ProtoCore.DSASM.Constants.kInvalidIndex)
                        {
                            retArgs.Warnings.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = 0 });
                            continue;
                        }

                        string varName = GetVarNameFromCode(lineNo, code);

                        // This array should be empty for Build errors

                        /*foreach (var ssnode in syncDataReturn.ModifiedNodes)
                        {
                            if(ssnode.Content.Contains(varName))
                            {
                                uint id = ssnode.Id;

                                retArgs.Warnings.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = id });
                                break;
                            }
                        }*/
                        foreach (var kvp in modifiedGuidList)
                        {
                            // Get the uid recognized by the graphIDE
                            uint guid = kvp.Key;
                            string name = kvp.Value;
                            if (name.Equals(varName))
                            {
                                retArgs.Warnings.Add(new GraphUpdateReadyEventArgs.ErrorObject { Message = msg, Id = runner.graphCompiler.GetRealUID(guid) });
                                break;
                            }
                        }

                        if(retArgs.Warnings.Count == 0)
                        {
                            LogWarningsFromInputNodes(retArgs, varName, msg);
                        }

                    }
                }
            }
コード例 #5
0
ファイル: LiveRunner.cs プロジェクト: TheChosen0ne/Dynamo
            private SynchronizeData CreateSynchronizeDataForGuidList(Dictionary<uint, string> modfiedGuidList)
            {
                Dictionary<uint, SnapshotNode> modifiedGuids = new Dictionary<uint, SnapshotNode>();
                SynchronizeData syncDataReturn = new SynchronizeData();

                if (modfiedGuidList != null)
                {
                    //foreach (uint guid in modfiedGuidList)
                    foreach (var kvp in modfiedGuidList)
                    {
                        // Get the uid recognized by the graphIDE
                        uint guid = kvp.Key;
                        string name = kvp.Value;
                        SnapshotNode sNode = new SnapshotNode(this.graphCompiler.GetRealUID(guid), SnapshotNodeType.Identifier, name);
                        if (!modifiedGuids.ContainsKey(sNode.Id))
                        {
                            modifiedGuids.Add(sNode.Id, sNode);
                        }
                    }

                    foreach (KeyValuePair<uint, SnapshotNode> kvp in modifiedGuids)
                        syncDataReturn.ModifiedNodes.Add(kvp.Value);
                }

                return syncDataReturn;
            }