Ejemplo n.º 1
0
        // Message受信
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_MY_WND)
            {
                if ((int)(m.WParam) == 0x0001)
                {
                    textBox1.Text = "Pushed button1";
                }
                if ((int)(m.WParam) == 0x0002)
                {
                    textBox1.Text = "Pushed button2";
                }
            }
            if (m.Msg == WM_COPYDATA)
            {
                if ((int)(m.WParam) == 0x0000)
                {
                    COPYDATASTRUCT st = new COPYDATASTRUCT();
                    st            = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT));
                    textBox1.Text = st.lpData;
                }
                if ((int)(m.WParam) == 0x0001)
                {
                    COPYDATASTRUCT2 st = new COPYDATASTRUCT2();
                    st = (COPYDATASTRUCT2)m.GetLParam(typeof(COPYDATASTRUCT2));

                    msgData dt = new msgData();
                    dt = (msgData)st.lpData;

                    textBox1.Text = dt.name;
                }
            }

            base.WndProc(ref m);
        }
Ejemplo n.º 2
0
 private void descriptionToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     //remove msg desc
     if (Items.Length > 211 && DescsLoaded)
     {
         msgData[] reduce = new msgData[Descs.data.Length - 1];
         Array.Copy(Descs.data, reduce, Descs.data.Length - 1);
         Descs.data = reduce;
     }
 }
Ejemplo n.º 3
0
 private void descriptionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //remove msg name
     if (Items.Length > 211 && NamesLoaded)
     {
         msgData[] reduce = new msgData[Names.data.Length - 1];
         Array.Copy(Names.data, reduce, Names.data.Length - 1);
         Names.data = reduce;
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 模板推送
        /// </summary>
        /// <param name="bx_content"></param>
        /// <param name="bx_Address"></param>
        /// <param name="openid"></param>
        /// <param name="Remarks"></param>
        public bool Send_WX_Message(Object postDataObj, string openid, string template_id, string url = "")
        {
            try
            {
                //获取AccessToken
                string accessToken = GetAccessToken();
                //Log.WriteLog("微信推送", "access_token:", accessToken);
                //第一步设置所属行业
                msgData msg = new msgData();
                msg.touser = openid;
                if (!string.IsNullOrEmpty(msg.touser))
                {
                    msg.template_id = template_id;

                    msg.url = url;

                    msg.data = postDataObj;

                    string postUrl = string.Format("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}", accessToken);

                    string postData = JsonConvert.SerializeObject(msg);
                    //Log.WriteLog("微信推送", "模板发送postData:", JsonConvert.SerializeObject(postData));
                    JObject result = JsonConvert.DeserializeObject <JObject>(webRequestPost(postUrl, postData));
                    Log.WriteLog("微信推送", "result:", JsonConvert.SerializeObject(result));
                    if (result["errcode"].ObjToStr().Equals("0"))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.WriteLog("微信推送", "模板发送异常:" + ex.Message, ";发送异常的位置:" + ex.StackTrace);
                return(false);
            }
        }
Ejemplo n.º 5
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            msgData[] expand = new msgData[file.data.Length + 1];
            Array.Copy(file.data, expand, file.data.Length);
            string nameid = file.data[file.data.Length - 1].NameID;
            int    endid  = int.Parse(nameid.Substring(nameid.Length - 3, 3));

            expand[expand.Length - 1].ID     = file.data.Length;
            expand[expand.Length - 1].Lines  = new string[] { "New Entry" };
            expand[expand.Length - 1].NameID = nameid.Substring(0, nameid.Length - 3) + (endid + 1).ToString("000");

            file.data = expand;

            cbList.Items.Clear();
            for (int i = 0; i < file.data.Length; i++)
            {
                cbList.Items.Add(file.data[i].ID.ToString() + "-" + file.data[i].NameID);
            }
        }
Ejemplo n.º 6
0
        private void nameToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            //add msg desc
            if (DescsLoaded)
            {
                msgData[] Expand = new msgData[Descs.data.Length + 1];
                Array.Copy(Descs.data, Expand, Descs.data.Length);
                Expand[Expand.Length - 1].NameID = "talisman_eff_" + Descs.data.Length.ToString("000");
                Expand[Expand.Length - 1].ID     = Descs.data.Length;
                Expand[Expand.Length - 1].Lines  = new string[] { "New Description Entry" };
                Descs.data = Expand;

                DialogResult msgbox = MessageBox.Show("Do you want to set current Z-soul to use this Description", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (msgbox == DialogResult.Yes)
                {
                    txtDescID.Text = Descs.data[Descs.data.Length - 1].ID.ToString();
                }
            }
        }
Ejemplo n.º 7
0
        // SendMEssage WM_COPYDATA ( data is struct msgData )
        private void button4_Click(object sender, EventArgs e)
        {
            // COPYDATASTRUCT2 に入れる data用構造対用意
            msgData msgdata = new msgData();

            msgdata.no   = 1;
            msgdata.name = "msgData.name";

            // WM_COPYDATA用構造体に struct msgData を設定
            COPYDATASTRUCT2 cds = new COPYDATASTRUCT2();

            cds.dwData = IntPtr.Zero;
            cds.lpData = msgdata;
            cds.cbData = Marshal.SizeOf(msgdata);

            // Message送信
            IntPtr myh = Process.GetCurrentProcess().MainWindowHandle;

            SendMessage(myh, WM_COPYDATA, 1, ref cds);
        }
Ejemplo n.º 8
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //add/import Z -soul
            //load zss file
            OpenFileDialog browseFile = new OpenFileDialog();

            browseFile.Filter = "Z Soul Share File (*.zss)|*.zss";
            browseFile.Title  = "Select the Z-Soul you want to use as a template for the new Z-soul";
            if (browseFile.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            byte[] zssfile   = File.ReadAllBytes(browseFile.FileName);
            int    nameCount = BitConverter.ToInt32(zssfile, 4);
            int    DescCount = BitConverter.ToInt32(zssfile, 8);

            //expand the item array

            idbItem[] Expand = new idbItem[Items.Length + 1];
            Array.Copy(Items, Expand, Items.Length);
            Expand[Expand.Length - 1].Data = new byte[640];
            Items = Expand;
            short ID = BitConverter.ToInt16(Items[Items.Length - 2].Data, 0);

            ID++;
            Array.Copy(BitConverter.GetBytes(ID), Items[Items.Length - 1].Data, 2);

            //apply Zss data to added z-soul
            Array.Copy(zssfile, 12 + (nameCount * 2) + (DescCount * 2), Items[Items.Length - 1].Data, 2, 638);

            //expand Names msg
            byte[] pass;
            if (NamesLoaded)
            {
                msgData[] Expand2 = new msgData[Names.data.Length + 1];
                Array.Copy(Names.data, Expand2, Names.data.Length);
                Expand2[Expand2.Length - 1].NameID = "talisman_" + Names.data.Length.ToString("000");
                Expand2[Expand2.Length - 1].ID     = Names.data.Length;
                if (nameCount > 0)
                {
                    pass = new byte[nameCount * 2];
                    Array.Copy(zssfile, 12, pass, 0, nameCount * 2);
                    Expand2[Expand2.Length - 1].Lines = new string[] { BytetoString(pass) };
                }
                else
                {
                    Expand2[Expand2.Length - 1].Lines = new string[] { "New Name Entry" }
                };

                Array.Copy(BitConverter.GetBytes((short)Expand2[Expand2.Length - 1].ID), 0, Items[Items.Length - 1].Data, 4, 2);
                Names.data = Expand2;
                Items[Items.Length - 1].msgIndexName = FindmsgIndex(ref Names, Names.data[Names.data.Length - 1].ID);
            }

            //expand description msg
            if (DescsLoaded)
            {
                msgData[] Expand3 = new msgData[Descs.data.Length + 1];
                Array.Copy(Descs.data, Expand3, Descs.data.Length);
                Expand3[Expand3.Length - 1].NameID = "talisman_eff_" + Descs.data.Length.ToString("000");
                Expand3[Expand3.Length - 1].ID     = Descs.data.Length;
                if (DescCount > 0)
                {
                    pass = new byte[DescCount * 2];
                    Array.Copy(zssfile, 12 + (nameCount * 2), pass, 0, DescCount * 2);
                    Expand3[Expand3.Length - 1].Lines = new string[] { BytetoString(pass) };
                }
                else
                {
                    Expand3[Expand3.Length - 1].Lines = new string[] { "New Description Entry" }
                };

                Array.Copy(BitConverter.GetBytes((short)Expand3[Expand3.Length - 1].ID), 0, Items[Items.Length - 1].Data, 6, 2);
                Descs.data = Expand3;
                Items[Items.Length - 1].msgIndexDesc = FindmsgIndex(ref Descs, Descs.data[Descs.data.Length - 1].ID);
            }

            //loadzss(browseFile.FileName, Items.Length - 1);
            //itemList.SelectedIndex = itemList.Items.Count - 1;
            itemList.Items.Clear();
            for (int i = 0; i < Items.Length; i++)
            {
                if (NamesLoaded)
                {
                    itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)) + "-" + Names.data[Items[i].msgIndexName].Lines[0]);
                }
                else
                {
                    itemList.Items.Add(BitConverter.ToInt16(Items[i].Data, 0).ToString() + " / " + String.Format("{0:X}", BitConverter.ToInt16(Items[i].Data, 0)));
                }
            }
        }
Ejemplo n.º 9
0
        // Message受信
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == WM_MY_WND)
            {
                if ( (int)(m.WParam) == 0x0001 )
                {
                    textBox1.Text = "Pushed button1";
                }
                if ((int)(m.WParam) == 0x0002)
                {
                    textBox1.Text = "Pushed button2";
                }

            }
            if (m.Msg == WM_COPYDATA)
            {
                if ((int)(m.WParam) == 0x0000)
                {
                    COPYDATASTRUCT st = new COPYDATASTRUCT();
                    st = (COPYDATASTRUCT)m.GetLParam(typeof(COPYDATASTRUCT));
                    textBox1.Text = st.lpData;
                }
                if ((int)(m.WParam) == 0x0001)
                {
                    COPYDATASTRUCT2 st = new COPYDATASTRUCT2();
                    st = (COPYDATASTRUCT2)m.GetLParam(typeof(COPYDATASTRUCT2));

                    msgData dt = new msgData();
                    dt = (msgData)st.lpData;

                    textBox1.Text = dt.name;
                }

            }

            base.WndProc(ref m);
        }
Ejemplo n.º 10
0
        // SendMEssage WM_COPYDATA ( data is struct msgData )
        private void button4_Click(object sender, EventArgs e)
        {
            // COPYDATASTRUCT2 に入れる data用構造対用意
            msgData msgdata = new msgData();
            msgdata.no = 1;
            msgdata.name = "msgData.name";

            // WM_COPYDATA用構造体に struct msgData を設定
            COPYDATASTRUCT2 cds = new COPYDATASTRUCT2();
            cds.dwData = IntPtr.Zero;
            cds.lpData = msgdata;
            cds.cbData = Marshal.SizeOf(msgdata);

            // Message送信
            IntPtr myh = Process.GetCurrentProcess().MainWindowHandle;
            SendMessage(myh, WM_COPYDATA, 1, ref cds);
        }
Ejemplo n.º 11
0
 private void removeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     msgData[] reduce = new msgData[file.data.Length - 1];
     Array.Copy(file.data, reduce, file.data.Length - 1);
     file.data = reduce;
 }