Esempio n. 1
0
        void TypeCommandHandler(ITextBuilder responseBuilder, String arguments)
        {
            if (arguments == null || arguments.Length <= 0)
            {
                foreach (KeyValuePair <String, Type> pair in npcExecutor.EnumAndObjectTypes)
                {
                    Type type = pair.Value;
                    responseBuilder.AppendAscii(type.SosTypeName());
                    responseBuilder.AppendAscii(' ');
                    responseBuilder.AppendAscii(type.SosTypeDefinition());
                    responseBuilder.AppendAscii('\n');
                }
                responseBuilder.AppendAscii('\n');
                return;
            }

            String requestedTypeString = arguments.Trim();

            if (requestedTypeString.IsSosPrimitive())
            {
                responseBuilder.AppendAscii(requestedTypeString);
                responseBuilder.AppendAscii(" primitive type\n");
                return;
            }

            Type enumOrObjectType;

            if (npcExecutor.EnumAndObjectTypes.TryGetValue(requestedTypeString, out enumOrObjectType))
            {
                responseBuilder.AppendAscii(enumOrObjectType.SosTypeName());
                responseBuilder.AppendAscii(' ');
                responseBuilder.AppendAscii(enumOrObjectType.SosTypeDefinition());
                responseBuilder.AppendAscii('\n');
                return;
            }
            OneOrMoreTypes oneOrMoreEnumOrObjectType;

            if (npcExecutor.EnumAndObjectShortNameTypes.TryGetValue(requestedTypeString, out oneOrMoreEnumOrObjectType))
            {
                enumOrObjectType = oneOrMoreEnumOrObjectType.firstType;
                if (oneOrMoreEnumOrObjectType.otherTypes == null)
                {
                    responseBuilder.AppendAscii(enumOrObjectType.SosTypeName());
                    responseBuilder.AppendAscii(' ');
                    responseBuilder.AppendAscii(enumOrObjectType.SosTypeDefinition());
                    responseBuilder.AppendAscii('\n');
                    return;
                }
                else
                {
                    responseBuilder.AppendAscii("Error: '");
                    responseBuilder.AppendAscii(requestedTypeString);
                    responseBuilder.AppendAscii("' is ambiguous, include namespace to find the correct type");
                    return;
                }
            }

            responseBuilder.AppendAscii(requestedTypeString);
            responseBuilder.AppendAscii(" unknown type\n");
        }
            /// <summary>
            /// Updates associated text label for the entry in the menu
            /// </summary>
            public void UpdateText(bool selected)
            {
                StringBuilder name = BlockMember.Name,
                              disp = BlockMember.FormattedValue;
                ITextBuilder tb    = Element.TextBoard;

                var fmtName  = selected ? selectedFormatCenter : nameFormatCenter;
                var fmtValue = selected ? selectedFormatCenter : valueFormatCenter;

                tb.Clear();

                if (name != null)
                {
                    textBuf.Clear();
                    textBuf.AppendSubstringMax(name, maxEntryCharCount);

                    if (disp != null)
                    {
                        textBuf.Append(":\n");
                    }

                    tb.Append(textBuf, fmtName);
                }

                if (disp != null)
                {
                    textBuf.Clear();
                    textBuf.AppendSubstringMax(disp, maxEntryCharCount);

                    tb.Append(textBuf, fmtValue);
                }
            }
            private void UpdateDebugText()
            {
                PropertyWheelEntryBase selection = activeWheel?.Selection;

                if (selection != null)
                {
                    var          propertyEntry = selection as PropertyWheelEntry;
                    ITextBuilder textBuilder   = debugText.TextBoard;
                    textBuilder.Clear();

                    textBuilder.Append($"Prioritized Members: {Target.Prioritizer.PrioritizedMemberCount}\n");
                    textBuilder.Append($"Enabled Members: {Target.EnabledMemberCount}\n");
                    textBuilder.Append($"Selection: {selection.Element.TextBoard}\n");

                    if (propertyEntry != null)
                    {
                        textBuilder.Append($"ID: {propertyEntry.BlockMember.PropName}\n");
                        textBuilder.Append($"Type: {propertyEntry.BlockMember.GetType().Name}\n");
                        textBuilder.Append($"Entry Enabled: {propertyEntry.Enabled}\n");
                        textBuilder.Append($"Prop Enabled: {propertyEntry.BlockMember.Enabled}\n");
                        textBuilder.Append($"Value Text: {propertyEntry.BlockMember.ValueText}\n");
                        textBuilder.Append($"Is Duplicating: {propertyEntry.IsSelectedForDuplication}\n");
                    }
                }
            }
Esempio n. 4
0
        static void AddShortObjectMethods(ITextBuilder builder, NpcExecutionObject executionObject)
        {
            for (int interfaceIndex = 0; interfaceIndex < executionObject.ancestorNpcInterfaces.Count; interfaceIndex++)
            {
                NpcInterfaceInfo npcInterfaceInfo = executionObject.ancestorNpcInterfaces[interfaceIndex];
                for (int methodIndex = 0; methodIndex < npcInterfaceInfo.npcMethods.Length; methodIndex++)
                {
                    NpcMethodInfo npcMethodInfo = npcInterfaceInfo.npcMethods[methodIndex];
                    builder.AppendAscii(npcMethodInfo.methodName);

                    ParameterInfo[] parameters = npcMethodInfo.parameters;
                    for (UInt16 argIndex = 0; argIndex < npcMethodInfo.parametersLength; argIndex++)
                    {
                        ParameterInfo parameterInfo = parameters[argIndex];
                        builder.AppendAscii(' ');
                        builder.AppendAscii(parameterInfo.ParameterType.SosShortTypeName());
                        builder.AppendAscii(':');
                        builder.AppendAscii(parameterInfo.Name);
                    }

                    builder.AppendAscii(" returns ");
#if WindowsCE
                    builder.AppendAscii(npcMethodInfo.methodInfo.ReturnType.SosTypeName());
#else
                    builder.AppendAscii(npcMethodInfo.methodInfo.ReturnParameter.ParameterType.SosShortTypeName());
#endif
                    builder.AppendAscii("\n");
                }
            }
        }
Esempio n. 5
0
        protected override void Layout()
        {
            if ((MenuState & QuickActionMenuState.ListMenuOpen) > 0)
            {
                Size = propertyList.Size;
            }
            else
            {
                Size = propertyWheel.Size;
            }

            if (DrawDebug && textUpdateTick == 0)
            {
                ITextBuilder debugBuilder = debugText.TextBoard;
                debugBuilder.Clear();
                debugBuilder.Append($"ConObj: {MyAPIGateway.Session.ControlledObject.GetType().Name}\n");
                debugBuilder.Append($"SpecCam: {LocalPlayer.IsSpectating}\n");
                debugBuilder.Append($"State: {MenuState}\n");
                debugBuilder.Append($"Wheel Menu Open: {propertyWheel.IsOpen}\n");
                debugBuilder.Append($"IsWidgetOpen: {propertyWheel.IsWidgetOpen}\n");
                debugBuilder.Append($"List Menu Open: {propertyList.IsOpen}\n");
                debugBuilder.Append($"Cursor Mode: {HudMain.InputMode}\n");
                debugBuilder.Append($"Blacklist Mode: {BindManager.BlacklistMode}\n");
                debugBuilder.Append($"Enable Cursor Pressed: {BvBinds.MultXOrMouse.IsPressed}\n");
            }

            debugText.Visible = DrawDebug;

            textUpdateTick++;
            textUpdateTick %= textTickDivider;
        }
Esempio n. 6
0
 public UserController(
     IUserRepository userRepo,
     ICommentRepository commentRepo,
     IArticleRepository articleRepo,
     ICategoryRepository categoryRepo,
     IConfigurationKeyRepository configRepo,
     IAccount accnt,
     IFtp ft,
     ITextBuilder txtBuilder,
     IImageModifier imgModifier,
     ISessionHelper sessionRepo,
     IImageHelper imgHelper)
 {
     repoUser               = userRepo;
     repoComment            = commentRepo;
     repoArticle            = articleRepo;
     repoCategory           = categoryRepo;
     repoConfig             = configRepo;
     account                = accnt;
     ftp                    = ft;
     textBuilder            = txtBuilder;
     imageModifier          = imgModifier;
     repoSession            = sessionRepo;
     imageHelper            = imgHelper;
     repoSession.Controller = this;
 }
Esempio n. 7
0
        static void AddVerboseObjectMethods(ITextBuilder builder, NpcExecutionObject executionObject)
        {
            for (int interfaceIndex = 0; interfaceIndex < executionObject.ancestorNpcInterfaces.Count; interfaceIndex++)
            {
                NpcInterfaceInfo npcInterfaceInfo = executionObject.ancestorNpcInterfaces[interfaceIndex];
                for (int methodIndex = 0; methodIndex < npcInterfaceInfo.npcMethods.Length; methodIndex++)
                {
                    NpcMethodInfo npcMethodInfo = npcInterfaceInfo.npcMethods[methodIndex];
#if WindowsCE
                    builder.AppendAscii(npcMethodInfo.methodInfo.ReturnType.SosTypeName());
#else
                    builder.AppendAscii(npcMethodInfo.methodInfo.ReturnParameter.ParameterType.SosTypeName());
#endif
                    builder.AppendAscii(' ');
                    builder.AppendAscii(npcMethodInfo.methodName);

                    builder.AppendAscii('(');

                    ParameterInfo[] parameters = npcMethodInfo.parameters;
                    for (UInt16 j = 0; j < npcMethodInfo.parametersLength; j++)
                    {
                        ParameterInfo parameterInfo = parameters[j];
                        if (j > 0)
                        {
                            builder.AppendAscii(',');
                        }
                        builder.AppendAscii(parameterInfo.ParameterType.SosTypeName());
                        builder.AppendAscii(' ');
                        builder.AppendAscii(parameterInfo.Name);
                    }
                    builder.AppendAscii(")\n");
                }
            }
        }
Esempio n. 8
0
 public void GenerateExceptionHtml(ITextBuilder htmlBuilder, Exception e)
 {
     htmlBuilder.AppendAscii("<div style=\"text-align:center;\"><div style=\"padding:10px;text-align:left\"><h3>" + e.Message + "</h3></div>");
     htmlBuilder.AppendAscii("<div style=\"border:1px solid #aaa;text-align:left;padding:10px;width:850px;margin:0 auto 10px auto;overflow-x:scroll;\"><pre >");
     htmlBuilder.AppendAscii(e.ToString());
     htmlBuilder.AppendAscii("</pre></div></div>");
 }
Esempio n. 9
0
 public void GenerateHtmlHeaders(ITextBuilder htmlBuilder, String resourceString)
 {
     htmlBuilder.AppendAscii("<title>");
     htmlBuilder.AppendAscii(htmlPageTitle);
     htmlBuilder.AppendAscii(" - ");
     htmlBuilder.AppendAscii(resourceString);
     htmlBuilder.AppendAscii("</title>");
 }
Esempio n. 10
0
        public void GenerateTypesPage(ITextBuilder htmlBuilder)
        {
            Int32 enumTypeCount = 0, objectTypeCount = 0;

            foreach (KeyValuePair <String, Type> pair in npcExecutor.EnumAndObjectTypes)
            {
                if (pair.Value.IsEnum)
                {
                    enumTypeCount++;
                }
                else
                {
                    objectTypeCount++;
                }
            }

            htmlBuilder.AppendAscii("<br/><br/><hr/>");
            if (enumTypeCount <= 0)
            {
                htmlBuilder.AppendAscii("<h2>There are no enum types</h2><hr/>");
            }
            else
            {
                //htmlBuilder.AppendFormat("<h2>{0} enum types</h2><hr/>", enumTypeCount);
                htmlBuilder.AppendAscii("<h2>");
                htmlBuilder.AppendNumber(enumTypeCount);
                htmlBuilder.AppendAscii(" enum types</h2><hr/>");
                foreach (KeyValuePair <String, Type> pair in npcExecutor.EnumAndObjectTypes)
                {
                    if (pair.Value.IsEnum)
                    {
                        htmlBuilder.AppendAscii(TypeAsHtml(pair.Value));
                        htmlBuilder.AppendAscii("<br/>");
                    }
                }
            }

            htmlBuilder.AppendAscii("<br/><br/><hr/>");
            if (objectTypeCount <= 0)
            {
                htmlBuilder.AppendAscii("<h2>There are no object types</h2><hr/>");
            }
            else
            {
                //htmlBuilder.AppendFormat("<h2>{0} object types</h2><hr/>", objectTypeCount);
                htmlBuilder.AppendAscii("<h2>");
                htmlBuilder.AppendNumber(objectTypeCount);
                htmlBuilder.AppendAscii(" object types</h2><hr/>");
                foreach (KeyValuePair <String, Type> pair in npcExecutor.EnumAndObjectTypes)
                {
                    if (!pair.Value.IsEnum)
                    {
                        htmlBuilder.AppendAscii(TypeAsHtml(pair.Value));
                        htmlBuilder.AppendAscii("<br/>");
                    }
                }
            }
        }
Esempio n. 11
0
 static void AppendNpcError(ITextBuilder responseBuilder, NpcErrorCode errorCode, String errorMessage)
 {
     responseBuilder.AppendAscii(NpcReturnObject.NpcReturnLineNpcErrorPrefix);
     responseBuilder.AppendNumber((byte)errorCode);
     responseBuilder.AppendAscii(' ');
     responseBuilder.AppendAscii(errorCode.ToString());
     responseBuilder.AppendAscii(errorMessage.Replace("\n", "\\n"));
     responseBuilder.AppendAscii('\n');
 }
Esempio n. 12
0
 static void AppendProtocolHelp(ITextBuilder responseBuilder)
 {
     responseBuilder.AppendAscii("Npc Protocol:\n");
     responseBuilder.AppendAscii("   method-name [args...]       Call method-name with the given arguments\n");
     responseBuilder.AppendAscii("   :methods [object] [verbose] Print all objects and their methods or just the given objects methods\n");
     responseBuilder.AppendAscii("   :type [type]                No argument: print all types, 1 argument: print given type information\n");
     responseBuilder.AppendAscii("   :interface                  Print all interfaces then the objects\n");
     responseBuilder.AppendAscii("   :exit                       Exit\n");
     responseBuilder.AppendAscii("   :help                       Show this help\n");
 }
Esempio n. 13
0
        // Returns false if the npc stream is done
        public Boolean HandleLine(ITextBuilder responseBuilder, String line)
        {
            String commandArguments;
            String command = line.Peel(out commandArguments);

            if (String.IsNullOrEmpty(command))
            {
                AppendProtocolHelp(responseBuilder);
            }
            else
            {
                if (commandArguments != null)
                {
                    commandArguments = commandArguments.Trim();
                }

                if (command[0] != ':')
                {
                    CallCommandHandler(responseBuilder, command, commandArguments);
                }
                else if (command.Equals(":call", StringComparison.OrdinalIgnoreCase))
                {
                    CallCommandHandler(responseBuilder, commandArguments);
                }
                else if (command.Equals(":methods", StringComparison.OrdinalIgnoreCase))
                {
                    MethodsCommandHandler(responseBuilder, commandArguments);
                }
                else if (command.Equals(":type", StringComparison.OrdinalIgnoreCase))
                {
                    TypeCommandHandler(responseBuilder, commandArguments);
                }
                else if (command.Equals(":interface", StringComparison.OrdinalIgnoreCase))
                {
                    InterfaceCommandHandler(responseBuilder);
                }
                else if (command.Equals(":help", StringComparison.OrdinalIgnoreCase) || command.Equals("", StringComparison.OrdinalIgnoreCase))
                {
                    AppendProtocolHelp(responseBuilder);
                }
                else if (command.Equals(":exit", StringComparison.OrdinalIgnoreCase))
                {
                    return(false); // Close the stream
                }
                else
                {
                    callback.GotInvalidData(clientString, String.Format("Unknown Command from line '{0}'", line));
                    responseBuilder.AppendAscii("Unknown command '");
                    responseBuilder.AppendAscii(command);
                    responseBuilder.AppendAscii("'\n");
                    AppendProtocolHelp(responseBuilder);
                }
            }
            return(true); // Stay connected
        }
Esempio n. 14
0
 public ImageHelper(
     IConfigurationKeyRepository configRepo,
     IImageModifier imgModifier,
     IFtp ft,
     ITextBuilder txtBuilder)
 {
     repoConfig    = configRepo;
     imageModifier = imgModifier;
     ftp           = ft;
     textBuilder   = txtBuilder;
 }
Esempio n. 15
0
        public void GenerateTypePage(ITextBuilder htmlBuilder, String type)
        {
            Type enumOrObjectType;

            if (npcExecutor.EnumAndObjectTypes.TryGetValue(type, out enumOrObjectType))
            {
                htmlBuilder.AppendAscii(TypeAsHtml(enumOrObjectType) + "<br/>");
                if (enumOrObjectType.IsEnum)
                {
                    htmlBuilder.AppendAscii("<span class=\"cskeyword\">enum</span> {<table class=\"enumtable\">");
                    Array enumValues = EnumReflection.GetValues(enumOrObjectType);
                    for (int i = 0; i < enumValues.Length; i++)
                    {
                        Enum enumValue = (Enum)enumValues.GetValue(i);
                        htmlBuilder.AppendAscii("<tr><td>&nbsp;" + enumValue.ToString() + "</td><td>&nbsp;= " + enumValue.ToString("D") + ",</tr>");
                    }
                    htmlBuilder.AppendAscii("</table>}");
                }
                else
                {
                    htmlBuilder.AppendAscii("<span class=\"cskeyword\">object</span> {<table class=\"objecttable\">");
                    FieldInfo[] fieldInfos = enumOrObjectType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
                    if (fieldInfos != null && fieldInfos.Length > 0)
                    {
                        for (int i = 0; i < fieldInfos.Length; i++)
                        {
                            FieldInfo fieldInfo = fieldInfos[i];
                            htmlBuilder.AppendAscii("<tr><td>&nbsp;");
                            htmlBuilder.AppendAscii(TypeAsHtml(fieldInfo.FieldType));
                            htmlBuilder.AppendAscii("</td><td>&nbsp;");
                            htmlBuilder.AppendAscii(fieldInfo.Name);
                            htmlBuilder.AppendAscii(";</tr>");
                        }
                    }
                    htmlBuilder.AppendAscii("</table>}");
                }
                return;
            }

            Type sosPrimitiveType = type.TryGetSosPrimitive();

            if (sosPrimitiveType != null)
            {
                htmlBuilder.AppendAscii(TypeAsHtml(sosPrimitiveType) + " is a primitive type");
                return;
            }

            //htmlBuilder.AppendFormat("<a href=\"#\" class=\"cstype\">{0}</a> is an unknown type", type);
            htmlBuilder.AppendAscii("<a href=\"#\" class=\"cstype\">");
            htmlBuilder.AppendAscii(type);
            htmlBuilder.AppendAscii("</a> is an unknown type");
        }
Esempio n. 16
0
 public Account(IEmailSender emailSender,
                IConfigurationKeyRepository configRepo,
                ITextBuilder txtBuilder,
                IUserRepository userRepo,
                ISessionHelper sessionRepo)
 {
     myMembershipProvider = new MyMembershipProvider();
     sender      = emailSender;
     repoConfig  = configRepo;
     textBuilder = txtBuilder;
     repoUser    = userRepo;
     repoSession = sessionRepo;
 }
Esempio n. 17
0
        public OrientRepo(
            IJsonManger jsonManager_, ITokenBuilder tokenBuilder_, ITypeConverter typeConverter_, ITextBuilder textBuilder_,
            IWebManager webManger_, IResponseReader responseReader_)
        {
            this.jm  = jsonManager_;
            this.tb  = tokenBuilder_;
            this.tk  = typeConverter_;
            this.txb = textBuilder_;
            this.wm  = webManger_;
            this.ir  = responseReader_;

            AuthUrl    = txb.Build(TokenRepo.authUrl, new OrientAuthenticationURLFormat());
            CommandUrl = txb.Build(TokenRepo.commandUrl, new OrientCommandURLFormat());
        }
Esempio n. 18
0
 public AccountController(
     IUserRepository userRepo,
     IEmailSender emailSender,
     IConfigurationKeyRepository configRepo,
     IAccount accnt,
     ITextBuilder txtBuilder,
     ISessionHelper sessionRepo)
 {
     repo                   = userRepo;
     sender                 = emailSender;
     repoConfig             = configRepo;
     account                = accnt;
     textBuilder            = txtBuilder;
     repoSession            = sessionRepo;
     repoSession.Controller = this;
 }
Esempio n. 19
0
        public void CallCommandHandler(ITextBuilder responseBuilder, String methodName, String arguments)
        {
            //
            // Parse Parameters
            //
            List <String> parametersList = new List <String>();

            try
            {
                Npc.ParseParameters(arguments, parametersList);
            }
            catch (FormatException e)
            {
                callback.GotInvalidData(clientString, e.Message);
                AppendNpcError(responseBuilder, NpcErrorCode.InvalidCallParameters, e.Message);
                return;
            }

            String[] parameters = (parametersList == null) ? null : parametersList.ToArray();
            try
            {
                NpcReturnObjectOrException returnObject = npcExecutor.ExecuteWithStrings(methodName, parameters);
                if (returnObject.exception != null)
                {
                    callback.FunctionCallThrewException(clientString, methodName, returnObject.exception);
                }
                else
                {
                    callback.FunctionCall(clientString, methodName);
                }

                returnObject.AppendNpcReturnLine(responseBuilder);
                return;
            }
            catch (NpcErrorException ne)
            {
                callback.ExceptionDuringExecution(clientString, methodName, ne);
                responseBuilder.Clear();
                AppendNpcError(responseBuilder, ne.errorCode, ne.Message);
            }
            catch (Exception e)
            {
                callback.ExceptionDuringExecution(clientString, methodName, e);
                responseBuilder.Clear();
                AppendNpcError(responseBuilder, NpcErrorCode.UnhandledException, e.GetType().Name + ": " + e.Message);
            }
        }
Esempio n. 20
0
 public void GenerateCss(ITextBuilder htmlBuilder)
 {
     htmlBuilder.AppendAscii("*{margin:0;padding:0;}");
     htmlBuilder.AppendAscii("a:link{font-weight:bold;text-decoration:none;}a:visited{text-decoration:none;}a:hover{text-decoration:underline;}");
     htmlBuilder.AppendAscii("body{font-family:\"Courier New\";background:#eee;text-align:center;}");
     htmlBuilder.AppendAscii("#PageDiv{margin:auto;width:900px;text-align:left;position:relative;}");
     htmlBuilder.AppendAscii("#Nav{margin-top:20px;}#NavLinkWrapper{height:50px;border-bottom:1px solid #333;}.NavLink{display:inline-block;height:49px;margin:0 5px;padding:0 5px;line-height:50px;border:1px solid #333;border-bottom:none;background:#333;color:#fff;}#CurrentNav{background:#fff;color:#000;height:50px;}");
     htmlBuilder.AppendAscii("#ContentDiv{background:#fff;border:1px solid #333;border-top:none;margin-bottom:20px;overflow-x:auto;padding:10px;}");
     htmlBuilder.AppendAscii(".executebutton{font-weight:bold;margin:3px;padding:3px;}");
     htmlBuilder.AppendAscii(".SectionTitle{display:inline-block;background:#333;color:#fff;font-weight:bold;padding:5px;}");
     htmlBuilder.AppendAscii(".methods{padding:10px 0;}");
     htmlBuilder.AppendAscii("table{border-collapse:collapse;} /*table.noborder ,tr.noborder ,td.noborder  {border:none;}*/");
     htmlBuilder.AppendAscii(".methodtable table{width:100%;} .methodtable td{padding:5px 0;}");
     htmlBuilder.AppendAscii(".csobjecttable td{border:1px solid #aaa;padding:3px;}");
     htmlBuilder.AppendAscii(".csarraytable table,.csarraytable td{border: 1px solid #000;}.csarraytable td{padding:2px;}.csstring{color:#A31515}.cstype{color:#2b91af;font-weight:bold;}.cskeyword{color:#00f;font-weight:bold;}.bold{font-weight:bold;}");
     htmlBuilder.AppendAscii(".formathelp{background-color:#ddd; padding:5px;}.stacktrace{}.methodform{margin:3px;padding:3px;}");
 }
Esempio n. 21
0
		public CommonEventMessageBuilder(
			string defaultFrom,
			IRecipientsFacade recipients,
			ISerializer serializer,
			ITextBuilder textBuilder,
			ILocalizedDataHelper localizedHelper,
			ITemplateRepositoryHelper templates,
			ICommonFilesFacade files)
		{
			_defaultFrom = defaultFrom;
			_recipients = recipients;
			_serializer = serializer;
			_textBuilder = textBuilder;
			_localizedHelper = localizedHelper;
			_templates = templates;
			_files = files;
		}
            private void UpdateText()
            {
                IPropertyBlock block = propertyWheelMenu.quickActionMenu.Target;

                summaryBuilder.Clear();
                summaryBuilder.Add("Build Vision\n", wheelHeaderFormat);
                block.GetSummary(summaryBuilder, bodyFormatCenter, bodyValueFormatCenter);

                ITextBuilder notificationBuidler = notificationText.TextBoard;

                if (notification != null && notificationTimer.ElapsedMilliseconds < notificationTime)
                {
                    notificationBuidler.Clear();
                    notificationBuidler.Append("\n", bodyFormatCenter);
                    notificationBuidler.Append(notification, bodyValueFormatCenter);

                    if (contNotification)
                    {
                        notification     = null;
                        contNotification = false;
                    }
                }
                else if ((MenuState & QuickActionMenuState.PropertyDuplication) > 0)
                {
                    textBuf.Clear();
                    textBuf.Append("Copying ");
                    textBuf.Append(block.Duplicator.GetSelectedEntryCount());
                    textBuf.Append(" of ");
                    textBuf.Append(block.Duplicator.GetValidEntryCount());
                    notificationBuidler.SetText(textBuf, bodyValueFormatCenter);
                }
                else
                {
                    notification = null;
                    notificationBuidler.Clear();
                    var target = propertyWheelMenu.quickActionMenu.Target;

                    if (!target.IsFunctional)
                    {
                        notificationBuidler.SetText("[Incomplete]", blockIncFormat.WithAlignment(TextAlignment.Center));
                    }
                }

                summaryLabel.TextBoard.SetText(summaryBuilder);
            }
Esempio n. 23
0
            protected override void Layout()
            {
                base.Layout();

                if (!sliderBox.IsTextInputOpen)
                {
                    ITextBuilder valueBuilder = sliderBox.ValueBuilder;
                    valueBuilder.Clear();

                    if (floatMember.StatusText != null && floatMember.StatusText.Length > 0)
                    {
                        valueBuilder.Append(floatMember.StatusText, wheelValueColor);
                        valueBuilder.Append(" ");
                    }

                    valueBuilder.Append(floatMember.FormattedValue, wheelNameColor);
                }
            }
Esempio n. 24
0
 public virtual void AppendNpcReturnLine(ITextBuilder responseBuilder)
 {
     //
     // This method call will always return a specifically formatted string.
     //    1. On Success "Success <ReturnType> <ReturnValue>"
     //    2. On Exception "Exception <ExceptionTypeName> <ExceptionMessage> <StackTrace>
     //
     responseBuilder.AppendAscii(NpcReturnLineSuccessPrefix);
     if (type == typeof(void))
     {
         responseBuilder.AppendAscii("Void\n");
     }
     else
     {
         responseBuilder.AppendAscii(type.SosTypeName());
         responseBuilder.AppendAscii(' ');
         responseBuilder.AppendAscii(valueSosSerializationString);
         responseBuilder.AppendAscii('\n');
     }
 }
Esempio n. 25
0
        public override void AppendNpcReturnLine(ITextBuilder responseBuilder)
        {
            if (exception == null)
            {
                base.AppendNpcReturnLine(responseBuilder);
            }
            else
            {
                String exceptionMessage     = exception.Message.SerializeString().Replace("\n", "\\n");
                String exceptionAsNpcString = exception.SerializeObject().Replace("\n", "\\n");

                responseBuilder.AppendAscii(NpcReturnObject.NpcReturnLineExceptionPrefix);
                responseBuilder.AppendAscii(exceptionMessage);
                responseBuilder.AppendAscii(' ');
                responseBuilder.AppendAscii(exception.GetType().SosTypeName());
                responseBuilder.AppendAscii(' ');
                responseBuilder.AppendAscii(exceptionAsNpcString);
                responseBuilder.AppendAscii('\n');
            }
        }
Esempio n. 26
0
            private void UpdateDebugText()
            {
                ITextBuilder textBuilder = debugText.TextBoard;

                textBuilder.Clear();
                textBuilder.Append($"Selection: {listBody[selectionIndex].NameText}\n");
                textBuilder.Append($"ID: {listBody[selectionIndex].AssocMember.PropName}\n");
                textBuilder.Append($"Type: {listBody[selectionIndex].AssocMember.GetType().Name}\n");
                textBuilder.Append($"Value Text: {listBody[selectionIndex].AssocMember.ValueText}\n");
                textBuilder.Append($"Open: {listBody[selectionIndex].PropertyOpen}\n");
                textBuilder.Append($"Is Duplicating: {listBody[selectionIndex].IsSelectedForDuplication}\n");

                if (listBody[selectionIndex].AssocMember is IBlockComboBox)
                {
                    var member = listBody[selectionIndex].AssocMember as IBlockComboBox;
                    textBuilder.Append($"Value: {member.Value}\n");

                    for (int i = 0; i < member.ComboEntries.Count; i++)
                    {
                        textBuilder.Append($"Entry {member.ComboEntries[i].Key}: {member.ComboEntries[i].Value}\n");
                    }
                }
            }
Esempio n. 27
0
        public void CallCommandHandler(ITextBuilder responseBuilder, String call)
        {
            //
            // This method always returns a specifically formatted string.
            //    1. On Success   "Success <ReturnType> [<ReturnValue>]"
            //    3. On Exception "Exception <ExceptionMessage> <ExceptionType> <SerializedException>
            //    2. On NpcError  "NpcError <ErrorCode> <ErrorMessage>
            //
            if (String.IsNullOrEmpty(call))
            {
                AppendNpcError(responseBuilder, NpcErrorCode.InvalidCallSyntax, "missing method name");
                return;
            }

            //
            // Get method name
            //
            String methodName;
            String parametersString;

            methodName = call.Peel(out parametersString);

            CallCommandHandler(responseBuilder, methodName, parametersString);
        }
 public ComputerPerson(IMathProcessor mathProcessor, ITextBuilder textBuilder, IMemoryProcessor memoryProcessor)
 {
     _MathProcessor = mathProcessor;
     _TextBuilder = textBuilder;
     _MemoryProcessor = memoryProcessor;
 }
Esempio n. 29
0
 /// <summary>
 /// Creates the RRuleParser.
 /// </summary>
 /// <param name="rruleTokenizer">The tokenizer to use.</param>
 /// <param name="textBuilder">The text builder to use.</param>
 public RRuleParser(IRRuleTokenizer rruleTokenizer, ITextBuilder textBuilder)
 {
     _tokenizer   = rruleTokenizer;
     _textBuilder = textBuilder;
 }
Esempio n. 30
0
 /// <summary>
 /// Creates the RRuleParser. With <see cref="RRuleTokenizer" /> as RRuleTokenizer.
 /// </summary>
 /// <param name="textBuilder">The text builder to use.</param>
 public RRuleParser(ITextBuilder textBuilder) :
     this(new RRuleTokenizer(new RRuleValueParser(), new RRuleValidator()), textBuilder)
 {
 }
Esempio n. 31
0
 public TextPage() : base(ModPages.TextPage)
 {
     TextBuilder = new BasicTextBuilder((TextBuilderMembers)GetOrSetMemberFunc(null, (int)TextPageAccessors.GetTextBuilder));
 }