Exemple #1
0
        public static string sMachineKeyPathFile(tvProfile aoProfile, X509Certificate2 aoCertificate)
        {
            string lsMachineKeyPathFile = null;

            try
            {
                lsMachineKeyPathFile = Path.Combine(aoProfile.sValue("-MachineKeysPath", @"C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys")
                                                    , HashClass.GetKeyFileName(aoCertificate));
            }
            catch (InvalidOperationException ex)
            {
                if (aoProfile.bValue("-DeclareErrorOnPrivateKeyFileCleanedUp", false))
                {
                    Type ltDoGetCert = Type.GetType("DoGetCert");
                    if (null == ltDoGetCert)
                    {
                        throw ex;
                    }
                    else
                    {
                        ltDoGetCert.GetMethod("LogIt").Invoke(null, new object[] {
                            String.Format("GetCertServiceFault: {0}{1}{2}{3}"
                                          , ex.Message, (null == ex.InnerException ? "": "; " + ex.InnerException.Message)
                                          , Environment.NewLine
                                          , ex.StackTrace)
                        });
                    }
                }
            }

            return(lsMachineKeyPathFile);
        }
        public LaunchScreen()
        {
            InitializeComponent();

            this.Title = "Monopoly Deal Setup";

            // Load cached settings from Profile.
            settings = ClientUtilities.GetClientSettings(ResourceList.SettingsFilePath);

            // Populate fields with settings.
            this.PlayerNameTextBox.Text = settings.sValue(ResourceList.SettingNameKey, string.Empty);
            this.IPAddressTextBox.Text  = settings.sValue(ResourceList.SettingIpAddressKey, string.Empty);
            this.PortTextBox.Text       = settings.sValue(ResourceList.SettingPortKey, ResourceList.SettingPortDefaultValue);

            // Play the sound of silence to allow the game client to adjust the volume of the application.
            // Without this, the volume would not be able to be adjusted until after the first sound is played.
            ClientUtilities.PlaySound(ResourceList.UriPathSilence);
        }
Exemple #3
0
        public static string sMachineKeyPathFile(tvProfile aoProfile, X509Certificate2 aoCertificate)
        {
            string lsMachineKeyPathFile = null;

            try
            {
                lsMachineKeyPathFile = Path.Combine(aoProfile.sValue("-MachineKeysPath", @"C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys")
                                                    , HashClass.GetKeyFileName(aoCertificate));
            }
            catch (InvalidOperationException ex)
            {
                if (aoProfile.bValue("-DeclareErrorOnPrivateKeyFileCleanedUp", false))
                {
                    DoGetCert.LogIt(aoProfile, DoGetCert.sExceptionMessage(ex));
                }
            }

            return(lsMachineKeyPathFile);
        }
Exemple #4
0
        // Scan data from the profile file to generate the cards for the deck.
        // ROBIN TODO: Generalize this method so that it works for cards with any properties (not just those specific to Monopoly Deal).
        public List <Card> GenerateDeck()
        {
            // Variables to hold temporary data.
            string          name;
            CardType        cardType;
            EnhancementType enhanceType;
            int             value;
            PropertyType    propertyType;
            PropertyType    altPropertyType;
            string          uriPath;
            string          soundUriPath;
            int             actionID;

            List <Card> cardList = new List <Card>();

            // Each card must have a unique ID.
            int cardID = 0;

            foreach (DictionaryEntry keyVal in Profile)
            {
                string    resourceName = keyVal.Key as string;
                tvProfile cardProfile  = Profile.oProfile(resourceName);

                for (int a = 0; a < cardProfile.iValue("-Count", 0); ++a)
                {
                    name            = cardProfile.sValue("-Name", "");
                    cardType        = (CardType)Enum.Parse(typeof(CardType), cardProfile.sValue("-CardType", ""));
                    enhanceType     = (EnhancementType)Enum.Parse(typeof(EnhancementType), cardProfile.sValue("-EnhancementType", "None"));
                    value           = cardProfile.iValue("-Value", 0);
                    propertyType    = (cardProfile.sValue("-PropertyType", "") == "") ? PropertyType.None : (PropertyType)Enum.Parse(typeof(PropertyType), cardProfile.sValue("-PropertyType", ""));
                    altPropertyType = (cardProfile.sValue("-AltPropertyType", "") == "") ? PropertyType.None : (PropertyType)Enum.Parse(typeof(PropertyType), cardProfile.sValue("-AltPropertyType", ""));
                    uriPath         = resourceName.Replace("-", string.Empty) + "DrawingImage";

                    string soundEffectFileName = cardProfile.sValue("-SoundEffectFile", string.Empty);
                    soundUriPath = string.IsNullOrWhiteSpace(soundEffectFileName) ? ResourceList.UriPathEmpty : ResourceList.UriPathAudioFolder + soundEffectFileName;

                    actionID = (cardProfile.sValue("-ActionID", "") == "") ? -1 : Convert.ToInt32((cardProfile.sValue("-ActionID", "")));

                    cardList.Add(new Card(name, cardType, value, propertyType, altPropertyType, uriPath, soundUriPath, actionID, cardID));

                    // Iterate the card ID so that it is different for the next card.
                    cardID++;
                }
            }

            return(cardList);
        }
Exemple #5
0
 public static string sMachineKeyPathFile(tvProfile aoProfile, X509Certificate2 aoCertificate)
 {
     return(Path.Combine(aoProfile.sValue("-MachineKeysPath", @"C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys")
                         , HashClass.GetKeyFileName(aoCertificate)));
 }