コード例 #1
0
        /// <summary>
        /// Occurs when the time ComboBox is changed from selection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbTime_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (this.cbTime.SelectedIndex)
            {
            case 0:
                //Selected "Constant Value"
                this.nudTime.Enabled = true;
                break;

            case 1:
                //Selected "Create New variable"
                this.nudTime.Enabled = false;
                NewVariableForm newVariableForm = new NewVariableForm();
                if (DialogResult.OK == newVariableForm.ShowDialog())
                {
                    //The new variable is created, added to this form and selected with the ComboBox
                    GraphManager.AddVariable(newVariableForm.VariableCreated);
                    this.AddVariable(newVariableForm.VariableCreated);
                    this.cbTime.SelectedItem = newVariableForm.VariableCreated.Name;
                }
                else
                {
                    //If the variable has not been created an Undo of the control is produced to replace the previous value
                    this.cbTime.Undo();
                }
                break;

            default:
                //Selected a variable "xxxx"
                this.nudTime.Enabled = false;
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Returns a project manager based on a draft file
        /// </summary>
        /// <param name="projectFile">Project File</param>
        /// <returns>Project Manager</returns>
        public static ProjectManager GetManager(string projectFile)
        {
            ProjectManager projectManager = null;

            XmlDocument document = new XmlDocument();

            document.Load(projectFile);
            XmlNodeList projectProp = document.GetElementsByTagName("mowayProject");

            if ((projectProp.Count == 1) && (projectProp[0].FirstChild.Name == "type"))
            {
                switch (projectProp[0].FirstChild.InnerText)
                {
                case "graphic":
                    projectManager = GraphManager.GetManager();
                    break;

                default:
                    throw new ProjectException("Error al abrir el proyecto");
                }
            }
            else
            {
                throw new ProjectException("Error al abrir el proyecto");
            }
            return(projectManager);
        }
コード例 #3
0
        protected override void SaveSettings()
        {
            ObstacleSensor sensor = ObstacleSensor.Right;

            if (this.rbUpperRightSensor.Checked)
            {
                sensor = ObstacleSensor.UpperRight;
            }
            else if (this.rbLeftSensor.Checked)
            {
                sensor = ObstacleSensor.Left;
            }
            else if (this.rbUpperLeftSensor.Checked)
            {
                sensor = ObstacleSensor.UpperLeft;
            }
            ComparativeOp operation = (ComparativeOp)Enum.ToObject(typeof(ComparativeOp), this.cbOperator.SelectedIndex);
            Variable      variable  = null;
            int           value     = 0;

            if (this.cbCompareVariable.SelectedIndex != 0)
            {
                variable = GraphManager.GetVariable(this.cbCompareVariable.SelectedItem.ToString());
            }
            else
            {
                value = (int)this.nudCompareValue.Value;
            }
            this.action.UpdateSettings(sensor, operation, variable, value);
        }
コード例 #4
0
ファイル: NodeGraphManager.cs プロジェクト: sm6uax/plegma
        //------------------------------------------------------------------------------------------------------------------------
        #endregion


        #region Constructors
        //------------------------------------------------------------------------------------------------------------------------
        public NodeGraphManager(IEnumerable <Type> BlockLibrarians)
        {
            //keep
            this.BlockLibrarians = BlockLibrarians.ToArray();

            //Create Graph Manager
            _GraphManager = new GraphManager(Residency.Node)
            {
                Name = "NodeLibrary Graph Manager"
            };
            //Setup GraphManager
            GraphManager.Loader = OnGraphLoadReq;
            GraphManager.Saver  = GraphSaveReq;

            //initialize librarians
            if (this.BlockLibrarians != null && this.BlockLibrarians.Length > 0)
            {
                //add librarians to graph manager
                GraphManager.AddLibrarians(this.BlockLibrarians);

                //setup basic librarian
                GraphManager.GetLibrarian <Logic.BlockLibrary.Basic.Librarian>().VirtualOutputMsgHandler      = VirtualOutputMsgHandler;
                GraphManager.GetLibrarian <Logic.BlockLibrary.Basic.Librarian>().VirtualOutputBatchMsgHandler = VirtualOutputBatchMsgHandler;
            }
        }
コード例 #5
0
        private void CbOperand_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (this.cbOperand.SelectedIndex)
            {
            case 0:
                this.nudOperandValue.Enabled = true;
                break;

            case 1:
                this.nudOperandValue.Enabled = false;
                NewVariableForm newVariableForm = new NewVariableForm();
                if (DialogResult.OK == newVariableForm.ShowDialog())
                {
                    GraphManager.AddVariable(newVariableForm.VariableCreated);
                    this.AddVariable(newVariableForm.VariableCreated);
                    this.cbOperand.SelectedItem = newVariableForm.VariableCreated.Name;
                }
                else
                {
                    this.cbOperand.Undo();
                }
                break;

            default:
                this.nudOperandValue.Enabled = false;
                break;
            }
        }
コード例 #6
0
ファイル: AssemblyGraph.cs プロジェクト: Azarem/RogueLauncher
 private void DefineCode(GraphManager translator)
 {
     foreach (var m in _modules)
     {
         m.DefineCode(translator);
     }
 }
コード例 #7
0
        public WsnProtocolAdapter(PiraeusConfig config, GraphManager graphManager, IChannel channel, HttpContext context, ILog logger = null)
        {
            this.config       = config;
            this.graphManager = graphManager;
            this.Channel      = channel;
            this.logger       = logger;

            IdentityDecoder decoder = new IdentityDecoder(config.ClientIdentityNameClaimType, context, config.GetClientIndexes());

            identity     = decoder.Id;
            localIndexes = decoder.Indexes;

            MessageUri messageUri = new MessageUri(context.Request);

            this.contentType   = messageUri.ContentType;
            this.cacheKey      = messageUri.CacheKey;
            this.resource      = messageUri.Resource;
            this.subscriptions = messageUri.Subscriptions != null ? new List <string>(messageUri.Subscriptions) : null;
            this.indexes       = messageUri.Indexes != null ? new List <KeyValuePair <string, string> >(messageUri.Indexes) : null;

            auditFactory = AuditFactory.CreateSingleton();
            if (config.AuditConnectionString != null && config.AuditConnectionString.Contains("DefaultEndpointsProtocol"))
            {
                auditFactory.Add(new AzureTableAuditor(config.AuditConnectionString, "messageaudit"), AuditType.Message);
                auditFactory.Add(new AzureTableAuditor(config.AuditConnectionString, "useraudit"), AuditType.User);
            }
            else if (config.AuditConnectionString != null)
            {
                auditFactory.Add(new FileAuditor(config.AuditConnectionString), AuditType.Message);
                auditFactory.Add(new FileAuditor(config.AuditConnectionString), AuditType.User);
            }

            messageAuditor = auditFactory.GetAuditor(AuditType.Message);
            userAuditor    = auditFactory.GetAuditor(AuditType.User);
        }
コード例 #8
0
    void Start()
    {
        string statsUser = PlayerPrefs.GetString("statsUser");

        usernameText.text = statsUser + "'s Statistics";

        GraphManager  graphManager = GetComponent <GraphManager>();
        List <string> timestamps   = graphManager.GetDataTimeStamps(statsUser);

        timestampDropdown.options.Clear();
        foreach (string timestamp in timestamps)
        {
            timestampDropdown.options.Add(new Dropdown.OptionData()
            {
                text = timestamp
            });
        }

        //graphManager.ChangeSimulation(timestamps[0]);

        // chartTypeDropdown.options.Clear();
        // chartTypeDropdown.options.Add (new Dropdown.OptionData() {text="hi2"});

        reportsPopup = GameObject.Find("Reports-Popup(Clone)");
        reportsPopup.SetActive(false);
    }
コード例 #9
0
ファイル: TestForm.cs プロジェクト: GHh0stEx/CFG
        public TestForm()
        {
            InitializeComponent();

            #region Graph
            graph = new CFGraph(PB_Graph, 40);

            string cCode = "int main() {\n\tint abc; switch(abc) { case 1:{i++;break;} case 2:{i++;break;} default:{asd--;break;} } \n\treturn 0; }\n";
            //string cCode = "if (true) printf(\"k\"); else { printf(\"no\"); cout << \"awsm\"; }";
            //string cCode = "while (true) { ok1(); ok2();  goto someLBL; DEADStatement;  someLBL:   stat1; stat2;}";
            //string cCode = "while (true) {switch (c) {	case 1: break;	case 2: continue;	}	break;}";

            CFGParserWrapper.SetCodeToParse(cCode);

            GraphManager.BuildGraph(graph, CFGParserWrapper.GetPairs());
            #endregion

            #region Code
            int offsetV = 40;

            master = new ProgramTextMaster(PB_Code, CFGParserWrapper.GetParsedCode(),
                                           new ProgramTextBrushes(Brushes.Black, Brushes.DarkRed, Brushes.DarkGray));
            master.CreateProgramText(offsetV);
            #endregion
        }
コード例 #10
0
        public void TranslateTypes(GraphManager t, Type[] newGenerics = null)
        {
            if (_noBody)
            {
                return;
            }

            //Translate local variables
            foreach (var l in _locals)
            {
                l.Type = t.GetType(l.Type, newGenerics);
            }

            //Translate exception types
            foreach (var e in _exceptionBlocks)
            {
                e.CatchType = t.GetType(e.CatchType, newGenerics);
            }

            //Translate instruction types
            foreach (var i in _instructions)
            {
                i.TranslateOperand(t, newGenerics);
            }
        }
コード例 #11
0
ファイル: Module.cs プロジェクト: NKnusperer/Delta.Console
        /// <summary>
        /// Constructor for this module, will be child of the Application module to
        /// be executed as part of the Application.Run.
        /// </summary>
        /// <param name="bindConsole">The button to open and close the console</param>
        /// <param name="consoleMargin">The space between the screenspace and the console. Pass NULL to use the default value.</param>
        /// <param name="consoleBackground">The console background color or material. Pass NULL to use the default value.</param>
        /// <param name="consoleFontColor">The color for the font to display text. Pass NULL to use the default value.</param>
        /// <param name="maxNumberOfLines">The max. number of lines that will be displayed befor the oldest entry will be deleted. Pass NULL to use the default value.</param>
        public Module(InputButton bindConsoleButton, Margin consoleMargin, Material2DColored consoleBackground, Color consoleFontColor, int? maxNumberOfLines )
            : base("Delta.Console", typeof(Application))
        {

            if (consoleMargin.Left == 0 && consoleMargin.Top == 0 && consoleMargin.Right == 0)
            {
                consoleMargin = new Margin() { Left = 0.01f, Top = 0.01f, Right = 0.02f };
            }

            if (consoleBackground == null)
            {
                consoleBackground = new Material2DColored(new Color(new Color(0, 167, 255), 0.5f));
            }

            if (consoleFontColor.PackedRGBA == 0)
            {
                consoleFontColor = new Color(200, 220, 255);
            }

            if (maxNumberOfLines == null)
            {
                maxNumberOfLines = 20;
            }

            // Initialize
            console = new Delta.Console.Console(bindConsoleButton, consoleMargin, consoleBackground, consoleFontColor, (int)maxNumberOfLines);
            graph = new GraphManager();

            // Add command to the console to enable or disable the graph
            console.AddCmdToConsole(typeof(Module).GetMethod("SetGraphState"), this);
        }
コード例 #12
0
        protected override void SaveSettings()
        {
            Variable frequencyVariable = null;
            decimal  frequencyValue    = 244.14M;

            if (this.cbFrequency.SelectedIndex != 0)
            {
                frequencyVariable = GraphManager.GetVariable(this.cbFrequency.SelectedItem.ToString());
            }
            else
            {
                frequencyValue = this.nudFrequency.Value;
            }

            FlowchartControl flowchartControl = FlowchartControl.Continuously;
            Variable         timeVariable     = null;
            Decimal          timeValue        = 0.1M;
            bool             waitFinish       = false;

            if (this.rbTime.Checked)
            {
                flowchartControl = FlowchartControl.FinishTime;
                if (this.cbTime.SelectedIndex != 0)
                {
                    timeVariable = GraphManager.GetVariable(this.cbTime.SelectedItem.ToString());
                }
                else
                {
                    timeValue = this.nudTime.Value;
                }
            }
            waitFinish = this.cbFinishCommands.Checked;

            this.action.UpdateSettings(frequencyVariable, frequencyValue, flowchartControl, timeVariable, timeValue, waitFinish);
        }
コード例 #13
0
 private void CbResult_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.cbResult.SelectedIndex >= 1)
     {
         this.bSave.Enabled = true;
     }
     else
     {
         this.bSave.Enabled = false;
     }
     if (this.cbResult.SelectedIndex == 0)
     {
         NewVariableForm newVariableForm = new NewVariableForm();
         if (DialogResult.OK == newVariableForm.ShowDialog())
         {
             GraphManager.AddVariable(newVariableForm.VariableCreated);
             this.AddVariable(newVariableForm.VariableCreated);
             this.cbResult.SelectedItem = newVariableForm.VariableCreated.Name;
         }
         else
         {
             this.cbResult.Undo();
         }
     }
 }
コード例 #14
0
        public void LinkManager(object sender, EventArgs e)
        {
            GraphManagerInterface = core.Initialize(Visualizer);
            manager = new GraphManager(GraphManagerInterface, Graphs);

            manager.Initialize();
        }
コード例 #15
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(this);
        }

        for (int i = 1; i < primaryPathSize - 1; ++i)
        {
            currentSecPathPoss.Add(i);
        }

        InitGraph(); // graph main path

        subPathsCount = Mathf.FloorToInt(primaryPathSize / 3);

        // creates sub paths automatically depending on the main path length
        while (currentSecPathPoss.Count > 2)
        {
            CreateSubPath();
        }
        // manual input

        /*for (int i = 0; i < subPathsCount; i++)
         * {
         *  CreateSubPath();
         * }*/

        PrintGraph();
    }
コード例 #16
0
ファイル: NodeGraphManager.cs プロジェクト: sm6uax/plegma
        //------------------------------------------------------------------------------------------------------------------------
        public void Initialize(Node ParentNode)
        {
            try
            {
                lock (locker)
                {
                    //check
                    if (IsInitialized)
                    {
                        return;
                    }

                    //keep
                    this._Node = ParentNode;

                    //hook on nodediscovery module
                    if (Node.NodeDiscovery != null)
                    {
                        Node.NodeDiscovery.OnVBMReceived += NodeDiscovery_OnVBMReceived;
                    }

                    //start
                    GraphManager.Start();

                    //register for thing solve
                    YEventRouter.EventRouter.AddEventHandler <Logic.Blocks.Things.EvThingSolved>(OnThingSolvedCb, 100);

                    //set flag
                    IsInitialized = true;
                }
            }
            catch (Exception ex) { DebugEx.Assert(ex); }
        }
コード例 #17
0
        public static void Process(GraphManager manager)
        {
            var graph = manager.Graph.Modules.SelectMany(x => x.TypeGraphs.Where(y => y.FullName == "RogueCastle.Program")).Single();
            var main  = graph.Methods.Single(x => x.Name == "Main");

            //Pull out Steam app ID
            var instr = main.InstructionList;
            int ix    = 0;
            int count = instr.Count;

            while (ix < count)
            {
                var i = instr[ix] as MethodInstruction;
                if (i != null && i.Operand.DeclaringType.Name == "SWManager" && i.Operand.Name == "init")
                {
                    Environment.SetEnvironmentVariable("SteamAppId", instr[ix - 1].RawOperand.ToString());
                    //RogueLauncher.Program.SteamAppId = (int)instr[ix - 1].RawOperand;
                    //PInvoke.SetEnvironmentVariable("SteamAppId", RogueLauncher.Program.SteamAppId.ToString());
                    break;
                }
                ix++;
            }

            //main.InstructionList[5].OpCode = OpCodes.Ldc_I4_1;

            //var inst = main.InstructionList.First(x => x.OpCode == OpCodes.Ldsfld && x is FieldInstruction && ((FieldInstruction)x).Operand.Name == "CREATE_RETAIL_VERSION");
            //inst.Replace(new InstructionBase() { OpCode = OpCodes.Ldc_I4_0 });
        }
コード例 #18
0
ファイル: NodeGraphManager.cs プロジェクト: sm6uax/plegma
        //------------------------------------------------------------------------------------------------------------------------
        public void DeInitialize()
        {
            try
            {
                lock (locker)
                {
                    //check
                    if (!IsInitialized)
                    {
                        return;
                    }

                    //set flag
                    IsInitialized = false;

                    //unhook on nodediscovery module
                    if (Node.NodeDiscovery != null)
                    {
                        Node.NodeDiscovery.OnVBMReceived -= NodeDiscovery_OnVBMReceived;
                    }

                    //start
                    GraphManager.Stop();

                    //register for thing solve
                    YEventRouter.EventRouter.RemoveEventHandler <Logic.Blocks.Things.EvThingSolved>(OnThingSolvedCb);
                }
            }
            catch (Exception ex) { DebugEx.Assert(ex); }
        }
コード例 #19
0
ファイル: AssemblyGraph.cs プロジェクト: Azarem/RogueLauncher
        public AssemblyBuilder Rebuild(GraphManager translator, string fileName, bool debug = false)
        {
            //Create assembly / modules / types
            //Create members
            //Define all

            _fileName = fileName;

            if (debug)
            {
                var debugAttr = _customAttributes.FirstOrDefault(x => x.Constructor.DeclaringType == typeof(DebuggableAttribute));
                if (debugAttr != null)
                {
                    _customAttributes.Remove(debugAttr);
                }

                _customAttributes.Add(debugAttr = new CustomAttributeGraph()
                {
                    Constructor = typeof(DebuggableAttribute).GetConstructor(new Type[] { typeof(DebuggableAttribute.DebuggingModes) })
                });
                debugAttr.ConstructorArguments.Add(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints);
            }

            CreateBuilders(translator, debug);
            DefineMembers(translator);
            DefineCode(translator);
            CreateTypes();

            _builder.SetEntryPoint((MethodInfo)translator.GetMethod(_sourceObject.EntryPoint), PEFileKinds.WindowApplication);

            //TranslateTypes(translator);

            return(_builder);
        }
コード例 #20
0
        public static ValidatorResult Validate(bool publish, EventMetadata metadata, IChannel channel,
                                               GraphManager graphManager, HttpContext context = null)
        {
            metadataHandlers ??= new List <MetadataHandler>();
            policyHandlers ??= new List <PolicyHandler>();
            Init();

            int             index  = 0;
            bool            result = true;
            ValidatorResult vr     = null;

            while (result && index < metadataHandlers.Count)
            {
                vr     = metadataHandlers[index].Invoke(metadata, channel.IsEncrypted);
                result = vr.Validated;
                index++;
            }

            AuthorizationPolicy policy = graphManager
                                         .GetAccessControlPolicyAsync(publish
                    ? metadata.PublishPolicyUriString
                    : metadata.SubscribePolicyUriString).GetAwaiter().GetResult();
            ClaimsIdentity identity = context == null
                ? Thread.CurrentPrincipal.Identity as ClaimsIdentity
                : new ClaimsIdentity(context.User.Claims);

            index = 0;
            while (result && index < policyHandlers.Count)
            {
                vr = policyHandlers[index].Invoke(policy, identity);
                index++;
            }

            return(vr);
        }
コード例 #21
0
        public async Task <string> SubscribeAsync(string resourceUriString, SubscriptionMetadata metadata)
        {
            metadata.IsEphemeral = true;
            string subscriptionUriString = await GraphManager.SubscribeAsync(resourceUriString, metadata);

            //create and observer and wire up event to receive notifications
            MessageObserver observer = new MessageObserver();

            observer.OnNotify += Observer_OnNotify;

            //set the observer in the subscription with the lease lifetime
            TimeSpan leaseTime = TimeSpan.FromSeconds(20.0);

            string leaseKey = await GraphManager.AddSubscriptionObserverAsync(subscriptionUriString, leaseTime, observer);

            //add the lease key to the list of ephemeral observers
            ephemeralObservers.Add(subscriptionUriString, observer);

            //add the resource, subscription, and lease key the container
            if (!container.ContainsKey(resourceUriString))
            {
                container.Add(resourceUriString, new Tuple <string, string>(subscriptionUriString, leaseKey));
            }

            //ensure the lease timer is running
            EnsureLeaseTimer();

            return(subscriptionUriString);
        }
コード例 #22
0
        public async Task PublishAsync(EventMessage message, List <KeyValuePair <string, string> > indexes = null)
        {
            AuditRecord record      = null;
            DateTime    receiveTime = DateTime.UtcNow;

            try
            {
                record = new MessageAuditRecord(message.MessageId, identity, channelType, protocolType.ToUpperInvariant(), message.Message.Length, MessageDirectionType.In, true, receiveTime);

                if (indexes == null || indexes.Count == 0)
                {
                    await GraphManager.PublishAsync(message.ResourceUri, message);
                }
                else
                {
                    await GraphManager.PublishAsync(message.ResourceUri, message, indexes);
                }
            }
            catch (Exception ex)
            {
                record = new MessageAuditRecord(message.MessageId, identity, channelType, protocolType.ToUpperInvariant(), message.Message.Length, MessageDirectionType.In, false, receiveTime, ex.Message);
            }
            finally
            {
                if (message.Audit)
                {
                    await auditor?.WriteAuditRecordAsync(record);
                }
            }
        }
コード例 #23
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.Escape))
     {
         GraphManager.MyQuit();
     }
 }
コード例 #24
0
 public DebugManager(Game game, Camera camera, ChunkCache chunkCache, SpriteFont debugFont)
     : base(game)
 {
     m_graphs = new GraphManager(game);
     m_debugger = new InGameDebugger(game, camera);
     var statistics = new Statistics(game, chunkCache);
     m_components = new GameComponentCollection
     {
         m_debugger,
         new DebugBar(game, statistics, chunkCache),
         statistics,
         m_graphs,
         new GameConsole(game,  new SpriteBatch(game.GraphicsDevice), new GameConsoleOptions
         {
             Font = debugFont,
             FontColor = Color.LawnGreen,
             Prompt = ">",
             PromptColor = Color.Crimson,
             CursorColor = Color.OrangeRed,
             BackgroundColor = Color.Black*0.8f,
             PastCommandOutputColor = Color.Aqua,
             BufferColor = Color.Gold
         }, m_debugger.ToggleInGameDebugger)
     };
 }
コード例 #25
0
        // Main constructor that initializes everything except window
        public Algorithm(CitiesLocations _citiesLocations, CitiesConnections _citiesConnectios,
                         City _startCity, City _finalCity, Alg_Speed _algSpeed, Heuristic _algHeuristic,
                         ref GraphLayoutCity _graphLayout, ref TextBox _textBoxLog,
                         ResourceDictionary _resourceDictionary, GraphManager _graphManager)
        {
            citiesLocations   = _citiesLocations;
            citiesConnecitons = _citiesConnectios;

            StartCity = _startCity;
            FinalCity = _finalCity;

            AlgSpeed     = _algSpeed;
            AlgHeuristic = _algHeuristic;

            graphLayout        = _graphLayout;
            textBoxLog         = _textBoxLog;
            resourceDictionary = _resourceDictionary;

            IsRunning = false;

            Window = null;

            CanContinue = false;

            graphManager = _graphManager;
        }
コード例 #26
0
 /// <summary>
 /// 刷新子绘图连接线的数据
 /// </summary>
 /// <param name="innerChart">子绘图</param>
 protected virtual void RefreshInnerChartLine(InnerChart innerChart)
 {
     DocumentManager  documentManager  = DocumentManager.GetDocumentManager();
     FlowChartManager flowChartManager = documentManager.CurrentFlowChartManager;
     GraphManager     graphManager     = flowChartManager.CurrentGraphManager;
     DataManager      dataManager      = flowChartManager.CurrentDataManager;
 }
コード例 #27
0
        /// <summary>
        /// 弹出右键菜单
        /// </summary>
        /// <param name="flowChartManager">绘图管理器</param>
        /// <param name="logicData">逻辑数据</param>
        /// <returns>是否操作成功</returns>
        protected virtual bool LogicPopUpMenuStrip(FlowChartManager flowChartManager, object logicData)
        {
            Point           popUpLocation   = (Point)logicData;
            DocumentManager documentManager = DocumentManager.GetDocumentManager();
            GraphManager    graphManager    = flowChartManager.CurrentGraphManager;

            if (graphManager.SelectedGraphElement is SlotContainer) // 有AI插槽容器被选中
            {
                editMenu.Popup(popUpLocation);
            }
            else if (graphManager.SelectedGraphElement == null) // 没有选中任何图元
            {
                if (documentManager.CopyTable != null)
                {
                    canvasMenu.SubItems["bPasteGraphElement"].Enabled = true;
                }
                else
                {
                    canvasMenu.SubItems["bPasteGraphElement"].Enabled = false;
                }

                if (flowChartManager.MapName == "子绘图") // 子绘图不允许重设图元ID
                {
                    canvasMenu.SubItems["bResetGraphElementID"].Enabled = false;
                }
                else
                {
                    canvasMenu.SubItems["bResetGraphElementID"].Enabled = true;
                }

                canvasMenu.Popup(popUpLocation);
            }

            return(true);
        }
コード例 #28
0
        protected override void SaveSettings()
        {
            AccelerometerAxis axis = AccelerometerAxis.X;

            if (this.rbYAxis.Checked)
            {
                axis = AccelerometerAxis.Y;
            }
            else if (this.rbZAxis.Checked)
            {
                axis = AccelerometerAxis.Z;
            }
            ComparativeOp operation = (ComparativeOp)Enum.ToObject(typeof(ComparativeOp), this.cbOperator.SelectedIndex);
            Variable      variable  = null;
            decimal       value     = 0;

            if (this.cbCompareVariable.SelectedIndex != 0)
            {
                variable = GraphManager.GetVariable(this.cbCompareVariable.SelectedItem.ToString());
            }
            else
            {
                value = this.nudCompareValue.Value;
            }
            this.action.UpdateSettings(axis, operation, variable, value);
        }
コード例 #29
0
ファイル: CheckCircleForm.cs プロジェクト: uvbs/FullSource
        private List <List <SlotContainer> > circleList; // 当前循环的圈


        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="graphManager">绘图管理器</param>
        /// <param name="circleList">当前循环的圈</param>
        public CheckCircleForm(GraphManager graphManager, List <List <SlotContainer> > circleList)
        {
            this.graphManager = graphManager;
            this.circleList   = circleList;
            InitializeComponent();
            Init();
        }
コード例 #30
0
        public static async Task Configure()
        {
            if (IsConfigured)
            {
                return;
            }

            if (Orleans.GrainClient.IsInitialized)
            {
                List <Claim> claimSet = await GraphManager.GetServiceIdentityClaimsAsync();

                X509Certificate2 cert = await GraphManager.GetServiceIdentityCertificateAsync();

                IsConfigured = cert != null || claimSet != null;

                if (!IsConfigured)
                {
                    IEnumerable <Claim> claimArray = Piraeus.Configuration.PiraeusConfigManager.Settings.Identity.Service.Claims;
                    cert = Piraeus.Configuration.PiraeusConfigManager.Settings.Security.Service.Certificate;
                    List <Claim> claimList = claimArray != null ? new List <Claim>(claimArray) : null;
                    await GraphManager.SetServiceIdentityAsync(claimList, cert);

                    IsConfigured = true;
                }
            }
        }
コード例 #31
0
	// Use this for initialization
	void Awake() {
		enemyUnits = new List<Unit>();
		allyUnits = new List<Unit>();

        parent = gameObject;

		enemyUnitObjects = GameObject.Find("Enemy Units");
		allyUnitObjects = GameObject.Find("Ally Units");
		enemyUnitObjects.transform.parent = parent.transform;
		allyUnitObjects.transform.parent = parent.transform;

        pathManager = new GraphManager(parent);
        pathFinder = pathManager.getGraph();

        //TODO: Integrate PCG here
        //OR generate more spawns than needed and randomly select from generated spawn points.
        Vector2 topright = pathFinder.getTopRightBound();
        Vector2 botleft = pathFinder.getBottomLeftBound();
        Vector2 mid = topright - botleft;
        mid /= 3;
        KeyValuePair<List<Node>, List<Node>> spawnPoints = pathFinder.getSpawnPoints(topright - mid, botleft + mid, 5);

        for (int i = 0; i < spawnPoints.Key.Count; i++) {
            Node spawnEnemy = spawnPoints.Key[i];
            Node spawnAlly = spawnPoints.Value[i];

			addLongArmUnit(enemyUnits, enemyUnitObjects, "Enemy LongArm", spawnEnemy, true);
			addLongArmUnit(allyUnits, allyUnitObjects, "Ally LongArm", spawnAlly, false);
        }

        enemyUnits.Reverse();
        allyUnits.Reverse();

        turnManager = new TurnManager(pathFinder, allyUnits, enemyUnits);
	}
コード例 #32
0
ファイル: ModuleGraph.cs プロジェクト: Azarem/RogueLauncher
        internal void DeclareTypes(GraphManager translator, bool debug = false)
        {
            _builder = _parentObject.Builder.DefineDynamicModule(_name, _parentObject.FileName, debug);

            translator.SetModule(_sourceObject ?? _builder, _builder);
            translator.CurrentModuleBuilder = _builder;

            if (translator._staticImplCache.Count > 0)
            {
                var tGraph = new TypeGraph(null, null, this)
                {
                    Name       = "<ImplSplice>",
                    FullName   = "<ImplSplice>",
                    BaseType   = typeof(object),
                    Attributes = TypeAttributes.Sealed
                };

                foreach (var i in translator._staticImplCache)
                {
                    new MethodGraph(i, tGraph);
                }

                translator._staticImplCache.Clear();
            }

            foreach (var t in _typeGraphs)
            {
                t.DeclareType(translator);
            }
        }
コード例 #33
0
        public static ValidatorResult Validate(bool publish, string resourceUriString, IChannel channel,
                                               GraphManager graphManager, HttpContext context = null)
        {
            EventMetadata metadata = graphManager.GetPiSystemMetadataAsync(resourceUriString).GetAwaiter().GetResult();

            return(Validate(publish, metadata, channel, graphManager, context));
        }
コード例 #34
0
 //SQLLinker sqlinker = new SQLLinker();
 public SkillSimulatorMainGUI()
 {
     InitializeComponent();
     SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
     Graph = new GraphManager();
     menu = new MainMenu();
     PrevSelectedJob = SelectedJob = "";
 }
コード例 #35
0
 /// <summary>
 /// Lambda-distance calculation method.
 /// </summary>
 /// <param name="graph">
 /// Connections graph.
 /// </param>
 /// <param name="normalizedDistanceWeight">
 /// The normalized distance weight.
 /// </param>
 /// <param name="distanceWeight">
 /// The distance weight.
 /// </param>
 public void Calculate(GraphManager graph, double normalizedDistanceWeight, double distanceWeight)
 {
     for (int i = 0; i < graph.Connections.Count; i++)
     {
         graph.Connections[i].Lambda = Math.Pow(graph.Connections[i].Tau, normalizedDistanceWeight) *
                                  Math.Pow(graph.Connections[i].Distance, distanceWeight);
     }
 }
コード例 #36
0
 /// <summary>
 /// Local density of nodes in neighborhood of given pair of nodes calculation method.
 /// </summary>
 /// <param name="graph">
 /// Connections graph.
 /// </param>
 public void Calculate(GraphManager graph)
 {
     double tauMax = GetTauStarMax(graph.Connections);
     for (int i = 0; i < graph.Connections.Count; i++)
     {
         graph.Connections[i].Tau = graph.Connections[i].TauStar / tauMax;
     }
 }
コード例 #37
0
    void Start()
    {
        // have to use FindGameObjectWithTag instead of just Find because Unity dies trying to Find from this class...
        constraints = new ArrayList();
        GameObject globalObj = GameObject.FindGameObjectWithTag("GlobalTag");

        globalVals = globalObj.GetComponent("GlobalValues") as GlobalValues;
        graphManager = globalObj.GetComponent("GraphManager") as GraphManager;
    }
コード例 #38
0
 /// <summary>
 /// Local density of nodes in neighborhood of given pair of nodes calculation method.
 /// </summary>
 /// <param name="graph">
 /// Connections graph.
 /// </param>
 public void Calculate(GraphManager graph)
 {
     for (int i = 0; i < graph.Connections.Count; i++)
     {
         Connection connection = graph.Connections[i];
         double bMinimum = GetBMinimum(graph.Connections, graph.Elements.Count, connection.FirstElementIndex, connection.SecondElementIndex);
         connection.TauStar = connection.Distance / bMinimum;
     }
 }
コード例 #39
0
ファイル: FlowChartBaseCommand.cs プロジェクト: viticm/pap2
        protected FlowChartManager flowChartManager; // 流程图管理器实例

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="data">当前对象</param>
        /// <param name="description">命令的描述</param>
        public FlowChartBaseCommand(object data, string description):
            base(data, description)
        {
            graphManager = data as GraphManager;
            flowChartManager = graphManager.CurrentFlowChartManager;
            dataManager = flowChartManager.CurrentDataManager;
            documentManager = DocumentManager.GetDocumentManager();

            dataBeforeExecute = new SerialMemento();
            dataAfterExecute = new SerialMemento();
        }
コード例 #40
0
 /// <summary>
 /// Calculates euclidean distance, normalized euclidean distance, local nodes density,
 /// normalized local nodes density and lambda-distance.
 /// </summary>
 /// <param name="graph">
 /// Array of graph links.
 /// </param>
 /// <param name="normalizedDistanceWeight">
 /// The normalized distance weight.
 /// </param>
 /// <param name="distanceWeight">
 /// The distance weight.
 /// </param>
 public static void CalculateCharacteristic(GraphManager graph, double normalizedDistanceWeight, double distanceWeight)
 {
     ICalculator calculator = new LinearCalculator();
     calculator.Calculate(graph);
     calculator = new NormalizedLinearCalculator();
     calculator.Calculate(graph);
     calculator = new TauStarCalculator();
     calculator.Calculate(graph);
     calculator = new TauCalculator();
     calculator.Calculate(graph);
     var lambdaCalculator = new LambdaCalculator();
     lambdaCalculator.Calculate(graph, normalizedDistanceWeight, distanceWeight);
 }
コード例 #41
0
        /// <summary>
        /// The calculate.
        /// </summary>
        /// <param name="currentGraph">
        /// The current graph.
        /// </param>
        /// <param name="sourceGraph">
        /// The source graph.
        /// </param>
        /// <param name="powerWeight">
        /// The power weight.
        /// </param>
        /// <returns>
        /// The <see cref="double"/>.
        /// </returns>
        public static double Calculate(GraphManager currentGraph, GraphManager sourceGraph, double powerWeight)
        {
            double quality = Math.Pow(EquipotencyCalculator.Calculate(currentGraph), powerWeight);
            for (int i = 0; i < currentGraph.Connections.Count; i++)
            {
                // H is multiplied by lambda-distance of disconnected link
                if (currentGraph.Connections[i].Connected != sourceGraph.Connections[i].Connected)
                {
                    quality *= currentGraph.Connections[i].Lambda;
                }
            }

            return quality;
        }
コード例 #42
0
        /// <summary>
        /// Normalized euclidean distance calculation method.
        /// </summary>
        /// <param name="graph">
        /// Connections graph.
        /// </param>
        public void Calculate(GraphManager graph)
        {
            double diameter = GetDiameter(graph.Connections);
            if (Math.Abs(diameter - 0) < 0.00001)
            {
                return;
            }

            // Normalizing all distances to range (0;1]
            foreach (Connection connection in graph.Connections)
            {
                connection.NormalizedDistance = connection.Distance / diameter;
            }
        }
コード例 #43
0
        /// <summary>
        /// Euclidean distance calculation method.
        /// </summary>
        /// <param name="graph">
        /// Connections graph.
        /// </param>
        public void Calculate(GraphManager graph)
        {
            for (int i = 0; i < graph.Connections.Count; i++)
            {
                double distance = 0;

                for (int j = 0; j < graph.Elements[graph.Connections[i].FirstElementIndex].Content.Length; j++)
                {
                    double substraction = graph.Elements[graph.Connections[i].FirstElementIndex].Content[j] -
                                     graph.Elements[graph.Connections[i].SecondElementIndex].Content[j];

                    distance += substraction * substraction;
                }

                distance = Math.Sqrt(distance);
                graph.Connections[i].Distance = distance;
            }
        }
コード例 #44
0
        /// <summary>
        /// Equipotency calculation method.
        /// </summary>
        /// <param name="manager">
        /// Storage of graph nodes and connections.
        /// </param>
        /// <returns>
        /// Equipotency of sets.
        /// </returns>
        public static double Calculate(GraphManager manager)
        {
            // calculating nodes count in each group
            var taxonPower = new List<int>();
            for (int i = 0; i < manager.GetNextTaxonNumber(); i++)
            {
                taxonPower.Add(0);
            }

            for (int j = 0; j < manager.Elements.Count; j++)
            {
                int taxonNumber = manager.Elements[j].TaxonNumber;
                taxonPower[taxonNumber]++;
            }

            // calculating number of not empty groups
            int taxonCount = 0;
            for (int k = 0; k < taxonPower.Count; k++)
            {
                if (taxonPower[k] > 0)
                {
                    taxonCount++;
                }
            }

            // calculating equipotency of groups - h
            // groups count to the power of groups count.
            double h = Math.Pow(taxonCount, taxonCount);
            for (int m = 0; m < taxonPower.Count; m++)
            {
                if (taxonPower[m] != 0)
                {
                    // Elements count in group divided by elements count in whole graph.
                    h *= (double)taxonPower[m] / manager.Elements.Count;
                }
            }

            return h;
        }
コード例 #45
0
ファイル: NodeGraphManager.cs プロジェクト: yodiwo/plegma
        //------------------------------------------------------------------------------------------------------------------------
        #endregion


        #region Constructors
        //------------------------------------------------------------------------------------------------------------------------
        public NodeGraphManager(IEnumerable<Type> BlockLibrarians)
        {
            //keep
            this.BlockLibrarians = BlockLibrarians.ToArray();

            //Create Graph Manager
            _GraphManager = new GraphManager(Residency.Node) { Name = "NodeLibrary Graph Manager" };
            //Setup GraphManager
            GraphManager.Loader = OnGraphLoadReq;
            GraphManager.Saver = GraphSaveReq;

            //initialize librarians
            if (this.BlockLibrarians != null && this.BlockLibrarians.Length > 0)
            {
                //add librarians to graph manager
                GraphManager.AddLibrarians(this.BlockLibrarians);

                //setup basic librarian
                GraphManager.GetLibrarian<Logic.BlockLibrary.Basic.Librarian>().VirtualOutputMsgHandler = VirtualOutputMsgHandler;
                GraphManager.GetLibrarian<Logic.BlockLibrary.Basic.Librarian>().VirtualOutputBatchMsgHandler = VirtualOutputBatchMsgHandler;
            }
        }
コード例 #46
0
ファイル: MainWindow.xaml.cs プロジェクト: Altrue/Overview
        public MainWindow()
        {
            // Handle recuperation for current window
            GCHandle handle1 = GCHandle.Alloc(Process.GetCurrentProcess().MainWindowHandle);
            IntPtr hwndf = (IntPtr) handle1;
            IntPtr hwndParent = GetDesktopWindow();
            SetParent(hwndf, hwndParent);

            // Initialization
            InitializeComponent();
            Width = GD.WINDOW_WIDTH;
            Height = GD.WINDOW_HEIGHT;
            ResizeMode = ResizeMode.CanMinimize;
            WindowStyle = WindowStyle.None;
            Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x22, 0x22, 0x22));
            Icon = new BitmapImage(new Uri("pack://application:,,,/ressources/icon.ico"));
            //ShowInTaskbar = false;

            // Event assignation
            MouseLeftButtonDown += MainWindow_MouseDown;
            Loaded += MainWindowLoaded;

            // Main Canvas Initialization
            AddChild(GD.MainCanvas);
            GD.MainCanvas.Width = GD.WINDOW_WIDTH;
            GD.MainCanvas.Height = GD.WINDOW_HEIGHT;
            GD.MainCanvas.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            GD.MainCanvas.VerticalAlignment = System.Windows.VerticalAlignment.Top;

            // TB ICON
            /*
            TaskbarIcon tbi = new TaskbarIcon();
            Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/ressources/icon.ico")).Stream;
            tbi.Icon = new System.Drawing.Icon(iconStream);
            iconStream.Dispose();
            tbi.ToolTipText = "Overview is Running";*/

            // Logo
            Rectangle bt_logo = new Rectangle();
            bt_logo.Width = 91;
            bt_logo.Height = 13;
            bt_logo.Fill = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/ressources/overviewlogo_mini.png")));
            Canvas.SetTop(bt_logo, (8));
            Canvas.SetLeft(bt_logo, (30));
            GD.MainCanvas.Children.Add(bt_logo);

            // Head Text
            TextBlock tb_head = new TextBlock();
            tb_head.Text = "";
            tb_head.Foreground = new SolidColorBrush(Colors.Gray);
            tb_head.FontSize = 10;
            Canvas.SetTop(tb_head, (23));
            Canvas.SetLeft(tb_head, (7));
            GD.MainCanvas.Children.Add(tb_head);

            TextBlock tb_head2 = new TextBlock();
            tb_head2.Text = "";
            tb_head2.Foreground = new SolidColorBrush(Colors.Gray);
            tb_head2.FontSize = 10;
            Canvas.SetTop(tb_head2, (35));
            Canvas.SetLeft(tb_head2, (7));
            GD.MainCanvas.Children.Add(tb_head2);

            // Head Text Fill
            ManagementObjectSearcher mos =
                new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor");
            foreach (ManagementObject mo in mos.Get())
            {
                string nameFull = (string)mo["Name"];
                string[] words = nameFull.Split(' ');

                string tb1Text = "";
                string tb2Text = "";
                int tb1Length = 0;

                foreach (string word in words)
                {
                    int wLength = word.Length;
                    if (tb1Length + wLength < 27)
                    {
                        tb1Text += (tb1Length == 0 ? word : (" " + word));
                        tb1Length = tb1Text.Length;
                    }
                    else
                    {
                        tb2Text += (tb2Text.Length == 0 ? word : (" " + word)); ;
                    }
                }

                tb_head.Text = tb1Text;
                tb_head2.Text = tb2Text;
            }

            // Lock button
            Rectangle bt_Lock = new Rectangle();
            bt_Lock.Width = 14;
            bt_Lock.Height = 13;
            bt_Lock.Fill = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/ressources/lockopen_mini.png")));
            bt_Lock.MouseLeftButtonDown += LockButton_MouseDown;
            Canvas.SetTop(bt_Lock, (5));
            Canvas.SetLeft(bt_Lock, (6));
            GD.MainCanvas.Children.Add(bt_Lock);

            // Exit button
            GD.bt_Exit.Width = 14;
            GD.bt_Exit.Height = 14;
            GD.bt_Exit.Fill = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/ressources/exit_mini.png")));
            GD.bt_Exit.MouseLeftButtonDown += ExitButton_MouseDown;
            Canvas.SetTop(GD.bt_Exit, (5));
            Canvas.SetRight(GD.bt_Exit, (5));
            GD.MainCanvas.Children.Add(GD.bt_Exit);

            // CPU Total
            GD.tbArrayCPU[0] = new TextBlock();
            GD.tbArrayCPU[0].Text = "?";
            GD.tbArrayCPU[0].Foreground = new SolidColorBrush(Colors.White);
            Canvas.SetTop(GD.tbArrayCPU[0], (50));
            Canvas.SetLeft(GD.tbArrayCPU[0], (7));
            GD.MainCanvas.Children.Add(GD.tbArrayCPU[0]);

            // CPU Total bars
            GD.rectCPU[0] = new Rectangle();
            GD.rectCPU[0].Fill = new SolidColorBrush(Colors.White);
            GD.rectCPU[0].Height = 10;
            GD.rectCPU[0].Width = 0;
            Canvas.SetTop(GD.rectCPU[0], (53));
            Canvas.SetLeft(GD.rectCPU[0], (GD.WINDOW_WIDTH / 2 + 1));
            GD.MainCanvas.Children.Add(GD.rectCPU[0]);

            GD.borderCPU[0] = new Border();
            GD.borderCPU[0].Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x11, 0x11, 0x11));
            GD.borderCPU[0].BorderThickness = new Thickness(1);
            GD.borderCPU[0].BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0x33, 0x33, 0x33));
            GD.borderCPU[0].Height = 12;
            GD.borderCPU[0].Width = GD.WINDOW_WIDTH/2 - 4;
            Canvas.SetTop(GD.borderCPU[0], (52));
            Canvas.SetRight(GD.borderCPU[0], (4));
            GD.MainCanvas.Children.Add(GD.borderCPU[0]);

            // Build the Processor Manager
            ProcessorManager PM = new ProcessorManager();

            Height = GD.coreNumber * 15 + 115;

            // Build the CPU Graph
            GraphManager CPUGraph = new GraphManager(GD.coreNumber * 15 + 70, GD.CPUGRAPH_WIDTH, GD.CPUGRAPH_HEIGHT);
        }
コード例 #47
0
ファイル: NodeGraphManager.cs プロジェクト: yodiwo/plegma
 //------------------------------------------------------------------------------------------------------------------------
 public bool OnGraphLoadReq(GraphManager.GraphLoadRequestData req, out Graph Graph)
 {
     lock (locker)
     {
         Graph = null;
         var gi = Graphs.TryGetOrDefault(req.GraphKey);
         if (gi == null)
             return false;
         else
         {
             Graph = gi.Graph;
             return Graph != null;
         }
     }
 }
コード例 #48
0
ファイル: NodeGraphManager.cs プロジェクト: yodiwo/plegma
 //------------------------------------------------------------------------------------------------------------------------
 void GraphSaveReq(GraphManager.GraphSaveRequestData request)
 {
     lock (locker)
     {
     }
 }
コード例 #49
0
    void Start()
    {
        GameObject globalObj = GameObject.FindGameObjectWithTag("GlobalTag");

        lineManager = globalObj.GetComponent("ConstraintManager") as ConstraintManager;
        graphManager = globalObj.GetComponent("GraphManager") as GraphManager;
        guiManager = globalObj.GetComponent("GUIManager") as GUIManager;
        globalVals = globalObj.GetComponent("GlobalValues") as GlobalValues;
        ballClass = globalObj.GetComponent("Player_Ball") as Player_Ball;
        endPoint = GameObject.Find("EndPoint");
    }
コード例 #50
0
ファイル: GraphManager.cs プロジェクト: AdrienVR/eegSea
 void Awake()
 {
     s_instance = this;
 }
コード例 #51
0
 void Start()
 {
     ballCam = Camera.main;
     guiManager = GameObject.Find("Globals").GetComponent("GUIManager") as GUIManager;
     globalVals = GameObject.Find("Globals").GetComponent("GlobalValues") as GlobalValues;
     playerBall = GameObject.Find("Globals").GetComponent("Player_Ball") as Player_Ball;
     pathManager = GameObject.Find("Globals").GetComponent("ConstraintManager") as ConstraintManager;
     graphManager = GameObject.Find("Globals").GetComponent("GraphManager") as GraphManager;
     meta = GameObject.Find("Globals").GetComponent("GameMetaManager") as GameMetaManager;
 }