Пример #1
0
            protected override void Context()
            {
                base.Context();

                GreetingWithNameCommand = A.Fake <NewGreetingWithNameCommand>();
                Sut = new MyWcfService(GreetingWithNameCommand);
            }
Пример #2
0
            protected override void Context()
            {
                base.Context();

                GreetingWithNameCommand = A.Fake<NewGreetingWithNameCommand>();
                Sut = new MyWcfService(GreetingWithNameCommand);
            }
Пример #3
0
 public static void Main()
 {
     using (var client = new MyWcfService())
     {
         // TODO: your things with the client.
     }
 }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cdKey"></param>
        /// <param name="myWcf"></param>
        /// <param name="validKeyInfo"></param>
        /// <param name="reEnterCDKey"></param>
        private void EnterNewCDKey(ref string cdKey, MyWcfService myWcf, ref KeyInfo validKeyInfo, bool reEnterCDKey = false)
        {
            // KXXNR-OCMGT-SOFQO-WBJRY
            // ICFXR - YDZOG - LDPLB - NMODN
            // MachineCode
            // ProcessorId
            // "178BFBFF00600F12"
            // Win32_BIOS
            // "To be filled by O.E.M."
            // Win32_BaseBoard
            // "MB-1234567890"
            // join 3 part togeter and cal 8byte hash
            // result like 83628

            string machineCode = RegUtil.GetRegValue(@"HKLM\SOFTWARE\Wow6432Node\CamAligner", "MachineCode");

            if (string.IsNullOrEmpty(machineCode))
            {
                try
                {
                    machineCode = myWcf.GetMachineCode();
                }
                catch
                {
                    MessageBox.Show("计算机器码错误");
                    this.Close();
                    return;
                }
            }



            // CDKey 不存在 或者 需要重新输入(因为过期),重新输入
            if (string.IsNullOrEmpty(cdKey) || reEnterCDKey)
            {
                InputCDKey inputForm = new InputCDKey();

                inputForm.MachineCode = machineCode;
                inputForm.ShowDialog();
                if (inputForm.enterKeyFlag == false)
                {
                    return;
                }

                cdKey = inputForm.CDKey;

                if (string.IsNullOrEmpty(cdKey))
                {
                    MessageBox.Show("请输入CDKey");
                    return;
                }
            }

            try
            {
                validKeyInfo = myWcf.GetKeyInfo(cdKey, "hello");

                if (validKeyInfo.IsValid == true && validKeyInfo.IsOnRightMachine == true)
                {
                    JudgeCDKeyStillWorks();
                    LoadValidKeyOnPanel();
                }
                else
                {
                    MessageBox.Show("CDKey内容非法");
                }
            }
            catch
            {
                MessageBox.Show("CDKey格式非法");
            }

            if (validKeyInfo == null)
            {
                button1.Enabled = false;
                timer1.Enabled  = false;
            }


            // CDKey 合法,写注册表
            if (RegUtil.CreateKeyValue(@"SOFTWARE\Wow6432Node\CamAligner", "CDKey", cdKey) == false)
            {
                MessageBox.Show("由于系统问题无法注册软件");
                return;
            }

            // Machine Code 合法,写注册表
            if (RegUtil.CreateKeyValue(@"SOFTWARE\Wow6432Node\CamAligner", "MachineCode", machineCode) == false)
            {
                MessageBox.Show("机器码写入注册表失败");
                return;
            }
        }