ToString() public méthode

public ToString ( ) : string
Résultat string
        public static INode AddNode(this IGraph myIGraph, UInt32 myUInt32Id)
        {
            if (myIGraph == null)
                throw new ArgumentNullException("myIGraph must not be null!");

            return myIGraph.AddNode(myUInt32Id.ToString());
        }
Exemple #2
0
        public void AddTransition(State srcState, char c, State dstState)
        {
            if (!_Q.Contains(srcState))
            {
                throw new DFAException("Source State " + srcState.ToString() + " does not exist in the current DFA");
            }
            if (!_S.Contains(c))
            {
                _S.Add(c);
            }
            if (!_Q.Contains(dstState))
            {
                throw new DFAException("Destination State " + dstState.ToString() + " does not exist in the " +
                                       "current DFA");
            }

            if (!_d.ContainsKey(srcState))
            {
                _d [srcState] = new Dictionary <char, State> ();
            }
            if (_d [srcState].ContainsKey(c))
            {
                if (_d [srcState] [c] != dstState)
                {
                    throw new DFAException("Transition from " + srcState.ToString() + " with " + c.ToString() +
                                           " already exists in the current DFA.");
                }
            }
            else
            {
                _d [srcState] [c] = dstState;
            }
        }
Exemple #3
0
        public DWORD Init(string license)
        {
            PCIE_DEFAULT_LICENSE_STRING = license;
            // "6C3CC2CFE89E7AD0424A070D434A6F6DC4954C87.qqzhw";
            if (windrvr_decl.WD_DriverName(PCIE_DEFAULT_DRIVER_NAME) == null)
            {
                Log.ErrLog("NEWAMD86_DeviceList.Init: Failed to set driver name for the " +
                           "WDC library.");
                return((DWORD)wdc_err.WD_SYSTEM_INTERNAL_ERROR);
            }

            DWORD dwStatus = wdc_lib_decl.WDC_SetDebugOptions(wdc_lib_consts.WDC_DBG_DEFAULT,
                                                              null);

            if (dwStatus != (DWORD)wdc_err.WD_STATUS_SUCCESS)
            {
                Log.ErrLog("NEWAMD86_DeviceList.Init: Failed to initialize debug options for the " +
                           "WDC library. Error 0x" + dwStatus.ToString("X") +
                           utils.Stat2Str(dwStatus));
                return(dwStatus);
            }

            dwStatus = wdc_lib_decl.WDC_DriverOpen(
                (WDC_DRV_OPEN_OPTIONS)wdc_lib_consts.WDC_DRV_OPEN_DEFAULT,
                PCIE_DEFAULT_LICENSE_STRING);
            if (dwStatus != (DWORD)wdc_err.WD_STATUS_SUCCESS)
            {
                Log.ErrLog("NEWAMD86_DeviceList.Init: Failed to initialize the WDC library. "
                           + "Error 0x" + dwStatus.ToString("X") + utils.Stat2Str(dwStatus));
                return(dwStatus);
            }
            return(Populate());
        }
Exemple #4
0
        public UInt32 createNewCharacter(string handle, UInt32 userid, UInt32 worldId)
        {
            conn.Open();
            UInt32 charId = 0;
            //TODO: Complete with real data from a hashtable (or something to do it faster);
            //TODO: find values for uria starting place
            string sqlInsertQuery="INSERT INTO characters SET userid = '" + userid.ToString() + "', worldid='" + worldId.ToString() + "', status='0', handle = '" + handle + "', created=NOW() ";
            queryExecuter= conn.CreateCommand();
            queryExecuter.CommandText = sqlInsertQuery;
            queryExecuter.ExecuteNonQuery();

            //As i didnt find a solution for "last_insert_id" in C# we must fetch the last row by a normal query
            string sqlQuery = "SELECT charId FROM characters WHERE userId='" + userid.ToString() + "' AND worldId='" + worldId.ToString() + "' AND is_deleted='0' ORDER BY charId DESC LIMIT 1";
            queryExecuter = conn.CreateCommand();
            queryExecuter.CommandText = sqlQuery;
            dr = queryExecuter.ExecuteReader();

            while (dr.Read())
            {
                charId = (UInt32)dr.GetDecimal(0);
            }

            conn.Close();

            // Create RSI Entry
            conn.Open();
            string sqlRSIQuery = "INSERT INTO rsivalues SET charid='" + charId.ToString() + "' ";
            queryExecuter = conn.CreateCommand();
            queryExecuter.CommandText = sqlRSIQuery;
            queryExecuter.ExecuteNonQuery();

            conn.Close();

            return charId;
        }
Exemple #5
0
        private void TraceLog(BOOL bIsRead, wdc_err status)//状态输出
        {
            string sData = "";
            string sInfo = "";

            if (status == wdc_err.WD_STATUS_SUCCESS)
            {
                sData = (bIsRead? "R: " : "W: ") +
                        diag_lib.DisplayHexBuffer(m_buff, m_dwBytes);//数据装换成字符串
                sInfo = (bIsRead? " from " : " to ") + "offset " +
                        m_dwOffset.ToString("X") + "(" + m_device.ToString(false)
                        + ")";

                Log.TraceLog("CfgTransfersForm: " + sData + sInfo);//在主窗口输出
            }
            else
            {
                sData = "failed to " + (bIsRead? "read from" : "write to") +
                        " offset " + m_dwOffset.ToString("X") + " status 0x" +
                        status.ToString("X") + ": " + utils.Stat2Str((DWORD)status);
                sInfo = "(" + m_device.ToString(false) + ")";

                Log.ErrLog("CfgTransfersForm: " + sData + sInfo);
            }

            txtData.Text += sData + Environment.NewLine;     //字窗口输出
        }
        private void TraceLog(BOOL bIsRead, wdc_err status)
        {
            string sData = "";
            string sInfo = "";

            if (status == wdc_err.WD_STATUS_SUCCESS)
            {
                sData = (bIsRead? "R: " : "W: ") +
                        diag_lib.DisplayHexBuffer(m_obj, m_dwBytes, m_mode);
                sInfo = (bIsRead ? " from " : " to ") + "offset " +
                        m_dwOffset.ToString("X") + " on BAR " + m_dwBar.ToString()
                        + "(" + m_device.ToString(false) + ")";

                Log.TraceLog("AddrSpaceTransferForm: " + sData + sInfo);
            }
            else
            {
                sData = "failed to " + (bIsRead? "read from" : "write to") +
                        " offset " + m_dwOffset.ToString("X") + " on BAR " +
                        m_dwBar.ToString() + "status 0x" + status.ToString("X") +
                        ": " + utils.Stat2Str((DWORD)status);
                sInfo = "(" + m_device.ToString(false) + ")";

                Log.ErrLog("AddrSpaceTransferForm: " + sData + sInfo);
            }

            txtData.Text += sData + Environment.NewLine;
        }
Exemple #7
0
        public DWORD Init()
        {
            if (windrvr_decl.WD_DriverName(PCI_0228_DEFAULT_DRIVER_NAME) == null)
            {
                Log.ErrLog("PCI_0228_DeviceList.Init: Failed to set driver name for the " +
                           "WDC library.");
                return((DWORD)wdc_err.WD_SYSTEM_INTERNAL_ERROR);
            }

            DWORD dwStatus = wdc_lib_decl.WDC_SetDebugOptions(wdc_lib_consts.WDC_DBG_DEFAULT,
                                                              null);

            if (dwStatus != (DWORD)wdc_err.WD_STATUS_SUCCESS)
            {
                Log.ErrLog("PCI_0228_DeviceList.Init: Failed to initialize debug options for the " +
                           "WDC library. Error 0x" + dwStatus.ToString("X") +
                           utils.Stat2Str(dwStatus));
                return(dwStatus);
            }

            dwStatus = wdc_lib_decl.WDC_DriverOpen(
                (WDC_DRV_OPEN_OPTIONS)wdc_lib_consts.WDC_DRV_OPEN_DEFAULT,
                PCI_0228_DEFAULT_LICENSE_STRING);
            if (dwStatus != (DWORD)wdc_err.WD_STATUS_SUCCESS)
            {
                Log.ErrLog("PCI_0228_DeviceList.Init: Failed to initialize the WDC library. "
                           + "Error 0x" + dwStatus.ToString("X") + utils.Stat2Str(dwStatus));
                return(dwStatus);
            }
            return(Populate());
        }
Exemple #8
0
 public static string getSampleName(UInt32 val)
 {
     try{
         string temp = "0x" + val.ToString("X");
         sampleNames.TryGetValue(val, out temp);
         if (temp == null) return "0x" + val.ToString("X");
         return temp;
     }catch{
         return "0x" + val.ToString("X");
     }
 }
Exemple #9
0
        override public string ToString()
        {
            string res = "";

            res += "Q:";
            foreach (State s in _Q)
            {
                res += " " + s.ToString();
            }
            res += Environment.NewLine + "S:";
            foreach (char c in _S)
            {
                res += " " + c.ToString();
            }
            res += Environment.NewLine + "d:";
            foreach (State startState in _d.Keys)
            {
                foreach (char c in _d[startState].Keys)
                {
                    foreach (State endState in _d[startState][c])
                    {
                        res += Environment.NewLine + "(" + startState + "," + c + ") -> " + endState;
                    }
                }
            }
            res += Environment.NewLine + "Final State: " + _finalState.ToString() + Environment.NewLine;
            return(res);
        }
Exemple #10
0
 public void AddTransition(State srcState, char c, State dstState)
 {
     if (!_Q.Contains(srcState))
     {
         throw new NFAException("Source State " + srcState.ToString() + " does not exist in the current NFA");
     }
     if (!_S.Contains(c))
     {
         _S.Add(c);
     }
     if (!_Q.Contains(dstState))
     {
         throw new NFAException("Destination State " + dstState.ToString() + " does not exist in the " +
                                "current NFA");
     }
     if (!_d.ContainsKey(srcState))
     {
         _d [srcState] = new Dictionary <char, HashSet <State> > ();
     }
     if (!_d [srcState].ContainsKey(c))
     {
         _d [srcState] [c] = new HashSet <State> ();
     }
     _d [srcState] [c].Add(dstState);
 }
Exemple #11
0
        protected void GetMediaInfoSink(System.UInt32 InstanceID, out System.UInt32 NrTracks, out System.String MediaDuration, out System.String CurrentURI, out System.String CurrentURIMetaData, out System.String NextURI, out System.String NextURIMetaData, out DvAVTransport.Enum_PlaybackStorageMedium PlayMedium, out DvAVTransport.Enum_RecordStorageMedium RecordMedium, out DvAVTransport.Enum_RecordMediumWriteStatus WriteStatus)
        {
            if (ID_Table.ContainsKey(InstanceID) == false)
            {
                throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
            }
            else
            {
                AVConnection c = (AVConnection)ID_Table[InstanceID];
                NrTracks      = c._NumberOfTracks;
                MediaDuration = string.Format("{0:00}", c._Duration.Hours) + ":" + string.Format("{0:00}", c._Duration.Minutes) + ":" + string.Format("{0:00}", c._Duration.Seconds);
                if (c._CurrentURI == null)
                {
                    CurrentURI = "";
                }
                else
                {
                    CurrentURI = HTTPMessage.UnEscapeString(c._CurrentURI.AbsoluteUri);
                }
                if (c._NextURI == null)
                {
                    NextURI = "";
                }
                else
                {
                    NextURI = HTTPMessage.UnEscapeString(c._NextURI.AbsoluteUri);
                }

                CurrentURIMetaData = c._CurrentURIMetaData;
                NextURIMetaData    = c._NextURIMetaData;
                PlayMedium         = c._PlaybackMedium;
                RecordMedium       = c._RecordMedium;
                WriteStatus        = c._WriteStatus;
            }
        }
		public Message getMessageById( UInt32 id )
		{
			string sql = "`SELECT " +
			             "messages`.`id`, " +
			             "`messages`.`nuberReceiver`, " +
			             "`messages`.`message`, " +
			             "`messages`.`sendAt`, " +
			             "`messages`.`contactId` " +
			             "FROM SmsApplicatie.messages " +
			             "WHERE id=:id";

			MySqlCommand statement = this.databaseConnection.CreateCommand ();
			statement.CommandText = sql;
			statement.Parameters.AddWithValue ("id", id.ToString ());

			MySqlDataReader reader = statement.ExecuteReader ();

			if (reader.Read ()) 
			{
				Message message = new Message ( 
					Convert.ToUInt32( reader["id"] ),
					Convert.ToString( reader["nuberReceiver"] ),
					Convert.ToString( reader["message"] ),
					Convert.ToDateTime( reader["sendAt"] ),
					Convert.ToUInt32( reader["contactId"] )
				);
				return new Message ();
			}
			return null;
		}
Exemple #13
0
 public void AddFinalState(State finalState)
 {
     if (!_Q.Contains(finalState))
     {
         throw new DFAException("Final State " + finalState.ToString() + " does not exist in the current DFA");
     }
     _finalStates.Add(finalState);
 }
Exemple #14
0
    public bool StartListeningForChuckEvent(System.UInt32 chuckId, string variableName, Chuck.VoidCallback callback)
    {
        // save a copy of the delegate so it doesn't get garbage collected!
        string internalKey = chuckId.ToString() + "$" + variableName;

        voidCallbacks[internalKey] = callback;
        return(startListeningForChuckEvent(chuckId, variableName, callback));
    }
Exemple #15
0
        public Chunk_Base getChunk(UInt32 chunkID, bool error = true)
        {
            Chunk_Base chunk = getChunksByID(chunkID).FirstOrDefault();
            if (chunk == null && error)
                throw new WMOException(string.Format("File does not contain chunk 0x{0}.", chunkID.ToString("X")));

            return chunk;
        }
Exemple #16
0
 public override string ToString()
 {
     return("MThd: " + MThd.ToString()
            + " header_length:" + header_length.ToString()
            + " format: " + format.ToString()
            + " # tracks: " + number_of_tracks.ToString()
            + " division" + division.ToString());
 }
Exemple #17
0
        public void RemotedExperienceService_Advertise(System.UInt32 Nonce, System.String HostId, System.String ApplicationId, System.String ApplicationVersion, System.String ApplicationData, System.String HostFriendlyName, System.String ExperienceFriendlyName, System.String ExperienceIconUri, System.String ExperienceEndpointUri, System.String ExperienceEndpointData, System.String SignatureAlgorithm, System.String Signature, System.String HostCertificate)
        {
            _RES_HostNonce              = BitConverter.GetBytes(Nonce);
            _RES_ApplicationId          = ApplicationId;
            _RES_ApplicationVersion     = ApplicationVersion;
            _RES_ExperienceEndpointUri  = ExperienceEndpointUri;
            _RES_ExperienceEndpointData = ExperienceEndpointData;
            _RES_SignatureAlgorithm     = SignatureAlgorithm;
            _RES_Signature              = Signature;
            _RES_HostCertificate        = HostCertificate;
            m_logger.LogDebug("RemotedExperienceService_Advertise(" + Nonce.ToString() + HostId.ToString() + ApplicationId.ToString() + ApplicationVersion.ToString() + ApplicationData.ToString() + HostFriendlyName.ToString() + ExperienceFriendlyName.ToString() + ExperienceIconUri.ToString() + ExperienceEndpointUri.ToString() + ExperienceEndpointData.ToString() + SignatureAlgorithm.ToString() + Signature.ToString() + HostCertificate.ToString() + ")");

            // parse endpoint data
            Dictionary <String, String> endpointData = new Dictionary <String, String>();

            foreach (String part in ExperienceEndpointData.Split(';'))
            {
                String[] nameValuePair = part.Split(new char[] { '=' }, 2);
                endpointData.Add(nameValuePair[0], nameValuePair[1]);
            }

            // decrypt MCX user password with cert's signing key (private key)
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();

            rsa.FromXmlString(File.ReadAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Certificates\\SoftSledPrivateKey.xml"));

            byte[] cryptedPass = Convert.FromBase64String(endpointData["encryptedpassword"]);
            String rdpPass     = "";

            try
            {
                rdpPass = Encoding.ASCII.GetString(rsa.Decrypt(cryptedPass, true));
            }
            catch (Exception ex)
            {
                m_logger.LogError("RSA decryption of encrypted password failed " + ex.Message);
                m_logger.LogError("Extender Experience Pairing has failed!");
                return;
            }

            string rdpHost = ExperienceEndpointUri.Substring(6, ExperienceEndpointUri.Length - 12);
            string rdpUser = endpointData["user"];

            m_logger.LogDebug("RDP host: " + rdpHost);
            m_logger.LogDebug("RDP clear text Password: "******"RDP user: "******"Extender Experience data exchanged!");
        }
Exemple #18
0
        public void addItemToInventory(UInt16 slotId, UInt32 itemGoID)
        {
            UInt32 charID = Store.currentClient.playerData.getCharID();

            string sqlQuery = "INSERT INTO inventory SET charId = '" + charID.ToString() + "' , goid = '" + itemGoID.ToString() + "', slot = '" + slotId.ToString() + "', created = NOW() ";
            queryExecuter = conn.CreateCommand();
            queryExecuter.CommandText = sqlQuery;
            queryExecuter.ExecuteNonQuery();
        }
Exemple #19
0
 public void addAbility(Int32 abilityID, UInt16 slotID, UInt32 charID, UInt16 level, UInt16 is_loaded)
 {
     string theQuery = "INSERT INTO char_abilities SET char_id='" + charID.ToString()  + "', slot='" + slotID.ToString() + "', ability_id='" + abilityID.ToString() + "', level='" + level.ToString() + "', is_loaded='" + is_loaded.ToString() + "', added=NOW() ";
     conn.Open();
     queryExecuter = conn.CreateCommand();
     queryExecuter.CommandText = theQuery;
     queryExecuter.ExecuteNonQuery();
     conn.Close();
 }
 private void btnOK_Click(object sender, EventArgs e)
 {
     Nmin = Convert.ToUInt32(numNmin.Value);
     Nmax = Convert.ToUInt32(numNmax.Value);
     Tsay = Convert.ToUInt32(numTsayMinute.Value * 60 + numTsaySecond.Value);
     Tnguoi = Convert.ToUInt32(numTnguoiMinute.Value * 60 + numTnguoiSecond.Value);
     ret = Nmin.ToString() + "," + Nmax.ToString() + "," + Tsay.ToString() + "," + Tnguoi.ToString();
     this.Close();
 }
        internal static string ChangeTimesPlayed(string songLine, LUint newTimesPlayed)
        {
            string returnVal = newTimesPlayed.ToString();

            for (int i = GetTimesPlayed(songLine).ToString().Length; i < songLine.Length; i++)
            {
                returnVal += songLine[i];
            }
            return(returnVal);
        }
Exemple #22
0
 protected void GetVolumeSink(System.UInt32 InstanceID, DvRenderingControl.Enum_A_ARG_TYPE_Channel Channel, out System.UInt16 CurrentVolume)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         CurrentVolume = c.GetVolume(Channel);
     }
 }
Exemple #23
0
 protected void SetMuteSink(System.UInt32 InstanceID, DvRenderingControl.Enum_A_ARG_TYPE_Channel Channel, System.Boolean DesiredMute)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         c._SetMute(Channel, DesiredMute);
     }
 }
Exemple #24
0
 protected void GetRedVideoGainSink(System.UInt32 InstanceID, out System.UInt16 CurrentRedVideoGain)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         CurrentRedVideoGain = c.RedVideoGain;
     }
 }
Exemple #25
0
        public static RunnerResult FetchCardPage(UInt32 mid)
        {
            HttpWebResponse resp;
            String respBody;

            _RunHttpRequest(_CardDetailsUrlPath + mid.ToString(), out resp, out respBody);

            if (resp.StatusCode != HttpStatusCode.OK)
                return new RunnerResult(ResultType.UnknownCard, null);
            else
                return new RunnerResult(ResultType.CardResult, respBody);
        }
Exemple #26
0
 protected void SetRedVideoGainSink(System.UInt32 InstanceID, System.UInt16 DesiredRedVideoGain)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         c._SetRedVideoGain(DesiredRedVideoGain);
     }
 }
Exemple #27
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="index"></param>
        /// <param name="abc"></param>
        public AVM2Method( UInt32 index, AbcFile abc )
        {
            if ( abc.Methods.Count <= index )
            {
                ArgumentException ae = new ArgumentException( "Method " + index.ToString( "d" ) + " not in ABC file" );
                Log.Error(this,  ae );
                throw ae;
            }

            _Abc = abc;
            _MethodID = index;
        }
Exemple #28
0
 protected void PlaySink(System.UInt32 InstanceID, DvAVTransport.Enum_TransportPlaySpeed Speed)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         c.Play(Speed);
     }
 }
Exemple #29
0
 protected void NextSink(System.UInt32 InstanceID)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         c.Next();
     }
 }
Exemple #30
0
 protected void SetRecordQualityModeSink(System.UInt32 InstanceID, DvAVTransport.Enum_CurrentRecordQualityMode NewRecordQualityMode)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         c.SetRecordQualityMode(NewRecordQualityMode);
     }
 }
Exemple #31
0
 protected void GetCurrentTransportActionsSink(System.UInt32 InstanceID, out System.String Actions)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         Actions = c._Actions;
     }
 }
        // ITDLUIExtension ------------------------------------------------------------------

        public bool SelectTask(UInt32 dwTaskID)
        {
            SampleListItem item = new SampleListItem();

            item.Value = dwTaskID.ToString();
            item.Type = "Selection";

            m_Items.Add(item);
            m_ListView.Items.Refresh();

            return true;
        }
 public string AnalogInput(int portNumber)
 {
     if (ADResolution > 16)
     {
         ULStat = DaqBoard.AIn32(portNumber, AcutalRange, out DataValue32, Options);
         return(DataValue32.ToString());
     }
     else
     {
         ULStat = DaqBoard.AIn(portNumber, AcutalRange, out DataValue);
         return(DataValue.ToString());
     }
 }
        public TextureListObject(UInt32 imageHeaderOffset, TextureNode node)
        {
            name = "Texture " + (DatFile.textureList.Items.Count +1) + " (" + imageHeaderOffset.ToString("x8") + ")";
            this.node = node;
            imageHeader = node.imageHeader;
            paletteHeader = node.paletteHeader;
            imageBitmap = TPL.ConvertFromTextureMelee(imageHeader, paletteHeader, out imageSize);





        }
Exemple #35
0
    public bool GetFloat(System.UInt32 chuckId, string variableName, Chuck.FloatCallback callback)
    {
        // save a copy of the delegate so it doesn't get garbage collected!
        string internalKey = chuckId.ToString() + "$" + variableName;

        floatCallbacks[internalKey] = callback;
        // register the callback with ChucK
        if (!getChuckFloat(chuckId, variableName, floatCallbacks[internalKey]))
        {
            return(false);
        }
        return(true);
    }
Exemple #36
0
 protected void GetTransportSettingsSink(System.UInt32 InstanceID, out DvAVTransport.Enum_CurrentPlayMode PlayMode, out DvAVTransport.Enum_CurrentRecordQualityMode RecQualityMode)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         PlayMode       = c._CurrentPlayMode;
         RecQualityMode = c._CurrentRecMode;
     }
 }
Exemple #37
0
        static StackObject *ToString_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.UInt32 instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack);

            var result_of_this_method = instance_of_this_method.ToString();

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemple #38
0
            public CKey Connect(TPeerCnt PeerNum_, string DataPath_, CNamePort MasterNamePort_)
            {
                var FullPath = Path.GetFullPath(DataPath_);

                var FileName = FullPath + "Data_" + PeerNum_.ToString() + ".bin";

                _Servers.AddAt((Int32)PeerNum_, new _SServer(_PeerCounter, MasterNamePort_, FileName));
                if (!_Connect(PeerNum_))
                {
                    return(new CKey());
                }

                return(new CKey(PeerNum_, _PeerCounter++));
            }
Exemple #39
0
 protected void GetTransportInfoSink(System.UInt32 InstanceID, out DvAVTransport.Enum_TransportState CurrentTransportState, out DvAVTransport.Enum_TransportStatus CurrentTransportStatus, out DvAVTransport.Enum_TransportPlaySpeed CurrentSpeed)
 {
     if (ID_Table.ContainsKey(InstanceID) == false)
     {
         throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
     }
     else
     {
         AVConnection c = (AVConnection)ID_Table[InstanceID];
         CurrentTransportState  = c._CurrentTransportState;
         CurrentSpeed           = c._CurrentTransportSpeed;
         CurrentTransportStatus = c._CurrentStatus;
     }
 }
Exemple #40
0
 internal int AddConnection(BTCONNHDL conn_hdl, IBluesoleilConnection newConn)
 {
     lock (_liveConns) {
         if (_liveConns.ContainsKey(conn_hdl))
         {
             Debug.Fail("AddDisconnect: already contains hConn! 0x" + conn_hdl.ToString("X"));
         }
         else
         {
             _liveConns.Add(conn_hdl, newConn);
         }
         return(_liveConns.Count);
     }
 }
Exemple #41
0
        protected void GetDeviceCapabilitiesSink(System.UInt32 InstanceID, out System.String PlayMedia, out System.String RecMedia, out System.String RecQualityModes)
        {
            if (ID_Table.ContainsKey(InstanceID) == false)
            {
                throw(new UPnPCustomException(802, InstanceID.ToString() + " is not a valid InstanceID"));
            }
            else
            {
                AVConnection c = (AVConnection)ID_Table[InstanceID];
                PlayMedia       = "";
                RecMedia        = "";
                RecQualityModes = "";

                foreach (string m in DvAVTransport.Values_PlaybackStorageMedium)
                {
                    if (PlayMedia == "")
                    {
                        PlayMedia = m;
                    }
                    else
                    {
                        PlayMedia = PlayMedia + "," + m;
                    }
                }

                foreach (string m in DvAVTransport.Values_RecordStorageMedium)
                {
                    if (RecMedia == "")
                    {
                        RecMedia = m;
                    }
                    else
                    {
                        RecMedia = RecMedia + "," + m;
                    }
                }

                foreach (string m in DvAVTransport.Values_CurrentRecordQualityMode)
                {
                    if (RecQualityModes == "")
                    {
                        RecQualityModes = m;
                    }
                    else
                    {
                        RecQualityModes = RecQualityModes + "," + m;
                    }
                }
            }
        }
Exemple #42
0
        public string DeviceDescription()
        {
            string deviceDesc = "Device ";

            if (dwAddr != VALUE_NONE)
            {
                string.Concat(deviceDesc, "0x", dwAddr.ToString("X"), ", ");
            }

            return(string.Concat(deviceDesc, "vid 0x", wVid.ToString("X"),
                                 ", pid 0x", wPid.ToString("X"), ", ifc ",
                                 dwInterfaceNum.ToString(), ", alt setting ",
                                 dwAltSettingNum.ToString(), ", handle 0x",
                                 hDevice.ToString()));
        }
Exemple #43
0
    //生成请求
    public void SettingParams()
    {
        SystemOptions so = new SystemOptions();

        //请求网关
        requestUrl = so["MemberSharing_Tencent_Gateway"].ToString("").Trim();

        //签名类型
        sign_type = "md5";

        //签名
        key = so["MemberSharing_Tencent_MD5"].ToString("").Trim();

        //对于商户:使用和支付时一样的key,可以登录财付通商户系统修改。
        sign_encrypt_keyid = "0";

        //字符编码格式
        input_charset = "GBK";

        //服务名称
        service = "login";

        //商户编号
        chnid = so["MemberSharing_Tencent_UserNumber"].ToString("").Trim();

        //chnid类型
        chtype = "0";

        //服务器通知返回接口
        redirect_url = Shove._Web.Utility.GetUrl() + "/Home/Room/TencentReceive.aspx";

        //自定义参数
        attach =redirect_url;

        //时间戳
        tmstamp = GetTmstamp();
        Dictionary<string, string> dict = new Dictionary<string, string>();
        dict.Add("sign_type", sign_type);
        dict.Add("sign_encrypt_keyid", sign_encrypt_keyid);
        dict.Add("input_charset", input_charset);
        dict.Add("service", service);
        dict.Add("chnid", chnid);
        dict.Add("chtype", chtype);
        dict.Add("redirect_url", redirect_url);
        dict.Add("attach", attach);
        dict.Add("tmstamp", tmstamp.ToString());
        sign=GetSign(key, input_charset,dict);
    }
Exemple #44
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sourceStream"></param>
        protected override void Parse(BinaryReader sourceStream)
        {
            _DebugType = AVM2.Static.VariableLengthInteger.ReadU8(sourceStream);
            _Index = AVM2.Static.VariableLengthInteger.ReadU30(sourceStream);
            _Reg = AVM2.Static.VariableLengthInteger.ReadU8(sourceStream);
            _Extra = AVM2.Static.VariableLengthInteger.ReadU30(sourceStream);

            if (0 != _Extra)
            {
                // Of course, Adobe Flash CS4 makes use of this field
                AbcFormatException abcfe = new AbcFormatException("Extra (reserved) field in Debug instruction used: 0x" + _Extra.ToString("X"));
                Log.Warn(this, abcfe);
                //throw abcfe;
                //Log.Warn(this, "Extra (reserved) field in Debug instruction used: 0x" + _Extra.ToString("X"));
            }
        }
Exemple #45
0
        // Allows the thread to place data in the RichEditBox control.
        private void AddMessageData(Int32 chNum, UInt32 msgId, UInt32 dlc, Byte [] msgData,
            UInt32 flags, Linlib.LinMessageInfo msgInfo)
        {
            if ((flags & Linlib.LIN_RX) != 0)
             {
            OutputRTB.AppendText("  RX   " + chNum.ToString("00") + "   ");
             }
             else
             {
            OutputRTB.AppendText("  TX   " + chNum.ToString("00") + "   ");
             }
             OutputRTB.AppendText(msgId.ToString("X8") + "   ");

             OutputRTB.AppendText(
            (((flags & Linlib.LIN_BIT_ERROR) != 0) ? "B" : " ") +
            (((flags & Linlib.LIN_SYNCH_ERROR) != 0) ? "S" : " ") +
            (((flags & Linlib.LIN_PARITY_ERROR) != 0) ? "P" : " ") +
            (((flags & Linlib.LIN_CSUM_ERROR) != 0) ? "C" : " ") +
            (((flags & Linlib.LIN_NODATA) != 0) ? "H" : " ") +
            (((flags & Linlib.LIN_WAKEUP_FRAME) != 0) ? "W" : " ") + "   ");

             OutputRTB.AppendText(dlc.ToString("D") + "     " +
                              msgInfo.checkSum.ToString("X2") + "     " +
                              msgInfo.idPar.ToString("X2") +
                              "         ");
             for (int i = 0; i < 8; i++)
             {
            if (i < dlc)
            {
               OutputRTB.AppendText(msgData[i].ToString("X2") + "  ");
            }
            else
            {
               OutputRTB.AppendText("    ");
            }
             }
             // time stamp
             double modifiedTime;
             modifiedTime = ((double)(msgInfo.timestamp)) / 1000.0;
             OutputRTB.AppendText(modifiedTime.ToString(" " + "000000.000") + "\n");

             // Need scroll bar to move down as data is added.
             // qqq - Something needs to be fixed here so scroll bar prevents this call.
             OutputRTB.ScrollToCaret();
        }
Exemple #46
0
        public VolumeInfo(string path)
        {
            var drive_letter = Path.GetPathRoot(path);
            uint serial_number = 0;
            uint max_component_length = 0;
            StringBuilder sb_volume_name = new StringBuilder(256);
            UInt32 file_system_flags = new UInt32();
            StringBuilder sb_file_system_name = new StringBuilder(256);

            if (GetVolumeInformation(drive_letter, sb_volume_name,
                (UInt32)sb_volume_name.Capacity, out serial_number, out max_component_length,
                out file_system_flags, sb_file_system_name, (UInt32)sb_file_system_name.Capacity))
            {
                VolumeName = sb_volume_name.ToString();
                SerialNumber = serial_number.ToString();
            //                lblMaxComponentLength.Text = max_component_length.ToString();
                FileSystem = sb_file_system_name.ToString();
                Flags = "&&H" + file_system_flags.ToString("x");
            }
        }
Exemple #47
0
    public void CreateRole(string account, string loginKey, UInt32 serverID, string roleName, UInt32 p)
    {
        var rArgs = new Dict<string, string>();
        rArgs["acc"] = account;
        rArgs["key"] = loginKey;
        rArgs["sid"] = serverID.ToString();
        rArgs["n"] = roleName;
        rArgs["p"] = p.ToString();

        var rPath = "CreateRole";
        this.SendRequest(rPath, rArgs, ServerType.LoginServer, (args) =>
        {
            var stream = new MemoryStream(args.bytes);
            StreamReader sr = new StreamReader(stream, System.Text.Encoding.GetEncoding("UTF-8"));
            var ret = UInt32.Parse(sr.ReadLine());

            var eventArgs = new ResponseEventArgs(ret);

            ResponseCreateRoleEvent(this, eventArgs);
        });
    }
Exemple #48
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="size"></param>
        /// <param name="sourceStream"></param>
        /// <param name="sourceVersion"></param>
        /// <returns></returns>
        public static AVM1InstructionSequence GetCode( UInt32 size, BinaryReader sourceStream, byte sourceVersion )
        {
            AVM1InstructionSequence retVal = new AVM1InstructionSequence();

            using ( MemoryStream memStream = new MemoryStream( sourceStream.ReadBytes( (int)size ) ) )
            {
                BinaryReader2 brInner = new BinaryReader2( memStream );
                while ( brInner.BaseStream.Position < size )
                {
                    if ( 0 == brInner.PeekByte() )
                    {
                        //
                        // ActionEndFlag found
                        //
                        AbstractAction innerAction = AVM1Factory.Create( brInner, sourceVersion );
                        retVal.Add( innerAction );

                        //
                        // Verify that the entire MemoryStream (i.e. "size" bytes) were consumed
                        //
                        if ( brInner.BaseStream.Position != size )
                        {
                            Log.Warn(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Code reading for size " + size.ToString("d") +
                                " terminated prematurely at position 0x" + brInner.BaseStream.Position.ToString( "X08" )
                            );
                        }

                        break;
                    }
                    else
                    {
                        AbstractAction innerAction = AVM1Factory.Create( brInner, sourceVersion );
                        retVal.Add( innerAction );
                    }
                }
            }

            return retVal;
        }
Exemple #49
0
        public static PutFileRet PutFileWithUpToken(
            string upToken, string tableName, string key, string mimeType,
            string localFile, string customMeta, string callbackParam, UInt32 crc32)
        {
            string entryURI = tableName + ":" + key;
            if (String.IsNullOrEmpty(mimeType))
            {
                mimeType = "application/octet-stream";
            }
            string action = "/rs-put/" + Base64UrlSafe.Encode(entryURI) +
                    "/mimeType/" + Base64UrlSafe.Encode(mimeType);
            if (!String.IsNullOrEmpty(customMeta))
            {
                action += "/meta/" + Base64UrlSafe.Encode(customMeta);
            }
            if (crc32 != 0)
            {
                action += "/crc32/" + crc32.ToString();
            }

            try
            {
                var postParams = new Dictionary<string, object>();
                postParams["auth"] = upToken;
                postParams["action"] = action;
                postParams["file"] = new FileParameter(localFile, mimeType);
                if (!String.IsNullOrEmpty(callbackParam))
                    postParams["params"] = callbackParam;
                CallRet callRet = MultiPartFormDataPost.Post(Config.UP_HOST + "/upload", postParams);
                return new PutFileRet(callRet);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return new PutFileRet(new CallRet(HttpStatusCode.BadRequest, e));
            }
        }
Exemple #50
0
 public String get_torrent_name(UInt32 id)
 {
     String url = nyaruko.Text;
     if (!(url.EndsWith("/")))
         url += "/";
     url += "?page=view&tid=" + id.ToString();
     try
     {
         HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
         HttpWebResponse response = request.GetResponse() as HttpWebResponse;
         String name=null;
         if (response.StatusCode == HttpStatusCode.OK)
         {
             StreamReader readStream;
             Stream receiveStream = response.GetResponseStream();
             Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
             readStream = new StreamReader(receiveStream, encode);
             String data = readStream.ReadToEnd();
             readStream.Close();
             int start = data.IndexOf("<td class=\"viewtorrentname\">");
             if (start < 0) //no such torrent
                 return null;
             name = data.Substring(start + 28);
             name = name.Substring(0, name.IndexOf("</td>"));
         }
         response.Close();
         return name;
     }
     catch (IOException e)
     {
         return null;
     }
     catch (WebException e)
     {
         return null;
     };
 }
 public static void VerifySucceeded(UInt32 hresult)
 {
     if (hresult > 1)
     {
         throw new Exception("Failed with HRESULT: " + hresult.ToString("X"));
     }
 }
Exemple #52
0
        static void Main(string[] args)
        {
            e = emu_new();
            cpu = emu_cpu_get(e);
            mem = emu_memory_get(e);
            env = emu_env_new(e);

            Console.WriteLine("hEmu=" + e.ToString("X") + " hMem=" + mem.ToString("X") + " hEnv=" + env.ToString("X"));

            //emu_cpu_reg32_set( cpu, emu_reg32.esp  , 0x12FE00);
            //emu_cpu_reg32_set( cpu, emu_reg32.ebp, 0x12FFF0);

            cpu->esp = 0x12FE00;
            cpu->ebp = 0x12FFF0;

            //ApiHookProc ahp = new ApiHookProc(hook_LoadLibraryA);
            UInt32 r = emu_env_w32_export_new_hook(env, "LoadLibraryA", hook_LoadLibraryA, 0);
            Console.WriteLine("SetHook returned: " + r+"\n");

            //mov eax, 0; inc eax, int 3
            //byte[] b = { 0xb8, 0x00, 0x00, 0x00, 0x00, 0x40, 0xcc, 0xcc };

            //00436A3D     68 6C333200    PUSH 32336C
            //00436A42     68 7368656C    PUSH 6C656873
            //00436A47     54             PUSH ESP
            //00436A48     68 771D807C    PUSH 7C801D77  ;LoadLibrary address
            //00436A4D     59             POP ECX
            //00436A4E     FFD1           CALL ECX
            //00436A48     68 A0AD807C    PUSH 7c80ada0 ;GetProcAddress (stack not setup properly though for legit call)
            //00436A4D     59             POP ECX
            //00436A4E     FFD1           CALL ECX

            byte[] b = {0x68, 0x6C, 0x33, 0x32, 0x00, 0x68, 0x73, 0x68, 0x65, 0x6C, 0x54,
                        0x68, 0x77, 0x1D, 0x80, 0x7C, 0x59, 0xFF, 0xD1,0x68, 0xa0, 0xad,
                        0x80, 0x7c, 0x59, 0xFF, 0xD1, 0xCC };

            WriteShellcode(0x401000, b);

            //emu_cpu_eip_set(cpu, 0x401000);
            cpu->eip = 0x401000;

            Console.WriteLine("Eip = " + emu_cpu_eip_get(cpu));

            for (int i = 0; i < 100; i++)
            {
                emu_env_w32_dll_export* export = emu_env_w32_eip_check(env);
                if ( (int)export != 0)
                {
                    if (export->lpfnHook == 0){ //then it is an api start address, but its not hooked..
                        Console.WriteLine("\nUnhooked api: " + CString(export->lpfnName,256));
                        break;
                    }
                }
                else
                {
                    print_disasm();
                    if (!Step()) break;
                }
            }

            Console.WriteLine("\nError: " + emu_strerror(e));
            Console.WriteLine("Run Complete eax=" + emu_cpu_reg32_get(cpu, emu_reg32.eax).ToString("X") );
            Console.ReadKey();
        }
Exemple #53
0
        /// <summary>
        /// 
        /// </summary>
        protected override void Parse()
        {
            long before = _dataStream.Position;

            BinaryReader br = new BinaryReader(_dataStream);
            byte[] content;

            _flags = br.ReadUInt32();
            _name = Helper.SwfStrings.SwfString(this.Version, br);

            content = br.ReadBytes((int)(_tag.Length - (_dataStream.Position - before)));
            Log.Debug(this, "AVM2 Code named '" + _name + "' with Flags 0x" + _flags.ToString("X08") + ", " + content.Length.ToString("d") + " bytes");

            using (MemoryStream ms = new MemoryStream(content))
            {
                _AbcFile = new Recurity.Swf.AVM2.ABC.AbcFile();
                _AbcFile.Parse(ms);

                /*
                 * TODO: Move into AVM2Code
                 *
                for ( uint i = 0; i < abcFile.Methods.Count; i++ )
                {
                    AVM2Method m = new AVM2Method( i, abcFile );
                   //Log.Debug(this,  m.ToString() );
                }
                 */
                String s = String.Format("Calculated length of AbcFile: {0:d} (real: {1:d})", _AbcFile.Length, content.Length);
                Log.Debug(this, s);
            }
        }
Exemple #54
0
        private void DownloadProgress(int lPlayHandle, UInt32 dwTotalSize, UInt32 dwDownLoadSize)
        {

            if (dwDownLoadSize != 0xFFFFFFFF &&
                dwDownLoadSize != 0xFFFFFFFE &&
                dwDownLoadSize <= dwTotalSize)
            {
                int iPos = (int)((dwDownLoadSize * 100) / dwTotalSize);
                Console.WriteLine(iPos.ToString() + " " + dwDownLoadSize.ToString() + "/" + dwTotalSize.ToString());
                psbMain.Value = iPos;
            }
            else
            {
                if (0xFFFFFFFF == dwDownLoadSize)
                {
                    btnDownLoad2.Tag = "";
                    psbMain.Value = 0;
                    MessageUtil.ShowMsgBox(StringUtil.ConvertString("下载结束!"));
                    btnDownLoad1.Enabled = true;
                    btnDownLoad2.Enabled = true;

                    psbMain.Value = 0;

                    //DHClient.DHStopDownload(lPlayHandle);
                }
                else if (0xFFFFFFFE == dwDownLoadSize)
                {
                    btnDownLoad2.Tag = "";
                    psbMain.Value = 0;
                    MessageUtil.ShowMsgBox(StringUtil.ConvertString("磁盘空间不足!"));
                    btnDownLoad1.Enabled = true;
                    btnDownLoad2.Enabled = true;

                    psbMain.Value = 0;

                    //DHClient.DHStopDownload(lPlayHandle);
                }
            }
        }
Exemple #55
0
        private void ToggleBookmark(UInt32 EID)
        {
            int index = m_Bookmark.IndexOf(EID);

            TreelistView.Node found = null;
            FindEventNode(ref found, m_Core.CurFrame, EID);

            if (index >= 0)
            {
                bookmarkStrip.Items.Remove(m_BookmarkButtons[index]);

                m_Bookmark.RemoveAt(index);
                m_BookmarkButtons.RemoveAt(index);

                found.Image = null;
            }
            else
            {
                ToolStripButton but = new ToolStripButton();

                but.DisplayStyle = ToolStripItemDisplayStyle.Text;
                but.Name = "bookmarkButton" + EID.ToString();
                but.Text = EID.ToString();
                but.Tag = EID;
                but.Size = new Size(23, 22);
                but.Click += new EventHandler(this.bookmarkButton_Click);

                but.Checked = true;

                bookmarkStrip.Items.Add(but);

                found.Image = global::renderdocui.Properties.Resources.asterisk_orange;

                m_Bookmark.Add(EID);
                m_BookmarkButtons.Add(but);
            }

            bookmarkStrip.Visible = m_BookmarkButtons.Count > 0;

            eventView.Invalidate();
        }
Exemple #56
0
        public void AddBeep(UInt32 freq, UInt32 dur, bool bl)
        {
            int select = actionList.SelectedIndex;
            if (bl == true)
            {
                actionList.Items.Insert(++select, "Beep Sound(" + freq.ToString() + "," + dur.ToString() + ")");
                actionList.Items.RemoveAt(--select);
            }
            else
            {
                if (select == -1)
                {
                    actionList.Items.Add("Beep Sound(" + freq.ToString() + "," + dur.ToString() + ")");
                }
                else
                {
                    actionList.Items.Insert(++select, "Beep Sound(" + freq.ToString() + "," + dur.ToString() + ")");
                }
            }

            actionList.SelectedIndex = (actionList.Items.Count) - 1;
            saved = false;
        }
Exemple #57
0
 private TreelistView.Node MakeNode(UInt32 minEID, UInt32 maxEID, UInt32 minDraw, UInt32 maxDraw, string text, double duration)
 {
     string eidString = (maxEID == minEID) ? maxEID.ToString() : String.Format("{0}-{1}", minEID, maxEID);
     string drawString = (maxDraw == minDraw) ? maxDraw.ToString() : String.Format("{0}-{1}", minDraw, maxDraw);
     return new TreelistView.Node(new object[] {eidString, drawString, text.Replace("&", "&&"), duration });
 }
Exemple #58
0
        private static void ReportDimensionId(NetworkClient client, Account account, UInt32 realmId)
        {
            var sender = new byte[] {0x0d, 0x13, 0xce, 0x71, 0xb1, 0x10, 0x0b};
            var receiver = new byte[] {0x0d, 0x47, 0xc1, 0x67, 0x6c, 0x10, 0xe6, 0x8f, 0x80, 0x08};

            new PacketStream()
                .WriteHeader(sender, receiver, null, 0x200b) // ReportDimesionID
                .WriteString(realmId.ToString())
                .Send(client);
        }
Exemple #59
0
 public void SetDefSetting(String ip, UInt32 port)
 {
     textBox_ip.Text = ip;
     textBox_port.Text = port.ToString();
 }
Exemple #60
0
		/// <summary>
		/// Initializes a new instance of the <see cref="OrgInstruction"/> class.
		/// </summary>
		/// <param name="value">The value.</param>
		public OrgInstruction (UInt32 value)
			: base (true, string.Empty, string.Empty, "ORG", value.ToString (), null, null, null, value, null)
		{
		}