Server.Commands.CommandLogging.WriteLine C# (CSharp) Méthode

WriteLine() public static méthode

public static WriteLine ( Mobile from, string format ) : void
from Mobile
format string
Résultat void
		public static void WriteLine( Mobile from, string format, params object[] args )
		{
			if ( !m_Enabled )
				return;

			WriteLine( from, String.Format( format, args ) );
		}

Usage Example

            protected override void OnTarget(Mobile from, object targ)
            {
                bool done = false;

                if (!(targ is Item))
                {
                    from.SendMessage("You can only dupe items.");
                    return;
                }

                CommandLogging.WriteLine(from, "{0} {1} duping {2} (inBag={3}; amount={4})", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ), m_InBag, m_Amount);

                Item      copy = (Item)targ;
                Container pack;

                if (m_InBag)
                {
                    if (copy.Parent is Container)
                    {
                        pack = (Container)copy.Parent;
                    }
                    else if (copy.Parent is Mobile)
                    {
                        pack = ((Mobile)copy.Parent).Backpack;
                    }
                    else
                    {
                        pack = null;
                    }
                }
                else
                {
                    pack = from.Backpack;
                }

                Type t = copy.GetType();

                //ConstructorInfo[] info = t.GetConstructors();

                ConstructorInfo c = t.GetConstructor(Type.EmptyTypes);

                if (c != null)
                {
                    try
                    {
                        from.SendMessage("Duping {0}...", m_Amount);
                        for (int i = 0; i < m_Amount; i++)
                        {
                            object o = c.Invoke(null);

                            if (o != null && o is Item)
                            {
                                Item newItem = (Item)o;
                                CopyProperties(newItem, copy);                                  //copy.Dupe( item, copy.Amount );
                                copy.OnAfterDuped(newItem);
                                newItem.Parent = null;

                                if (pack != null)
                                {
                                    pack.DropItem(newItem);
                                }
                                else
                                {
                                    newItem.MoveToWorld(from.Location, from.Map);
                                }

                                CommandLogging.WriteLine(from, "{0} {1} duped {2} creating {3}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ), CommandLogging.Format(newItem));
                            }
                        }
                        from.SendMessage("Done");
                        done = true;
                    }
                    catch
                    {
                        from.SendMessage("Error!");
                        return;
                    }
                }

                if (!done)
                {
                    from.SendMessage("Unable to dupe.  Item must have a 0 parameter constructor.");
                }
            }
All Usage Examples Of Server.Commands.CommandLogging::WriteLine