コード例 #1
0
ファイル: ConnectionFacts.cs プロジェクト: rhoadsce/SignalR
            public void SendingBigData()
            {
                var host = new MemoryHost();
                host.MapConnection<SampleConnection>("/echo");

                var connection = new Connection("http://foo/echo");

                var wh = new ManualResetEventSlim();
                var n = 0;
                var target = 20;

                connection.Received += data =>
                {
                    n++;
                    if (n == target)
                    {
                        wh.Set();
                    }
                };

                connection.Start(host).Wait();

                var conn = host.ConnectionManager.GetConnection<SampleConnection>();

                for (int i = 0; i < target; ++i)
                {
                    var node = new BigData();
                    conn.Broadcast(node).Wait();
                    Thread.Sleep(1000);
                }

                Assert.True(wh.Wait(TimeSpan.FromMinutes(1)), "Timed out");
            }
コード例 #2
0
        private void Main_Load(object sender, EventArgs e)
        {
            //Console.WriteLine(System.Diagnostics.Process.GetProcesses("TheLongDarkBuckUpTools").ToString());
            IniAllValues = Item.ReadAllIni(IniPath)[0];
            var allValues = BigData.Parses(IniAllValues);

            gameSavePath.val = allValues.SearchData("savePath").Value;
            if (string.IsNullOrWhiteSpace(gameSavePath.val) || !Directory.Exists(gameSavePath.val))
            {
                //自动读取存档路径
                gameSavePath.val  = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                gameSavePath.val += "\\Hinterland\\TheLongDark\\";
            }
            if (Item.CheckFolder(gameSavePath.val) == false)
            {
                if (IsElseForm == false)
                {
                    new InputChouseBox("提示", "没有找到存档文件夹\n请手动输入或者右边选择:", gameSavePath);
                }
            }
            textBox3.Text = allValues.SearchData("buckPath").Value;
            textBox3.Text = string.IsNullOrEmpty(textBox3.Text) || !Directory.Exists(textBox3.Text) ?CurrentPath + "bfFolder\\":allValues.SearchData("buckPath").Value;
            if (!Item.CheckFolder(textBox3.Text))
            {
                Directory.CreateDirectory(textBox3.Text);
            }
            saveTimes     = string.IsNullOrEmpty(allValues.SearchData("saveTimes").Value)?0:int.Parse(allValues.SearchData("saveTimes").Value);
            textBox1.Text = string.IsNullOrEmpty(allValues.SearchData("quickSave").Value)?"F6": allValues.SearchData("quickSave").Value;
            QuickSave     = (Keys)Enum.Parse(typeof(Keys), textBox1.Text);
            var RIDIO = allValues.SearchData("starType").Value;

            if (string.IsNullOrEmpty(RIDIO))
            {
                RIDIO = "0";
            }
            switch (RIDIO)
            {
            case "1":
                radioButton1.Checked = true;
                break;

            case "2":
                radioButton2.Checked = true;
                textBox5.Text        = allValues.SearchData("starWay").Value;
                starWay = textBox5.Text;
                break;

            default:
                radioButton1.Checked = true;
                break;
            }
        }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        GameObject charSelector = GameObject.FindWithTag("DATA");

        if (charSelector != null)
        {
            charSel = charSelector.GetComponent <BigData>();
        }
        if (charSel == null)
        {
            Debug.Log("Cannot find 'DATA' script");
        }
    }
コード例 #4
0
ファイル: UnitTest1.cs プロジェクト: BruceBayne/CSharp-Study
 int RecursiveMethod(BigData b, int limit)
 {
     try
     {
         limit++;
         RuntimeHelpers.EnsureSufficientExecutionStack();
         return(RecursiveMethod(b, limit));
     }
     catch (Exception)
     {
         return(limit);
     }
 }
コード例 #5
0
        public ActionResult Index()
        {
            var Order  = OrdersDetails.GetAllRecords();
            var Order1 = OrdersData.GetAllRecords();

            ViewBag.DataSource  = BigData.GetAllRecords();
            ViewBag.DataSource1 = Order;
            ViewBag.DataSource2 = OrdersData.GetAllRecords();
            ViewBag.DataSource3 = from a in Order
                                  join b in Order1 on a.EmployeeID equals b.EmployeeID
                                  select new { a.CustomerID, a.EmployeeID, a.OrderDate, a.OrderID, b.ShipName,
                                               b.ShipAddress };

            return(View());
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: Lexv0lk/medium-8-homeworks
    static void Main(string[] args)
    {
        SomeGlobalClass SGC = new SomeGlobalClass();
        BigData         d   = new BigData();
        BigData         d2  = new BigData();

        d.DescribeAll();
        d2.DescribeAll();
        d  = null;
        d2 = null;

        GC.Collect();

        Console.ReadKey();
    }
コード例 #7
0
    // Use this for initialization
    void Start()
    {
        spawnPoints      = new Vector3[4];
        spawnPoints[0].x = -4.7f; spawnPoints[0].y = -4.3f; spawnPoints[0].z = 90.0f;
        spawnPoints[1].x = -6.8f; spawnPoints[1].y = -1.0f; spawnPoints[0].z = 180.0f;
        spawnPoints[2].x = 4.8f; spawnPoints[2].y = 3.8f; spawnPoints[0].z = -90.0f;
        spawnPoints[3].x = 6.5f; spawnPoints[3].y = 1.32f; spawnPoints[0].z = 0.0f;

        players = new GameObject[numPlayers];

        GameObject tempBigDick = GameObject.FindWithTag("DATA");

        if (tempBigDick != null)
        {
            bDicks     = tempBigDick.GetComponent <BigData>();
            playerData = bDicks.getPlayerData();
            numPlayers = bDicks.getNumCharacters();
            for (int x = 0; x < numPlayers; x++)
            {
                for (int y = sD - 1; y >= 0; y--)
                {//fuckinnnnn does shit,
                    if (y == 1)
                    {
                        players[x] = (GameObject)Instantiate(Resources.Load("Prefabs/" + playerData[x, y]), new Vector3(spawnPoints[x].x, spawnPoints[x].y, 0), new Quaternion());

                        players[x].transform.localScale = new Vector3(.5f, .5f, 1.0f);

                        players[x].name = playerData[x, 0];

                        players[x].transform.Rotate(new Vector3(0, 0, spawnPoints[x].z));
                    }
                }
            }
        }
        if (bDicks == null)
        {
            Debug.Log("Cannot find 'DATA' script");
        }
    }
コード例 #8
0
 public void SendCompressedMessageToServer()
 {
     using (var client = CreatedConnectedClient())
     {
         var message = new BigData(new byte[32000]);
         message.Bytes[0]    = 5;
         message.Bytes[3458] = 34;
         BigData receivedBigData = null;
         client.DataReceived           += o => Console.WriteLine("Received: " + o);
         echoServer.ClientDataReceived += (c, m) =>
         {
             Assert.AreEqual(typeof(BigData), m.GetType());
             receivedBigData = m as BigData;
         };
         client.Send(message);
         Thread.Sleep(100);
         Assert.IsNotNull(receivedBigData);
         Assert.AreEqual(32000, receivedBigData.Bytes.Length);
         Assert.AreEqual(5, receivedBigData.Bytes[0]);
         Assert.AreEqual(0, receivedBigData.Bytes[1]);
         Assert.AreEqual(34, receivedBigData.Bytes[3458]);
     }
 }
コード例 #9
0
ファイル: SocketTests.cs プロジェクト: remy22/DeltaEngine
 public void SendCompressedMessageToServer()
 {
     using (var client = CreatedConnectedClient())
     {
         var message = new BigData(new byte[32000]);
         message.Bytes[0] = 5;
         message.Bytes[3458] = 34;
         BigData receivedBigData = null;
         client.DataReceived += o => Console.WriteLine("Received: " + o);
         echoServer.ClientDataReceived += (c, m) =>
         {
             Assert.AreEqual(typeof(BigData), m.GetType());
             receivedBigData = m as BigData;
         };
         client.Send(message);
         Thread.Sleep(100);
         Assert.IsNotNull(receivedBigData);
         Assert.AreEqual(32000, receivedBigData.Bytes.Length);
         Assert.AreEqual(5, receivedBigData.Bytes[0]);
         Assert.AreEqual(0, receivedBigData.Bytes[1]);
         Assert.AreEqual(34, receivedBigData.Bytes[3458]);
     }
 }
コード例 #10
0
        static private float RunTest(Test test)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            DayTime dt = new DayTime();

            Console.WriteLine("Updating Configuration for {0}", test.Name);
            Configuration.Initialize(test);

            //Console.WriteLine("{0}: Creating Customer and Enterprise", test.Name);
            Customer   customer = new Customer();
            Enterprise ent      = new Enterprise(customer);
            BigData    bigData  = new BigData();

            //Console.WriteLine("{0}: Generating Plants", test.Name);
            List <Plant> plants = SimulationSetup.GeneratePlants();

            foreach (Plant plant in plants)
            {
                ent.Add(plant);
                foreach (var wc in plant.Workcenters)
                {
                    if (wc.Name == "Shipping Dock" || wc.Name == "Stage")
                    {
                        continue;
                    }
                    bigData.AddWorkcenter(wc.Name);
                    ((Core.Workcenters.Workcenter)wc).AddBigData(bigData);
                }
            }
            ent.Add(bigData);

            //Console.WriteLine("{0}: Generating Transport Routes", test.Name);
            var       routes    = SimulationSetup.GenerateRoutes(plants);
            Transport transport = new Transport(ent, routes);

            ent.Add(transport);

            //Console.WriteLine("{0}: Generating Simulation Node", test.Name);
            SimulationNode sn = new SimulationNode(dt, ent);

            //Console.WriteLine("{0}: Loading Workorders", test.Name);
            int woCounter = 0;

            while (woCounter < Configuration.InitialNumberOfWorkorders)
            {
                Workorder.PoType type = SimulationSetup.SelectWoPoType(woCounter);
                DayTime          due  = SimulationSetup.SelectWoDueDate(dt, woCounter);
                int initialOp         = SimulationSetup.SelectWoInitialOp(woCounter, Workorder.GetMaxOps(type) - 1);
                customer.CreateOrder(type, due, initialOp);
                woCounter++;
            }
            customer.Work(dt); // Load Workorders into Enterprise

            //SaveToFile(Configuration.Instance.TestFilename, 0, sn);

            Console.WriteLine("{0}: Starting Simulation", test.Name);
            for (int i = 1; i < Configuration.MinutesForProgramToTest; i++)
            {
                dt.Next();
                ent.Work(dt);
                customer.Work(dt);

                var next = bigData.GetNextOrder(i);
                if (next.HasValue)
                {
                    customer.CreateOrder(next.Value.Item1, new DayTime((int)next.Value.Item2, 800));
                }

                if (i % 500 == 0)
                {
                    Console.Write(".");
                }

                //SaveToFile(Configuration.Instance.TestFilename, i, sn);
            }
            Console.WriteLine(".");
            //Console.WriteLine("Finished with Test {0}", test.Name);
            sw.Stop();
            Console.WriteLine("Time to Complete: {0}", sw.Elapsed);
            sw.Reset();

            var result = customer.Result();

            Console.WriteLine("Result: {0}", result.ToString());
            return(result);
        }
コード例 #11
0
        private void DrawEngagedThemesInGroup(PdfPage page, PdfDocument document, int group_id)
        {
            int y = 60, x = 26;

            page = document.AddPage();
            XGraphics gfx = XGraphics.FromPdfPage(page);

            drawTable(gfx, page);
            string connStr = connectionString.Text +
                             "user id=" + common.username +
                             ";password="******"SELECT name FROM groups WHERE id = @myid";
                cmd = new MySqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@myid", group_id);
                rdr = cmd.ExecuteReader();
                rdr.Read();
                name = rdr[0].ToString();
            }
            finally
            {
                conn.Close();
            }

            gfx.DrawString("Group " + name, titleFont, XBrushes.Black,
                           new XRect(50, 10, page.Width, 100),
                           XStringFormats.TopLeft);

            List <Data> list2 = new List <Data>();

            conn = new MySqlConnection(connStr);
            try
            {
                conn.Open();
                sql = "SELECT id,name FROM subjects ORDER BY id";
                cmd = new MySqlCommand(sql, conn);
                rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    Data it = new Data();
                    it.id    = Convert.ToInt32(rdr[0].ToString());
                    it.login = rdr[1].ToString();
                    list2.Add(it);
                }
            }
            finally
            {
                conn.Close();
            }
            foreach (Data d in list2)
            {
                List <S_S>     s_s    = new List <S_S>();
                List <BigData> BDlist = new List <BigData>();

                sql  = "call autoSplit(@group_id,@subject_id)";
                conn = new MySqlConnection(connStr);
                cmd  = new MySqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@group_id", group_id);
                cmd.Parameters.AddWithValue("@subject_id", d.id);
                conn.Open();
                rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    string studentTheme = rdr[3].ToString();
                    string studentName  = rdr[1].ToString();

                    BigData it = new BigData();

                    it.student_id = Convert.ToInt32(rdr[0].ToString());
                    it.student    = studentName;
                    it.theme_id   = Convert.ToInt32(rdr[2].ToString());
                    it.theme      = studentTheme;
                    BDlist.Add(it);
                }
                conn.Close();
                for (int n = 0; n < BDlist.Count - 1; ++n)
                {
                    int    std_id = 0, thm_id = 0;
                    string std = "", thm = "";
                    try
                    {
                        std_id = BDlist[0].student_id;
                        std    = BDlist[0].student;
                        thm_id = BDlist[0].theme_id;
                        thm    = BDlist[0].theme;
                    }
                    catch (Exception ex)
                    {
                        //Console.WriteLine(ex.ToString());
                    }

                    S_S s = new S_S();
                    s.student = std;
                    s.theme   = thm;
                    s_s.Add(s);

                    BDlist.RemoveAll(
                        it => s_s.Exists(
                            it2 => ((it2.student == it.student) || (it2.theme == it.theme))
                            )
                        );
                }
                //foreach (S_S s in s_s) Console.WriteLine(s.student + " " + s.theme);
                //Console.WriteLine(d.login);
                //foreach (BigData bd in BDlist)
                {
                    foreach (S_S s in s_s)
                    {
                        gfx.DrawString(d.login, font, XBrushes.Black,
                                       new XRect(x, y, 250, 0));
                        gfx.DrawString(s.student, font, XBrushes.Black,
                                       new XRect(x + 160, y, 250, 0));
                        gfx.DrawString(s.theme, font, XBrushes.Black,
                                       new XRect(x + 250, y, 250, 0));

                        //Console.WriteLine(d.login + " ---- " + s.student + " ---- " + s.theme);
                        y += 15;
                    }
                    //y += 15;
                    //Console.WriteLine(name + "\t-\t" + bd.student + "\t-\t" + d.login  + "\t-\t" + bd.theme);
                    //gfx.DrawString(d.login, font, XBrushes.Black,
                    //    new XRect(x, y, 300, 0));
                }
                //Console.WriteLine("-------------------------\n");
            }
            drawLines(gfx, page, 180, 400);
        }