New additions.

This commit is contained in:
McMak 2015-04-27 20:21:59 +03:00
parent 47adf43407
commit 5115b49630
11 changed files with 4859 additions and 0 deletions

View file

@ -0,0 +1,35 @@
using System;
using System.Diagnostics;
using System.Text;
namespace WebsitePanel.WIXInstaller.Common
{
class InMemoryStringLogListener : TraceListener
{
private const string Format = "[{0}] Message: {1}";
static private StringBuilder m_Ctx;
string m_id;
static InMemoryStringLogListener()
{
m_Ctx = new StringBuilder();
}
public InMemoryStringLogListener(string InstanceID)
: base(InstanceID)
{
m_id = InstanceID;
}
public override void Write(string Value)
{
WriteLog(Value);
}
public override void WriteLine(string Value)
{
WriteLog(Value + Environment.NewLine);
}
[Conditional("DEBUG")]
private void WriteLog(string Value)
{
m_Ctx.Append(string.Format(Format, m_id, Value));
}
}
}

View file

@ -0,0 +1,19 @@
using System;
namespace WebsitePanel.WIXInstaller.Common
{
internal struct Prop
{
public const int REQ_IIS_MINIMUM = 6;
public const string REQ_LOG = "PI_PREREQ_LOG";
public const string REQ_OS = "PI_PREREQ_OS";
public const string REQ_IIS = "PI_PREREQ_IIS";
public const string REQ_IIS_MAJOR = "PI_PREREQ_IIS_MAJOR";
public const string REQ_IIS_MINOR = "PI_PREREQ_IIS_MINOR";
public const string REQ_ASPNET = "PI_PREREQ_ASPNET";
public const string REQ_SERVER = "PI_PREREQ_WP_SERVER";
public const string REQ_ESERVER = "PI_PREREQ_WP_ESERVER";
public const string REQ_PORTAL = "PI_PREREQ_WP_PORTAL";
public const string REQ_WDPORTAL = "PI_PREREQ_WP_WDPORTAL";
}
}

View file

@ -0,0 +1,36 @@
using Microsoft.Deployment.WindowsInstaller;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WebsitePanel.Setup;
namespace WebsitePanel.WIXInstaller.Common
{
internal static class Tool
{
public static SetupVariables GetSetupVars(Session Ctx)
{
return new SetupVariables
{
SetupAction = SetupActions.Install,
IISVersion = Global.IISVersion
};
}
public static void FillServerVariables(SetupVariables Vars)
{
}
public static void FillEServerVariables(SetupVariables Vars)
{
}
public static void FillPortalVariables(SetupVariables Vars)
{
}
}
}

View file

@ -0,0 +1,79 @@
using System;
using Microsoft.Deployment.WindowsInstaller;
namespace WebsitePanel.WIXInstaller.Common.Util
{
internal interface IListCtrl
{
ulong Count { get; }
string Id { get; }
void AddItem(Record Item);
}
internal abstract class ListCtrlBase : IListCtrl
{
private Session m_Ctx;
private string m_CtrlType;
private string m_CtrlId;
private View m_View;
private ulong m_Count;
public ListCtrlBase(Session session, string CtrlType, string CtrlId)
{
m_Ctx = session;
m_CtrlType = CtrlType;
m_CtrlId = CtrlId;
m_View = null;
m_Count = 0;
Initialize();
}
~ListCtrlBase()
{
if (m_View != null)
m_View.Close();
}
public virtual ulong Count { get { return m_Count; } }
public virtual string Id { get { return m_CtrlId; } }
public virtual void AddItem(Record Item)
{
m_View.Execute(Item);
++m_Count;
}
private void Initialize()
{
m_Ctx.Database.Execute(string.Format("DELETE FROM `{0}` WHERE `Property`='{1}'", m_CtrlType, m_CtrlId));
m_View = m_Ctx.Database.OpenView(m_Ctx.Database.Tables[m_CtrlType].SqlInsertString + " TEMPORARY");
}
}
class ListViewCtrl : ListCtrlBase
{
public ListViewCtrl(Session session, string WiXListID) : base(session, "ListView", WiXListID)
{
}
public void AddItem(bool Checked, string Value)
{
AddItem(new Record(new object[] { Id, Count, Value, Value, Checked ? "passmark" : "failmark" }));
}
}
class ComboBoxCtrl : ListCtrlBase
{
public ComboBoxCtrl(Session session, string WiXComboID): base(session, "ComboBox", WiXComboID)
{
}
public void AddItem(string Value)
{
AddItem(new Record(new object[] { Id, Count, Value, Value }));
}
}
}

View file

@ -0,0 +1,26 @@
using System;
using System.Diagnostics;
using Microsoft.Deployment.WindowsInstaller;
namespace WebsitePanel.WIXInstaller.Common
{
public class WiXLogListener : TraceListener
{
private Session m_Ctx;
public WiXLogListener(Session Ctx)
: base("WiXLogListener")
{
m_Ctx = Ctx;
}
public override void Write(string Value)
{
m_Ctx.Log(Value);
}
public override void WriteLine(string Value)
{
m_Ctx.Log(Value + Environment.NewLine);
}
}
}

View file

@ -0,0 +1,11 @@
using System;
namespace WebsitePanel.WIXInstaller.Common
{
internal struct YesNo
{
public static string Yes { get { return "1"; } }
public static string No { get { return "0"; } }
}
}