Here are the examples of the csharp api string.Concat(params string[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2016 Examples
19
View Source File : TemplateEngin.cs
License : MIT License
Project Creator : 2881099
License : MIT License
Project Creator : 2881099
private static string htmlSyntax(string tplcode, int num) {
while (num-- > 0) {
string[] arr = _reg_syntax.Split(tplcode);
if (arr.Length == 1) break;
for (int a = 1; a < arr.Length; a += 4) {
string tag = string.Concat('<', arr[a]);
string end = string.Concat("</", arr[a], '>');
int fc = 1;
for (int b = a; fc > 0 && b < arr.Length; b += 4) {
if (b > a && arr[a].ToLower() == arr[b].ToLower()) fc++;
int bpos = 0;
while (true) {
int fa = arr[b + 3].IndexOf(tag, bpos);
int fb = arr[b + 3].IndexOf(end, bpos);
if (b == a) {
var z = arr[b + 3].IndexOf("/>");
if ((fb == -1 || z < fb) && z != -1) {
var y = arr[b + 3].Substring(0, z + 2);
if (_reg_htmltag.IsMatch(y) == false)
fb = z - end.Length + 2;
}
}
if (fa == -1 && fb == -1) break;
if (fa != -1 && (fa < fb || fb == -1)) {
fc++;
bpos = fa + tag.Length;
continue;
}
if (fb != -1) fc--;
if (fc <= 0) {
var a1 = arr[a + 1];
var end3 = string.Concat("{/", a1, "}");
if (a1.ToLower() == "else") {
if (_reg_blank.Replace(arr[a - 4 + 3], "").EndsWith("{/if}", StringComparison.CurrentCultureIgnoreCase) == true) {
var idx = arr[a - 4 + 3].IndexOf("{/if}");
arr[a - 4 + 3] = string.Concat(arr[a - 4 + 3].Substring(0, idx), arr[a - 4 + 3].Substring(idx + 5));
//如果 @else="有条件内容",则变换成 elseif 条件内容
if (_reg_blank.Replace(arr[a + 2], "").Length > 0) a1 = "elseif";
end3 = "{/if}";
} else {
arr[a] = string.Concat("指令 @", arr[a + 1], "='", arr[a + 2], "' 没紧接着 if/else 指令之后,无效. <", arr[a]);
arr[a + 1] = arr[a + 2] = string.Empty;
}
}
if (arr[a + 1].Length > 0) {
if (_reg_blank.Replace(arr[a + 2], "").Length > 0 || a1.ToLower() == "else") {
arr[b + 3] = string.Concat(arr[b + 3].Substring(0, fb + end.Length), end3, arr[b + 3].Substring(fb + end.Length));
arr[a] = string.Concat("{", a1, " ", arr[a + 2], "}<", arr[a]);
arr[a + 1] = arr[a + 2] = string.Empty;
} else {
arr[a] = string.Concat('<', arr[a]);
arr[a + 1] = arr[a + 2] = string.Empty;
}
}
break;
}
bpos = fb + end.Length;
}
}
if (fc > 0) {
arr[a] = string.Concat("不严谨的html格式,请检查 ", arr[a], " 的结束标签, @", arr[a + 1], "='", arr[a + 2], "' 指令无效. <", arr[a]);
arr[a + 1] = arr[a + 2] = string.Empty;
}
}
if (arr.Length > 0) tplcode = string.Join(string.Empty, arr);
}
return tplcode;
}
19
View Source File : RazorModel.cs
License : MIT License
Project Creator : 2881099
License : MIT License
Project Creator : 2881099
public string GetMySqlEnumSetDefine() {
if (fsql.Ado.DataType != FreeSql.DataType.MySql) return null;
var sb = new StringBuilder();
foreach (var col in table.Columns) {
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Enum || col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Set) {
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Set) sb.Append("\r\n\t[Flags]");
sb.Append($"\r\n\tpublic enum {this.GetCsName(this.FullTableName)}{this.GetCsName(col.Name).ToUpper()}");
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Set) sb.Append(" : long");
sb.Append(" {\r\n\t\t");
string slkdgjlksdjg = "";
int field_idx = 0;
int unknow_idx = 0;
string exp2 = string.Concat(col.DbTypeTextFull);
int quote_pos = -1;
while (true) {
int first_pos = quote_pos = exp2.IndexOf('\'', quote_pos + 1);
if (quote_pos == -1) break;
while (true) {
quote_pos = exp2.IndexOf('\'', quote_pos + 1);
if (quote_pos == -1) break;
int r_cout = 0;
//for (int p = 1; true; p++) {
// if (exp2[quote_pos - p] == '\\') r_cout++;
// else break;
//}
while (exp2[++quote_pos] == '\'') r_cout++;
if (r_cout % 2 == 0/* && quote_pos - first_pos > 2*/) {
string str2 = exp2.Substring(first_pos + 1, quote_pos - first_pos - 2).Replace("''", "'");
if (Regex.IsMatch(str2, @"^[\u0391-\uFFE5a-zA-Z_\$][\u0391-\uFFE5a-zA-Z_\$\d]*$"))
slkdgjlksdjg += ", " + str2;
else
slkdgjlksdjg += string.Format(@",
/// <summary>
/// {0}
/// </summary>
[Description(""{0}"")]
Unknow{1}", str2.Replace("\"", "\\\""), ++unknow_idx);
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Set)
slkdgjlksdjg += " = " + Math.Pow(2, field_idx++);
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Enum && field_idx++ == 0)
slkdgjlksdjg += " = 1";
break;
}
}
if (quote_pos == -1) break;
}
sb.Append(slkdgjlksdjg.Substring(2).TrimStart('\r', '\n', '\t'));
sb.Append("\r\n\t}");
}
}
return sb.ToString();
}
19
View Source File : RazorModel.cs
License : MIT License
Project Creator : 2881099
License : MIT License
Project Creator : 2881099
public string GetMySqlEnumSetDefine()
{
if (fsql.Ado.DataType != FreeSql.DataType.MySql && fsql.Ado.DataType != FreeSql.DataType.OdbcMySql) return null;
var sb = new StringBuilder();
foreach (var col in table.Columns)
{
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Enum || col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Set)
{
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Set) sb.Append("\r\n\t[Flags]");
sb.Append($"\r\n\tpublic enum {this.GetCsName(this.FullTableName)}{this.GetCsName(col.Name).ToUpper()}");
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Set) sb.Append(" : long");
sb.Append(" {\r\n\t\t");
string slkdgjlksdjg = "";
int field_idx = 0;
int unknow_idx = 0;
string exp2 = string.Concat(col.DbTypeTextFull);
int quote_pos = -1;
while (true)
{
int first_pos = quote_pos = exp2.IndexOf('\'', quote_pos + 1);
if (quote_pos == -1) break;
while (true)
{
quote_pos = exp2.IndexOf('\'', quote_pos + 1);
if (quote_pos == -1) break;
int r_cout = 0;
//for (int p = 1; true; p++) {
// if (exp2[quote_pos - p] == '\\') r_cout++;
// else break;
//}
while (exp2[++quote_pos] == '\'') r_cout++;
if (r_cout % 2 == 0/* && quote_pos - first_pos > 2*/)
{
string str2 = exp2.Substring(first_pos + 1, quote_pos - first_pos - 2).Replace("''", "'");
if (Regex.IsMatch(str2, @"^[\u0391-\uFFE5a-zA-Z_\$][\u0391-\uFFE5a-zA-Z_\$\d]*$"))
slkdgjlksdjg += ", " + str2;
else
slkdgjlksdjg += string.Format(@",
/// <summary>
/// {0}
/// </summary>
[Description(""{0}"")]
Unknow{1}", str2.Replace("\"", "\\\""), ++unknow_idx);
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Set)
slkdgjlksdjg += " = " + Math.Pow(2, field_idx++);
if (col.DbType == (int)MySql.Data.MySqlClient.MySqlDbType.Enum && field_idx++ == 0)
slkdgjlksdjg += " = 1";
break;
}
}
if (quote_pos == -1) break;
}
sb.Append(slkdgjlksdjg.Substring(2).TrimStart('\r', '\n', '\t'));
sb.Append("\r\n\t}");
}
}
return sb.ToString();
}
19
View Source File : TemplateEngin.cs
License : MIT License
Project Creator : 2881099
License : MIT License
Project Creator : 2881099
public static string ReplaceSingleQuote(object exp) {
//将 ' 转换成 "
string exp2 = string.Concat(exp);
int quote_pos = -1;
while (true) {
int first_pos = quote_pos = exp2.IndexOf('\'', quote_pos + 1);
if (quote_pos == -1) break;
while (true) {
quote_pos = exp2.IndexOf('\'', quote_pos + 1);
if (quote_pos == -1) break;
int r_cout = 0;
for (int p = 1; true; p++) {
if (exp2[quote_pos - p] == '\\') r_cout++;
else break;
}
if (r_cout % 2 == 0/* && quote_pos - first_pos > 2*/) {
string str1 = exp2.Substring(0, first_pos);
string str2 = exp2.Substring(first_pos + 1, quote_pos - first_pos - 1);
string str3 = exp2.Substring(quote_pos + 1);
string str4 = str2.Replace("\"", "\\\"");
quote_pos += str4.Length - str2.Length;
exp2 = string.Concat(str1, "\"", str4, "\"", str3);
break;
}
}
if (quote_pos == -1) break;
}
return exp2;
}
19
View Source File : TemplateEngin.cs
License : MIT License
Project Creator : 2881099
License : MIT License
Project Creator : 2881099
private static string codeTreeEnd(Stack<string> codeTree, string tag) {
string ret = string.Empty;
Stack<int> pop = new Stack<int>();
foreach (string ct in codeTree) {
if (ct == "import" ||
ct == "include") {
pop.Push(1);
} else if (ct == tag) {
pop.Push(2);
break;
} else {
if (string.IsNullOrEmpty(tag) == false) pop.Clear();
break;
}
}
if (pop.Count == 0 && string.IsNullOrEmpty(tag) == false)
return string.Concat("语法错误,{", tag, "} {/", tag, "} 并没配对");
while (pop.Count > 0 && pop.Pop() > 0) codeTree.Pop();
return ret;
}
19
View Source File : Utils.cs
License : MIT License
Project Creator : 2881099
License : MIT License
Project Creator : 2881099
async public static Task<(TableRef, string, string, Dictionary<string, object>, List<Dictionary<string, object>>)> GetTableRefData(IFreeSql fsql, TableRef tbref) {
var reftb = fsql.CodeFirst.GetTableByEnreplacedy(tbref.RefEnreplacedyType);
var reflist = await fsql.Select<object>().AsType(tbref.RefEnreplacedyType).ToListAsync();
var fitlerTextCol = reftb.ColumnsByCs.Values.Where(a => a.CsType == typeof(string)).FirstOrDefault();
var filterTextProp = fitlerTextCol == null ? null : reftb.Properties[fitlerTextCol.CsName];
var filterValueProp = reftb.Properties[reftb.Primarys.FirstOrDefault().CsName];
var filterKv = new Dictionary<string, object>();
var gethashlist = new List<Dictionary<string, object>>();
foreach (var refitem in reflist) {
filterKv[string.Concat(filterValueProp.GetValue(refitem))] = filterTextProp == null ? refitem : filterTextProp.GetValue(refitem);
var gethash = new Dictionary<string, object>();
foreach (var getcol in reftb.ColumnsByCs) {
gethash.Add(getcol.Key, reftb.Properties[getcol.Key].GetValue(refitem));
}
gethashlist.Add(gethash);
}
return (
tbref,
tbref.RefEnreplacedyType.Name,
tbref.RefEnreplacedyType.Name + "_" + reftb.Primarys.FirstOrDefault().CsName,
filterKv,
gethashlist
);
}
19
View Source File : TrainRepository.cs
License : MIT License
Project Creator : 42skillz
License : MIT License
Project Creator : 42skillz
public void UpdateTrainReservations(TrainUpdateDTO trainUpdateDto)
{
if (string.IsNullOrEmpty(trainUpdateDto.train_id))
{
throw new InvalidOperationException("Must have a non-null or non-empty train_id");
}
var train = GetTrain(trainUpdateDto.train_id);
var seats = new List<Seat>();
foreach (var seatInString in trainUpdateDto.seats)
{
// BUGFIX: 25/04/17
var seatNumber = string.Concat(seatInString.Where(c => char.IsDigit(c)));
var coach = string.Concat(seatInString.Where(c => char.IsLetter(c)));
// END OF BUGFIX: 25/04/17
var s = new Seat(coach, seatNumber, trainUpdateDto.booking_reference);
seats.Add(s);
}
train.Reserve(seats, trainUpdateDto.booking_reference);
}
19
View Source File : BaseApiClient.cs
License : MIT License
Project Creator : 4egod
License : MIT License
Project Creator : 4egod
protected AuthenticationHeaderValue GetAuthorizationHeader(string uri, HttpMethod method)
{
string nonce = DateTime.Now.Ticks.ToString();
string timestamp = DateTime.Now.ToUnixTimestamp().ToString();
List<string> authParams = new List<string>();
authParams.Add("oauth_consumer_key=" + ConsumerKey);
authParams.Add("oauth_nonce=" + nonce);
authParams.Add("oauth_signature_method=HMAC-SHA1");
authParams.Add("oauth_timestamp=" + timestamp);
authParams.Add("oauth_token=" + AccessToken);
authParams.Add("oauth_version=1.0");
SplitUri(uri, out string url, out string[] queryParams);
List<string> requestParams = new List<string>(authParams);
requestParams.AddRange(queryParams);
requestParams.Sort();
string signatureBaseString = string.Join("&", requestParams);
signatureBaseString = string.Concat(method.Method.ToUpper(), "&", Uri.EscapeDataString(url), "&", Uri.EscapeDataString(signatureBaseString));
string signature = GetSignature(signatureBaseString);
string hv = string.Join(", ", authParams.Select(x => x.Replace("=", " = \"") + '"'));
hv += $", oauth_signature=\"{Uri.EscapeDataString(signature)}\"";
return new AuthenticationHeaderValue("OAuth", hv);
}
19
View Source File : XmlFoldingStrategy.cs
License : MIT License
Project Creator : Abdesol
License : MIT License
Project Creator : Abdesol
XmlFoldStart CreateElementFoldStart(TextDoreplacedent doreplacedent, XmlReader reader)
{
// Take off 1 from the offset returned
// from the xml since it points to the start
// of the element name and not the beginning
// tag.
//XmlFoldStart newFoldStart = new XmlFoldStart(reader.Prefix, reader.LocalName, reader.LineNumber - 1, reader.LinePosition - 2);
XmlFoldStart newFoldStart = new XmlFoldStart();
IXmlLineInfo lineInfo = (IXmlLineInfo)reader;
newFoldStart.StartLine = lineInfo.LineNumber;
newFoldStart.StartOffset = doreplacedent.GetOffset(newFoldStart.StartLine, lineInfo.LinePosition - 1);
if (this.ShowAttributesWhenFolded && reader.HasAttributes) {
newFoldStart.Name = String.Concat("<", reader.Name, " ", GetAttributeFoldText(reader), ">");
} else {
newFoldStart.Name = String.Concat("<", reader.Name, ">");
}
return newFoldStart;
}
19
View Source File : PressableButtonInspector.cs
License : Apache License 2.0
Project Creator : abist-co-ltd
License : Apache License 2.0
Project Creator : abist-co-ltd
public override void OnInspectorGUI()
{
serializedObject.Update();
if (target != null)
{
var helpURL = target.GetType().GetCustomAttribute<HelpURLAttribute>();
if (helpURL != null)
{
InspectorUIUtility.RenderDoreplacedentationButton(helpURL.URL);
}
}
// Ensure there is a touchable.
if (touchable == null)
{
EditorGUILayout.HelpBox($"{target.GetType().Name} requires a {nameof(NearInteractionTouchableSurface)}-derived component on this game object to function.", MessageType.Warning);
bool isUnityUI = (button.GetComponent<RectTransform>() != null);
var typeToAdd = isUnityUI ? typeof(NearInteractionTouchableUnityUI) : typeof(NearInteractionTouchable);
if (GUILayout.Button($"Add {typeToAdd.Name} component"))
{
Undo.RecordObject(target, string.Concat($"Add {typeToAdd.Name}"));
var addedComponent = button.gameObject.AddComponent(typeToAdd);
touchable = (NearInteractionTouchableSurface)addedComponent;
}
else
{
// It won't work without it, return to avoid nullrefs.
return;
}
}
// Ensure that the touchable has EventsToReceive set to Touch
if (touchable.EventsToReceive != TouchableEventType.Touch)
{
EditorGUILayout.HelpBox($"The {nameof(NearInteractionTouchableSurface)}-derived component on this game object currently has its EventsToReceive set to '{touchable.EventsToReceive}'. It must be set to 'Touch' in order for PressableButton to function properly.", MessageType.Warning);
if (GUILayout.Button("Set EventsToReceive to 'Touch'"))
{
Undo.RecordObject(touchable, string.Concat("Set EventsToReceive to Touch on ", touchable.name));
touchable.EventsToReceive = TouchableEventType.Touch;
}
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(movingButtonVisuals);
// Ensure that there is a moving button visuals in the UnityUI case. Even if it is not visible, it must be present to receive GraphicsRaycasts.
if (touchable is NearInteractionTouchableUnityUI)
{
if (movingButtonVisuals.objectReferenceValue == null)
{
EditorGUILayout.HelpBox($"When used with a NearInteractionTouchableUnityUI, a MovingButtonVisuals is required, as it receives the GraphicsRaycast that allows pressing the button with near/hand interactions. It does not need to be visible, but it must be able to receive GraphicsRaycasts.", MessageType.Warning);
}
else
{
var movingVisualGameObject = (GameObject)movingButtonVisuals.objectReferenceValue;
var movingGraphic = movingVisualGameObject.GetComponentInChildren<UnityEngine.UI.Graphic>();
if (movingGraphic == null)
{
EditorGUILayout.HelpBox($"When used with a NearInteractionTouchableUnityUI, the MovingButtonVisuals must contain an Image, RawImage, or other Graphic element so that it can receive a GraphicsRaycast.", MessageType.Warning);
}
}
}
EditorGUILayout.LabelField("Press Settings", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
var currentMode = distanceSpaceMode.intValue;
EditorGUILayout.PropertyField(distanceSpaceMode);
// EndChangeCheck returns true when something was selected in the dropdown, but
// doesn't necessarily mean that the value itself changed. Check for that too.
if (EditorGUI.EndChangeCheck() && currentMode != distanceSpaceMode.intValue)
{
// Changing the DistanceSpaceMode requires updating the plane distance values so they stay in the same relative ratio positions
Undo.RecordObject(target, string.Concat("Trigger Plane Distance Conversion of ", button.name));
button.DistanceSpaceMode = (PressableButton.SpaceMode)distanceSpaceMode.enumValueIndex;
serializedObject.Update();
}
DrawPropertiesExcluding(serializedObject, excludeProperties);
startPushDistance.floatValue = ClampStartPushDistance(startPushDistance.floatValue);
// show button state in play mode
{
EditorGUI.BeginDisabledGroup(Application.isPlaying == false);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Button State", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Current Push Distance", button.CurrentPushDistance.ToString());
EditorGUILayout.Toggle("Touching", button.IsTouching);
EditorGUILayout.Toggle("Pressing", button.IsPressing);
EditorGUI.EndDisabledGroup();
}
// editor settings
{
EditorGUI.BeginDisabledGroup(Application.isPlaying == true);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Editor Settings", EditorStyles.boldLabel);
var prevVisiblePlanes = SessionState.GetBool(VisiblePlanesKey, true);
VisiblePlanes = EditorGUILayout.Toggle("Show Button Event Planes", prevVisiblePlanes);
if (VisiblePlanes != prevVisiblePlanes)
{
SessionState.SetBool(VisiblePlanesKey, VisiblePlanes);
EditorUtility.SetDirty(target);
}
// enable plane editing
{
EditorGUI.BeginDisabledGroup(VisiblePlanes == false);
var prevEditingEnabled = SessionState.GetBool(EditingEnabledKey, false);
EditingEnabled = EditorGUILayout.Toggle("Make Planes Editable", EditingEnabled);
if (EditingEnabled != prevEditingEnabled)
{
SessionState.SetBool(EditingEnabledKey, EditingEnabled);
EditorUtility.SetDirty(target);
}
EditorGUI.EndDisabledGroup();
}
EditorGUI.EndDisabledGroup();
}
serializedObject.ApplyModifiedProperties();
}
19
View Source File : PressableButtonInspector.cs
License : Apache License 2.0
Project Creator : abist-co-ltd
License : Apache License 2.0
Project Creator : abist-co-ltd
public override void OnInspectorGUI()
{
serializedObject.Update();
if (target != null)
{
var helpURL = target.GetType().GetCustomAttribute<HelpURLAttribute>();
if (helpURL != null)
{
InspectorUIUtility.RenderDoreplacedentationButton(helpURL.URL);
}
}
// Ensure there is a touchable.
if (touchable == null)
{
EditorGUILayout.HelpBox($"{target.GetType().Name} requires a {nameof(NearInteractionTouchableSurface)}-derived component on this game object to function.", MessageType.Warning);
bool isUnityUI = (button.GetComponent<RectTransform>() != null);
var typeToAdd = isUnityUI ? typeof(NearInteractionTouchableUnityUI) : typeof(NearInteractionTouchable);
if (GUILayout.Button($"Add {typeToAdd.Name} component"))
{
Undo.RecordObject(target, string.Concat($"Add {typeToAdd.Name}"));
var addedComponent = button.gameObject.AddComponent(typeToAdd);
touchable = (NearInteractionTouchableSurface)addedComponent;
}
else
{
// It won't work without it, return to avoid nullrefs.
return;
}
}
// Ensure that the touchable has EventsToReceive set to Touch
if (touchable.EventsToReceive != TouchableEventType.Touch)
{
EditorGUILayout.HelpBox($"The {nameof(NearInteractionTouchableSurface)}-derived component on this game object currently has its EventsToReceive set to '{touchable.EventsToReceive}'. It must be set to 'Touch' in order for PressableButton to function properly.", MessageType.Warning);
if (GUILayout.Button("Set EventsToReceive to 'Touch'"))
{
Undo.RecordObject(touchable, string.Concat("Set EventsToReceive to Touch on ", touchable.name));
touchable.EventsToReceive = TouchableEventType.Touch;
}
}
EditorGUILayout.Space();
EditorGUILayout.PropertyField(movingButtonVisuals);
// Ensure that there is a moving button visuals in the UnityUI case. Even if it is not visible, it must be present to receive GraphicsRaycasts.
if (touchable is NearInteractionTouchableUnityUI)
{
if (movingButtonVisuals.objectReferenceValue == null)
{
EditorGUILayout.HelpBox($"When used with a NearInteractionTouchableUnityUI, a MovingButtonVisuals is required, as it receives the GraphicsRaycast that allows pressing the button with near/hand interactions. It does not need to be visible, but it must be able to receive GraphicsRaycasts.", MessageType.Warning);
}
else
{
var movingVisualGameObject = (GameObject)movingButtonVisuals.objectReferenceValue;
var movingGraphic = movingVisualGameObject.GetComponentInChildren<UnityEngine.UI.Graphic>();
if (movingGraphic == null)
{
EditorGUILayout.HelpBox($"When used with a NearInteractionTouchableUnityUI, the MovingButtonVisuals must contain an Image, RawImage, or other Graphic element so that it can receive a GraphicsRaycast.", MessageType.Warning);
}
}
}
EditorGUILayout.LabelField("Press Settings", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
var currentMode = distanceSpaceMode.intValue;
EditorGUILayout.PropertyField(distanceSpaceMode);
// EndChangeCheck returns true when something was selected in the dropdown, but
// doesn't necessarily mean that the value itself changed. Check for that too.
if (EditorGUI.EndChangeCheck() && currentMode != distanceSpaceMode.intValue)
{
// Changing the DistanceSpaceMode requires updating the plane distance values so they stay in the same relative ratio positions
Undo.RecordObject(target, string.Concat("Trigger Plane Distance Conversion of ", button.name));
button.DistanceSpaceMode = (PressableButton.SpaceMode)distanceSpaceMode.enumValueIndex;
serializedObject.Update();
}
DrawPropertiesExcluding(serializedObject, excludeProperties);
startPushDistance.floatValue = ClampStartPushDistance(startPushDistance.floatValue);
// show button state in play mode
{
EditorGUI.BeginDisabledGroup(Application.isPlaying == false);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Button State", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Current Push Distance", button.CurrentPushDistance.ToString());
EditorGUILayout.Toggle("Touching", button.IsTouching);
EditorGUILayout.Toggle("Pressing", button.IsPressing);
EditorGUI.EndDisabledGroup();
}
// editor settings
{
EditorGUI.BeginDisabledGroup(Application.isPlaying == true);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Editor Settings", EditorStyles.boldLabel);
var prevVisiblePlanes = SessionState.GetBool(VisiblePlanesKey, true);
VisiblePlanes = EditorGUILayout.Toggle("Show Button Event Planes", prevVisiblePlanes);
if (VisiblePlanes != prevVisiblePlanes)
{
SessionState.SetBool(VisiblePlanesKey, VisiblePlanes);
EditorUtility.SetDirty(target);
}
// enable plane editing
{
EditorGUI.BeginDisabledGroup(VisiblePlanes == false);
var prevEditingEnabled = SessionState.GetBool(EditingEnabledKey, false);
EditingEnabled = EditorGUILayout.Toggle("Make Planes Editable", EditingEnabled);
if (EditingEnabled != prevEditingEnabled)
{
SessionState.SetBool(EditingEnabledKey, EditingEnabled);
EditorUtility.SetDirty(target);
}
EditorGUI.EndDisabledGroup();
}
EditorGUI.EndDisabledGroup();
}
serializedObject.ApplyModifiedProperties();
}
19
View Source File : PressableButtonInspector.cs
License : Apache License 2.0
Project Creator : abist-co-ltd
License : Apache License 2.0
Project Creator : abist-co-ltd
private void DrawButtonInfo(ButtonInfo info, bool editingEnabled)
{
if (editingEnabled)
{
EditorGUI.BeginChangeCheck();
}
var targetBehaviour = (MonoBehaviour)target;
bool isOpaque = targetBehaviour.isActiveAndEnabled;
float alpha = (isOpaque) ? 1.0f : 0.5f;
// START PUSH
Handles.color = ApplyAlpha(Color.cyan, alpha);
float newStartPushDistance = DrawPlaneAndHandle(startPlaneVertices, info.PlaneExtents * 0.5f, info.StartPushDistance, info, "Start Push Distance", editingEnabled);
if (editingEnabled && newStartPushDistance != info.StartPushDistance)
{
EnforceDistanceOrdering(ref info);
info.StartPushDistance = ClampStartPushDistance(Mathf.Min(newStartPushDistance, info.ReleaseDistance));
}
// RELEASE DISTANCE
Handles.color = ApplyAlpha(Color.red, alpha);
float newReleaseDistance = DrawPlaneAndHandle(releasePlaneVertices, info.PlaneExtents * 0.3f, info.ReleaseDistance, info, "Release Distance", editingEnabled);
if (editingEnabled && newReleaseDistance != info.ReleaseDistance)
{
EnforceDistanceOrdering(ref info);
info.ReleaseDistance = Mathf.Clamp(newReleaseDistance, info.StartPushDistance, info.PressDistance);
}
// PRESS DISTANCE
Handles.color = ApplyAlpha(Color.yellow, alpha);
float newPressDistance = DrawPlaneAndHandle(pressPlaneVertices, info.PlaneExtents * 0.35f, info.PressDistance, info, "Press Distance", editingEnabled);
if (editingEnabled && newPressDistance != info.PressDistance)
{
EnforceDistanceOrdering(ref info);
info.PressDistance = Mathf.Clamp(newPressDistance, info.ReleaseDistance, info.MaxPushDistance);
}
// MAX PUSH
var purple = new Color(0.28f, 0.0f, 0.69f);
Handles.color = ApplyAlpha(purple, alpha);
float newMaxPushDistance = DrawPlaneAndHandle(endPlaneVertices, info.PlaneExtents * 0.5f, info.MaxPushDistance, info, "Max Push Distance", editingEnabled);
if (editingEnabled && newMaxPushDistance != info.MaxPushDistance)
{
EnforceDistanceOrdering(ref info);
info.MaxPushDistance = Mathf.Max(newMaxPushDistance, info.PressDistance);
}
if (editingEnabled && EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, string.Concat("Modify Button Planes of ", button.name));
startPushDistance.floatValue = info.StartPushDistance;
maxPushDistance.floatValue = info.MaxPushDistance;
pressDistance.floatValue = info.PressDistance;
releaseDistanceDelta.floatValue = info.PressDistance - info.ReleaseDistance;
serializedObject.ApplyModifiedProperties();
}
// Draw dotted lines showing path from beginning to end of button path
Handles.color = Color.Lerp(Color.cyan, Color.clear, 0.25f);
Handles.DrawDottedLine(startPlaneVertices[0], endPlaneVertices[0], 2.5f);
Handles.DrawDottedLine(startPlaneVertices[1], endPlaneVertices[1], 2.5f);
Handles.DrawDottedLine(startPlaneVertices[2], endPlaneVertices[2], 2.5f);
Handles.DrawDottedLine(startPlaneVertices[3], endPlaneVertices[3], 2.5f);
}
19
View Source File : EvaluationResult.cs
License : MIT License
Project Creator : actions
License : MIT License
Project Creator : actions
private void TraceValue(
EvaluationContext context,
Object val,
ValueKind kind)
{
if (!m_omitTracing)
{
TraceVerbose(context, String.Concat("=> ", ExpressionUtility.FormatValue(context?.SecretMasker, val, kind)));
}
}
19
View Source File : BasicExpressionToken.cs
License : MIT License
Project Creator : actions
License : MIT License
Project Creator : actions
private String ConvertFormatParameterToExpression(ExpressionNode node)
{
var nodeString = node.ConvertToExpression();
// If the node is a container, see if it starts with '(' and ends with ')' so we can simplify the string
// Should only simplify if only one '(' or ')' exists in the string
// We are trying to simplify the case (a || b) to a || b
// But we should avoid simplifying ( a && b
if (node is Container &&
nodeString.Length > 2 &&
nodeString[0] == ExpressionConstants.StartParameter &&
nodeString[nodeString.Length - 1] == ExpressionConstants.EndParameter &&
nodeString.Count(character => character == ExpressionConstants.StartParameter) == 1 &&
nodeString.Count(character => character == ExpressionConstants.EndParameter) == 1)
{
nodeString = nodeString = nodeString.Substring(1, nodeString.Length - 2);
}
return String.Concat(TemplateConstants.OpenExpression, " ", nodeString, " ", TemplateConstants.CloseExpression);
}
19
View Source File : IdentityDescriptor.cs
License : MIT License
Project Creator : actions
License : MIT License
Project Creator : actions
public override string ToString()
{
return string.Concat(m_idenreplacedyType, IdenreplacedyConstants.IdenreplacedyDescriptorPartsSeparator, m_identifier);
}
19
View Source File : LocalizationWithConcatenationInMethods.cs
License : GNU General Public License v3.0
Project Creator : Acumatica
License : GNU General Public License v3.0
Project Creator : Acumatica
public string All()
{
string localizedString;
object parameter = new object();
localizedString = PXLocalizer.Localize(MyMessages.CommasInUserName + MyMessages.SomeString);
localizedString = PXLocalizer.Localize(string.Format(MyMessages.StringToFormat, parameter), typeof(MyMessages).FullName);
localizedString = PXLocalizer.LocalizeFormat(String.Concat(MyMessages.CommasInUserName, MyMessages.SomeString), parameter);
localizedString = PXMessages.Localize(MyMessages.CommasInUserName + "123");
localizedString = PXMessages.Localize(string.Format(MyMessages.StringToFormat, 123), out string strPrefix);
localizedString = PXMessages.LocalizeNoPrefix(string.Concat(MyMessages.CommasInUserName, "123"));
localizedString = PXMessages.LocalizeFormat(MyMessages.StringToFormat + "456", parameter);
localizedString = PXMessages.LocalizeFormat(string.Format(MyMessages.StringToFormat, parameter), out string prefix, parameter);
localizedString = PXMessages.LocalizeFormatNoPrefix(string.Concat(MyMessages.StringToFormat, "456"), parameter);
localizedString = PXMessages.LocalizeFormatNoPrefixNLA(string.Concat(MyMessages.StringToFormat, "456", "789"), parameter);
return localizedString;
}
19
View Source File : Code.cs
License : MIT License
Project Creator : adamant
License : MIT License
Project Creator : adamant
public override string ToString()
{
return string.Concat(
Includes.Code,
CCodeBuilder.LineTerminator,
TypeIdDeclaration.Code,
CCodeBuilder.LineTerminator,
TypeDeclarations.Code,
CCodeBuilder.LineTerminator,
FunctionDeclarations.Code,
CCodeBuilder.LineTerminator,
StructDeclarations.Code,
CCodeBuilder.LineTerminator,
GlobalDefinitions.Code,
CCodeBuilder.LineTerminator,
Definitions.Code);
}
19
View Source File : LexResult.cs
License : MIT License
Project Creator : adamant
License : MIT License
Project Creator : adamant
public string TokensToString()
{
return string.Concat(Tokens.Select(t => t.Text(File.Code)));
}
19
View Source File : LexerTests.cs
License : MIT License
Project Creator : adamant
License : MIT License
Project Creator : adamant
[Property(MaxTest = 200)]
public Property Valid_token_sequence_lexes_back_to_itself()
{
return Prop.ForAll(Arbitrary.PsuedoTokenList(), tokens =>
{
var input = string.Concat(tokens.Select(t => t.Text));
var result = Lex(input);
var outputAsPsuedoTokens = result.ToPsuedoTokens();
var expectedPsuedoTokens = tokens.Append(PsuedoToken.EndOfFile()).ToFixedList();
return expectedPsuedoTokens.SequenceEqual(outputAsPsuedoTokens)
.Label($"Text: „{input.Escape()}„")
.Label($"Actual: {outputAsPsuedoTokens.DebugFormat()}")
.Label($"Expected: {expectedPsuedoTokens.DebugFormat()}");
});
}
19
View Source File : CrmEntitySecurityCacheInfo.cs
License : MIT License
Project Creator : Adoxio
License : MIT License
Project Creator : Adoxio
private string BuildKey(Enreplacedy enreplacedy, CrmEnreplacedyRight right, string securityContextKey)
{
var baseKey = string.Concat(securityContextKey, ":", enreplacedy.Id, ":", right);
IIdenreplacedy idenreplacedy;
return TryGetCurrentIdenreplacedy(out idenreplacedy)
? string.Concat(baseKey, ":Idenreplacedy=", idenreplacedy.Name)
: string.Concat(baseKey, ":Anonymous");
}
19
View Source File : AddressCompositeControlTemplate.cs
License : MIT License
Project Creator : Adoxio
License : MIT License
Project Creator : Adoxio
private IEnumerable<Control> MakeEditControls(string fieldName, string labelName)
{
var fieldMetaData = this.enreplacedyMetadata.Attributes.FirstOrDefault(a => a.LogicalName == this.alias + fieldName);
var controls = new List<Control>();
var textBox = new TextBox
{
ID = string.Concat(this.ControlID, fieldName),
CssClreplaced = string.Concat(" content ", " ", this.CssClreplaced, this.Metadata.CssClreplaced),
ToolTip = this.Metadata.ToolTip
};
var snippetName = "AddressCompositeControlTemplate/FieldLabel/" + labelName;
var fieldLabelSnippet = new WebControls.Snippet
{
SnippetName = snippetName,
DisplayName = snippetName,
EditType = "text",
Editable = true,
DefaultText = ResourceManager.GetString(labelName),
HtmlTag = HtmlTextWriterTag.Label
};
if (this.isEditable)
{
// Applying required parameters to first name if it's application required
if (fieldMetaData != null
&& (fieldMetaData.RequiredLevel.Value == AttributeRequiredLevel.ApplicationRequired
|| fieldMetaData.RequiredLevel.Value == AttributeRequiredLevel.SystemRequired))
{
textBox.Attributes.Add("required", string.Empty);
var requierdContainer = new HtmlGenericControl("div");
requierdContainer.Attributes["clreplaced"] = "info required";
requierdContainer.Controls.Add(fieldLabelSnippet);
controls.Add(requierdContainer);
}
else
{
controls.Add(fieldLabelSnippet);
}
}
controls.Add(textBox);
textBox.Attributes.Add("onchange", "setIsDirty(this.id);");
this.Bindings[this.ControlID + this.alias + fieldName] = new CellBinding
{
Get = () =>
{
var str = textBox.Text;
return str != null ? str.Replace("\r\n", "\n") : string.Empty;
},
Set = obj =>
{
var enreplacedy = obj as Enreplacedy;
if (enreplacedy != null)
{
textBox.Text =
enreplacedy.GetAttributeValue<string>(
this.alias + fieldName);
}
}
};
this.bindControlValue.Add(enreplacedy =>
{
this.addressControlValue.Replace("{" + textBox.ID + "}", enreplacedy.GetAttributeValue<string>(this.alias + fieldName));
});
return controls;
}
19
View Source File : LoginManager.cs
License : MIT License
Project Creator : Adoxio
License : MIT License
Project Creator : Adoxio
public void AddErrors(IdenreplacedyResult result)
{
foreach (var error in result.Errors)
{
if (this.Controller != null)
{
this.Controller.ModelState.AddModelError(string.Empty, error);
}
else
{
this.Error.Add(string.Concat(this.Error.Count == 0 ? string.Empty : "<li>", error, this.Error.Count == 0 ? "\n" : "</li>\n"));
}
}
}
19
View Source File : FluidMoveBehavior.cs
License : GNU General Public License v3.0
Project Creator : aduskin
License : GNU General Public License v3.0
Project Creator : aduskin
private Storyboard CreateTransitionStoryboard(FrameworkElement child, bool usingBeforeLoaded,
ref Rect layoutRect, ref Rect currentRect)
{
var duration = Duration;
var storyboard = new Storyboard
{
Duration = duration
};
var num = !usingBeforeLoaded || Math.Abs(layoutRect.Width) < 0.001
? 1.0
: currentRect.Width / layoutRect.Width;
var num2 = !usingBeforeLoaded || Math.Abs(layoutRect.Height) < 0.001
? 1.0
: currentRect.Height / layoutRect.Height;
var num3 = currentRect.Left - layoutRect.Left;
var num4 = currentRect.Top - layoutRect.Top;
var group = new TransformGroup();
var transform = new ScaleTransform
{
ScaleX = num,
ScaleY = num2
};
group.Children.Add(transform);
var transform2 = new TranslateTransform
{
X = num3,
Y = num4
};
group.Children.Add(transform2);
AddTransform(child, group);
var str = "(FrameworkElement.RenderTransform).";
if (child.RenderTransform is TransformGroup renderTransform && GetHasTransformWrapper(child))
{
object obj2 = str;
str = string.Concat(obj2, "(TransformGroup.Children)[", renderTransform.Children.Count - 1,
"].");
}
if (usingBeforeLoaded)
{
if (Math.Abs(num - 1.0) > 0.001)
{
var element = new DoubleAnimation
{
Duration = duration,
From = num,
To = 1.0
};
Storyboard.SetTarget(element, child);
Storyboard.SetTargetProperty(element,
new PropertyPath(str + "(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"));
element.EasingFunction = EaseX;
storyboard.Children.Add(element);
}
if (Math.Abs(num2 - 1.0) > 0.001)
{
var animation3 = new DoubleAnimation
{
Duration = duration,
From = num2,
To = 1.0
};
Storyboard.SetTarget(animation3, child);
Storyboard.SetTargetProperty(animation3,
new PropertyPath(str + "(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"));
animation3.EasingFunction = EaseY;
storyboard.Children.Add(animation3);
}
}
if (Math.Abs(num3) > 0.001)
{
var animation5 = new DoubleAnimation
{
Duration = duration,
From = num3,
To = 0.0
};
Storyboard.SetTarget(animation5, child);
Storyboard.SetTargetProperty(animation5,
new PropertyPath(str + "(TransformGroup.Children)[1].(TranslateTransform.X)"));
animation5.EasingFunction = EaseX;
storyboard.Children.Add(animation5);
}
if (Math.Abs(num4) > 0.001)
{
var animation7 = new DoubleAnimation
{
Duration = duration,
From = num4,
To = 0.0
};
Storyboard.SetTarget(animation7, child);
Storyboard.SetTargetProperty(animation7,
new PropertyPath(str + "(TransformGroup.Children)[1].(TranslateTransform.Y)"));
animation7.EasingFunction = EaseY;
storyboard.Children.Add(animation7);
}
return storyboard;
}
19
View Source File : Maps.cs
License : GNU General Public License v3.0
Project Creator : aedenthorn
License : GNU General Public License v3.0
Project Creator : aedenthorn
public static void BuildOneSpouseRoom(FarmHouse farmHouse, string name, int count)
{
NPC spouse = Game1.getCharacterFromName(name);
Layer back = null;
Layer buildings = null;
Layer front = null;
Layer alwaysFront = null;
if (spouse != null || name == "")
{
if (farmHouse.owner.friendshipData[spouse.Name] != null && farmHouse.owner.friendshipData[spouse.Name].IsEngaged())
name = "";
Map refurbishedMap;
if (name == "")
{
refurbishedMap = Helper.Content.Load<Map>("Maps\\" + farmHouse.Name + ((farmHouse.upgradeLevel == 0) ? "" : ((farmHouse.upgradeLevel == 3) ? "2" : string.Concat(farmHouse.upgradeLevel))) + "_marriage", ContentSource.GameContent);
}
else
{
refurbishedMap = Helper.Content.Load<Map>("Maps\\spouseRooms", ContentSource.GameContent);
}
int indexInSpouseMapSheet = -1;
if (roomIndexes.ContainsKey(name))
{
back = refurbishedMap.GetLayer("Back");
buildings = refurbishedMap.GetLayer("Buildings");
front = refurbishedMap.GetLayer("Front");
indexInSpouseMapSheet = roomIndexes[name];
if(name == "Emily")
{
farmHouse.temporarySprites.RemoveAll((s) => s is EmilysParrot);
int offset = (1 + count) * 7 * 64;
Vector2 parrotSpot = new Vector2(2064f + offset, 160f);
int upgradeLevel = farmHouse.upgradeLevel;
if (upgradeLevel > 1)
{
parrotSpot = new Vector2(2448f + offset, 736f);
}
ModEntry.PMonitor.Log($"Building Emily's parrot at {parrotSpot}, spouse room count {count}, upgrade level {upgradeLevel}");
farmHouse.temporarySprites.Add(new EmilysParrot(parrotSpot));
}
}
else if (tmxSpouseRooms.ContainsKey(name))
{
refurbishedMap = tmxSpouseRooms[name];
if (refurbishedMap == null)
{
ModEntry.PMonitor.Log($"Couldn't load TMX spouse room for spouse {name}", LogLevel.Error);
return;
}
try
{
foreach(Layer l in refurbishedMap.Layers)
{
ModEntry.PMonitor.Log($"layer ID: {l.Id}");
if(l.Id != "Back" && l.Id.StartsWith("Back")){
back = l;
ModEntry.PMonitor.Log($"Using {l.Id} for back in TMX spouse room layers for spouse {name}.");
}
else if(back == null && l.Id == "Back"){
back = l;
ModEntry.PMonitor.Log($"Using {l.Id} for back in TMX spouse room layers for spouse {name}.");
}
else if(l.Id != "Buildings" && l.Id.StartsWith("Buildings"))
{
buildings = l;
ModEntry.PMonitor.Log($"Using {l.Id} for buildings in TMX spouse room layers for spouse {name}.");
}
else if(buildings == null && l.Id == "Buildings")
{
buildings = l;
ModEntry.PMonitor.Log($"Using {l.Id} for buildings in TMX spouse room layers for spouse {name}.");
}
else if (l.Id != "Front" && l.Id.StartsWith("Front"))
{
front = l;
ModEntry.PMonitor.Log($"Using {l.Id} for front in TMX spouse room layers for spouse {name}.");
}
else if(front == null && l.Id == "Front")
{
front = l;
ModEntry.PMonitor.Log($"Using {l.Id} for front in TMX spouse room layers for spouse {name}.");
}
else if (l.Id != "AlwaysFront" && l.Id.StartsWith("AlwaysFront"))
{
alwaysFront = l;
ModEntry.PMonitor.Log($"Using {l.Id} for alwaysFront in TMX spouse room layers for spouse {name}.");
}
else if(alwaysFront == null && l.Id == "AlwaysFront")
{
alwaysFront = l;
ModEntry.PMonitor.Log($"Using {l.Id} for alwaysFront in TMX spouse room layers for spouse {name}.");
}
}
if(back == null)
back = refurbishedMap.Layers[0];
if (buildings == null)
buildings = refurbishedMap.Layers[1];
if (front == null)
front = refurbishedMap.Layers[2];
if(alwaysFront == null && refurbishedMap.Layers.Count > 3)
alwaysFront = refurbishedMap.Layers[3];
}
catch(Exception ex)
{
ModEntry.PMonitor.Log($"Couldn't load TMX spouse room layers for spouse {name}. Exception: {ex}", LogLevel.Error);
}
ModEntry.PMonitor.Log($"Loaded TMX spouse room layers for spouse {name}.");
indexInSpouseMapSheet = 0;
}
else if(name != "")
{
return;
}
Monitor.Log($"Building {name}'s room", LogLevel.Debug);
int startx = 29;
int ox = ModEntry.config.ExistingSpouseRoomOffsetX;
int oy = ModEntry.config.ExistingSpouseRoomOffsetY;
if (farmHouse.upgradeLevel > 1)
{
ox += 6;
oy += 9;
}
Microsoft.Xna.Framework.Rectangle areaToRefurbish = new Microsoft.Xna.Framework.Rectangle(startx + 7 + ox + (7 * count), 1 + oy, 6, 9);
Point mapReader;
if (name == "")
{
mapReader = new Point(areaToRefurbish.X, areaToRefurbish.Y);
}
else
{
mapReader = new Point(indexInSpouseMapSheet % 5 * 6, indexInSpouseMapSheet / 5 * 9);
}
farmHouse.map.Properties.Remove("DayTiles");
farmHouse.map.Properties.Remove("NightTiles");
List<string> sheetNames = new List<string>();
for (int i = 0; i < farmHouse.map.TileSheets.Count; i++)
{
sheetNames.Add(farmHouse.map.TileSheets[i].Id);
//Monitor.Log($"tilesheet id: {farmHouse.map.TileSheets[i].Id}");
}
int unreplacedled = sheetNames.IndexOf("unreplacedled tile sheet");
int floorsheet = sheetNames.IndexOf("walls_and_floors");
int indoor = sheetNames.IndexOf("indoor");
if (ModEntry.config.BuildAllSpousesRooms)
{
for (int i = 0; i < 7; i++)
{
// bottom wall
farmHouse.setMapTileIndex(ox + startx + 7 + i + (count * 7), oy + 10, 165, "Front", indoor);
farmHouse.setMapTileIndex(ox + startx + 7 + i + (count * 7), oy + 11, 0, "Buildings", indoor);
farmHouse.removeTile(ox + startx + 6 + (7 * count), oy + 4 + i, "Back");
if (count % 2 == 0)
{
// vert hall
farmHouse.setMapTileIndex(ox + startx + 6 + (7 * count), oy + 4 + i, (i % 2 == 0 ? 352 : 336), "Back", floorsheet);
// horiz hall
farmHouse.setMapTileIndex(ox + startx + 7 + i + (count * 7), oy + 10, (i % 2 == 0 ? 336 : 352), "Back", floorsheet);
}
else
{
// vert hall
farmHouse.setMapTileIndex(ox + startx + 6 + (7 * count), oy + 4 + i, (i % 2 == 0 ? 336 : 352), "Back", floorsheet);
// horiz hall
farmHouse.setMapTileIndex(ox + startx + 7 + i + (count * 7), oy + 10, (i % 2 == 0 ? 352 : 336), "Back", floorsheet);
}
}
for (int i = 0; i < 6; i++)
{
// top wall
farmHouse.setMapTileIndex(ox + startx + 7 + i + (count * 7), oy + 0, 2, "Buildings", indoor);
}
// vert wall
farmHouse.setMapTileIndex(ox + startx + 6 + (7 * count), oy + 0, 87, "Buildings", unreplacedled);
farmHouse.setMapTileIndex(ox + startx + 6 + (7 * count), oy + 1, 99, "Buildings", unreplacedled);
farmHouse.setMapTileIndex(ox + startx + 6 + (7 * count), oy + 2, 111, "Buildings", unreplacedled);
farmHouse.setMapTileIndex(ox + startx + 6 + (7 * count), oy + 3, 123, "Buildings", unreplacedled);
farmHouse.setMapTileIndex(ox + startx + 6 + (7 * count), oy + 4, 135, "Buildings", unreplacedled);
}
for (int x = 0; x < areaToRefurbish.Width; x++)
{
for (int y = 0; y < areaToRefurbish.Height; y++)
{
//PMonitor.Log($"x {x}, y {y}", LogLevel.Debug);
if (back?.Tiles[mapReader.X + x, mapReader.Y + y] != null)
{
farmHouse.map.GetLayer("Back").Tiles[areaToRefurbish.X + x, areaToRefurbish.Y + y] = new StaticTile(farmHouse.map.GetLayer("Back"), farmHouse.map.GetTileSheet(back.Tiles[mapReader.X + x, mapReader.Y + y].TileSheet.Id), BlendMode.Alpha, back.Tiles[mapReader.X + x, mapReader.Y + y].TileIndex);
foreach (KeyValuePair<string, PropertyValue> prop in back.Tiles[mapReader.X + x, mapReader.Y + y].Properties)
{
farmHouse.setTileProperty(areaToRefurbish.X + x, areaToRefurbish.Y + y, "Back", prop.Key, prop.Value);
}
}
if (buildings?.Tiles[mapReader.X + x, mapReader.Y + y] != null)
{
farmHouse.map.GetLayer("Buildings").Tiles[areaToRefurbish.X + x, areaToRefurbish.Y + y] = new StaticTile(farmHouse.map.GetLayer("Buildings"), farmHouse.map.GetTileSheet(buildings.Tiles[mapReader.X + x, mapReader.Y + y].TileSheet.Id), BlendMode.Alpha, buildings.Tiles[mapReader.X + x, mapReader.Y + y].TileIndex);
foreach(KeyValuePair<string, PropertyValue> prop in buildings.Tiles[mapReader.X + x, mapReader.Y + y].Properties)
{
farmHouse.setTileProperty(areaToRefurbish.X + x, areaToRefurbish.Y + y, "Buildings", prop.Key, prop.Value);
}
typeof(GameLocation).GetMethod("adjustMapLightPropertiesForLamp", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(farmHouse, new object[] { buildings.Tiles[mapReader.X + x, mapReader.Y + y].TileIndex, areaToRefurbish.X + x, areaToRefurbish.Y + y, "Buildings" });
}
else
{
farmHouse.map.GetLayer("Buildings").Tiles[areaToRefurbish.X + x, areaToRefurbish.Y + y] = null;
}
if (y < areaToRefurbish.Height - 1 && front?.Tiles[mapReader.X + x, mapReader.Y + y] != null)
{
farmHouse.map.GetLayer("Front").Tiles[areaToRefurbish.X + x, areaToRefurbish.Y + y] = new StaticTile(farmHouse.map.GetLayer("Front"), farmHouse.map.GetTileSheet(front.Tiles[mapReader.X + x, mapReader.Y + y].TileSheet.Id), BlendMode.Alpha, front.Tiles[mapReader.X + x, mapReader.Y + y].TileIndex);
foreach (KeyValuePair<string, PropertyValue> prop in front.Tiles[mapReader.X + x, mapReader.Y + y].Properties)
{
farmHouse.setTileProperty(areaToRefurbish.X + x, areaToRefurbish.Y + y, "Front", prop.Key, prop.Value);
}
typeof(GameLocation).GetMethod("adjustMapLightPropertiesForLamp", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(farmHouse, new object[] { front.Tiles[mapReader.X + x, mapReader.Y + y].TileIndex, areaToRefurbish.X + x, areaToRefurbish.Y + y, "Front" });
}
else if (y < areaToRefurbish.Height - 1)
{
farmHouse.map.GetLayer("Front").Tiles[areaToRefurbish.X + x, areaToRefurbish.Y + y] = null;
}
if (y < areaToRefurbish.Height - 2 && alwaysFront?.Tiles[mapReader.X + x, mapReader.Y + y] != null)
{
if(farmHouse.map.GetLayer("AlwaysFront") == null)
{
farmHouse.map.AddLayer(new Layer("AlwaysFront", farmHouse.map, farmHouse.map.GetLayer("Front").LayerSize, farmHouse.map.GetLayer("Front").TileSize));
}
farmHouse.map.GetLayer("AlwaysFront").Tiles[areaToRefurbish.X + x, areaToRefurbish.Y + y] = new StaticTile(farmHouse.map.GetLayer("AlwaysFront"), farmHouse.map.GetTileSheet(alwaysFront.Tiles[mapReader.X + x, mapReader.Y + y].TileSheet.Id), BlendMode.Alpha, alwaysFront.Tiles[mapReader.X + x, mapReader.Y + y].TileIndex);
foreach (KeyValuePair<string, PropertyValue> prop in alwaysFront.Tiles[mapReader.X + x, mapReader.Y + y].Properties)
{
farmHouse.setTileProperty(areaToRefurbish.X + x, areaToRefurbish.Y + y, "AlwaysFront", prop.Key, prop.Value);
}
typeof(GameLocation).GetMethod("adjustMapLightPropertiesForLamp", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(farmHouse, new object[] { alwaysFront.Tiles[mapReader.X + x, mapReader.Y + y].TileIndex, areaToRefurbish.X + x, areaToRefurbish.Y + y, "AlwaysFront" });
}
else if (y < areaToRefurbish.Height - 2 && farmHouse.map.GetLayer("AlwaysFront") != null)
{
farmHouse.map.GetLayer("AlwaysFront").Tiles[areaToRefurbish.X + x, areaToRefurbish.Y + y] = null;
}
if (x == 4 && y == 4)
{
try
{
farmHouse.map.GetLayer("Back").Tiles[areaToRefurbish.X + x, areaToRefurbish.Y + y].Properties["NoFurniture"] = new PropertyValue("T");
}
catch (Exception ex)
{
Monitor.Log(ex.ToString());
}
}
}
}
if(name == "Sebastian" && Game1.netWorldState.Value.hasWorldStateID("sebastianFrogReal"))
{
Monitor.Log("building Sebastian's terrarium");
Vector2 spot = new Vector2(startx + 8 + (7 * count) + ox, 7 + oy);
farmHouse.removeTile((int)spot.X, (int)spot.Y - 1, "Front");
farmHouse.removeTile((int)spot.X + 1, (int)spot.Y - 1, "Front");
farmHouse.removeTile((int)spot.X + 2, (int)spot.Y - 1, "Front");
farmHouse.temporarySprites.Add(new TemporaryAnimatedSprite
{
texture = Game1.mouseCursors,
sourceRect = new Microsoft.Xna.Framework.Rectangle(641, 1534, 48, 37),
animationLength = 1,
sourceRectStartingPos = new Vector2(641f, 1534f),
interval = 5000f,
totalNumberOfLoops = 9999,
position = spot * 64f + new Vector2(0f, -5f) * 4f,
scale = 4f,
layerDepth = (spot.Y + 2f + 0.1f) * 64f / 10000f
});
if (Game1.random.NextDouble() < 0.85)
{
Texture2D crittersText2 = Game1.temporaryContent.Load<Texture2D>("TileSheets\\critters");
farmHouse.TemporarySprites.Add(new SebsFrogs
{
texture = crittersText2,
sourceRect = new Microsoft.Xna.Framework.Rectangle(64, 224, 16, 16),
animationLength = 1,
sourceRectStartingPos = new Vector2(64f, 224f),
interval = 100f,
totalNumberOfLoops = 9999,
position = spot * 64f + new Vector2((float)((Game1.random.NextDouble() < 0.5) ? 22 : 25), (float)((Game1.random.NextDouble() < 0.5) ? 2 : 1)) * 4f,
scale = 4f,
flipped = (Game1.random.NextDouble() < 0.5),
layerDepth = (spot.Y + 2f + 0.11f) * 64f / 10000f,
Parent = farmHouse
});
}
if (!Game1.player.activeDialogueEvents.ContainsKey("sebastianFrog2") && Game1.random.NextDouble() < 0.5)
{
Texture2D crittersText3 = Game1.temporaryContent.Load<Texture2D>("TileSheets\\critters");
farmHouse.TemporarySprites.Add(new SebsFrogs
{
texture = crittersText3,
sourceRect = new Microsoft.Xna.Framework.Rectangle(64, 240, 16, 16),
animationLength = 1,
sourceRectStartingPos = new Vector2(64f, 240f),
interval = 150f,
totalNumberOfLoops = 9999,
position = spot * 64f + new Vector2(8f, 3f) * 4f,
scale = 4f,
layerDepth = (spot.Y + 2f + 0.11f) * 64f / 10000f,
flipped = (Game1.random.NextDouble() < 0.5),
pingPong = false,
Parent = farmHouse
});
}
}
/*
List<string> sheets = new List<string>();
for (int i = 0; i < farmHouse.map.TileSheets.Count; i++)
{
sheets.Add(farmHouse.map.TileSheets[i].Id);
}
for (int i = 0; i < 7; i++)
{
// vert floor ext
farmHouse.removeTile(ox + 42 + (7 * count), oy + 4 + i, "Back");
farmHouse.setMapTileIndex(ox + 42 + (7 * count), oy + 4 + i, farmHouse.getTileIndexAt(ox + 41 + (7 * count), oy + 4 + i, "Back"), "Back", sheets.IndexOf(farmHouse.getTileSheetIDAt(ox + 41 + (7 * count), oy + 4 + i, "Back")));
}
*/
}
}
19
View Source File : PhoneGameLoop.cs
License : GNU General Public License v3.0
Project Creator : aedenthorn
License : GNU General Public License v3.0
Project Creator : aedenthorn
public static void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
{
foreach (IContentPack contentPack in Helper.ContentPacks.GetOwned())
{
Monitor.Log($"Reading content pack: {contentPack.Manifest.Name} {contentPack.Manifest.Version} from {contentPack.DirectoryPath}");
try
{
MobilePhonePackJSON json = contentPack.ReadJsonFile<MobilePhonePackJSON>("content.json") ?? null;
if(json != null)
{
if (json.apps != null && json.apps.Any())
{
foreach (AppJSON app in json.apps)
{
Texture2D tex = contentPack.Loadreplacedet<Texture2D>(app.iconPath);
if (tex == null)
{
continue;
}
ModEntry.apps.Add(app.id, new MobileApp(app.name, app.keyPress, app.closePhone, tex));
Monitor.Log($"Added app {app.name} from {contentPack.DirectoryPath}");
}
}
else if (json.iconPath != null)
{
Texture2D icon = contentPack.Loadreplacedet<Texture2D>(json.iconPath);
if (icon == null)
{
continue;
}
ModEntry.apps.Add(json.id, new MobileApp(json.name, json.keyPress, json.closePhone, icon));
Monitor.Log($"Added app {json.name} from {contentPack.DirectoryPath}");
}
if (json.invites != null && json.invites.Any())
{
foreach (EventInvite invite in json.invites)
{
MobilePhoneCall.eventInvites.Add(invite);
Monitor.Log($"Added event invite {invite.name} from {contentPack.DirectoryPath}");
}
}
}
}
catch (Exception ex)
{
Monitor.Log($"error reading content.json file in content pack {contentPack.Manifest.Name}.\r\n{ex}", LogLevel.Error);
}
if (Directory.Exists(Path.Combine(contentPack.DirectoryPath, "replacedets", "events")))
{
Monitor.Log($"Adding events");
string[] events = Directory.GetFiles(Path.Combine(contentPack.DirectoryPath, "replacedets", "events"), "*.json");
Monitor.Log($"CP has {events.Length} events");
foreach (string eventFile in events)
{
try
{
string eventPath = Path.Combine("replacedets", "events", Path.GetFileName(eventFile));
Monitor.Log($"Adding events {Path.GetFileName(eventFile)} from {contentPack.DirectoryPath}");
Reminiscence r = contentPack.ReadJsonFile<Reminiscence>(eventPath);
MobilePhoneCall.contentPackReminiscences.Add(Path.GetFileName(eventFile).Replace(".json", ""), r);
Monitor.Log($"Added event {Path.GetFileName(eventFile)} from {contentPack.DirectoryPath}");
}
catch { }
}
}
if (Directory.Exists(Path.Combine(contentPack.DirectoryPath, "replacedets", "skins")))
{
Monitor.Log($"Adding skins");
string[] skins = Directory.GetFiles(Path.Combine(contentPack.DirectoryPath, "replacedets", "skins"), "*_landscape.png");
Monitor.Log($"CP has {skins.Length} skins");
foreach (string skinFile in skins)
{
try
{
string skinPath = Path.Combine("replacedets", "skins", Path.GetFileName(skinFile));
Monitor.Log($"Adding skin {Path.GetFileName(skinFile).Replace("_landscape.png", "")} from {contentPack.DirectoryPath}");
Texture2D skin = contentPack.Loadreplacedet<Texture2D>(skinPath.Replace("_landscape.png", ".png"));
Texture2D skinl = contentPack.Loadreplacedet<Texture2D>(skinPath);
ThemeApp.skinList.Add(contentPack.Manifest.UniqueID + ":" + Path.GetFileName(skinFile).Replace("_landscape.png", ""));
ThemeApp.skinDict.Add(contentPack.Manifest.UniqueID + ":" + Path.GetFileName(skinFile).Replace("_landscape.png", ""), new Texture2D[] { skin, skinl});
Monitor.Log($"Added skin {Path.GetFileName(skinFile).Replace("_landscape.png", "")} from {contentPack.DirectoryPath}");
}
catch { }
}
}
if (Directory.Exists(Path.Combine(contentPack.DirectoryPath, "replacedets", "backgrounds")))
{
Monitor.Log($"Adding backgrounds");
string[] backgrounds = Directory.GetFiles(Path.Combine(contentPack.DirectoryPath, "replacedets", "backgrounds"), "*_landscape.png");
Monitor.Log($"CP has {backgrounds.Length} backgrounds");
foreach (string backFile in backgrounds)
{
try
{
string backPath = Path.Combine("replacedets", "backgrounds", Path.GetFileName(backFile));
Monitor.Log($"Adding background {Path.GetFileName(backFile).Replace("_landscape.png", "")} from {contentPack.DirectoryPath}");
Texture2D back = contentPack.Loadreplacedet<Texture2D>(backPath.Replace("_landscape.png", ".png"));
Texture2D backl = contentPack.Loadreplacedet<Texture2D>(backPath);
ThemeApp.backgroundDict.Add(contentPack.Manifest.UniqueID + ":" + Path.GetFileName(backFile).Replace("_landscape.png", ""), new Texture2D[] { back, backl });
ThemeApp.backgroundList.Add(contentPack.Manifest.UniqueID + ":" + Path.GetFileName(backFile).Replace("_landscape.png", ""));
Monitor.Log($"Added background {Path.GetFileName(backFile).Replace("_landscape.png", "")} from {contentPack.DirectoryPath}");
}
catch { }
}
}
if (Directory.Exists(Path.Combine(contentPack.DirectoryPath, "replacedets", "ringtones")))
{
Monitor.Log($"Adding ringtones");
string[] rings = Directory.GetFiles(Path.Combine(contentPack.DirectoryPath, "replacedets", "ringtones"), "*.wav");
Monitor.Log($"CP has {rings.Length} ringtones");
foreach (string path in rings)
{
try
{
object ring;
try
{
var type = Type.GetType("System.Media.SoundPlayer, System");
ring = Activator.CreateInstance(type, new object[] { path });
}
catch
{
ring = SoundEffect.FromStream(new FileStream(path, FileMode.Open));
}
if (ring != null)
{
ThemeApp.ringDict.Add(string.Concat(contentPack.Manifest.UniqueID,":", Path.GetFileName(path).Replace(".wav", "")), ring);
ThemeApp.ringList.Add(string.Concat(contentPack.Manifest.UniqueID,":", Path.GetFileName(path).Replace(".wav", "")));
Monitor.Log($"loaded ring {path}");
}
else
Monitor.Log($"Couldn't load ring {path}");
}
catch (Exception ex)
{
Monitor.Log($"Couldn't load ring {path}:\r\n{ex}", LogLevel.Error);
}
}
}
}
ModEntry.listHeight = Config.IconMarginY + (int)Math.Ceiling(ModEntry.apps.Count / (float)ModEntry.gridWidth) * (Config.IconHeight + Config.IconMarginY);
PhoneVisuals.CreatePhoneTextures();
PhoneUtils.RefreshPhoneLayout();
if (Helper.ModRegistry.IsLoaded("purrplingcat.npcadventure"))
{
INpcAdventureModApi api = Helper.ModRegistry.GetApi<INpcAdventureModApi>("purrplingcat.npcadventure");
if (api != null)
{
Monitor.Log("Loaded NpcAdventureModApi successfully");
ModEntry.npcAdventureModApi = api;
}
}
}
19
View Source File : LevelTriggerHint.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
private void Start()
{
if (!FengGameManagerMKII.Level.Hint)
{
base.enabled = false;
}
if (this.content != string.Empty)
{
return;
}
switch (this.myhint)
{
case HintType.MOVE:
this.content = string.Concat(new string[]
{
"Hello soldier!\nWelcome to Attack On replacedan Tribute Game!\n Press [F7D358]",
InputManager.Settings[InputCode.Up].ToString(),
InputManager.Settings[InputCode.Left].ToString(),
InputManager.Settings[InputCode.Down].ToString(),
InputManager.Settings[InputCode.Right].ToString(),
"[-] to Move."
});
break;
case HintType.TELE:
this.content = "Move to [82FA58]green warp point[-] to proceed.";
break;
case HintType.CAMA:
this.content = string.Concat(new string[]
{
"Press [F7D358]",
InputManager.Settings[InputCode.CameraChange].ToString(),
"[-] to change camera mode\nPress [F7D358]",
InputManager.Settings[InputCode.HideCursor].ToString(),
"[-] to hide or show the cursor."
});
break;
case HintType.JUMP:
this.content = "Press [F7D358]" + InputManager.Settings[InputCode.Gas] + "[-] to Jump.";
break;
case HintType.JUMP2:
this.content = "Press [F7D358]" + InputManager.Settings[InputCode.Up] + "[-] towards a wall to perform a wall-run.";
break;
case HintType.HOOK:
this.content = string.Concat(new string[]
{
"Press and Hold[F7D358] ",
InputManager.Settings[InputCode.LeftRope].ToString(),
"[-] or [F7D358]",
InputManager.Settings[InputCode.RightRope].ToString(),
"[-] to launch your grapple.\nNow Try hooking to the [>3<] box. "
});
break;
case HintType.HOOK2:
this.content = string.Concat(new string[]
{
"Press and Hold[F7D358] ",
InputManager.Settings[InputCode.BothRope].ToString(),
"[-] to launch both of your grapples at the same Time.\n\nNow aim between the two black blocks. \nYou will see the mark '<' and '>' appearing on the blocks. \nThen press ",
InputManager.Settings[InputCode.BothRope].ToString(),
" to hook the blocks."
});
break;
case HintType.SUPPLY:
this.content = "Press [F7D358]" + InputManager.Settings[InputCode.Reload] + "[-] to reload your blades.\n Move to the supply station to refill your gas and blades.";
break;
case HintType.DODGE:
this.content = "Press [F7D358]" + InputManager.Settings[InputCode.Dodge] + "[-] to Dodge.";
break;
case HintType.ATTACK:
this.content = string.Concat(new string[]
{
"Press [F7D358]",
InputManager.Settings[InputCode.Attack0].ToString(),
"[-] to Attack. \nPress [F7D358]",
InputManager.Settings[InputCode.Attack1].ToString(),
"[-] to use special attack.\n***You can only kill a replacedan by slashing his [FA5858]NAPE[-].***\n\n"
});
break;
}
}
19
View Source File : UIItemSlot.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
private void OnTooltip(bool show)
{
InvGameItem invGameItem = (!show) ? null : this.mItem;
if (invGameItem != null)
{
InvBaseItem baseItem = invGameItem.baseItem;
if (baseItem != null)
{
string text = string.Concat(new string[]
{
"[",
NGUITools.EncodeColor(invGameItem.color),
"]",
invGameItem.name,
"[-]\n"
});
string text2 = text;
text = string.Concat(new object[]
{
text2,
"[AFAFAF]Level ",
invGameItem.itemLevel,
" ",
baseItem.slot
});
List<InvStat> list = invGameItem.CalculateStats();
int i = 0;
int count = list.Count;
while (i < count)
{
InvStat invStat = list[i];
if (invStat.amount != 0)
{
if (invStat.amount < 0)
{
text = text + "\n[FF0000]" + invStat.amount;
}
else
{
text = text + "\n[00FF00]+" + invStat.amount;
}
if (invStat.modifier == InvStat.Modifier.Percent)
{
text += "%";
}
text = text + " " + invStat.id;
text += "[-]";
}
i++;
}
if (!string.IsNullOrEmpty(baseItem.description))
{
text = text + "\n[FF9900]" + baseItem.description;
}
UITooltip.ShowText(text);
return;
}
}
UITooltip.ShowText(null);
}
19
View Source File : BTN_save_snapshot.cs
License : GNU General Public License v3.0
Project Creator : aelariane
License : GNU General Public License v3.0
Project Creator : aelariane
private IEnumerator ScreenshotEncode()
{
yield return new WaitForEndOfFrame();
float r = (float)Screen.height / 600f;
Texture2D texture = new Texture2D((int)(r * this.targetTexture.transform.localScale.x), (int)(r * this.targetTexture.transform.localScale.y), TextureFormat.RGB24, false);
texture.ReadPixels(new Rect((float)Screen.width * 0.5f - (float)texture.width * 0.5f, (float)Screen.height * 0.5f - (float)texture.height * 0.5f - r * 0f, (float)texture.width, (float)texture.height), 0, 0);
texture.Apply();
yield return 0;
foreach (GameObject go in this.thingsNeedToHide)
{
go.transform.position -= Vectors.up * 10000f;
}
string img_name = string.Concat(new string[]
{
"aottg_ss-",
DateTime.Today.Month.ToString(),
"_",
DateTime.Today.Day.ToString(),
"_",
DateTime.Today.Year.ToString(),
"-",
DateTime.Now.Hour.ToString(),
"_",
DateTime.Now.Minute.ToString(),
"_",
DateTime.Now.Second.ToString(),
".png"
});
Application.ExternalCall("SaveImg", new object[]
{
img_name,
texture.width,
texture.height,
Convert.ToBase64String(texture.EncodeToPNG())
});
UnityEngine.Object.DestroyObject(texture);
yield break;
}
19
View Source File : AElfString.cs
License : MIT License
Project Creator : AElfProject
License : MIT License
Project Creator : AElfProject
public static string Concat(string[] values)
{
return ValidatedString(string.Concat(values));
}
19
View Source File : BloomTests.cs
License : MIT License
Project Creator : AElfProject
License : MIT License
Project Creator : AElfProject
[Fact]
public void AddHashAddValue_Test()
{
var empty = BytesValue.Parser.ParseFrom(ByteString.Empty);
var elf = new StringValue()
{
Value = "ELF"
}; // Serialized: 0a03454c46
// sha256 of empty string: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
// sha256 of 0a03454c46: 782330156f8c9403758ed30270a3e2d59e50b8f04c6779d819b72eee02addb13
var expected = string.Concat(
"0000000000000000000000000000100000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000040000000000000000",
"0000000000000000000100000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000800200000"
);
var bloom = new Bloom();
bloom.AddSha256Hash(
ByteArrayHelper.HexStringToByteArray("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"));
bloom.AddSha256Hash(
ByteArrayHelper.HexStringToByteArray("782330156f8c9403758ed30270a3e2d59e50b8f04c6779d819b72eee02addb13"));
replacedert.Equal(expected, bloom.Data.ToHex().Replace("0x", ""));
new Bloom(bloom).Data.ShouldBe(bloom.Data);
// add value
var bloom1 = new Bloom();
bloom1.AddValue(empty);
bloom1.AddValue(elf);
replacedert.Equal(expected, bloom1.Data.ToHex().Replace("0x", ""));
// Take only 12 characters (2 * 3 = 6 bytes)
var bloom2 = new Bloom();
var fiftyTwoZeros = string.Join("", Enumerable.Repeat("0", 52));
// Too short
replacedert.ThrowsAny<Exception>(() => bloom2.AddSha256Hash(ByteArrayHelper.HexStringToByteArray("e3b0c44298fc")));
replacedert.ThrowsAny<Exception>(() => bloom2.AddSha256Hash(ByteArrayHelper.HexStringToByteArray("782330156f8c")));
// Too long
replacedert.ThrowsAny<Exception>(() =>
bloom2.AddSha256Hash(ByteArrayHelper.HexStringToByteArray("e3b0c44298fc" + "00" + fiftyTwoZeros)));
replacedert.ThrowsAny<Exception>(() =>
bloom2.AddSha256Hash(ByteArrayHelper.HexStringToByteArray("782330156f8c" + "00" + fiftyTwoZeros)));
// Right size
bloom2.AddSha256Hash(ByteArrayHelper.HexStringToByteArray("e3b0c44298fc" + fiftyTwoZeros));
bloom2.AddSha256Hash(ByteArrayHelper.HexStringToByteArray("782330156f8c" + fiftyTwoZeros));
replacedert.Equal(expected, bloom2.Data.ToHex().Replace("0x", ""));
// Incorrect value
var bloom3 = new Bloom();
bloom3.AddSha256Hash(ByteArrayHelper.HexStringToByteArray("e3b0c44298f0" + fiftyTwoZeros));
bloom3.AddSha256Hash(ByteArrayHelper.HexStringToByteArray("782330156f80" + fiftyTwoZeros));
replacedert.NotEqual(expected, bloom3.Data.ToHex().Replace("0x", ""));
}
19
View Source File : BloomTests.cs
License : MIT License
Project Creator : AElfProject
License : MIT License
Project Creator : AElfProject
[Fact]
public void MultiMerge_Test()
{
var a = ByteArrayHelper.HexStringToByteArray(string.Concat(
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000"
));
var b = ByteArrayHelper.HexStringToByteArray(string.Concat(
"0100000000000000000000000000000000000000000000000000000000000000",
"0100000000000000000000000000000000000000000000000000000000000000",
"0100000000000000000000000000000000000000000000000000000000000000",
"0100000000000000000000000000000000000000000000000000000000000000",
"0100000000000000000000000000000000000000000000000000000000000000",
"0100000000000000000000000000000000000000000000000000000000000000",
"0100000000000000000000000000000000000000000000000000000000000000",
"0100000000000000000000000000000000000000000000000000000000000000"
));
var c = ByteArrayHelper.HexStringToByteArray(string.Concat(
"1100000000000000000000000000000000000000000000000000000000000000",
"1100000000000000000000000000000000000000000000000000000000000000",
"1100000000000000000000000000000000000000000000000000000000000000",
"1100000000000000000000000000000000000000000000000000000000000000",
"1100000000000000000000000000000000000000000000000000000000000000",
"1100000000000000000000000000000000000000000000000000000000000000",
"1100000000000000000000000000000000000000000000000000000000000000",
"1100000000000000000000000000000000000000000000000000000000000000"
));
var res = Bloom.AndMultipleBloomBytes(new List<byte[]>(){a, b});
replacedert.Equal(c, res);
}
19
View Source File : BloomTests.cs
License : MIT License
Project Creator : AElfProject
License : MIT License
Project Creator : AElfProject
[Fact]
public void IsIn_Test()
{
var target = new Bloom(ByteArrayHelper.HexStringToByteArray(string.Concat(
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000"
)));
var source = new Bloom(ByteArrayHelper.HexStringToByteArray(string.Concat(
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"1000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
)));
replacedert.True(source.IsIn(target));
var wrongSource = new Bloom(ByteArrayHelper.HexStringToByteArray(string.Concat(
"1110000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000"
)));
replacedert.False(wrongSource.IsIn(target));
var emptySource=new Bloom();
replacedert.False(emptySource.IsIn(target));
}
19
View Source File : CSRedisClientAsync.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu
License : Mozilla Public License 2.0
Project Creator : agebullhu
async public Task<bool> SMoveAsync(string sourceKey, string destinationKey, string member) {
string rule = string.Empty;
if (ClusterNodes.Count > 1) {
var rule1 = ClusterRule(sourceKey);
var rule2 = ClusterRule(destinationKey);
if (rule1 != rule2) {
if (await SRemAsync(sourceKey, member) <= 0) return false;
return await SAddAsync(destinationKey, member) > 0;
}
rule = rule1;
}
var pool = ClusterNodes.TryGetValue(rule, out var b) ? b : ClusterNodes.First().Value;
var key1 = string.Concat(pool.Prefix, sourceKey);
var key2 = string.Concat(pool.Prefix, destinationKey);
return await GetConnectionAndExecuteAsync(pool, conn => conn.Client.SMoveAsync(key1, key2, member));
}
19
View Source File : CSRedisClientPipe.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu
License : Mozilla Public License 2.0
Project Creator : agebullhu
private CSRedisClientPipe PipeCommand(string key, Action<RedisConnection2, string> hander, Func<object, object> parser = null) {
if (key == null) return this;
var clusterKey = ClusterRule == null || ClusterNodes.Count == 1 ? ClusterKeys[0] : ClusterRule(key);
if (ClusterNodes.TryGetValue(clusterKey, out var pool)) ClusterNodes.TryGetValue(clusterKey = ClusterKeys[0], out pool);
if (Conns.TryGetValue(clusterKey, out var conn) == false) {
Conns.Add(clusterKey, conn = (new List<int>(), pool.GetConnection()));
try {
conn.conn.Client.StartPipe();
} catch (Exception ex) {
pool.RequirePing(ex);
throw ex;
} finally {
pool.ReleaseConnection(conn.conn);
}
}
key = string.Concat(pool.Prefix, key);
try {
hander(conn.conn, key);
} catch (Exception ex) {
pool.RequirePing(ex);
throw ex;
} finally {
pool.ReleaseConnection(conn.conn);
}
conn.indexes.Add(Parsers.Count);
Parsers.Enqueue(parser);
return this;
}
19
View Source File : CSRedisClientAsync.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu
License : Mozilla Public License 2.0
Project Creator : agebullhu
private Task<T> ExecuteScalarAsync<T>(string key, Func<RedisConnection2, string, Task<T>> hander) {
if (key == null) return Task.FromResult(default(T));
var pool = ClusterRule == null || ClusterNodes.Count == 1 ? ClusterNodes.First().Value : (ClusterNodes.TryGetValue(ClusterRule(key), out var b) ? b : ClusterNodes.First().Value);
key = string.Concat(pool.Prefix, key);
return GetConnectionAndExecuteAsync(pool, conn => hander(conn, key));
}
19
View Source File : CSRedisClientAsync.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu
License : Mozilla Public License 2.0
Project Creator : agebullhu
async private Task<T[]> ExeucteArrayAsync<T>(string[] key, Func<RedisConnection2, string[], Task<T[]>> hander) {
if (key == null || key.Any() == false) return new T[0];
if (ClusterRule == null || ClusterNodes.Count == 1) {
var pool = ClusterNodes.First().Value;
var keys = key.Select(a => string.Concat(pool.Prefix, a)).ToArray();
return await GetConnectionAndExecuteAsync(pool, conn => hander(conn, keys));
}
var rules = new Dictionary<string, List<(string, int)>>();
for (var a = 0; a < key.Length; a++) {
var rule = ClusterRule(key[a]);
if (rules.ContainsKey(rule)) rules[rule].Add((key[a], a));
else rules.Add(rule, new List<(string, int)> { (key[a], a) });
}
T[] ret = new T[key.Length];
foreach (var r in rules) {
var pool = ClusterNodes.TryGetValue(r.Key, out var b) ? b : ClusterNodes.First().Value;
var keys = r.Value.Select(a => string.Concat(pool.Prefix, a.Item1)).ToArray();
await GetConnectionAndExecuteAsync(pool, async conn => {
var vals = await hander(conn, keys);
for (var z = 0; z < r.Value.Count; z++) {
ret[r.Value[z].Item2] = vals == null || z >= vals.Length ? default(T) : vals[z];
}
return 0;
});
}
return ret;
}
19
View Source File : CSRedisClientAsync.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu
License : Mozilla Public License 2.0
Project Creator : agebullhu
async private Task<long> ExecuteNonQueryAsync(string[] key, Func<RedisConnection2, string[], Task<long>> hander) {
if (key == null || key.Any() == false) return 0;
if (ClusterRule == null || ClusterNodes.Count == 1) {
var pool = ClusterNodes.First().Value;
var keys = key.Select(a => string.Concat(pool.Prefix, a)).ToArray();
return await GetConnectionAndExecuteAsync(pool, conn => hander(conn, keys));
}
var rules = new Dictionary<string, List<string>>();
for (var a = 0; a < key.Length; a++) {
var rule = ClusterRule(key[a]);
if (rules.ContainsKey(rule)) rules[rule].Add(key[a]);
else rules.Add(rule, new List<string> { key[a] });
}
long affrows = 0;
foreach (var r in rules) {
var pool = ClusterNodes.TryGetValue(r.Key, out var b) ? b : ClusterNodes.First().Value;
var keys = r.Value.Select(a => string.Concat(pool.Prefix, a)).ToArray();
affrows += await GetConnectionAndExecuteAsync(pool, conn => hander(conn, keys));
}
return affrows;
}
19
View Source File : CSRedisClientAsync.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu
License : Mozilla Public License 2.0
Project Creator : agebullhu
async private Task<T> ClusterNodesNotSupportAsync<T>(string[] keys, T defaultValue, Func<RedisConnection2, string[], Task<T>> callbackAsync) {
if (keys == null || keys.Any() == false) return defaultValue;
var rules = ClusterNodes.Count > 1 ? keys.Select(a => ClusterRule(a)).Distinct() : new[] { ClusterNodes.FirstOrDefault().Key };
if (rules.Count() > 1) throw new Exception("由于开启了群集模式,keys 分散在多个节点,无法使用此功能");
var pool = ClusterNodes.TryGetValue(rules.First(), out var b) ? b : ClusterNodes.First().Value;
string[] rkeys = new string[keys.Length];
for (int a = 0; a < keys.Length; a++) rkeys[a] = string.Concat(pool.Prefix, keys[a]);
if (rkeys.Length == 0) return defaultValue;
return await GetConnectionAndExecuteAsync(pool, conn => callbackAsync(conn, rkeys));
}
19
View Source File : EnforceHttpsMiddleware.cs
License : MIT License
Project Creator : AiursoftWeb
License : MIT License
Project Creator : AiursoftWeb
protected virtual void HandleNonHttpsRequest(HttpContext context)
{
if (!string.Equals(context.Request.Method, "GET", StringComparison.OrdinalIgnoreCase))
{
context.Response.StatusCode = StatusCodes.Status403Forbidden;
}
else
{
var optionsAccessor = context.RequestServices.GetRequiredService<IOptions<MvcOptions>>();
var request = context.Request;
var host = request.Host;
if (optionsAccessor.Value.SslPort.HasValue && optionsAccessor.Value.SslPort > 0)
{
host = new HostString(host.Host, optionsAccessor.Value.SslPort.Value);
}
else
{
host = new HostString(host.Host);
}
string newUrl = string.Concat(
"https://",
host.ToUriComponent(),
request.PathBase.ToUriComponent(),
request.Path.ToUriComponent(),
request.QueryString.ToUriComponent());
context.Response.Redirect(newUrl, permanent: true);
}
}
19
View Source File : UndoParentNode.cs
License : MIT License
Project Creator : alexismorin
License : MIT License
Project Creator : alexismorin
public Enum EditorGUILayoutEnumPopup( string label, Enum selected, params GUILayoutOption[] options )
{
Enum newValue = EditorGUILayout.EnumPopup( label, selected, options );
if( !newValue.ToString().Equals( selected.ToString() ) )
{
UndoRecordObject( string.Concat( "Changing value ", label, " on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
//UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
}
return newValue;
}
19
View Source File : UndoParentNode.cs
License : MIT License
Project Creator : alexismorin
License : MIT License
Project Creator : alexismorin
public Enum EditorGUILayoutEnumPopup( Enum selected, params GUILayoutOption[] options )
{
Enum newValue = EditorGUILayout.EnumPopup( selected, options );
if( !newValue.ToString().Equals( selected.ToString() ) )
{
UndoRecordObject( string.Concat( "Changing value EditorGUILayoutEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
//UndoRecordObject(string.Format( MessageFormat, "EditorGUILayoutEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
}
return newValue;
}
19
View Source File : UndoParentNode.cs
License : MIT License
Project Creator : alexismorin
License : MIT License
Project Creator : alexismorin
public Enum EditorGUIEnumPopup( Rect position, Enum selected, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style )
{
Enum newValue = EditorGUI.EnumPopup( position, selected, style );
if( !newValue.ToString().Equals( selected.ToString() ) )
{
UndoRecordObject( string.Concat( "Changing value EditorGUIEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
//UndoRecordObject(string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
}
return newValue;
}
19
View Source File : UndoParentNode.cs
License : MIT License
Project Creator : alexismorin
License : MIT License
Project Creator : alexismorin
public Enum EditorGUILayoutEnumPopup( GUIContent label, Enum selected, params GUILayoutOption[] options )
{
Enum newValue = EditorGUILayout.EnumPopup( label, selected, options );
if( !newValue.ToString().Equals( selected.ToString() ) )
{
UndoRecordObject( string.Concat( "Changing value ", label, " on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
//UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
}
return newValue;
}
19
View Source File : UndoParentNode.cs
License : MIT License
Project Creator : alexismorin
License : MIT License
Project Creator : alexismorin
public Enum EditorGUIEnumPopup( Rect position, Enum selected )
{
Enum newValue = EditorGUI.EnumPopup( position, selected );
if( !newValue.ToString().Equals( selected.ToString() ) )
{
UndoRecordObject( string.Concat( "Changing value EditorGUIEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
//UndoRecordObject(string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
}
return newValue;
}
19
View Source File : GeneratorUtils.cs
License : MIT License
Project Creator : alexismorin
License : MIT License
Project Creator : alexismorin
static public string GenerateWorldReflection( ref MasterNodeDataCollector dataCollector, int uniqueId, bool normalize = false )
{
if( dataCollector.IsTemplate )
return dataCollector.TemplateDataCollectorInstance.GetWorldReflection( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, true, MasterNodePortCategory.Fragment, normalize );
string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 );
string result = string.Empty;
if( !dataCollector.DirtyNormal )
result = Constants.InputVarStr + ".worldRefl";
else
result = "WorldReflectionVector( " + Constants.InputVarStr + ", " + precisionType + "( 0, 0, 1 ) )";
if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
result = "UnityObjectToWorldNormal( " + Constants.VertexShaderInputStr + ".normal )";
if( normalize )
{
result = string.Format( "normalize( {0} )", result );
}
dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldReflectionStr, " = ", result, ";" ) );
return WorldReflectionStr;
}
19
View Source File : GeneratorUtils.cs
License : MIT License
Project Creator : alexismorin
License : MIT License
Project Creator : alexismorin
static public string GenerateWorldNormal( ref MasterNodeDataCollector dataCollector, int uniqueId, bool normalize = false )
{
if( dataCollector.IsTemplate )
return dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, true, MasterNodePortCategory.Fragment, normalize );
string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 );
string result = string.Empty;
if( !dataCollector.DirtyNormal )
result = Constants.InputVarStr + ".worldNormal";
else
result = "WorldNormalVector( " + Constants.InputVarStr + ", " + precisionType + "( 0, 0, 1 ) )";
if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
result = "UnityObjectToWorldNormal( " + Constants.VertexShaderInputStr + ".normal )";
dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldNormalStr, " = ", result, ";" ) );
if( normalize )
{
dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", NormalizedWorldNormalStr, " = normalize( ", WorldNormalStr, " );" ) );
return NormalizedWorldNormalStr;
}
return WorldNormalStr;
}
19
View Source File : GeneratorUtils.cs
License : MIT License
Project Creator : alexismorin
License : MIT License
Project Creator : alexismorin
static public string GenerateWorldTangent( ref MasterNodeDataCollector dataCollector, int uniqueId )
{
if( dataCollector.IsTemplate )
return dataCollector.TemplateDataCollectorInstance.GetWorldTangent( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision );
string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 );
string result = "WorldNormalVector( " + Constants.InputVarStr + ", " + precisionType + "( 1, 0, 0 ) )";
if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
result = "UnityObjectToWorldDir( " + Constants.VertexShaderInputStr + ".tangent.xyz )";
dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldTangentStr, " = ", result, ";" ) );
return WorldTangentStr;
}
19
View Source File : GeneratorUtils.cs
License : MIT License
Project Creator : alexismorin
License : MIT License
Project Creator : alexismorin
static public string GenerateWorldBitangent( ref MasterNodeDataCollector dataCollector, int uniqueId )
{
if( dataCollector.IsTemplate )
return dataCollector.TemplateDataCollectorInstance.GetWorldBinormal( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision );
string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 );
string result = "WorldNormalVector( " + Constants.InputVarStr + ", " + precisionType + "( 0, 1, 0 ) )";
if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation )
{
string worldNormal = GenerateWorldNormal( ref dataCollector, uniqueId );
string worldTangent = GenerateWorldTangent( ref dataCollector, uniqueId );
dataCollector.AddToVertexLocalVariables( uniqueId, string.Format( "half tangentSign = {0}.tangent.w * unity_WorldTransformParams.w;", Constants.VertexShaderInputStr ) );
result = "cross( " + worldNormal + ", " + worldTangent + " ) * tangentSign";
}
dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldBitangentStr, " = ", result, ";" ) );
return WorldBitangentStr;
}
19
View Source File : UndoParentNode.cs
License : GNU General Public License v3.0
Project Creator : alexismorin
License : GNU General Public License v3.0
Project Creator : alexismorin
public Enum EditorGUIEnumPopup( Rect position, Enum selected )
{
Enum newValue = EditorGUI.EnumPopup( position, selected );
if( !newValue.ToString().Equals( selected.ToString() ) )
{
UndoRecordObject( this, string.Concat( "Changing value EditorGUIEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
//UndoRecordObject( this, string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
}
return newValue;
}
19
View Source File : UndoParentNode.cs
License : GNU General Public License v3.0
Project Creator : alexismorin
License : GNU General Public License v3.0
Project Creator : alexismorin
public Enum EditorGUIEnumPopup( Rect position, Enum selected, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style )
{
Enum newValue = EditorGUI.EnumPopup( position, selected, style );
if ( !newValue.ToString().Equals( selected.ToString() ) )
{
UndoRecordObject( this, string.Concat( "Changing value EditorGUIEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
//UndoRecordObject( this, string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) );
}
return newValue;
}
See More Examples