コード例 #1
0
ファイル: DataManager.cs プロジェクト: bfayer/DaLinkO
        public void loadSavedData(Transmission loadedTransmission)
        {
            foreach (TElement t in loadedTransmission.TElementList)
            {
                if (t.elementName != "trigger")
                {
                    //something is wrong here, I think it
                    //needs to check to see that there isn't one already, if there is one already set the target equal to that one, the way it is
                    //right now is bugged out because if there are multiple references to the same thing it keeps overwriting the element with a new one instead of
                    //simply updating the values and changing the target of the transmission


                    /* new idea
                     *
                     * create entirely new active bean pack from all of the T elements in a broadcast
                     * cast that to the inbound add data class
                     * re link the telement's linked element
                     *
                     */



                    DR tempDR = new DR();
                    DP tempDP = new DP();
                    DE tempDE = new DE();

                    tempDE.N = t.linkedElement.N;
                    tempDE.T = t.linkedElement.T;
                    tempDE.V = t.linkedElement.V;

                    tempDP.LastHeardFrom = DateTime.Now;
                    tempDP.Src           = t.elementSourceName;
                    tempDP.v             = t.modversion;


                    tempDP.dataElement.Add(tempDE);
                    tempDR.dataPacks.Add(tempDP);
                    tempDR.TV = "1.00";
                    AddXML_1(tempDR);

                    reattachLinkeElement(t);
                }
            }

            //this probably shouldn't be used because this is all ghost data anyways from previous saves
            //if (packsAreUpdated != null) // will be null if no subscribers
            //{
            //    packsAreUpdated();  //global trigger for packs are updated, may be depreciated now that im doing it by passing the objects rather than events
            //}
        }
コード例 #2
0
ファイル: Transmission.cs プロジェクト: bfayer/DaLinkO
        public static TElement TElementPicker(string name, DE inDE)
        {
            TElement dataElement;


            if (inDE.T == "System.Int32" || inDE.T == "int")
            {
                dataElement = new TElement_Int32(name, inDE);
            }
            else if (inDE.T == "System.Boolean" || inDE.T == "bool")
            {
                dataElement = new TElement_Boolean(name, inDE);
            }
            else if (inDE.T == "System.Double" || inDE.T == "double")
            {
                dataElement = new TElement_Double(name, inDE);
            }
            else if (inDE.T == "System.SByte" || inDE.T == "sbyte")
            {
                dataElement = new TElement_SByte(name, inDE);
            }

            else if (inDE.T == "System.Int16" || inDE.T == "short")
            {
                dataElement = new TElement_Int16(name, inDE);
            }
            else if (inDE.T == "System.Int64" || inDE.T == "long")
            {
                dataElement = new TElement_Int64(name, inDE);
            }
            else if (inDE.T == "System.Byte" || inDE.T == "byte")
            {
                dataElement = new TElement_Byte(name, inDE);
            }
            else if (inDE.T == "System.UInt16" || inDE.T == "ushort")
            {
                dataElement = new TElement_UInt16(name, inDE);
            }
            else if (inDE.T == "System.UInt32" || inDE.T == "uint")
            {
                dataElement = new TElement_UInt32(name, inDE);
            }
            else if (inDE.T == "System.UInt64" || inDE.T == "ulong")
            {
                dataElement = new TElement_UInt64(name, inDE);
            }
            //else if (selectedDataElement.T == "System.Single")
            //{
            //    this.dataElement = new TElement_Single(tbDataName.Text, selectedDataElement);
            //    this.DialogResult = DialogResult.OK;
            //}
            //decimal??
            else if (inDE.T == "System.Char" || inDE.T == "char")
            {
                dataElement = new TElement_Char(name, inDE);
            }
            else
            {
                byte[] bytearray = new byte[1];
                bytearray[0] = 0;
                dataElement  = new TElement_Constant("broken", bytearray);
                //MessageBox.Show("incompatible data type");
            }

            return(dataElement);
        }
コード例 #3
0
ファイル: Transmission.cs プロジェクト: bfayer/DaLinkO
 public TElement_Char(string name, DE element)
 {
     // TElementType = 3;
     elementName   = name;
     linkedElement = element;
 }
コード例 #4
0
ファイル: Transmission.cs プロジェクト: bfayer/DaLinkO
 public TElement_Boolean(string name, DE element)
 {
     //TElementType = 2;
     elementName   = name;
     linkedElement = element;
 }
コード例 #5
0
ファイル: Transmission.cs プロジェクト: bfayer/DaLinkO
 public TElement_Int32(string name, DE element)
 {
     //TElementType = 1;
     elementName   = name;
     linkedElement = element;
 }