79 lines
2.9 KiB
C#
79 lines
2.9 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using JD.Core.ProjectManaging;
|
|
using Microsoft.Win32;
|
|
|
|
namespace JD.Serialization
|
|
{
|
|
public partial class CSharpDataWrapperConfigDlg : Form
|
|
{
|
|
const string RegistryPath = @"SOFTWARE\\Ubisoft\\UbiArt\\UAF";
|
|
public CSharpDataWrapperConfigDlg()
|
|
{
|
|
InitializeComponent();
|
|
|
|
InitDialog();
|
|
}
|
|
|
|
private void InitDialog()
|
|
{
|
|
RegistryKey MyReg = Registry.CurrentUser.OpenSubKey(RegistryPath);
|
|
if (MyReg == null)
|
|
MyReg = Registry.CurrentUser.CreateSubKey(RegistryPath);
|
|
if (MyReg != null)
|
|
{
|
|
Globals.ProjectRoot = ProjectManager.Instance.CurrentProject.DataPath;
|
|
Globals.P4_Server = (string)MyReg.GetValue("perforceServer", "mtp-sc-perfproxy01:1780");
|
|
Globals.P4_Client = (string)MyReg.GetValue("perforceClient", "");
|
|
Globals.FieldsDescriptorFile = (string)MyReg.GetValue("FieldsDescriptor", "");
|
|
}
|
|
textBoxDataRoot.Text = Globals.ProjectRoot;
|
|
folderBrowserDialogDataRoot.SelectedPath = Globals.ProjectRoot;
|
|
textBoxP4Server.Text = Globals.P4_Server;
|
|
textBoxP4Client.Text = Globals.P4_Client;
|
|
textBoxFieldsDescriptor.Text = Globals.FieldsDescriptorFile;
|
|
|
|
if (Globals.FieldsDescriptorFile.Length > 0)
|
|
Globals.loadFieldsDescriptor();
|
|
}
|
|
|
|
private void buttonOk_Click(object sender, EventArgs e)
|
|
{
|
|
Globals.ProjectRoot = textBoxDataRoot.Text;
|
|
Globals.P4_Server = textBoxP4Server.Text;
|
|
Globals.P4_Client = textBoxP4Client.Text;
|
|
Globals.FieldsDescriptorFile = textBoxFieldsDescriptor.Text;
|
|
|
|
RegistryKey MyReg = Registry.CurrentUser.OpenSubKey(RegistryPath,true);
|
|
if (MyReg != null)
|
|
{
|
|
MyReg.SetValue("dataPath", Globals.ProjectRoot);
|
|
MyReg.SetValue("perforceServer", Globals.P4_Server);
|
|
MyReg.SetValue("perforceClient", Globals.P4_Client);
|
|
MyReg.SetValue("FieldsDescriptor", Globals.FieldsDescriptorFile);
|
|
}
|
|
|
|
Close();
|
|
}
|
|
|
|
private void buttonCancel_Click(object sender, EventArgs e)
|
|
{
|
|
InitDialog();
|
|
|
|
Close();
|
|
}
|
|
|
|
private void buttonDataRoot_Click(object sender, EventArgs e)
|
|
{
|
|
if (folderBrowserDialogDataRoot.ShowDialog() == DialogResult.OK)
|
|
textBoxDataRoot.Text = folderBrowserDialogDataRoot.SelectedPath;
|
|
}
|
|
|
|
private void buttonFieldsDescriptor_Click(object sender, EventArgs e)
|
|
{
|
|
if (openFileDialoFieldsDescriptor.ShowDialog() == DialogResult.OK)
|
|
textBoxFieldsDescriptor.Text = openFileDialoFieldsDescriptor.FileName;
|
|
}
|
|
}
|
|
}
|