28 January 2015

Decompiled C# Library : AppStudio.Common.dll

Wonderfull Microsoft Windows AppStudio on adress http://appstudio.windows.com generate Universal Applications for Windows Phone and Windows Store in C# - online.

Downloaded generated source code use closed library AppStudio.Common.dll, which breaks further portability.

Fortunately, the only items being used from this library are the BindableBase, BindableSchemaBase, and IDataSource. 

So I recreated these files in the directly, removing the AppStudio.Common.dll reference entirely from both the  Windows projects.

Here’s the code for the BindableBase:

using System;
using System.Collectionus.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace SoftLabPro.Data
{ public abstract class BindableBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
    protected BindableBase()
    {
    }
    public virtual void Initialize(IDictionary<string, string> parameters)
    {
    }
    protected void OnPropertyChanged(string propertyName = null)
    {
        PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
        if (propertyChanged != null)
        {
            try
            {
                propertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
            catch
            {
            }
        }
    }
    protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
    {
        if (object.Equals((T)storage, value))
        {
            return false;
        }
        storage = value;
        this.OnPropertyChanged(propertyName);
        return true;
    }
}
}

Here is BindableSchemaBase:

using System;
using System.Runtime.CompilerServices;
using System.Text;

namespace SoftLabPro.Data
{ public abstract class BindableSchemaBase : BindableBase
{
    public BindableSchemaBase()
    {
        this.Id = Guid.NewGuid().ToString();
    }
    public abstract string GetValue(string propertyName);
    public virtual string GetValues(params string[] propertyNames)
    {
        StringBuilder builder = new StringBuilder();
        foreach (string str in propertyNames)
        {
            builder.AppendLine((this.GetValue(str) ?? string.Empty).ToString());
        }
        return builder.ToString();
    }
    public abstract string DefaultContent { get; }
    public abstract string DefaultImageUrl { get; }
    public abstract string DefaultSummary { get; }
    public abstract string DefaultTitle { get; }
    public string Id { get; set; }
}
}


And finally IDataSource:

using System.Collections.Generic;

using System.Threading.Tasks;

namespace SoftLabPro.Data

{
    public interface IDataSource<T> where T : BindableSchemaBase

{
    Task<IEnumerable<T>> LoadData();
    Task<IEnumerable<T>> Refresh();
}

}

Post a Comment