ToString() public method

public ToString ( ) : String
return String
Beispiel #1
0
    /// <summary>
    /// 转换float区间字符串(0.5,0.5)
    /// </summary>
    /// <param name="floatValue"></param>
    /// <returns>指定区间大小的数组</returns>
    static public float[] ParseFloatInterval(System.Object floatValue, int intervalSize = 2, char Separator = ',')
    {
        try {
            string[] intervalStr = floatValue.ToString().Split(Separator);
            var      firstValue  = Convert.ToSingle(intervalStr [0], NumberFormatInfo.InvariantInfo);

            float[] returnInterval = new float[intervalSize];

            for (var i = 0; i < returnInterval.Length; i++)
            {
                returnInterval [i] = firstValue;
            }

            for (var i = 0; i < intervalStr.Length; i++)
            {
                if (i >= returnInterval.Length)
                {
                    break;
                }
                returnInterval [i] = Convert.ToSingle(intervalStr [i], NumberFormatInfo.InvariantInfo);
            }

            return(returnInterval);
        }
        catch (Exception EX_NAME) {
#if UNITY_EDITOR
            if (!floatValue.ToString().Equals("——"))
            {
                Debug.LogWarning("Invaild Float:" + floatValue + " " + EX_NAME.Message);
            }
#endif
            return(null);
        }
    }
Beispiel #2
0
        /// <summary>
        /// Searchs the object for properties that can be mapped and replaces those properties with the new values.
        /// </summary>
        /// <param name="parentObj">The mapping object.</param>
        /// <returns></returns>
        public System.Object Map(System.Object parentObj)
        {
            // Any object to map ?
            if (parentObj == null || parentObj.GetType().GetProperties() == null || parentObj.GetType().IsValueType || !String.Equals(parentObj.GetType().Namespace, "ADX4"))
            {
                return(null);
            }

            // Recursive search the object's properties
            foreach (PropertyInfo propertyInfo in parentObj.GetType().GetProperties())
            {
                try
                {
                    // Get the property's value
                    System.Object propValue = propertyInfo.GetValue(parentObj, null);
                    if (propValue == null)
                    {
                        continue;
                    }

                    // Is this a Analyte property ?
                    if (propertyInfo.PropertyType == typeof(String) && String.Equals(propertyInfo.Name, "Analyte"))
                    {
                        propertyInfo.SetValue(parentObj, this.MapAnalyte(propValue.ToString()), null);
                    }

                    // Is this a UOM property ?
                    else if (propertyInfo.PropertyType == typeof(String) && String.Equals(propertyInfo.Name, "UOM"))
                    {
                        propertyInfo.SetValue(parentObj, this.MapUOM(propValue.ToString()), null);
                    }

                    // Is this a Processing Path property ?
                    else if (propertyInfo.PropertyType == typeof(ProcessingPath))
                    {
                        propertyInfo.SetValue(parentObj, this.MapProcessingPath(propValue as ProcessingPath), null);
                    }

                    // Map each chold object if it is an array of objects
                    else if (propertyInfo.PropertyType.IsArray)
                    {
                        foreach (System.Object childObj in propValue as Array)
                        {
                            Map(childObj);
                        }
                    }
                    // Otherwise map the propertie's on this object
                    else
                    {
                        Map(propValue);
                    }
                }
                catch (System.Exception exc)
                {
                    throw exc;
                }
            }

            return(parentObj);
        }
        public int GetUserTotalMessagesSent(Object datingBookId)
        {
            var dataBase = _serverWrapper.ServerConnection.GetDatabase("gokapara-newyork");
            var collection = dataBase.GetCollection(MESSAGE_SESSIONS_COLLECTION_NAME);

            var match1 = BsonDocument.Parse(@"{""$match"" : { $or : [
                                                                        { ""user_1"" : ObjectId(""" +datingBookId.ToString()+@""")},
                                                                        {""user_2"" : ObjectId(""" + datingBookId.ToString() +@""")}
                                                                    ]
                                                            }
                                               }");
            var project = BsonDocument.Parse(@"{""$project"" : { ""messages"" : ""$messages"" }}");
            var unwind = BsonDocument.Parse(@"{""$unwind"" :""$messages""}");
            var match2 = BsonDocument.Parse(@"{""$match"" : {""messages.from"" : ObjectId("""+ datingBookId + @""")}}");
            var group = BsonDocument.Parse(@"{""$group"" :  {
                                                                ""_id"" : ""$messages.from"",
                                                                ""count"" : { ""$sum"" : 1}
                                                            }
                                             }");

            var result = collection.Aggregate(match1, project, unwind, match2, group);
            if (result.Ok)
            {
                var res = result.ResultDocuments.FirstOrDefault();
                if(res != null)
                {
                    return res["count"].AsInt32;
                }
            }
            return 0;
        }
Beispiel #4
0
 public static void SQLWhere_SubStr(ref ArrayList ParameterList, DbType type, string FieldName, Object FieldValue, string Operator, string AndOr, int StartPos, int EndPos)
 {
     if (FieldValue.ToString().Trim() == "" || FieldValue.ToString().Trim() == "%%") return;
     ParameterItem pi = new ParameterItem();
     pi.ParaName = CheckParaName(ParameterList, FieldName);
     switch (type)
     {
         case DbType.String:
             pi.WhereString = string.Format(" {0} Substr({1},{4},{5}) {2} :{3}", AndOr, FieldName, Operator, pi.ParaName, StartPos.ToString(), EndPos.ToString());
             break;
         case DbType.Decimal:
             pi.WhereString = string.Format(" {0} Substr({1},{4},{5}) {2} :{3}", AndOr, FieldName, Operator, pi.ParaName, StartPos.ToString(), EndPos.ToString());
             break;
         case DbType.VarNumeric:
             pi.WhereString = string.Format(" {0} Substr({1},{4},{5}) {2} :{3}", AndOr, FieldName, Operator, pi.ParaName, StartPos.ToString(), EndPos.ToString());
             break;
         case DbType.DateTime:
             pi.WhereString = string.Format(" {0} Substr({1},{4},{5}) {2} :{3}", AndOr, FieldName, Operator, pi.ParaName, StartPos.ToString(), EndPos.ToString());
             FieldValue = string.Format("#{0}#", FieldValue.ToString());
             break;
     }
     pi.FieldName = FieldName;
     pi.FieldType = type;
     pi.FieldValue = FieldValue;
     ParameterList.Add(pi);
 }
Beispiel #5
0
        public virtual QueryString Append(String key, Object value)
        {
            if (value == null)
            {
                return this;
            }
            if (value is Request)
            {
                return AppendRequest(key, (Request)value);
            }
            if (value is Boolean)
            {
                return AppendString(key, value.ToString().ToLower());
            }
            else if (value is Dictionary<String, String>)
            {
                foreach (KeyValuePair<String, String> pair in (Dictionary<String, String>)value)
                {
                    AppendString(String.Format("{0}[{1}]", key, pair.Key), pair.Value);
                }
                return this;
            }

            return AppendString(key, value.ToString());
        }
 public void set(String field, Object value)
 {
     if (!list.ContainsKey(field))
         list.Add(field, value.ToString());
     else
         list[field] = value.ToString();
 }
Beispiel #7
0
 public static Int32 CInt32(Object xobjObject)
 {
     Int32 result;
     if (xobjObject == null || !Int32.TryParse(xobjObject.ToString(), out result) || xobjObject == DBNull.Value || xobjObject.ToString() == "")
         return 0;
     else return Convert.ToInt32(xobjObject);
 }
Beispiel #8
0
        public static Boolean IsInt(System.Object Expression)
        {
            if (Expression.ToString() == string.Empty)
            {
                return(true);
            }
            if (Expression is DateTime)
            {
                return(false);
            }

            if (Expression is Int16 || Expression is Int32 || Expression is Int64)
            {
                return(true);
            }

            try
            {
                if (Expression is string)
                {
                    Int32.Parse(Expression as string);
                }
                else
                {
                    Int32.Parse(Expression.ToString());
                }
                return(true);
            } catch {}  // just dismiss errors but return false

            return(false);
        }
Beispiel #9
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            // Allow saved page state to override the initial item to display
            if (pageState != null && pageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = pageState["SelectedItem"];
            }

            var itemId = navigationParameter.ToString();
            var item = DataSource.Instance.GetItem(navigationParameter.ToString());
            this.DefaultViewModel["Item"] = item;
            this.DefaultViewModel["ItemElements"] = item.Elements;

            var serviceItem = DataSource.Instance.GetItem(itemId.Split('/').First());
            var odataClient = new ODataClient(serviceItem.Subtitle);
            var results = (odataClient.FindEntries(itemId.Split('/').Last()).Take(10));

            foreach (var key in results.First().Keys)
            {
                this.gridResult.ColumnDefinitions.Add(new ColumnDefinition());
            }
            for (int index = 0; index < results.Count(); index++)
            {
                this.gridResult.RowDefinitions.Add(new RowDefinition());
            }
            this.DefaultViewModel["QueryResults"] = results.Select(x => x.Values.ToArray());
        }
Beispiel #10
0
        public Batch(String regionDir, String worldName, String dimensionName, bool replace, Object biome1, Object biome2, long worldSeed)
        {
            this.regionDir = regionDir;
            this.replace = replace;
            this.biome1 = biome1;
            this.biome2 = biome2;
            this.worldSeed = worldSeed;

            InitializeComponent();

            int before = lblPrompt3.Bottom;
            lblPrompt.MaximumSize = new Size(this.Width - lblPrompt.Left * 2, 0);
            lblPrompt2.MaximumSize = lblPrompt.MaximumSize;
            lblPrompt3.MaximumSize = lblPrompt.MaximumSize;
            if (!replace)
            {
                String b = String.Format(biome1 is BiomeType ? BIOMESTRING : MCSTRING, biome1.ToString());
                lblPrompt.Text = String.Format(PROMPTFILL, worldName, dimensionName, b);
                btnGo.Text = "Fill All Regions";
            }
            else
            {
                String b1 = String.Format(BIOMESTRING, biome1.ToString());
                String b2 = String.Format(biome2 is BiomeType ? BIOMESTRING : MCSTRING, biome2.ToString());
                lblPrompt.Text = String.Format(PROMPTREPLACE, worldName, dimensionName, b1, b2);
                btnGo.Text = "Replace All Regions";
            }

            lblPrompt2.Top = lblPrompt.Bottom + 10;
            lblPrompt3.Top = lblPrompt2.Bottom + 10;

            this.Height = this.Height + (lblPrompt3.Bottom - before);

            this.CancelButton = btnCancel;
        }
Beispiel #11
0
 public static Int64 CInt64(Object xobjObject)
 {
     Int64 result;
     if (xobjObject == null || !Int64.TryParse(xobjObject.ToString(), out result) || xobjObject == DBNull.Value || xobjObject.ToString() == "")
         return 0;
     else return (Int64)xobjObject;
 }
        public void Dispatch(Object @event)
        {
            //remember to use datetime.now to set an unique value for this event.
            _logger.SetOpType("event", @event.GetType().FullName + " " + DateTime.Now.ToString());

            _logger.Info("[evt dispatcher] dispatching event " + @event.ToString());
            var eventType = @event.GetType();
            var handlerInvokerList = _domainEventHandlerCatalog.GetAllHandlerFor(eventType);
            _logger.Debug("[evt dispatcher] dispatching event " + @event.ToString() + " found " + handlerInvokerList.Count() + " handlers");
            foreach (var invoker in handlerInvokerList)
            {
                invoker.Invoke(@event as IDomainEvent);
            }
            _logger.Debug("[evt dispatcher] dispatching event " + @event.ToString() + " done");
            _logger.RemoveOpType();
            //var eventHandlerType = typeof(IDomainEventHandler<>).MakeGenericType(eventType);
            
            //var handlers = _domainEventHandlerFactory.CreateHandlers(eventHandlerType);
            //if (handlers != null)
            //{
            //    foreach (var handler in handlers)
            //    {
            //        var handlerType = handler.GetType();
            //        MethodInfo mi = handlerType.GetMethod("Handle", new[] { eventType });
            //        mi.Invoke(handler, new[] { @event });
            //    }

            //    _domainEventHandlerFactory.ReleaseHandlers(handlers);
            //}
        }
Beispiel #13
0
        //Hear to set for Conversion of DBNull or Nothing or any Value from Object to String...
        public static string SetString(System.Object Value)
        {
            DateTime TempDate;
            int      Temp;
            string   str = "";

            if (object.ReferenceEquals(Value, System.DBNull.Value))
            {
                return(str);
            }
            else if (Value == null)
            {
                return(str);
            }

            else if (int.TryParse(Convert.ToString(Value), out Temp))
            {
                str = Value.ToString();
            }

            else if (DateTime.TryParse(Convert.ToString(Value), out TempDate))
            {
                str = Value.ToString();
            }
            else
            {
                str = Value.ToString();
            }
            return(str);
        }
Beispiel #14
0
        public static Boolean CheckDataType(Object value, FzDataTypeEntity dataType)
        {
            try
            {
                switch (dataType.DataType)
                {
                    case "Int16": Int16 a = 0; return (Int16.TryParse(value.ToString(), out a));
                    case "Int32": Int32 b = 0; return (Int32.TryParse(value.ToString(), out b));
                    case "Int64": Int64 c = 0; return (Int64.TryParse(value.ToString(), out c));
                    case "Byte": Byte d = 0; return (Byte.TryParse(value.ToString(), out d));
                    case "String": return true;
                    case "DateTime": return true;//DateTime e = DateTime.Today; return (DateTime.TryParse(value.ToString(), out e));
                    case "Decimal": Decimal f = 0; return (Decimal.TryParse(value.ToString(), out f));
                    case "Single": Single g = 0; return (Single.TryParse(value.ToString(), out g));
                    case "Double": Double h = 0; return (Double.TryParse(value.ToString(), out h));
                    case "Boolean":
                        if (value.ToString().ToLower() == "true" || value.ToString().ToLower() == "false") return true;
                        else return false;//Boolean k = true; return (Boolean.TryParse(value.ToString(), out k));
                    case "Binary": return (IsBinaryType(value));
                    case "Currency": return (IsCurrencyType(value));
                    case "UserDefined": return (dataType.DomainValues.Contains(value.ToString()));
                }
            }
            catch (Exception ex)
            {
                return false;
            }

            return false;
        }
Beispiel #15
0
 public static void SQLWhere_DateFormat(ref ArrayList ParameterList, DbType type, string FieldName, Object FieldValue, string Operator, string AndOr, string StringProvider)
 {
     if (FieldValue.ToString().Trim() == "" || FieldValue.ToString().Trim() == "%%" || type != DbType.DateTime) return;
     ParameterItem pi = new ParameterItem();
     pi.ParaName = ((FieldName.ToUpper() == "ROWNUM") ? "ROWNUM_1" : CheckParaName(ParameterList, FieldName));
     switch (type)
     {
         case DbType.String:
             pi.WhereString = string.Format(" {0} TO_CHAR({1},'{4}') {2} :{3}", AndOr, FieldName, Operator, pi.ParaName, StringProvider);
             break;
         case DbType.Decimal:
             pi.WhereString = string.Format(" {0} TO_CHAR({1},'{4}') {2} :{3}", AndOr, FieldName, Operator, pi.ParaName, StringProvider);
             break;
         case DbType.VarNumeric:
             pi.WhereString = string.Format(" {0} TO_CHAR({1},'{4}') {2} :{3}", AndOr, FieldName, Operator, pi.ParaName, StringProvider);
             break;
         case DbType.DateTime:
             pi.WhereString = string.Format(" {0} TO_CHAR({1},'{4}') {2} :{3}", AndOr, FieldName, Operator, pi.ParaName, StringProvider);
             break;
     }
     pi.FieldName = FieldName;
     pi.FieldType = DbType.String;
     pi.FieldValue = FieldValue;
     ParameterList.Add(pi);
 }
Beispiel #16
0
 public static double CDbl(Object xobjObject)
 {
     double result;
     if (xobjObject == null || !double.TryParse(xobjObject.ToString(), out result) || xobjObject == DBNull.Value || xobjObject.ToString() == "")
         return 0;
     else return Convert.ToDouble(xobjObject);
 }
Beispiel #17
0
        /**
         * using the original implementation
         * added check for empty lists
         * defaulting to "true"
         */
        public bool toBoolean(Object val)
        {
            if (val == null)
            {
                //controlNullOperand();
                return false;
            }
            else if (val is Boolean)
            {
                return ((Boolean) val);
            }
            else if (val is int)
            {
                double number = Double.Parse(val.ToString());
                return !Double.IsNaN(number) && Math.Abs(number) > 0.000000000001;
            }
            else if (val is String)
            {
                String strval = val.ToString();
                return strval.Length > 0 && !"false".Equals(strval);
            }
            else if (val is ICollection)
            {
                return (val as ICollection).Count > 0;
            }

            return true;
        }
Beispiel #18
0
 /// <summary> Default Deserialization - from Json string to models! </summary>
 protected virtual void OnLoadFromSerializerPlayerData(System.Object data)
 {
     if (data != null && !string.IsNullOrEmpty(data.ToString()))
     {
         Parse(data.ToString());
     }
 }
Beispiel #19
0
 public static decimal CDcml(Object xobjObject)
 {
     decimal result;
     if (xobjObject == null || !decimal.TryParse(xobjObject.ToString(), out result) || xobjObject == DBNull.Value || xobjObject.ToString() == "")
         return 0;
     else return Convert.ToDecimal(xobjObject);
 }
 protected string getShortOf(Object x)
 {
     if (x.ToString().Length < 50)
         return x.ToString();
     else
         return x.ToString().Substring(0, 50);
 }
Beispiel #21
0
        public static String Convert( Object obj, Boolean isBreakline, Boolean allowNotSave ) {

            if (obj == null) return empty();

            Type t = obj.GetType();
            if (t.IsArray) return ConvertArray( obj, allowNotSave );
            if (rft.IsInterface( t, typeof( IList ) )) return ConvertList( (IList)obj, allowNotSave );
            if (rft.IsInterface( t, typeof( IDictionary ) )) return ConvertDictionary( (IDictionary)obj, isBreakline, allowNotSave );

            if (t == typeof( int ) ||
                t == typeof( long ) ||
                t == typeof( decimal ) ||
                t == typeof( double )) {
                return obj.ToString();
            }

            if (t == typeof( Boolean )) return obj.ToString().ToLower();
            if (t == typeof( DateTime ) || t == typeof( long )) return "\"" + obj.ToString() + "\"";
            if (t == typeof( String )) {
                // 转义双引号,消除换行
                return "\"" + ClearNewLine( obj.ToString() ) + "\"";
            }

            return ConvertObject( obj, isBreakline, true, allowNotSave );
        }
Beispiel #22
0
 public static DateTime CDate(Object xobjObject)
 {
     DateTime result;
     if (xobjObject == null || !DateTime.TryParse(xobjObject.ToString(), out result) || xobjObject == DBNull.Value || xobjObject.ToString() == "")
         throw new Exception("Fecha invalida");
     else return Convert.ToDateTime(xobjObject);
 }
        /// <summary>
        /// Sets up a parameter for the query
        /// </summary>
        /// <param name="id">The ID of the parameter</param>
        /// <param name="type">The Sql type of the parameter</param>
        /// <param name="Value">The value of the parameter</param>
        public static void AddParameter(this List<SqlParameter> collection, string parameterName, SqlDbType type, Object Value)
        {
            SqlParameter parameter = new SqlParameter();
            parameter.ParameterName = parameterName;
            parameter.SqlDbType = type;

            if (Value == null)
            {
                parameter.Value = Convert.DBNull;
            }
            else if (Value.ToString() == "" && type != SqlDbType.VarChar)
            {
                // must convert the empty string to a DBNull
                parameter.Value = Convert.DBNull;
            }
            else if (Value.ToString() == "" && (type == SqlDbType.Float || type == SqlDbType.Int || type == SqlDbType.Money))
            {
                parameter.Value = 0;
            }
            else
            {
                // set the value of the parameter
                parameter.Value = Value;
            }

            collection.Add(parameter);
        }
Beispiel #24
0
 private string AlphaNumeric(Object input, int maxLength)
 {
     if (input.ToString().Length > maxLength)
     {
         throw new ApplicationException("Error occured: " + input + " is longer than maximum length: " + maxLength);
     }
     return input.ToString().PadRight(maxLength);
 }
Beispiel #25
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            // TODO: Assign a bindable collection of items to this.DefaultViewModel["Items"]

            DataModel.ContentViewModel temp = new DataModel.ContentViewModel();
            this.DefaultViewModel["Items"] = temp.searchFunction(navigationParameter.ToString());

            this.pageTitle.Text = "Search for " + navigationParameter.ToString();
        }
Beispiel #26
0
 /// <summary>
 /// Returns obj.ToString() if obj not null or Default if is null
 /// </summary>
 /// <param name="obj">Object From wich need to get String</param>
 /// <param name="Default">Returns when Obj is null</param>        
 /// <returns></returns>
 public static String getString(Object obj, String Default, bool nullstrict)
 {
     String retval = Default;
     if (obj != null && (!nullstrict || !"".Equals(obj.ToString())))
     {
         retval = obj.ToString();
     }
     return retval;
 }
Beispiel #27
0
 public String calculateDiscount(Object o)
 {
     String t;
     if (o != null && o.ToString() != "")
         t = double.Parse(o.ToString()).ToString("N2");
     else
         t = "";
     return t;
 }
Beispiel #28
0
    //---------------------------------------------------------------------------

    #endregion

    //---------------------------------------------------------------------------

    #region Private Member Functions

    //---------------------------------------------------------------------------

    /// <summary>
    /// Log at the specified level, message and showTrace.
    /// </summary>
    /// <param name='level'>
    /// Log Level.
    /// </param>
    /// <param name='message'>
    /// Log info object, usually a string.
    /// </param>
    /// <param name='showTrace'>
    /// Show trace.
    /// </param>
    private void Log(LogLevel level, System.Object message, bool showTrace = false)
    {
        if (!_isLogEnabled)
        {
            return;
        }

        string logToPrint;

        if (showTrace)
        {
            StackTrace trace  = new StackTrace();
            StackFrame frame  = null;
            MethodBase method = null;

            frame  = trace.GetFrame(2);
            method = frame.GetMethod();

            string callingMethod = method.ReflectedType.Name + "::" + method.Name;
            logToPrint = "[" + level.ToString() + "] " +
                         callingMethod + ": " + message.ToString();
        }
        else
        {
            logToPrint = "[" + level.ToString() + "] " + message.ToString();
        }
        if (level <= _currentLevel)
        {
            /**
             * Use unity api for writing information to
             * unity editor console.
             */
            switch (level)
            {
            case LogLevel.FINE:
            case LogLevel.DEBUG:
            case LogLevel.INFO:
            {
                UnityEngine.Debug.Log(logToPrint);
                break;
            }

            case LogLevel.WARN:
            {
                UnityEngine.Debug.LogWarning(logToPrint);
                break;
            }

            case LogLevel.ERROR:
            {
                UnityEngine.Debug.LogError(logToPrint);
                break;
            }
            }
        }
    }
Beispiel #29
0
        private static int TryInt(this System.Object Value)
        {
            int IntError = 0;

            if (int.TryParse(Value.ToString(), out IntError))
            {
                return(int.Parse(Value.ToString()));
            }
            return(0);
        }
Beispiel #30
0
 public String finalPrice(Object p, Object d)
 {
     double a, b, c;
     a = double.Parse(p.ToString());
     if (d != null && d.ToString() != "")
         b = double.Parse(d.ToString());
     else
         b = 0;
     return (a - b).ToString("N2");
 }
Beispiel #31
0
        public static bool Delete(Object O)
        {
            if (O != null && File.Exists(O.ToString().Replace(".", "_").Replace(":", "_") + ".ss"))
            {
                File.Delete(O.ToString().Replace(".", "_").Replace(":", "_") + ".ss");
                return true;
            }

            return false;
        }
 public void setProperty(string field, System.Object value)
 {
     if (!list.ContainsKey(field))
     {
         list.Add(field, value.ToString());
     }
     else
     {
         list[field] = value.ToString();
     }
 }
Beispiel #33
0
 public void AddWord(System.Object wordToAdd)
 {
     //adds the word to the wordbank ONLY if the word has not
     //been used yet. Ignores the word if it has.
     if (existingWords.IndexOf(wordToAdd.ToString().ToLower()) == -1)
     {
         wordToDisplay = previousWord + wordToAdd.ToString().ToLower() + "\n";
         Debug.Log("wordToDispay: " + wordToDisplay + "\nwordToAdd: " + wordToAdd);
         existingWords.Add(wordToAdd.ToString());
     }
 }
Beispiel #34
0
        /// <summary> Read the specified integer property.
        /// <p>
        /// Throws an exception if the property value isn't an integer.
        /// *
        /// </summary>
        /// <param name="key">the name of the property
        /// </param>
        /// <returns> the integer value of the property
        ///
        /// </returns>
        public static int getIntProperty(System.Configuration.AppSettingsReader properties, System.Object key)
        {
            System.String string_Renamed = (System.String)properties.GetValue(key.ToString(), Type.GetType("System.String"));

            if (string_Renamed == null)
            {
                System.Console.Error.WriteLine("WARN: couldn't find integer value under '" + key + "'");
            }

            return(System.Int32.Parse((System.String)properties.GetValue(key.ToString(), Type.GetType("System.String"))));
        }
 public void OnbuttonClick(System.Object buttonname, EventArgs args)
 {
     if (buttonname.ToString().Contains("left"))
     {
         LeftRotate();
     }
     else if (buttonname.ToString().Contains("right"))
     {
         RightRotate();
     }
 }
Beispiel #36
0
        protected static string ToString(Object o)
        {
            if (o == null)
            {
              return "null";
            }
              if (o is byte[])
            {
              string ret = "<";
              byte[] a = (byte[])o;
              for (uint i = 0; i < a.Length; i++)
            {
              if (i != 0)
                ret += ".";
              ret += a[i].ToString("X2");
            }
              ret += ">";
              return ret;
            }
              else if (o is Object[])
            {
              Object[] a = (Object[])o;
              string ret = "[";

              for (uint i = 0; i < a.Length; i++)
            {
              if (i != 0)
                ret += " ";
              ret += ToString(a[i]);
            }
              ret += "]";
              return ret;
            }
              else if (o is System.Int64)
            {
              System.Int64 i = (System.Int64)o;
              return (i < 0 ? "s-0x" : "s0x") + i.ToString("X");
            }
              else if (o is System.UInt64)
            {
              System.UInt64 i = (System.UInt64)o;
              return "u0x" + i.ToString("X");
            }
              else if (o is System.String)
            {
              return "\"" + o.ToString() + "\"";
            }
              else if (o is System.Char)
            {
              return "\'" + o.ToString() + "\'";
            }
              else
            return "WAT(" + o.GetType() + ")";
        }
Beispiel #37
0
 public static System.String ToPontuacaoResumo(System.Object AValue)
 {
     try
     {
         return(AValue.ToString().Substring(0, AValue.ToString().Length - 2) + " ");
     }
     catch (Exception)
     {
         return(AValue.ToString());
     }
 }
 public static string getMoney_string_format(Object ip_obj_so_tien)
 {
     /*Return string Money with format #,###,##*/
     string op_str_so_tien = "";
     if (ip_obj_so_tien.ToString().Trim().Equals("") | ip_obj_so_tien.ToString().Trim().Equals("-1"))
     {
         op_str_so_tien = "";
     }
     else op_str_so_tien = CIPConvert.ToStr(CIPConvert.ToDecimal(ip_obj_so_tien), "#,###,##");
     return op_str_so_tien;
 }
Beispiel #39
0
 public static void SQLWhere(ref ArrayList ParameterList, string FieldName, string ParaName, Object FieldValue, string Operator, string AndOr)
 {
     if (FieldValue.ToString().Trim() == "" || FieldValue.ToString().Trim() == "%%") return;
     ParameterItem pi = new ParameterItem();
     pi.ParaName = ParaName;
     pi.WhereString = string.Format(" {0} {1} {2} :{3}", AndOr, FieldName, Operator, pi.ParaName);
     pi.FieldName = FieldName;
     pi.FieldType = DbType.String;
     pi.FieldValue = FieldValue;
     ParameterList.Add(pi);
 }
Beispiel #40
0
 /// <summary>
 /// 判断对象是否为空
 /// </summary>
 /// <param name="obj">对象</param>
 /// <returns></returns>
 public static bool ObjectIsNull(Object obj)
 {
     //如果对象引用为null 或者 对象值为null 或者对象值为空
     if (obj == null || obj == System.DBNull.Value || obj.ToString().Equals("") || obj.ToString() == "")
     {
         return true;
     }
     else
     {
         return false;
     }
 }
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected async override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            pageTitle.Text = "Articles tagged \"" + App.page_title + "\"";
            navParam = navigationParameter.ToString();
            ViewCommentsButton.Visibility = Visibility.Collapsed;
            progressRing.Visibility = Visibility.Visible;
            Windows.UI.Xaml.Media.Animation.Storyboard sb =
                this.FindName("PopInStoryBoard") as Windows.UI.Xaml.Media.Animation.Storyboard;
            if (sb != null) sb.Begin();

            // TODO: Assign a bindable group to this.DefaultViewModel["Group"]
            // TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"]
            FeedDataSource feedDataSource = (FeedDataSource)App.Current.Resources["feedDataSource"];
            if (feedDataSource != null)
            {
                await feedDataSource.GetFeedsAsync("tag", navigationParameter.ToString());
            }
            RootObject feedData = FeedDataSource.GetFeed();
            if (feedData != null)
            {
                this.DefaultViewModel["Feed"] = feedData;
                this.DefaultViewModel["Items"] = feedData.posts;
            }

            if (pageState == null)
            {
                // When this is a new page, select the first item automatically unless logical page
                // navigation is being used (see the logical page navigation #region below.)
                if (!this.UsingLogicalPageNavigation() && this.itemsViewSource.View != null)
                {
                    this.itemsViewSource.View.MoveCurrentToFirst();
                }
                else
                {
                    //this.itemsViewSource.View.MoveCurrentToPosition(-1);
                }
            }
            else
            {
                // Restore the previously saved state associated with this page
                if (pageState.ContainsKey("SelectedItem") && this.itemsViewSource.View != null)
                {
                    // TODO: Invoke this.itemsViewSource.View.MoveCurrentTo() with the selected
                    //       item as specified by the value of pageState["SelectedItem"]
                    string itemTitle = (string)pageState["SelectedItem"];
                    Post selectedItem = FeedDataSource.GetItem(itemTitle);
                    this.itemsViewSource.View.MoveCurrentTo(selectedItem);
                }
            }
            ViewCommentsButton.Visibility = Visibility.Visible;
            progressRing.Visibility = Visibility.Collapsed;
        }
 public static System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> InitPubMessage(System.Object obj)
 {
     using (new zAppDev.DotNet.Framework.Profiling.Profiler("Utils", zAppDev.DotNet.Framework.Profiling.AppDevSymbolType.ClassOperation, "InitPubMessage")) {
         System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage> messages = new System.Collections.Generic.List <DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage>();
         System.Type type = obj.GetType();
         System.Collections.Generic.List <zAppDev.DotNet.Framework.Utilities.MambaRuntimeType> properties = zAppDev.DotNet.Framework.Utilities.MambaRuntimeType.FromPropertiesList(type.GetProperties());
         foreach (var property in properties ?? Enumerable.Empty <zAppDev.DotNet.Framework.Utilities.MambaRuntimeType>())
         {
             System.Object value    = property.GetValue(obj, new object[] {});
             string        name     = property.Name;
             string        datatype = zAppDev.DotNet.Framework.Utilities.Common.GetTypeName(property.PropertyType, false);
             zAppDev.DotNet.Framework.Utilities.DebugHelper.Log(zAppDev.DotNet.Framework.Utilities.DebugMessageType.Info, "Utils", DSS3_LogisticsPoolingForUrbanDistribution.Hubs.EventsHub.RaiseDebugMessage, "property value " + value + " property Name " + name + " property type " + datatype);
             if ((value == null))
             {
                 value = "";
             }
             DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage message = new DSS3_LogisticsPoolingForUrbanDistribution.BO.PubMessage();
             if ((datatype == "Guid"))
             {
                 continue;
             }
             string valueString = value.ToString();
             if (((valueString?.ToLower().Contains("Sarmed".ToLower()) ?? false)))
             {
                 continue;
             }
             if (((datatype?.Contains("Date") ?? false)))
             {
                 message.type = "DateTime"; message.key = name; DateTime?time = zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DateTime?>(value);
                 message.val  = (time?.ToString("yyyy-MM-ddThh-mm-ss") ?? "");
             }
             if ((datatype == "Int64"))
             {
                 message.type = "long"; message.key = name; message.val = value.ToString();
             }
             if ((datatype == "Int32"))
             {
                 message.type = "int"; message.key = name; message.val = value.ToString();
             }
             if ((datatype == "Single"))
             {
                 message.type = "double"; message.key = name; message.val = value.ToString();
             }
             if ((datatype == "String"))
             {
                 message.type = "string"; message.key = name; message.val = zAppDev.DotNet.Framework.Utilities.Common.SafeCast <string>(value);
             }
             messages?.Add(message);
         }
         return(messages);
     }
 }
Beispiel #43
0
    //for button control
    public void OnbuttonClick(System.Object buttonname, EventArgs args)
    {
        Debug.Log(" clicked on " + buttonname.ToString());
        switch (buttonname.ToString())
        {
        //for select button
        case "Play":
            //levelName = "NinjaGameplay";
            SoundController.Static.PlayClickSound();                                     //for click sound
            PlayerSelectionMenu.SetActive(true);
            PlayerGroup.SetActive(true);


            break;

        case "playGame":
            //levelName = "NinjaGameplay";
            SoundController.Static.PlayClickSound();             //for click sound
            Application.LoadLevel(1);


            break;

        //for previous button
        case "Previous":
            SoundController.Static.PlayClickSound(); //for click sound
            showPreviousPlayer();                    //for previos polayer information
            break;

        //for next button
        case "Next":
            SoundController.Static.PlayClickSound(); //for click sound
            showNextPlayer();                        //for next polayer information
            break;

        //for buy button
        case "Buy":
            SoundController.Static.PlayClickSound(); //for click sound
            PlayerGroup.SetActive(false);            //for player disable
            purchasePlayer();                        //for player purchase information
            //MainMenuScreens.currentScreen = MainMenuScreens.MenuScreens.UnSufficentCoinsMenu;//for moving unsufficent menu state
            break;

        //for back button
        case "Back":
            SoundController.Static.PlayClickSound();                                     //for click sound
            PlayerSelectionMenu.SetActive(false);
            PlayerGroup.SetActive(false);
            MainMenuParent.SetActive(true);             //for mainmenu enable
            break;
        }
    }
        public static String RenderValue(Object value, String type)
        {
            switch (type)
            {
                case "String":
                    return ((String)value).FromMarkdownToHtml();
                case "Percentage":
                    return value.ToString() + "%";

                default:
                    return value.ToString();
            }
        }
Beispiel #45
0
 private bool ExLength(System.Object Obj, int length, string exMessage)
 {
     if (Obj.ToString().Length > length)
     {
         Exception ExLength = new Exception(exMessage + " 超过" + length.ToString() + "位!");
         ExLength.Source = Obj.ToString();
         throw ExLength;
     }
     else
     {
         return(true);
     }
 }
Beispiel #46
0
 /// <summary> Read the specified float property.
 /// <p>
 /// Throws an exception if the property value isn't a floating-point number.
 /// *
 /// </summary>
 /// <param name="key">the name of the property
 /// </param>
 /// <returns> the float value of the property
 ///
 /// </returns>
 public static float getFloatProperty(System.Configuration.AppSettingsReader properties, System.Object key)
 {
     System.String string_Renamed = null;
     try
     {
         string_Renamed = (System.String)properties.GetValue(key.ToString(), Type.GetType("System.String"));
     }
     catch            //was: if (string_Renamed == null)
     {
         System.Console.Error.WriteLine("WARN: couldn't find float value under '" + key + "'");
         return(0);
     }
     return(System.Single.Parse((System.String)properties.GetValue(key.ToString(), Type.GetType("System.String"))));
 }
Beispiel #47
0
 //Update the userlist.
 void RefreshUserWindow(string flag, JsonObject msg)
 {
     System.Object user = null;
     if (msg.TryGetValue("user", out user))
     {
         if (flag == "add")
         {
             this.userList.Add(user.ToString());
         }
         else if (flag == "leave")
         {
             this.userList.Remove(user.ToString());
         }
     }
 }
Beispiel #48
0
 private string GetSetting(string property, System.Object defaultValue)
 {
     if (mMaterialSettings != null)
     {
         return(mMaterialSettings.GetSettingAsString(property));
     }
     if (defaultValue.GetType() == typeof(bool))
     {
         return(defaultValue.ToString().Equals("True") ? "true" : "false");
     }
     else
     {
         return(defaultValue.ToString());
     }
 }
Beispiel #49
0
 public GetComponentInChildrenAttribute(System.Object pObject, bool bInclude_DeActive)
 {
     bSearch_By_ComponentName      = true;
     this.strComponentName         = pObject.ToString();
     this.bSearch_By_ComponentName = true;
     this.bInclude_DeActive        = bInclude_DeActive;
 }
Beispiel #50
0
        public static void Save(string path, System.Object obj)
        {
#if !UNITY_WEBPLAYER
            string p = System.IO.Path.Combine(Application.persistentDataPath, path);
            Type   t = obj.GetType();
            if (t.GetCustomAttribute <SerializableAttribute>() != null || typeof(ISerializable).IsAssignableFrom(t))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                try{
                    using (FileStream fs = new FileStream(p, FileMode.Create)){
                        formatter.Serialize(fs, obj);
                    }
                }
                catch (Exception ex) {
                    UnityEngine.Debug.LogException(ex);
                }
            }
            else
            {
                try{
                    using (StreamWriter sr = new StreamWriter(p, false)){
                        sr.Write(obj.ToString());
                    }
                }
                catch (Exception ex) {
                    UnityEngine.Debug.LogException(ex);
                }
            }
#endif
        }
    public Expat(ReadOnlyTargetRules Target) : base(Target)
    {
        Type = ModuleType.External;

        string ExpatPackagePath = Target.UEThirdPartySourceDirectory + "Expat";

        if (Target.Platform == UnrealTargetPlatform.XboxOne)
        {
            string IncludePath = Path.Combine(ExpatPackagePath, "expat-2.2.0/lib");
            PublicSystemIncludePaths.Add(IncludePath);

            // Use reflection to allow type not to exist if console code is not present
            string      ToolchainName       = "VS";
            System.Type XboxOnePlatformType = System.Type.GetType("UnrealBuildTool.XboxOnePlatform,UnrealBuildTool");
            if (XboxOnePlatformType != null)
            {
                System.Object VersionName = XboxOnePlatformType.GetMethod("GetVisualStudioCompilerVersionName").Invoke(null, null);
                ToolchainName += VersionName.ToString();
            }

            string ConfigPath  = (Target.Configuration == UnrealTargetConfiguration.Debug && Target.bDebugBuildsActuallyUseDebugCRT) ? "Debug" : "Release";
            string LibraryPath = Path.Combine(ExpatPackagePath, "expat-2.2.0", "XboxOne", ToolchainName, ConfigPath);

            PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "expat.lib"));
        }
    }
 //for button control
 public void OnbuttonClick(System.Object buttonname, EventArgs args)
 {
     Debug.Log(" clicked on " + buttonname.ToString());
     switch (buttonname.ToString())
     {
     //for ok button
     case "Ok":
         SoundController.Static.PlayClickSound();                 //for click sound
         UnsufficentCoinsForPlayerselectionMenu.SetActive(false); //for unsufficent menu Disables
         PlayerGroupMenu.SetActive(true);
         PlayerSelectionMenu.SetActive(true);
         //InAppMenuParent.SetActive(true);//inapp menu Enables
         //	MainMenuScreens.currentScreen=MainMenuScreens.MenuScreens;//for moving inapp menu state
         break;
     }
 }
Beispiel #53
0
        private static void EventCallback(string type, System.Object data)
        {
            if (data != null)
            {
                Debug.Log("Lua Profiler - SocketEvent [" + type + "]: " + data.ToString());
            }
            else
            {
                Debug.Log("Lua Profiler - SocketEvent [" + type + "]");
            }

            switch (type)
            {
            case SocketEvent.CONNECTED:
                break;

            case SocketEvent.MESSAGE:
                break;

            // Connect Fail or Disconnect
            default:
                End();
                break;
            }
        }
Beispiel #54
0
 public Seat_Booking_Details(System.Object msgreceived, System.Object BN)
     : base()
 {
     InitializeComponent();
     checkm = msgreceived.ToString();
     BNO4   = Convert.ToInt32(BN);
 }
    // Verifica se a conexao foi bem sucedida
    private static void handleConnection(string error, IJSonObject data, System.Object state)
    {
        string id = state.ToString();

        // Obtem a conexao retornada
        PConn conn = null;

        lock (connections)
        {
            if (connections.ContainsKey(id))
            {
                conn = connections[id];
            }
        }

        // Se nao ha conexao, termina
        if (conn == null)
        {
            return;
        }

        // Se houve erro, libera a conexao e termina
        if (error != null)
        {
            conn.release();
            return;
        }

        // Remove e libera a conexao
        removeConnection(id);
        conn.release();
    }
Beispiel #56
0
    public void OnEvent(Object messageData, CardsGameClass cardsGameClass)
    {
        switch (messageData.ToString())
        {
        case "openPopup":
            if (!_flagPopup)
            {
                _cardGame = cardsGameClass;
                _classPopup.SetActive(true);
                ActionsWithCard cardDis = _classView.GetComponent <ActionsWithCard>();
                cardDis.CardSetup(_cardGame);
                _classView.gameObject.GetComponent <Animator>().SetBool("view", true);
                _flagPopup = true;
            }
            break;

            /*case "selectClass":
             *  if(_flagPopup)
             *  {
             *      _publisher.Publish(this,"selectClass", cardsClass);
             *      _classPopup.SetActive(false);
             *      _flagPopup = false;
             *  }
             *  break;*/
        }
    }
 // debug messages (change DBG to true for anything to print)
 protected internal virtual void  Log(System.Object o)
 {
     if (DBG)
     {
         System.Console.Out.WriteLine(o.ToString());
     }
 }
Beispiel #58
0
        public static void DrawText(String label, System.Object value = null, int?fontSize = null)
        {
            GUILayout.BeginHorizontal();
            var sk = new GUIStyle(GUI.skin.label);

            if (fontSize != null)
            {
                sk.fontSize = fontSize.Value;
            }
            GUILayout.Label(label, sk);
            var valSk = new GUIStyle(sk);

            valSk.alignment = TextAnchor.UpperRight; //右对齐

            if (value != null)
            {
                var t = "";
                if (value is float)
                {
                    t = $"{value:F2}";
                }
                else
                {
                    t = value.ToString();
                }


                GUILayout.Label(t, valSk);
            }

            GUILayout.EndHorizontal();
        }
        public static System.Boolean IsNumeric(System.Object Expression)
        {
            if (Expression == null || Expression is DateTime)
            {
                return(false);
            }

            if (Expression is Int16 || Expression is Int32 || Expression is Int64 || Expression is Decimal || Expression is Single || Expression is Double || Expression is Boolean)
            {
                return(true);
            }

            try
            {
                if (Expression is string)
                {
                    Double.Parse(Expression as string);
                }
                else
                {
                    Double.Parse(Expression.ToString());
                }
                return(true);
            }
            catch { } // just dismiss errors but return false
            return(false);
        }
Beispiel #60
0
        public static bool IsNumeric(System.Object Expression)
        {
            if (Expression == null || Expression is DateTime)
            {
                return(false);
            }

            if (Expression is Int16 || Expression is Int32 || Expression is Int64 || Expression is Decimal || Expression is Single || Expression is Decimal || Expression is Boolean)
            {
                return(true);
            }

            try
            {
                if (Expression is string)
                {
                    Decimal.Parse(Expression as string);
                }
                else
                {
                    Decimal.Parse(Expression.ToString());
                }
                return(true);
            }
            catch
            {
            }
            return(false);
        }