コード例 #1
0
ファイル: SetTests.cs プロジェクト: ungood/puzzles
        public void CanAddItemsToAnEmptySet(Common.DataStructures.ISet<string> set)
        {
            Assert.IsTrue(set.Add("apple"));
            Assert.IsFalse(set.Add("apple"));

            Assert.IsTrue(set.Contains("apple"));
            Assert.IsFalse(set.Contains("banana"));
        }
コード例 #2
0
        public override void AddInteraction(Common.InteractionInjectorList interactions)
        {
            interactions.Replace<ShowerOutdoor, ShowerOutdoor.TakeShower.Definition>(ShowerOutdoor.TakeShower.Singleton);

            // The other interactions are added by ShowerWoohoo itself
            interactions.Add<IShowerable>(ShowerWoohoo.SafeSingleton);
        }
コード例 #3
0
        public MainPage()
        {
            InitializeComponent();
            Common.Start(5);
            communication cm = new communication();

            cm.Connect(string.Empty);
            Common.Add(ref cm);
            DispCom.ViewChanged += MainPage_PageChange;

            DispCom.CurrentView = new StartPage();
        }
コード例 #4
0
        public TextsWindow()
        {
            InitializeComponent();

            Static2D = new CARCEditor("Static2D.carc");

            for (var i = 0; i < CARCLanguages.Length; i++)
            {
                var main2d = new CARCEditor(FormatLanguageFile("Main2D", "carc", i));
                Main2D.Add(main2d);
                var common = new BMG(main2d.ReadFile("common.bmg"));
                Common.Add(common);

                var mbchild = new BMG(Static2D.ReadFile(FormatLanguageFile("MBChild", "bmg", i)));
                MBChild.Add(mbchild);

                var chksel = new CARCEditor(FormatLanguageFile("CharacterKartSelect", "carc", i));
                CharacterKartSelect.Add(chksel);
                var kartsel = new BMG(chksel.ReadFile("kart_select.bmg"));
                KartSelect.Add(kartsel);

                var wlmenu = new CARCEditor(FormatLanguageFile("WLMenu", "carc", i));
                WLMenu.Add(wlmenu);
                var banner = new BMG(wlmenu.ReadFile("banner.bmg"));
                Banner.Add(banner);

                var menu = new CARCEditor(FormatLanguageFile("Menu", "carc", i));
                Menu.Add(menu);
                var menu_bmg = new BMG(menu.ReadFile("menu.bmg"));
                MenuBMG.Add(menu_bmg);
                var mission = new BMG(menu.ReadFile("mission.bmg"));
                Mission.Add(mission);
                var rule = new BMG(menu.ReadFile("rule.bmg"));
                Rule.Add(rule);
            }

            Load();
        }
コード例 #5
0
ファイル: MartialArtsTrain.cs プロジェクト: Robobeurre/NRaas
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<TrainingDummy>(Singleton);
 }
コード例 #6
0
ファイル: AddImg.cs プロジェクト: shibinhai/ImgPrint
 /// <summary>
 /// 保存图片 保存按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     if (Convert.ToInt32(this._qx) == 1)
     {
         //管理员
         string name     = txtStation_S_Name.Text.Trim();
         string GG       = txtGG.Text.Trim();
         string changjia = txtChangjia.Text.Trim();
         string PH       = txtPH.Text.Trim();
         if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(PH) || string.IsNullOrEmpty(GG) || string.IsNullOrEmpty(changjia) || pictureBox1.Image == null)
         {
             MessageBox.Show("请完善信息!");
         }
         else
         {
             //往服务器上传图片
             string fil = openFileDialog1.FileName;
             if (Convert.ToInt32(isChange.Text) == 0)
             {
                 fil = "111";
             }
             if (this.uploadFileByHttp(Common.GetAppSetingServerIp() + "/Upload.aspx", fil))
             {
                 //往数据库添加数据
                 ImgInfo m = new ImgInfo();
                 m.name     = name;
                 m.beizhu   = "";
                 m.guige    = GG;
                 m.changjia = changjia;
                 m.pihao    = PH;
                 m.url      = strImgs;
                 if (Convert.ToInt32(labId.Text) > 0)
                 {
                     //编辑
                     m.id         = Convert.ToInt32(labId.Text);
                     m.createtime = DateTime.Now;
                     if (imgInfobll.Update(m))
                     {
                         MessageBox.Show("修改成功!");
                         Common.Add("角色:" + _qx, ",修改图片成功" + DateTime.Now);
                         this.Close();
                     }
                     else
                     {
                         MessageBox.Show("修改失败!");
                     }
                 }
                 else
                 {
                     if (imgInfobll.Add(m))
                     {
                         MessageBox.Show("添加成功!");
                         Common.Add("角色:" + _qx, ",图片添加成功" + DateTime.Now);
                         this.Close();
                     }
                     else
                     {
                         MessageBox.Show("添加失败!");
                     }
                 }
             }
             else
             {
                 MessageBox.Show("网络异常,图片上传失败!");
             }
         }
     }
     else
     {
         MessageBox.Show("普通用户无权操作!");
     }
 }
コード例 #7
0
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {            
     interactions.Add<CraftersConsignment>(BuyFoodSingleton);
 }
コード例 #8
0
ファイル: PlayJuicePongEx.cs プロジェクト: Robobeurre/NRaas
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<PingPongTable>(Singleton);
 }
コード例 #9
0
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<AncientPortal>(Singleton);
 }
コード例 #10
0
ファイル: UseUberToiletEx.cs プロジェクト: Robobeurre/NRaas
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<UberToilet>(PrivacyInteraction.Singleton);
     interactions.Replace<UberToilet, UberToilet.UseToilet.Definition>(Singleton);
 }
コード例 #11
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            string name = txtname.Text.Trim();
            string pwd1 = txtpwd1.Text.Trim();
            string pwd2 = txtpwd2.Text.Trim();
            string qx   = comboBox1.SelectedIndex.ToString(); //0 普通用户  1管理员

            string userId = labuserid.Text;

            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(pwd1) || string.IsNullOrEmpty(pwd2))
            {
                MessageBox.Show("请完善信息");
            }
            else
            {
                if (pwd1.Length != 6)
                {
                    MessageBox.Show("密码必须是6位");
                    txtpwd1.Text = "";
                    txtpwd2.Text = "";
                }
                else
                {
                    if (pwd1 != pwd2)
                    {
                        MessageBox.Show("两次密码不一致");
                        txtpwd1.Text = "";
                        txtpwd2.Text = "";
                    }
                    else
                    {
                        if (userInfobll.Exists(name) && Convert.ToInt32(userId) <= 0)
                        {
                            //已存在
                            MessageBox.Show("该用户已存在");
                        }
                        else
                        {
                            UserInfo m = new UserInfo();
                            m.createtime = DateTime.Now;
                            m.username   = name;
                            m.userpwd    = Common.GetMD532(pwd1, "");
                            m.qx         = qx;
                            if (Convert.ToInt32(userId) > 0)
                            {
                                m.id         = Convert.ToInt32(userId);
                                m.createtime = DateTime.Now;

                                string oldpwd = Common.GetMD532(txtoldpwd.Text, "");
                                if (oldpwd != label6.Text)
                                {
                                    MessageBox.Show("和原来密码不一致");
                                    return;
                                }

                                //编辑
                                if (userInfobll.Update(m))
                                {
                                    MessageBox.Show("修改成功");
                                    Common.Add("登陆用户:" + _userId, ",用户信息修改成功" + DateTime.Now);
                                }
                                else
                                {
                                    MessageBox.Show("修改失败");
                                }
                                this.Close();
                            }
                            else
                            {
                                //新增
                                if (userInfobll.Add(m))
                                {
                                    MessageBox.Show("添加成功");
                                    Common.Add("登陆用户:" + _userId, ",新用户添加成功" + DateTime.Now);
                                }
                                else
                                {
                                    MessageBox.Show("添加失败");
                                }
                                this.Close();
                            }
                        }
                    }
                }
            }
        }
コード例 #12
0
        static async void ReadLineDO(string s)
        {
            if (s.EndsWith(".bsvcmd"))
            {
                Console.WriteLine("{0} => BIDS_Server Command preset file", s);
                try
                {
                    using (StreamReader sr = new StreamReader(s))
                    {
                        string[] sa = sr.ReadToEnd().Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
                        if (sa?.Length > 0)
                        {
                            for (int pi = 0; pi < sa.Length; pi++)
                            {
                                Console.WriteLine("do {0}[{1}] : {2}", s, pi, sa[pi]);
                                ReadLineDO(sa[pi]);
                            }
                        }
                        else
                        {
                            Console.WriteLine("{0} : There is no command in the file.", s);
                        }
                    }
                } catch (FileNotFoundException) { Console.WriteLine("Program.ReadLineDO : the file \"{0}\" is not found.", s); }
                catch (DirectoryNotFoundException) { Console.WriteLine("Program.ReadLineDO : the directory is not found. (file path:\"{0}\")", s); }
                catch (Exception e)
                {
                    Console.WriteLine("Program.ReadLineDO : an exception has occured (file path:\"{0}\")\n{1}", s, e);
                }

                return;
            }

            if (s.EndsWith(".btsetting"))
            {
                Console.WriteLine("{0} => Button assignment setting file to keep the compatibility with GIPI", s);
                using (StreamReader sr = new StreamReader(s))
                {
                    GIPI.LoadFromStream(sr);
                }

                return;
            }

            string[] cmd_orig = s?.Split(' ');
            string[] cmd      = cmd_orig?.Select((str) => str.ToLower()).ToArray();

            switch (cmd[0])
            {
            case "man":
                if (cmd.Length >= 2)
                {
                    switch (cmd[1])
                    {
                    case "auto":
                        Console.WriteLine("auto sending process turn on command : auto send will start when this command is entered.");
                        Console.WriteLine("  Option : bve5, common, const, handle, obve, panel, sound");
                        break;

                    case "autodel":
                        Console.WriteLine("auto sending process turn off command : auto send will stop when this command is entered.");
                        Console.WriteLine("  Option : bve5, common, const, handle, obve, panel, sound");
                        break;

                    case "exit":
                        Console.WriteLine("exit command : Used when user want to close this program.  This command has no arguments.");
                        break;

                    case "ls":
                        Console.WriteLine("connection listing command : Print the list of the Name of alive connection.  This command has no arguments.");
                        break;

                    case "lsmods":
                        Console.WriteLine("mods listing command : Print the list of the Name of mods you can use.  This command has no arguments.");
                        break;

                    case "close":
                        Console.WriteLine("close connection command : Used when user want to close the connection.  User must set the Connection Name to be closed.");
                        break;

                    case "delay":
                        Console.WriteLine("insert pause command : Insert Pause function.  You can set 0 ~ Int.Max[ms]");
                        break;

                    default:
                        IBIDSsv ibsv = LoadMod(FindMod(cmd[1]));
                        if (ibsv != null)
                        {
                            ibsv.WriteHelp(string.Empty);
                            ibsv.Dispose();
                        }
                        else
                        {
                            Console.WriteLine("Mod not found.");
                        }
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("BIDS Server Application");
                    Console.WriteLine("ver : " + VerNumStr + "\n");
                    Console.WriteLine("auto : Set the Auto Sending Function");
                    Console.WriteLine("close: Close the connection.");
                    Console.WriteLine("delay : insert delay function.");
                    Console.WriteLine("exit : close this program.");
                    Console.WriteLine("ls : Print the list of the Name of alive connection.");
                    Console.WriteLine("lsmods : Print the list of the Name of mods you can use.");
                    Console.WriteLine("man : Print the mannual of command.");
                    Console.WriteLine("  If you want to check the manual of each mod, please check the mod name and type \"man + (mod name)\"");
                }
                break;

            case "ls": Console.Write(Common.PrintList()); break;

            case "lsmods":
                try
                {
                    string[] fs = LSMod();
                    if (fs == null || fs.Length <= 0)
                    {
                        Console.WriteLine("There are no modules in the mods folder.");
                    }
                    else
                    {
                        for (int i = 0; i < fs.Length; i++)
                        {
                            string[] cn = fs[i].Split('.');
                            Console.WriteLine(" {0} : {1}", cn[cn.Length - 2], fs[i]);
                        }
                    }
                }
                catch (Exception e) { Console.WriteLine(e); }
                break;

            case "auto":
                foreach (string str in cmd)
                {
                    if (str == null || str == string.Empty)
                    {
                        continue;
                    }
                    if (str.StartsWith("/") || str.StartsWith("-"))
                    {
                        switch (str.Remove(0, 1).Substring(0, 3))
                        {
                        case "com": Common.AutoSendSetting.BasicCommonAS = true; Console.WriteLine("Common Data Autosend Enabled"); break;

                        case "bve": Common.AutoSendSetting.BasicBVE5AS = true; Console.WriteLine("BVE5 Data Autosend Enabled"); break;

                        case "obv": Common.AutoSendSetting.BasicOBVEAS = true; Console.WriteLine("OBVE Data Autosend Enabled"); break;

                        case "pan": Common.AutoSendSetting.BasicPanelAS = true; Console.WriteLine("Panel Data Autosend Enabled"); break;

                        case "sou": Common.AutoSendSetting.BasicPanelAS = true; Console.WriteLine("Sound Data Autosend Enabled"); break;

                        case "con": Common.AutoSendSetting.BasicConstAS = true; Console.WriteLine("Const Data Autosend Enabled"); break;

                        case "han": Common.AutoSendSetting.BasicHandleAS = true; Console.WriteLine("Handle Data Autosend Enabled"); break;

                        default: Console.WriteLine("Option Not Found : {0}", str); break;
                        }
                    }
                }
                break;

            case "autodel":
                foreach (string str in cmd)
                {
                    if (str == null || str == string.Empty)
                    {
                        continue;
                    }
                    if (str.StartsWith("/") || str.StartsWith("-"))
                    {
                        switch (str.Remove(0, 1).Substring(0, 3))
                        {
                        case "com": Common.AutoSendSetting.BasicCommonAS = false; Console.WriteLine("Common Data Autosend Disabled"); break;

                        case "bve": Common.AutoSendSetting.BasicBVE5AS = false; Console.WriteLine("BVE5 Data Autosend Disabled"); break;

                        case "obv": Common.AutoSendSetting.BasicOBVEAS = false; Console.WriteLine("OBVE Data Autosend Disabled"); break;

                        case "pan": Common.AutoSendSetting.BasicPanelAS = false; Console.WriteLine("Panel Data Autosend Disabled"); break;

                        case "sou": Common.AutoSendSetting.BasicPanelAS = false; Console.WriteLine("Sound Data Autosend Disabled"); break;

                        case "con": Common.AutoSendSetting.BasicConstAS = false; Console.WriteLine("Const Data Autosend Disabled"); break;

                        case "han": Common.AutoSendSetting.BasicHandleAS = false; Console.WriteLine("Handle Data Autosend Disabled"); break;

                        default: Console.WriteLine("Option Not Found : {0}", str); break;
                        }
                    }
                }
                break;

            case "exit":
                Common.Remove();
                IsLooping = false;
                break;

            case "close":
                if (cmd.Length >= 2)
                {
                    Common.Remove(cmd_orig[1]);
                }
                else
                {
                    Common.Remove();
                }
                break;

            case "debug":
                if (cmd.Length >= 2)
                {
                    Common.DebugDo(cmd_orig[1]);
                }
                else
                {
                    Common.DebugDo();
                }
                break;

            case "print":
                if (cmd.Length >= 3)
                {
                    for (int i = 2; i < cmd.Length; i++)
                    {
                        if (Common.Print(cmd_orig[1], cmd_orig[i]) != true)
                        {
                            break;
                        }
                    }
                }
                break;

            case "delay":
                await Task.Delay(int.Parse(cmd[1]));

                break;

            default:
                string modn = FindMod(cmd[0]);
                if (modn != null && modn != string.Empty)
                {
                    IBIDSsv ibsv = LoadMod(modn);
                    if (ibsv != null)
                    {
                        try
                        {
                            if (ibsv.Connect(s))
                            {
                                Common.Add(ref ibsv);
                            }
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                            ibsv.Dispose();
                            Common.Remove(ibsv);
                        }
                    }
                    else
                    {
                        Console.WriteLine("The specified dll file does not implement the IBIDSsv interface.");
                    }
                }
                else
                {
                    Console.WriteLine("Command({0}) Not Found", cmd[0]);
                }
                break;
            }
        }
コード例 #13
0
 public void ShouldAddTwoNumbers()
 {
     Assert.AreEqual(Common.Add(3, 2), 5);
 }
コード例 #14
0
ファイル: FixToddlerChat.cs プロジェクト: Robobeurre/NRaas
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<Sim>(Chat.Singleton);
 }
コード例 #15
0
        private async void bCount_Click(object sender, RoutedEventArgs e)
        {
            Dv = new Divided();
            Cm = new Common();
            PbWork.Value = 0;
            var unit = Convert.ToInt32(LNumberOfProc.Content);
            var alpha = Convert.ToInt32(LAlpha.Content);
            PbWork.Visibility = Visibility.Visible;

            if (RbDv.IsChecked != null && (bool)RbDv.IsChecked)
                switch ((string)LType.Content)
                {
                    case "Transposition":
                        DoPbDv();
                        print_Matrix(await Dv.Transpose(_matrixA, unit), TbMxRes);
                        break;
                    case "Addition":
                        DoPbDv();
                        print_Matrix(await Dv.Add(_matrixA, _matrixB, unit), TbMxRes);
                        break;
                    case "Multiplication":
                        DoPbDv();
                        print_Matrix(await Dv.Multiplicate(_matrixA, _matrixB, unit, alpha), TbMxRes);
                        break;
                }
            else
                switch ((string)LType.Content)
                {
                    case "Transposition":
                        DoPbCm();
                        print_Matrix(await Cm.Transpose(_matrixA, unit), TbMxRes);
                        break;
                    case "Addition":
                        DoPbCm();
                        print_Matrix(await Cm.Add(_matrixA, _matrixB, unit), TbMxRes);
                        break;
                    case "Multiplication":
                        DoPbCm();
                        print_Matrix(await Cm.Multiplicate(_matrixA, _matrixB, unit, alpha), TbMxRes);
                        break;
                }
            LTime.Content = (Dv.Time > Cm.Time) ? Dv.Time.ToString() : Cm.Time.ToString();
        }
コード例 #16
0
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<Computer>(Singleton);
 }
コード例 #17
0
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<Sim>(AskToJoinSkinnyDipping.Singleton);
 }
コード例 #18
0
ファイル: CyberWoohoo.cs プロジェクト: Robobeurre/NRaas
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<Computer>(Singleton);
     interactions.AddNoDupTest<Computer>(RandomSingleton);
 }
コード例 #19
0
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<TimeMachine>(Singleton);
 }
コード例 #20
0
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<SchoolRabbitHole>(Singleton);
 }
コード例 #21
0
ファイル: AttendShowEx.cs プロジェクト: Robobeurre/NRaas
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<ShowVenue>(Singleton);
 }
コード例 #22
0
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<RoutineMachine>(PrivacyInteraction.Singleton);
     interactions.Replace<RoutineMachine, RoutineMachine.TeleportToCommunityLot.Definition>(Singleton);
 }
コード例 #23
0
ファイル: QueueUpTrainSim.cs プロジェクト: Robobeurre/NRaas
 public void AddInteraction(Common.InteractionInjectorList interactions)
 {
     interactions.Add<AthleticGameObject>(Singleton);
 }