first commit

This commit is contained in:
Beyhan Oğur
2026-09-03 04:45:36 +03:00
commit d5f52cc3d3
1038 changed files with 169579 additions and 0 deletions
@@ -0,0 +1,41 @@
using System;
using System.ComponentModel;
using System.Globalization;
using System.Reflection;
namespace ClassicAssist.UI.Misc
{
public class EnumDescriptionTypeConverter : EnumConverter
{
public EnumDescriptionTypeConverter( Type type ) : base( type )
{
}
public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture, object value,
Type destinationType )
{
if ( destinationType != typeof( string ) )
{
return base.ConvertTo( context, culture, value, destinationType );
}
if ( value == null )
{
return string.Empty;
}
FieldInfo fi = value.GetType().GetField( value.ToString() );
if ( fi != null )
{
DescriptionAttribute[] attributes =
(DescriptionAttribute[]) fi.GetCustomAttributes( typeof( DescriptionAttribute ), false );
return attributes.Length > 0 && !string.IsNullOrEmpty( attributes[0].Description )
? attributes[0].Description
: value.ToString();
}
return string.Empty;
}
}
}
@@ -0,0 +1,68 @@
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
namespace ClassicAssist.UI.Misc
{
public sealed class ObservableCollectionEx<T> : ObservableCollection<T> where T : INotifyPropertyChanged
{
// this collection also reacts to changes in its components' properties
public ObservableCollectionEx()
{
CollectionChanged += ObservableCollectionEx_CollectionChanged;
}
private void ObservableCollectionEx_CollectionChanged( object sender, NotifyCollectionChangedEventArgs e )
{
switch ( e.Action )
{
case NotifyCollectionChangedAction.Remove:
foreach ( T item in e.OldItems )
{
//Removed items
item.PropertyChanged -= EntityViewModelPropertyChanged;
}
break;
case NotifyCollectionChangedAction.Add:
foreach ( T item in e.NewItems )
{
//Added items
item.PropertyChanged += EntityViewModelPropertyChanged;
}
break;
case NotifyCollectionChangedAction.Replace:
break;
case NotifyCollectionChangedAction.Move:
break;
case NotifyCollectionChangedAction.Reset:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
public void EntityViewModelPropertyChanged( object sender, PropertyChangedEventArgs e )
{
//This will get called when the property of an object inside the collection changes - note you must make it a 'reset' - dunno why
NotifyCollectionChangedEventArgs args =
new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Reset );
if ( args.NewStartingIndex < 0 )
{
return;
}
OnCollectionChanged( args );
}
}
}
@@ -0,0 +1,26 @@
#region License
// Copyright (C) 2020 Reetus
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#endregion
using System;
namespace ClassicAssist.UI.Misc
{
public class OptionsBindingAttribute : Attribute
{
public string Property { get; set; }
}
}
@@ -0,0 +1,33 @@
#region License
// Copyright (C) 2020 Reetus
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#endregion
using System;
using ClassicAssist.UO.Network.PacketFilter;
namespace ClassicAssist.UI.Misc
{
public class PacketEntry
{
public byte[] Data { get; set; }
public DateTime DateTime { get; set; } = DateTime.Now;
public PacketDirection Direction { get; set; }
public int Length => Data.Length;
public string Title { get; set; }
}
}