Exemple #1
0
        /// <summary>
        ///     returns a string of information about the exception and the
        ///     the nested exceptions, if any.
        /// </summary>
        public override string ToString()
        {
            string msg, tmsg;

            // Format the basic exception information
            msg = getExceptionString("LdapReferralException");

            // Add failed referral information
            if ((object)failedReferral != null)
            {
                tmsg = ResourcesHandler.getMessage("FAILED_REFERRAL",
                                                   new object[] { "LdapReferralException", failedReferral });
                // If found no string from resource file, use a default string
                if (tmsg.ToUpper().Equals("SERVER_MSG".ToUpper()))
                {
                    tmsg = "LdapReferralException: Failed Referral: " + failedReferral;
                }
                msg = msg + '\n' + tmsg;
            }

            // Add referral information, display all the referrals in the list
            if (referrals != null)
            {
                for (var i = 0; i < referrals.Length; i++)
                {
                    tmsg = ResourcesHandler.getMessage("REFERRAL_ITEM",
                                                       new object[] { "LdapReferralException", referrals[i] });
                    // If found no string from resource file, use a default string
                    if (tmsg.ToUpper().Equals("SERVER_MSG".ToUpper()))
                    {
                        tmsg = "LdapReferralException: Referral: " + referrals[i];
                    }
                    msg = msg + '\n' + tmsg;
                }
            }
            return(msg);
        }
 /// <summary> Returns a string representing the specified result code in the default
 /// locale.
 ///
 /// </summary>
 /// <param name="code"> The result code for which a message is to be returned.
 ///
 /// </param>
 /// <returns> The message corresponding to the specified result code, or
 /// or null if the message is not available for the default locale.
 /// </returns>
 public static System.String resultCodeToString(int code)
 {
     return(ResourcesHandler.getResultString(code));
 }
 /// <summary> Returns a string representing the result code in the default
 /// locale.
 ///
 /// </summary>
 /// <returns> The message for the result code in the LdapException object.
 /// </returns>
 public virtual System.String resultCodeToString()
 {
     return(ResourcesHandler.getResultString(resultCode));
 }
Exemple #4
0
        public void LoadPolicies_ResponsePoliciesData_IfAddressAndTableNameExists()
        {
            var result = ResourcesHandler.Load <Policy>(AddressValues.POLICIES, TableNameValues.POLICIES);

            Assert.IsNotEmpty(result);
        }
Exemple #5
0
        public void LoadClients_ResponseClientsData_IfAddressAndTableNameExists()
        {
            var result = ResourcesHandler.Load <Client>(AddressValues.CLIENTS, TableNameValues.CLIENTS);

            Assert.IsNotEmpty(result);
        }
Exemple #6
0
 public void Load_NullReferenceException_IfTableNameNotExists()
 {
     Assert.Throws <NullReferenceException>(() => ResourcesHandler.Load <Client>(AddressValues.CLIENTS, TABLE_NAME_NOT_EXIST));
     Assert.Throws <NullReferenceException>(() => ResourcesHandler.Load <Policy>(AddressValues.POLICIES, TABLE_NAME_NOT_EXIST));
 }
Exemple #7
0
 public void Load_WebException_IfAddressNotExists()
 {
     Assert.Throws <WebException>(() => ResourcesHandler.Load <Client>(ADDRESS_NOT_EXIST, TABLE_NAME_NOT_EXIST));
     Assert.Throws <WebException>(() => ResourcesHandler.Load <Policy>(ADDRESS_NOT_EXIST, TABLE_NAME_NOT_EXIST));
 }
 // Use this for initialization
 void Start()
 {
     Init();
     resourceHandler = transform.parent.GetComponent <ResourcesHandler>();
     researchHandler = FindObjectOfType <ResearchHandler>();
 }
 public void GetResultString_when_unknown_error_code_returns_unknown_message()
 {
     Assert.Contains("unknown", ResourcesHandler.GetResultString(int.MaxValue).ToLower());
 }
 public void GetResultString_when_known_error_code_returns_message()
 {
     Assert.Equal(ResultCodeMessages.GetResultCode("1"), ResourcesHandler.GetResultString(1));
 }
Exemple #11
0
    // ----------------------------------------------------------------
    //	Initialize
    // ----------------------------------------------------------------
    public void Initialize(GameController _gameControllerRef, Transform tf_world, RoomData _roomData)
    {
        gameControllerRef    = _gameControllerRef;
        MyRoomData           = _roomData;
        this.gameObject.name = MyRoomData.RoomKey;

        GameUtils.ParentAndReset(this.gameObject, tf_world);
        this.transform.localPosition = PosGlobal; // Position me!

        // Initialize channels!
        gateChannels = new GateChannel[5];
        for (int i = 0; i < gateChannels.Length; i++)
        {
            gateChannels[i] = new GateChannel(this, i);
        }

        // Instantiate my props!
        RoomData         rd  = MyRoomData;
        ResourcesHandler rh  = ResourcesHandler.Instance;
        int numProgressGates = 0; // for deteriming their indexes.
        int numVeils         = 0; // for determining their indexes.

        foreach (PropData propData in rd.allPropDatas)
        {
            System.Type pt = propData.GetType();
            if (false)
            {
            }
            // Enemies
            else if (pt == typeof(DweebData))
            {
                Dweeb newProp = Instantiate(rh.Dweeb).GetComponent <Dweeb>();
                newProp.Initialize(this, propData as DweebData);
            }
            // Grounds
            else if (pt == typeof(CrateData))
            {
                Crate newProp = Instantiate(rh.Crate).GetComponent <Crate>();
                newProp.Initialize(this, propData as CrateData);
            }
            else if (pt == typeof(DispGroundData))
            {
                DispGround newProp = Instantiate(rh.DispGround).GetComponent <DispGround>();
                newProp.Initialize(this, propData as DispGroundData);
            }
            else if (pt == typeof(GateData))
            {
                Gate newProp = Instantiate(rh.Gate).GetComponent <Gate>();
                newProp.Initialize(this, propData as GateData);
                gateChannels[newProp.ChannelID].AddGate(newProp);
            }
            else if (pt == typeof(ToggleGroundData))
            {
                ToggleGround newProp = Instantiate(rh.ToggleGround).GetComponent <ToggleGround>();
                newProp.Initialize(this, propData as ToggleGroundData);
            }
            else if (pt == typeof(PlatformData))
            {
                Platform newProp = Instantiate(rh.Platform).GetComponent <Platform>();
                newProp.Initialize(this, propData as PlatformData);
            }
            else if (pt == typeof(GroundData))
            {
                Ground newProp = Instantiate(rh.Ground).GetComponent <Ground>();
                newProp.Initialize(this, propData as GroundData);
            }
            // Everything else!
            else if (pt == typeof(BatteryData))
            {
                Battery newProp = Instantiate(rh.Battery).GetComponent <Battery>();
                newProp.Initialize(this, propData as BatteryData);
            }
            else if (pt == typeof(BuzzsawData))
            {
                Buzzsaw newProp = Instantiate(rh.Buzzsaw).GetComponent <Buzzsaw>();
                newProp.Initialize(this, propData as BuzzsawData);
            }
            else if (pt == typeof(CharBarrelData))
            {
                CharBarrel newProp = Instantiate(rh.CharBarrel).GetComponent <CharBarrel>();
                newProp.Initialize(this, propData as CharBarrelData, charBarrels.Count);
                charBarrels.Add(newProp);
            }
            else if (pt == typeof(CharUnlockOrbData))
            {
                CharUnlockOrb newProp = Instantiate(rh.CharUnlockOrb).GetComponent <CharUnlockOrb>();
                newProp.Initialize(this, propData as CharUnlockOrbData);
            }
            else if (pt == typeof(CameraBoundsData))
            {
                CameraBounds newProp = Instantiate(rh.CameraBounds).GetComponent <CameraBounds>();
                newProp.Initialize(this, propData as CameraBoundsData);
            }
            else if (pt == typeof(GateButtonData))
            {
                GateButton newProp = Instantiate(rh.GateButton).GetComponent <GateButton>();
                newProp.Initialize(this, propData as GateButtonData);
                gateChannels[newProp.ChannelID].AddButton(newProp);
            }
            else if (pt == typeof(GemData))
            {
                Gem newProp = Instantiate(rh.Gem).GetComponent <Gem>();
                newProp.Initialize(this, propData as GemData, gems.Count);
                gems.Add(newProp);
            }
            else if (pt == typeof(InfoSignData))
            {
                InfoSign newProp = Instantiate(rh.InfoSign).GetComponent <InfoSign>();
                newProp.Initialize(this, propData as InfoSignData);
            }
            else if (pt == typeof(LaserData))
            {
                Laser newProp = Instantiate(rh.Laser).GetComponent <Laser>();
                newProp.Initialize(this, propData as LaserData);
            }
            else if (pt == typeof(LiftData))
            {
                Lift newProp = Instantiate(rh.Lift).GetComponent <Lift>();
                newProp.Initialize(this, propData as LiftData);
            }
            else if (pt == typeof(PlayerStartData))
            {
                PlayerStart newProp = Instantiate(rh.PlayerStart).GetComponent <PlayerStart>();
                newProp.Initialize(this, propData as PlayerStartData);
            }
            else if (pt == typeof(ProgressGateData))
            {
                ProgressGate newProp = Instantiate(rh.ProgressGate).GetComponent <ProgressGate>();
                newProp.Initialize(this, propData as ProgressGateData, numProgressGates++);
            }
            else if (pt == typeof(RoomDoorData))
            {
                RoomDoor newProp = Instantiate(rh.RoomDoor).GetComponent <RoomDoor>();
                newProp.Initialize(this, propData as RoomDoorData);
            }
            else if (pt == typeof(SnackData))
            {
                Snack newProp = Instantiate(rh.Snack).GetComponent <Snack>();
                newProp.Initialize(this, propData as SnackData, snacks.Count);
                snacks.Add(newProp);
            }
            else if (pt == typeof(SpikesData))
            {
                Spikes newProp = Instantiate(rh.Spikes).GetComponent <Spikes>();
                newProp.Initialize(this, propData as SpikesData);
            }
            else if (pt == typeof(TurretData))
            {
                Turret newProp = Instantiate(rh.Turret).GetComponent <Turret>();
                newProp.Initialize(this, propData as TurretData);
            }
            else if (pt == typeof(VeilData))
            {
                Veil newProp = Instantiate(rh.Veil).GetComponent <Veil>();
                newProp.Initialize(this, propData as VeilData, numVeils++);
            }
            else
            {
                Debug.LogWarning("PropData not recognized: " + propData);
            }
        }

        AddHardcodedRoomElements();

        // For development, add bounds so we don't fall out of unconnected rooms!
        AutoAddInvisibounds();
        roomGizmos.Initialize(this);
        shutters.Initialize(this);
    }
 /// <summary> Returns a string representing the specified error code in the
 /// specified locale.
 ///
 /// </summary>
 /// <param name="code">    The result code for which a message is to be
 /// returned.
 ///
 /// </param>
 /// <param name="locale">  The locale in which to render the message.
 ///
 /// </param>
 /// <returns> A message corresponding to the result code in the
 /// specified locale, or null if the message is not available
 /// for the requested locale.
 /// </returns>
 public static string resultCodeToString(int code, CultureInfo locale)
 {
     return(ResourcesHandler.getResultString(code, locale));
 }
 /// <summary> Returns a string representing the result code in the
 /// specified locale.
 ///
 /// </summary>
 /// <param name="locale">The locale in which to render the error message.
 ///
 /// </param>
 /// <returns> A message corresponding to the result code in the
 /// specified locale, or null if the message is not available
 /// for the requested locale.
 /// </returns>
 public virtual string resultCodeToString(CultureInfo locale)
 {
     return(ResourcesHandler.getResultString(resultCode, locale));
 }
Exemple #14
0
 public void StartView()
 {
     gameObject.SetActive(true);
     resourcesHandler = sceneHandler.currentColony.GetComponent <ResourcesHandler>();
     UpdateView();
 }
 /// <summary> Returns a string representing the result code in the
 /// specified locale.
 ///
 /// </summary>
 /// <param name="locale">The locale in which to render the error message.
 ///
 /// </param>
 /// <returns> A message corresponding to the result code in the
 /// specified locale, or null if the message is not available
 /// for the requested locale.
 /// </returns>
 public virtual System.String resultCodeToString(System.Globalization.CultureInfo locale)
 {
     return(ResourcesHandler.getResultString(resultCode, locale));
 }
Exemple #16
0
 public void Load_ArgumentNullException_IfAnyParametersIsNullOrEmpty(string address, string tableName)
 {
     Assert.Throws <ArgumentNullException>(() => ResourcesHandler.Load <Client>(address, tableName));
     Assert.Throws <ArgumentNullException>(() => ResourcesHandler.Load <Policy>(address, tableName));
 }
 /// <summary> Returns a string representing the specified error code in the
 /// specified locale.
 ///
 /// </summary>
 /// <param name="code">    The result code for which a message is to be
 /// returned.
 ///
 /// </param>
 /// <param name="locale">  The locale in which to render the message.
 ///
 /// </param>
 /// <returns> A message corresponding to the result code in the
 /// specified locale, or null if the message is not available
 /// for the requested locale.
 /// </returns>
 public static System.String resultCodeToString(int code, System.Globalization.CultureInfo locale)
 {
     return(ResourcesHandler.getResultString(code, locale));
 }
Exemple #18
0
 void Start()
 {
     resourcesHandler = GetComponent <ResourcesHandler>();
     Load(Resources.Energy, 100);
 }