コード例 #1
0
ファイル: Client.cs プロジェクト: vikramjit30/TokenRingCSharp
        private void divisionEntry()
        {
            if (isOnline)
            {
                int b = 0;
                TokenRing.waitForToken();
                getListOfEvents(false);

                Console.WriteLine("Input the number: ");
                String date = Console.ReadLine();
                b = Convert.ToInt32(date);

                String lastLine = File.ReadLines("Calendar.txt").Last();
                result = Convert.ToInt32(lastLine);
                calculation_entry entry = new calculation_entry(result, b);
                entry.writeToFile_division();

                foreach (HostIPnPort h in activeNodes)
                {
                    if (!h.Equals(thisMachineIpnPort))
                    {
                        addOverRPC(h.getFullUrl(), entry.makeString());
                    }
                }
                TokenRing.sendToken();
            }
            else
            {
                Console.WriteLine("Node is offline! Operation is not allowed");
            }
        }
コード例 #2
0
ファイル: Client.cs プロジェクト: vikramjit30/TokenRingCSharp
        private void subtractionEntry()
        {
            if (isOnline)
            {   int b= 0;
                TokenRing.waitForToken();
                getListOfEvents(false);

                Console.WriteLine("Input the number: ");
                String date = Console.ReadLine();
                b = Convert.ToInt32(date);

                String lastLine = File.ReadLines("Calendar.txt").Last();
                result = Convert.ToInt32(lastLine);
                calculation_entry entry = new calculation_entry(result,b);
                entry.writeToFile_subtraction();

                 foreach (HostIPnPort h in activeNodes)
                {
                    if (!h.Equals(thisMachineIpnPort))
                    {
                        addOverRPC(h.getFullUrl(), entry.makeString());
                    }
                }
                TokenRing.sendToken();
            }
            else
            {
                Console.WriteLine("Node is offline! Operation is not allowed");
            }
        }