Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Need help with C#

  1. #1
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,849

    Need help with C#

    I have a little issue when i use 2 lines between the if an the else .

    Code:
                        for (uint g = 0; g < CTInfo.GetCoreCount; g++)
                        {
                            index = g + (i * CTInfo.GetCoreCount);
                            if (CTInfo.IsDistanceToTjMax)
                                SDK.SetUserVar("RRCORETEMP_CORE_TEMP_" + index, Convert.ToString(CTInfo.GetTemp[index]));
                                SDK.SetUserVar("RRCORETEMP_CORE_LOAD_" + index, Convert.ToString(CTInfo.GetCoreLoad[index]));
                            else
                                SDK.SetUserVar("RRCORETEMP_CORE_INFO_" + index, "Core " + index + ": " + CTInfo.GetTemp[index] + "" + TempType + " , " + CTInfo.GetCoreLoad[index] + "% Load");
                                SDK.SetUserVar("RRCORETEMP_CORE_TEMP_" + index, Convert.ToString(CTInfo.GetTemp[index]));
                        }
    Thanks for your help !!!

  2. #2
    Variable Bitrate Borte's Avatar
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    445
    You need to use { and } to "group" your code belonging to the if statement. If you skip these brackets then only the first line after the if and the else belongs to the statement.
    Change your code to this and it should work:

    Code:
                        for (uint g = 0; g < CTInfo.GetCoreCount; g++)
                        {
                            index = g + (i * CTInfo.GetCoreCount);
                            if (CTInfo.IsDistanceToTjMax)
                                {
                                      SDK.SetUserVar("RRCORETEMP_CORE_TEMP_" + index, Convert.ToString(CTInfo.GetTemp[index]));
                                      SDK.SetUserVar("RRCORETEMP_CORE_LOAD_" + index, Convert.ToString(CTInfo.GetCoreLoad[index]));
                                }
                            else
                                {
                                     SDK.SetUserVar("RRCORETEMP_CORE_INFO_" + index, "Core " + index + ": " + CTInfo.GetTemp[index] + "" + TempType + " , " + CTInfo.GetCoreLoad[index] + "% Load");
                                     SDK.SetUserVar("RRCORETEMP_CORE_TEMP_" + index, Convert.ToString(CTInfo.GetTemp[index]));
                                }
                       }
    Last edited by Borte; 09-30-2012 at 12:08 PM. Reason: Additional info
    Failure is not an option...
    __________________________________________________ ______________________________
    The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

  3. #3
    MySQL Error
    Auto Apps:loading...

    Join Date
    Oct 2004
    Posts
    5,255
    any why is that a USERVAR!!!!

    over use of uservars!!!

    if yout plugin uses it, and only your plugin, there is no need to make it a uservar
    -Thanks
    Mitch
    www.rush2112.net

    "Did you test it in carwings??"

    Sun, Come shine my way
    May healing waters bury all my pain
    Wind, Carry me home
    The fabric of reality is tearing apart
    The piece of me that died
    Will return To live again

  4. #4
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,849
    Quote Originally Posted by mitchjs View Post
    any why is that a USERVAR!!!!

    over use of uservars!!!

    if yout plugin uses it, and only your plugin, there is no need to make it a uservar
    And what i do to use !

  5. #5
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,849
    Thanks Borte

  6. #6
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,849
    I want a label that use a number but i want 0 digit , so i try to use the Math.Round function but without success

    Code:
                    case "rrcoretemp_maxtemp_alarm":
                        s = Convert.ToString(Math.Round((((Convert.ToInt32(CoreTempMax) - 20 - 9) * 10) * 65535) / 20));
                        break;
    An idea ?

  7. #7
    Variable Bitrate Borte's Avatar
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    445
    The Math.Round method has multiple calling options, some of these allowes you to specify how many decimals you want.
    Change your code to this and it it should work:

    Code:
                    case "rrcoretemp_maxtemp_alarm":
                        s = Convert.ToString(Math.Round((((Convert.ToInt32(CoreTempMax) - 20 - 9) * 10) * 65535) / 20, 0));
                        break;
    Failure is not an option...
    __________________________________________________ ______________________________
    The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

  8. #8
    MySQL Error
    Auto Apps:loading...

    Join Date
    Oct 2004
    Posts
    5,255
    Quote Originally Posted by pierrotm777 View Post
    And what i do to use !
    variables

    just not USERVARS... unless there is some reason to, ie the USER needs direct acess to it
    -Thanks
    Mitch
    www.rush2112.net

    "Did you test it in carwings??"

    Sun, Come shine my way
    May healing waters bury all my pain
    Wind, Carry me home
    The fabric of reality is tearing apart
    The piece of me that died
    Will return To live again

  9. #9
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,594
    pierrot, if those variables are just to display the info in a skin, then use the return label to display them. keep them as internal variables till then

  10. #10
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,849
    Quote Originally Posted by Enforcer View Post
    pierrot, if those variables are just to display the info in a skin, then use the return label to display them. keep them as internal variables till then
    Ok, i understand better !
    I try to modify that !
    I want to use a new thread for the timers ! I know how to do in VB.NET but not in C# !

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •