AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
BuildDeployPrefs.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using System;
5 using System.IO;
6 using UnityEngine;
7 
8 namespace HoloToolkit.Unity
9 {
10  public static class BuildDeployPrefs
11  {
12  // Constants
13  private const string EditorPrefs_BuildDir = "_BuildDeployWindow_BuildDir";
14  private const string EditorPrefs_BuildConfig = "_BuildDeployWindow_BuildConfig";
15  private const string EditorPrefs_BuildPlatform = "_BuildDeployWindow_BuildPlatform";
16  private const string EditorPrefs_ForceRebuild = "_BuildDeployWindow_ForceBuild";
17  private const string EditorPrefs_IncrementBuildVersion = "_BuildDeployWindow_IncrementBuildVersion";
18  private const string EditorPrefs_MSBuildVer = "_BuildDeployWindow_MSBuildVer";
19  private const string EditorPrefs_TargetIPs = "_BuildDeployWindow_DestIPs";
20  private const string EditorPrefs_ConnectInfos = "_BuildDeployWindow_ConnectInfos";
21  private const string EditorPrefs_DeviceUser = "_BuildDeployWindow_DeviceUser";
22  private const string EditorPrefs_DevicePwd = "_BuildDeployWindow_DevicePwd";
23  private const string EditorPrefs_FullReinstall = "_BuildDeployWindow_FullReinstall";
24  private const string EditorPrefs_UseSSL = "_BuildDeployWindow_UseSSL";
25  private const string EditorPrefs_ProcessAll = "_BuildDeployWindow_ProcessAll";
26 
27  public static string BuildDirectory
28  {
29  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_BuildDir, "UWP"); }
30  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_BuildDir, value); }
31  }
32 
33  public static string AbsoluteBuildDirectory
34  {
35  get
36  {
37  string rootBuildDirectory = BuildDirectory;
38  int dirCharIndex = rootBuildDirectory.IndexOf("/", StringComparison.Ordinal);
39  if (dirCharIndex != -1)
40  {
41  rootBuildDirectory = rootBuildDirectory.Substring(0, dirCharIndex);
42  }
43  return Path.GetFullPath(Path.Combine(Path.Combine(Application.dataPath, ".."), rootBuildDirectory));
44  }
45  }
46 
47  public static string MsBuildVersion
48  {
49  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_MSBuildVer, BuildDeployTools.DefaultMSBuildVersion); }
50  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_MSBuildVer, value); }
51  }
52 
53  public static string BuildConfig
54  {
55  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_BuildConfig, "Debug"); }
56  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_BuildConfig, value); }
57  }
58 
59  public static string BuildPlatform
60  {
61  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_BuildPlatform, "x86"); }
62  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_BuildPlatform, value); }
63  }
64 
65  public static bool ForceRebuild
66  {
67  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_ForceRebuild, false); }
68  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_ForceRebuild, value); }
69  }
70 
71  public static bool IncrementBuildVersion
72  {
73  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_IncrementBuildVersion, true); }
74  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_IncrementBuildVersion, value); }
75  }
76 
77  public static bool FullReinstall
78  {
79  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_FullReinstall, true); }
80  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_FullReinstall, value); }
81  }
82 
83  public static string DevicePortalConnections
84  {
85  get
86  {
88  EditorPrefs_ConnectInfos,
89  JsonUtility.ToJson(
91  new ConnectInfo("127.0.0.1", string.Empty, string.Empty, "Local Machine"))));
92  }
93  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_ConnectInfos, value); }
94  }
95 
96  [Obsolete("Use DevicePortalConnections")]
97  public static string DeviceUser
98  {
99  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_DeviceUser, string.Empty); }
100  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_DeviceUser, value); }
101  }
102 
103  [Obsolete("Use DevicePortalConnections")]
104  public static string DevicePassword
105  {
106  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_DevicePwd, string.Empty); }
107  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_DevicePwd, value); }
108  }
109 
110  [Obsolete("Use DevicePortalConnections")]
111  public static string TargetIPs
112  {
113  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_TargetIPs, "127.0.0.1"); }
114  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_TargetIPs, value); }
115  }
116 
117  public static bool UseSSL
118  {
119  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_UseSSL, true); }
120  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_UseSSL, value); }
121  }
122 
123  public static bool TargetAllConnections
124  {
125  get { return EditorPrefsUtility.GetEditorPref(EditorPrefs_ProcessAll, false); }
126  set { EditorPrefsUtility.SetEditorPref(EditorPrefs_ProcessAll, value); }
127  }
128  }
129 }
static void SetEditorPref(string key, string value)
static string GetEditorPref(string key, string defaultValue)
Contains utility functions for building for the device