/** * Controller: Menus * Action: Index * List All menu system * Author: Le Dang Son * Date: 08/08/2012 */ public ActionResult Index() { int admin = base.Authentication(); if (admin == 0) { return Redirect("~/member/logout"); } else if (admin == 1) { base.LoadMenu(); List<Menus> listMenu = new FineArtContext().Menus.ToList(); ViewBag.Title += " Menus"; listMenu.ForEach(delegate(Menus menu) { if (menu.Controller == "") { menu.Controller = "Index"; } if (menu.Action == "") { menu.Action = "Index"; } Strings stringsLibs = new Strings(); menu.Controller = stringsLibs.Capacital(menu.Controller); menu.Action = stringsLibs.Capacital(menu.Action); }); ViewBag.listMenu = listMenu; return View(); } else { Session["errorContorllerAction"] = true; return Redirect("~/administrator"); } }
public TijdPrestatiePrint(object datacontext) { InitializeComponent(); //TODO: MVVM?? var prestatie = datacontext as Prestatie; Strings currentStrings = new Strings(); BegroetingPrint currentBegroeting = new BegroetingPrint(); LabelHemden.Content = currentStrings.StringHemden; LabelLakens1.Content = currentStrings.StringLakens1; LabelLakens2.Content = currentStrings.StringLakens2; LabelAndereStrijk.Content = currentStrings.StringAndere; LabelAdministratie.Content = currentStrings.StringAdministratie; LabelBegroetingRegel1.Content = currentBegroeting.StringRegel1; LabelBegroetingRegel2.Content = currentBegroeting.StringRegel2; if (prestatie.Klant.Betalingswijze == "Elektronisch") { LabelGebruikersnummer.Visibility = Visibility.Visible; LabelDienstenChecks.Text = "aantal dienstencheques te betalen (elektronisch)"; } this.DataContext = datacontext; }
private static void ExtractFeatureInformation(object featuredObject, int iiLen, int oiLen, out FeatureDescription[] descriptions, out Strings inIDs, out Strings outIDs) { var ofo = featuredObject as IFeaturedInputOutput; if (ofo != null) { inIDs = ofo.InputFeatureIDs; outIDs = ofo.OutputFeatureIDs; descriptions = ofo.FeatureDescriptions.ToArray(); return; } var ifo = featuredObject as IFeaturedInput; if (ifo != null) { inIDs = ifo.InputFeatureIDs; var set = ifo.FeatureDescriptions; // Mutable. outIDs = GenerateFeatureDescriptions(set, oiLen); descriptions = set.ToArray(); return; } var newSet = new FeatureDescriptionSet(); inIDs = GenerateFeatureDescriptions(newSet, iiLen); outIDs = GenerateFeatureDescriptions(newSet, oiLen); descriptions = newSet.ToArray(); }
public static void Reinit() { if (_instance != null) { _instance = new Strings(); } }
public static void Main() { int[][] inputMatrix = { new[] {21, 24, 0, 0}, new[] {21, 23, 0, -2}, new[] {32, 23, 0, 122}, new[] {24, -3, 0, 23} }; var matrix = new Matrix(inputMatrix); Arrays.CountNullElements(new double[] { 10, -2, 0, 23, 23, 0, 3, -2, 222 }); Arrays.MultiplyInRange(new double[] { 10, -2, 0, -23, 23, 23, 0, -2, 3, -2, 222 }); Arrays.SortByAbs(new double[] { 10, -2, 0, -23, 23, 23, 0, -2, 3, -2, 222 }); matrix.CountRowsWithNullElement(); matrix.ColumnWithMostSameEl(); Console.WriteLine("Введіть строку: "); var strings = new Strings(Console.ReadLine()); Console.WriteLine("Всі символи, які розташовані після першої двокрапки: "); strings.SplitAfterColon(); Console.WriteLine("Кількість речень, що містять непарну кількість слів: "); strings.CountSentencesWithOddWords(); Console.WriteLine("Видалення всіх слів після ком: "); strings.RemoveWordsAfterComma(); Console.Read(); }
private RandomGenR() { this.dateModule = new Dates(); this.numberModule = new Numbers(); this.collectionsModule = new Collections(); this.stringsModule = new Strings(); }
public void FrontAgain(string str, bool expected) { Strings Obj = new Strings(); bool actual = Obj.FrontAgain(str); Assert.AreEqual(expected, actual); }
public void FirstHalf(string str, string expected) { Strings obj = new Strings(); string actual = obj.FirstHalf(str); Assert.AreEqual(expected, actual); }
public void EndsWithLy(string str, bool expected) { Strings obj = new Strings(); bool actual = obj.EndsWithLy(str); Assert.AreEqual(expected, actual); }
public void ConCat(string a, string b, string expected) { Strings Obj = new Strings(); string actual = Obj.ConCat(a, b); Assert.AreEqual(expected, actual); }
public void AtFirst(string str, string expected) { Strings Obj = new Strings(); string actual = Obj.AtFirst(str); Assert.AreEqual(expected, actual); }
private void CreateStringData() { ExecuteOnStepProgress(10); ExecuteOnStepMessage(StepInput.HtmlStrings.CreatingStringData); var stringData = new Strings(); File.WriteAllText(Path.Combine(StepInput.OutputPath, "data", "Strings.js"), stringData.TransformText()); }
public void IsValid_Should_Return_ValidationResult_When_Values_Are_Invalid() { var strings = new Strings { FirstString = "one", SecondString = "one" }; var attribute = new NotEqualToAttribute("FirstString"); var context = new ValidationContext(strings, null, null); var result = attribute.GetValidationResult(strings.SecondString, context); Assert.IsNotNull(result); }
public TijdBerekenModuleViewModel(UnitOfWork ctx) : base(ctx) { Init(); CurrentParameters = new Parameters(); CurrentStrings = new Strings(); LoadData(); }
public OrderListForm(List<OrderListRecord> orders) { InitializeComponent(); strings = i8n.strings; this.Text = ""; oilwellNumberColumnHeader.Text = strings["oilwellNumber"]; orderTypeColumnHeader.Text = strings["orderType"]; tubeDiameterColumnHeader.Text = strings["tubeDiameterAbbr"]; orderedTubesAmountColumnHeader.Text = strings["orderedTubesAmount"]; shippedTubesAmountColumnHeader.Text = strings["shippedTubesAmount"]; cancelOrderButton.Text = strings["cancelOrder"]; attachWaybillButton.Text = strings["attachWaybill"]; orderTypeDictionary = new Dictionary<int, string> { { 1, strings["orderTypeTubesDelivery"] }, { 2, strings["orderTypeTubesCleaning"] }, { 3, strings["orderTypeRodDelivery"] }, { 4, strings["orderTypeRodCleaning"] }, { 5, strings["orderTypePumpDelivery"] }, { 6, strings["orderTypePumpCleaning"] }, }; rodDiameterDictionary = new Dictionary<int, string> { { 1, "22" }, { 2, "19" }, { 3, "22 со скребком" }, { 4, "19 со скребком" }, { 1000, strings["otherOption"] }, }; pumpDictionary = new Dictionary<int, string> { { 1, "44" }, { 2, "57" }, { 3, "70" }, { 1000, strings["otherOption"] }, }; tubeDiameterDictionary = new Dictionary<int, string> { { 1, "60" }, { 2, "73" }, { 3, "73 выс" }, { 4, "89" }, { 1000, strings["otherOption"] }, }; if (M3Client.configuration.Role != Roles.repairForeman) { cancelOrderButton.Enabled = false; } SetOrders(orders); }
static void Main(string[] args) { Strings obj = new Strings(); //String Warmup 1 Console.WriteLine(obj.SayHi("Bob")); Console.WriteLine(obj.SayHi("Alice")); Console.WriteLine(obj.SayHi("X")); //String Warmup 2 Console.WriteLine(obj.Abba("Hi", "Bye")); Console.WriteLine(obj.Abba("Yo", "Alice")); Console.WriteLine(obj.Abba("What", "Up")); //String Warmup 3 Console.WriteLine(obj.MakeTags("i", "Yay")); Console.WriteLine(obj.MakeTags("i", "Hello")); Console.WriteLine(obj.MakeTags("cite", "Yay")); //String Warmup 4 Console.WriteLine(obj.InsertWord("<<>>", "Yay")); Console.WriteLine(obj.InsertWord("<<>>", "WooHoo")); Console.WriteLine(obj.InsertWord("[[]]", "word")); //String Warmup 5 Console.WriteLine(obj.MultipleEndings("Hello")); Console.WriteLine(obj.MultipleEndings("ab")); Console.WriteLine(obj.MultipleEndings("Hi")); //String Warmup 6 Console.WriteLine(obj.FirstHalf("WooHoo")); Console.WriteLine(obj.FirstHalf("HelloThere")); Console.WriteLine(obj.FirstHalf("abcdef")); //String Warmup 7 Console.WriteLine(obj.TrimOne("Hello")); Console.WriteLine(obj.TrimOne("java")); Console.WriteLine(obj.TrimOne("coding")); //String Warmup 8 Console.WriteLine(obj.LongInMiddle("Hello", "hi")); Console.WriteLine(obj.LongInMiddle("hi", "Hello")); Console.WriteLine(obj.LongInMiddle("aaa", "b")); //String Warmup 9 Console.WriteLine(obj.Rotateleft2("Hello")); Console.WriteLine(obj.Rotateleft2("java")); Console.WriteLine(obj.Rotateleft2("Hi")); //String Warmup 10 Console.WriteLine(obj.RotateRight2("Hello")); Console.WriteLine(obj.RotateRight2("java")); Console.WriteLine(obj.RotateRight2("Hi")); //String Warmup 11 Console.WriteLine(obj.TakeOne("Hello", true)); Console.WriteLine(obj.TakeOne("Hello", false)); Console.WriteLine(obj.TakeOne("oh", true)); //String Warmup 12 Console.WriteLine(obj.MiddleTwo("string")); Console.WriteLine(obj.MiddleTwo("code")); Console.WriteLine(obj.MiddleTwo("Practice")); //String Warmup 13 Console.WriteLine(obj.EndsWithLy("oddly")); Console.WriteLine(obj.EndsWithLy("y")); Console.WriteLine(obj.EndsWithLy("oddy")); Console.ReadLine(); }
public ActionResult Add(FormCollection form) { int admin = base.Authentication(); if (admin == 0) { return Redirect("~/member/logout"); } else if (admin == 1) { base.LoadMenu(); var db = new FineArtContext(); if (form["submit_class"] != null) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<ul>"); Strings stringsLibs = new Strings(); if (form["Name"].Trim() == "") { stringBuilder.Append("<li>Please type class name</li>"); } if (form["Alias"].Trim() == "") { stringBuilder.Append("<li>Please type class alias</li>"); } else { try { string alias = form["Alias"].Trim().ToString(); var classModels = db.Classes.Where(c => c.Alias == alias).First(); stringBuilder.Append("<li>This class alias had been exists in database, try a different</li>"); } catch { } } if (stringBuilder.ToString() == "<ul>") { Classes classModels = new Classes { Name = form["Name"], Alias = form["Alias"], DateUpdate = DateTime.Now }; db.Classes.Add(classModels); db.SaveChanges(); ViewBag.success = "Add class success!"; } else { stringBuilder.Append("</ul>"); ViewBag.error = stringBuilder.ToString(); ViewBag.dataForm = form; } } return View(); } else { Session["errorContorllerAction"] = true; return Redirect("~/administrator"); } }
public void RetrievedProductsAre(Strings expectedProducts) { Assert.That(_retrievedProducts.Count, Is.EqualTo(expectedProducts.Values.Length)); foreach (var productName in expectedProducts.Values) { var name = productName; Assert.That(_retrievedProducts.First(x => x.Name == name), Is.Not.Null); } }
// TODO: Configurable Cache! public DataFeatureMatrixProvider(DataFeatureSelectionStrategy selectionStrategy, IDataFeatureProvider dataFeatureProvider, Strings featureIDs = null) { Contract.Requires(selectionStrategy != null); Contract.Requires(dataFeatureProvider != null); this.selectionStrategy = selectionStrategy; DataFeatureProvider = dataFeatureProvider; vectorizer = new FeatureSetVectorizer(featureIDs == null ? dataFeatureProvider.FeatureDescriptions : dataFeatureProvider.FeatureDescriptions.GetSubset(featureIDs)); MatrixWidth = vectorizer.FeatureDescriptions.Sum(d => d.FeatureValueCount); }
public void Validate(Strings strings) { #if DEBUG foreach (Node n in this.nodes.Values) { if ((n.type == Node.Type.Choice || n.type == Node.Type.Text) && !strings.HasKey(n.name)) Log.d(string.Format("Invalid dialogue {0} \"{1}\"", n.type.ToString(), n.name)); } #endif }
public void AbbaTest(string a, string b, string expectedResult) { // arrange Strings obj = new Strings(); //act string actual = obj.ABBA(a, b); // assert Assert.AreEqual(expectedResult, actual); }
public virtual string GetLocalizedDescr(Strings str) { string name = "Rule."+Name+".Descr"; if(str.HasString(name)) return str[name]; else { return ""; Debug.LogError("No localized description for rule "+Name); } }
public virtual string GetLocalizedName(Strings str) { string name = "Rule."+Name; if(str.HasString(name)) return str[name]; else { return Name; Debug.LogError("No localized name for rule "+Name); } }
static void Main(string[] args) { var NewStringsObject = new Strings(); NewStringsObject.firstString = "Some random text value"; Console.WriteLine(string.Format("The value of the first string in this program is {0}", NewStringsObject.firstString)); Console.ReadLine(); //Broken has been removed!!! :) }
void Awake() { TextAsset curStringFile = null; foreach(TextAsset sf in stringsFiles) { if(System.IO.Path.GetFileNameWithoutExtension(sf.name) == System.Enum.GetName(typeof(SystemLanguage),Application.systemLanguage) ) curStringFile = sf; } if(curStringFile==null) curStringFile = defaultStringFile; S = Strings.Load(curStringFile.text); }
public static void LoadStrings(string rootPath) { try { using (var fs = new FileStream(Path.Combine(rootPath, @".\data\client_strings.xml"), FileMode.Open, FileAccess.Read)) using (var reader = XmlReader.Create(fs)) { XmlSerializer ser = new XmlSerializer(typeof(Strings)); StringIndex = (Strings)ser.Deserialize(reader); StringIndex.CreateIndex(); } } catch (Exception ex) { Debug.Print(ex.ToString()); } }
protected override void Awake () { try { // managed mode base.Awake (); S = M.UI.S; } catch (UnityException e) { StringLoaderController stringLoader = GetComponentInParent<StringLoaderController>(); if(stringLoader!=null) S = stringLoader.S; } }
public static string ContentToString(Strings strings) { string content = null; switch (strings) { case Strings.emptyString: content = " "; break; case Strings.lineString: content = "=="; break; case Strings.shotString: content = "<>"; break; } return content; }
public static void Main() { int[][] matrix = { new[] {21, 24, 3, 0}, new[] {-1, 23, 300, -2}, new[] {32, -2, 122, 122} }; //Console.WriteLine(new Matrix(matrix).CountMaxOccurences()); //Console.WriteLine(new Matrix(matrix).GetNotNullRows()); //Console.WriteLine(Arrays.SumNegativeElements(new double[] { 10, -2, -23, 23, 23, -2, 3, -2, 222 })); //Console.WriteLine(Arrays.MultiplyMinMaxRange(new double[] { 10, -2, -23, 23, 23, -2, 3, -2, 222 })); var strings = new Strings(Console.ReadLine()); //Console.WriteLine(strings.CountOddLengthWords()); strings.PrintLetterOccurrences(); //strings.RemoveWordsInParentheses(); Console.Read(); }
public static Strings Load(string text) { var serializer = new XmlSerializer(typeof(Strings)); Strings res; try { using(var stream = new StringReader(text)) { res = serializer.Deserialize(stream) as Strings; } } catch (FileNotFoundException) { res = new Strings(); } res.Sort(); return res; }
private IntersectGame(IClientContext context, Action postStartupAction) { Context = context; PostStartupAction = postStartupAction; Strings.Load(); mGraphics = new GraphicsDeviceManager(this) { PreferredBackBufferWidth = 800, PreferredBackBufferHeight = 480, PreferHalfPixelOffset = true }; mGraphics.PreparingDeviceSettings += (s, args) => { args.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents; }; Content.RootDirectory = ""; IsMouseVisible = true; Globals.ContentManager = new MonoContentManager(); Globals.Database = new MonoDatabase(); /* Load configuration */ ClientConfiguration.LoadAndSave(ClientConfiguration.DefaultPath); Globals.Database.LoadPreferences(); Window.IsBorderless = Context.StartupOptions.BorderlessWindow; var renderer = new MonoRenderer(mGraphics, Content, this) { OverrideResolution = Context.StartupOptions.ScreenResolution }; Globals.InputManager = new MonoInput(this); GameClipboard.Instance = new MonoClipboard(); Core.Graphics.Renderer = renderer; Globals.System = new MonoSystem(); Interface.Interface.GwenRenderer = new IntersectRenderer(null, Core.Graphics.Renderer); Interface.Interface.GwenInput = new IntersectInput(); Controls.Init(); Window.Position = new Microsoft.Xna.Framework.Point(-20, -2000); Window.AllowAltF4 = false; // If we're going to be rendering a custom mouse cursor, hide the default one! if (!string.IsNullOrWhiteSpace(ClientConfiguration.Instance.MouseCursor)) { IsMouseVisible = false; } if (!string.IsNullOrWhiteSpace(ClientConfiguration.Instance.UpdateUrl)) { mUpdater = new Updater.Updater( ClientConfiguration.Instance.UpdateUrl, Path.Combine("version.json"), true, 5 ); } }
public ServiceStopFailureException(string name, string msg, Exception innerException) : base(Strings.ServiceStopFailure(name, msg), innerException) { this.name = name; this.msg = msg; }
private void GenerateButton_Click(object sender, EventArgs e) { string sBinFile; OpenFileDialog.Filter = "Superpoint.bin.log|Superpoint.bin.log|All Files|*.*"; if (OpenFileDialog.ShowDialog() == DialogResult.Cancel) { return; } sBinFile = OpenFileDialog.FileName; // If System.IO.File.Exists(sBinFile + ".bin") = True Then // If MessageBox.Show("Output file exist. Overwrite?", "Exist file", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No Then Exit Sub // System.IO.File.Delete(sBinFile + ".bin") // End If var inFile = new System.IO.StreamReader(sBinFile, System.Text.Encoding.Default, true, 1); // Dim outFile As New System.IO.StreamWriter(sBinFile + ".bin", False, System.Text.Encoding.GetEncoding(1250), 1) // FOR Release sBinFile = sBinFile.Replace(".bin.log", ".bin"); System.IO.Stream outFile = new System.IO.FileStream(sBinFile, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite); // Dim outFile As System.IO.StreamWriter = New System.IO.StreamWriter(outFil) string sTemp = ""; int iTemp; var aTemp = new string[3]; // , iTempSP As Integer, SuperPointsValue As Integer, PointsInSuperpoint As Integer while (inFile.EndOfStream != true) { sTemp = inFile.ReadLine().Replace(" ", "").Replace(Conversions.ToString((char)9), ""); if (Strings.InStr(sTemp, "Superpoints") != 0) { // Superpoints: 16 iTemp = Conversions.ToInteger(sTemp.Remove(0, Strings.InStr(sTemp, ":")).Trim()); unendian(4, iTemp, ref outFile); // full amount in superpoint.bin } if (Strings.InStr(sTemp, "[") != 0) { // [scribe_leandro] textwrite(sTemp.Replace("[", "").Replace("]", "").Trim(), ref outFile); // name of superpoint unendian(4, 0, ref outFile); // unknown param } if (Strings.InStr(sTemp, "Points") != 0) { // Points in this superpoint: 11 iTemp = Conversions.ToInteger(sTemp.Remove(0, Strings.InStr(sTemp, ":")).Trim()); unendian(4, iTemp, ref outFile); // full amount in superpoint.bin } if (Strings.InStr(sTemp, "index:") != 0) { // index: 0: -82428;245204;-3712 aTemp = sTemp.Split(Conversions.ToChar(":")); unendian(4, Conversions.ToInteger(aTemp[1]), ref outFile); // index number aTemp = aTemp[2].Split(Conversions.ToChar(";")); unendian(4, Conversions.ToInteger(aTemp[0]), ref outFile); // x unendian(4, Conversions.ToInteger(aTemp[1]), ref outFile); // y unendian(4, Conversions.ToInteger(aTemp[2]), ref outFile); // z } if (Strings.InStr(sTemp, "delay:") != 0) { // Points in this superpoint: 11 iTemp = Conversions.ToInteger(sTemp.Remove(0, Strings.InStr(sTemp, ":")).Trim()); unendian(4, iTemp, ref outFile); // delay } if (Strings.InStr(sTemp, "conntype:") != 0) { // conn type:2 iTemp = Conversions.ToInteger(sTemp.Remove(0, Strings.InStr(sTemp, ":")).Trim()); unendian(4, iTemp, ref outFile); // conn type } } inFile.Close(); outFile.Close(); MessageBox.Show("New Superpoint.bin has been created in '" + sBinFile + "' file.", "Complete", MessageBoxButtons.OK); }
public TooManyResultsException(int count, Exception innerException) : base(Strings.ErrorAlsTooManyLogResults(count), innerException) { this.count = count; }
protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); base.InternalBeginProcessing(); if (this.ManagedBy != null) { ADRecipient adrecipient = (ADRecipient)base.GetDataObject <ADRecipient>(this.ManagedBy, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.RecipientNotFoundException(this.ManagedBy.ToString())), new LocalizedString?(Strings.RecipientNotUniqueException(this.ManagedBy.ToString()))); if (base.HasErrors) { return; } this.managerId = (ADObjectId)adrecipient.Identity; if (!base.CurrentOrganizationId.Equals(adrecipient.OrganizationId)) { base.CurrentOrganizationId = adrecipient.OrganizationId; } } TaskLogger.LogExit(); }
/// <summary> /// Parse Tagged Text /// </summary> private void ParseTaggedText() { // <geometry tagged text> ::= <point tagged text> | // <linestring tagged text> | // <polygon tagged text> | // <multipoint tagged text> | // <multilinestring tagged text> | // <multipolygon tagged text> | // <geometrycollection tagged text> // <point tagged text> ::= point <point text> // <linestring tagged text> ::= linestring <linestring text> // <polygon tagged text> ::= polygon <polygon text> // <multipoint tagged text> ::= multipoint <multipoint text> // <multilinestring tagged text> ::= multilinestring <multilinestring text> // <multipolygon tagged text> ::= multipolygon <multipolygon text> // <geometrycollection tagged text> ::= geometrycollection <geometrycollection text> if (!this.NextToken()) { throw new FormatException(Strings.WellKnownText_UnknownTaggedText(String.Empty)); } switch (this.lexer.CurrentToken.Text.ToUpperInvariant()) { case WellKnownTextConstants.WktPoint: this.pipeline.BeginGeo(SpatialType.Point); this.ParsePointText(); this.pipeline.EndGeo(); break; case WellKnownTextConstants.WktLineString: this.pipeline.BeginGeo(SpatialType.LineString); this.ParseLineStringText(); this.pipeline.EndGeo(); break; case WellKnownTextConstants.WktPolygon: this.pipeline.BeginGeo(SpatialType.Polygon); this.ParsePolygonText(); this.pipeline.EndGeo(); break; case WellKnownTextConstants.WktMultiPoint: this.pipeline.BeginGeo(SpatialType.MultiPoint); this.ParseMultiGeoText(SpatialType.Point, this.ParsePointText); this.pipeline.EndGeo(); break; case WellKnownTextConstants.WktMultiLineString: this.pipeline.BeginGeo(SpatialType.MultiLineString); this.ParseMultiGeoText(SpatialType.LineString, this.ParseLineStringText); this.pipeline.EndGeo(); break; case WellKnownTextConstants.WktMultiPolygon: this.pipeline.BeginGeo(SpatialType.MultiPolygon); this.ParseMultiGeoText(SpatialType.Polygon, this.ParsePolygonText); this.pipeline.EndGeo(); break; case WellKnownTextConstants.WktCollection: this.pipeline.BeginGeo(SpatialType.Collection); this.ParseCollectionText(); this.pipeline.EndGeo(); break; case WellKnownTextConstants.WktFullGlobe: this.pipeline.BeginGeo(SpatialType.FullGlobe); this.pipeline.EndGeo(); break; default: throw new FormatException(Strings.WellKnownText_UnknownTaggedText(this.lexer.CurrentToken.Text)); } }
public TypeUsage GetModelTypeUsage() { if (_modelTypeUsage == null) { var edmType = EdmType; // If the edm type is already a cspace type, return the same type if (edmType.DataSpace == DataSpace.CSpace || edmType.DataSpace == DataSpace.OSpace) { return(this); } TypeUsage result; if (Helper.IsRowType(edmType)) { var sspaceRowType = (RowType)edmType; var properties = new EdmProperty[sspaceRowType.Properties.Count]; for (var i = 0; i < properties.Length; i++) { var sspaceProperty = sspaceRowType.Properties[i]; var newTypeUsage = sspaceProperty.TypeUsage.GetModelTypeUsage(); properties[i] = new EdmProperty(sspaceProperty.Name, newTypeUsage); } var edmRowType = new RowType(properties, sspaceRowType.InitializerMetadata); result = Create(edmRowType, Facets); } else if (Helper.IsCollectionType(edmType)) { var sspaceCollectionType = ((CollectionType)edmType); var newTypeUsage = sspaceCollectionType.TypeUsage.GetModelTypeUsage(); result = Create(new CollectionType(newTypeUsage), Facets); } else if (Helper.IsPrimitiveType(edmType)) { result = ((PrimitiveType)edmType).ProviderManifest.GetEdmType(this); if (result == null) { throw new ProviderIncompatibleException(Strings.Mapping_ProviderReturnsNullType(ToString())); } if (!TypeSemantics.IsNullable(this)) { result = Create( result.EdmType, OverrideFacetValues( result.Facets, new FacetValues { Nullable = false })); } } else if (Helper.IsEntityTypeBase(edmType) || Helper.IsComplexType(edmType)) { result = this; } else { Debug.Assert(false, "Unexpected type found in entity data reader"); return(null); } Interlocked.CompareExchange(ref _modelTypeUsage, result, null); } return(_modelTypeUsage); }
// Token: 0x06000DEE RID: 3566 RVA: 0x00029D5F File Offset: 0x00027F5F protected override LocalizedString GetErrorMessageForWrongType(string id) { return(Strings.WrongTypeSecurityPrincipal(id)); }
/** * basic constructor - with bytes. */ public DerIA5String( byte[] str) : this(Strings.FromAsciiByteArray(str), false) { }
private void doLoad() { short x = 0; bool loading = false; string tmp = null; loading = true; lstStockItem.Visible = false; this.lstStockItem.Items.Clear(); int m = 0; switch (this.tbStockItem.Tag) { case Convert.ToString(1): for (x = 0; x <= Information.UBound(dataArray) - 1; x++) { if (dataArray[x, 2]) { if (Strings.InStr(Strings.UCase(dataArray[x, 1]), Strings.UCase(this.txtSearch.Text))) { tmp = dataArray[x, 1].ToString() + x.ToString(); m = lstStockItem.Items.Add(tmp); lstStockItem.SetItemChecked(m, dataArray[x, 2]); } } } break; case Convert.ToString(2): for (x = 0; x <= Information.UBound(dataArray) - 1; x++) { if (dataArray[x, 2]) { } else { if (Strings.InStr(Strings.UCase(dataArray[x, 1]), Strings.UCase(this.txtSearch.Text))) { tmp = dataArray[x, 1].ToString() + x.ToString(); m = lstStockItem.Items.Add(tmp); lstStockItem.SetItemChecked(m, dataArray[x, 2]); } } } break; default: for (x = 0; x <= Information.UBound(dataArray) - 1; x++) { if (Strings.InStr(Strings.UCase(dataArray[x, 1]), Strings.UCase(this.txtSearch.Text))) { tmp = dataArray[x, 1].ToString() + x.ToString(); m = lstStockItem.Items.Add(tmp); lstStockItem.SetItemChecked(m, dataArray[x, 2]); } } break; } if (lstStockItem.SelectedIndex) { lstStockItem.SelectedIndex = 0; } lstStockItem.Visible = true; loading = false; }
public static object ExtractMacAddressStringFromBytes(PropValue value, MapiPropertyDefinition propertyDefinition) { if (!(typeof(string) == propertyDefinition.Type)) { throw MapiPropValueConvertor.ConstructExtractingException(value, propertyDefinition, Strings.ConstantNa); } byte[] bytes = value.GetBytes(); if (6 == bytes.Length) { return(string.Format("{0:X2}-{1:X2}-{2:X2}-{3:X2}-{4:X2}-{5:X2}", new object[] { bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5] })); } throw MapiPropValueConvertor.ConstructExtractingException(value, propertyDefinition, Strings.ErrorByteArrayLength(6.ToString(), bytes.Length.ToString())); }
public static object ExtractIpV4StringFromIpV6Bytes(PropValue value, MapiPropertyDefinition propertyDefinition) { if (!(typeof(string) == propertyDefinition.Type)) { throw MapiPropValueConvertor.ConstructExtractingException(value, propertyDefinition, Strings.ConstantNa); } byte[] bytes = value.GetBytes(); if (16 == bytes.Length) { return(string.Format("{0}.{1}.{2}.{3}", new object[] { bytes[4], bytes[5], bytes[6], bytes[7] })); } throw MapiPropValueConvertor.ConstructExtractingException(value, propertyDefinition, Strings.ErrorByteArrayLength(16.ToString(), bytes.Length.ToString())); }
public static KeyParameter MakeKeyFromPassPhrase( SymmetricKeyAlgorithmTag algorithm, S2k s2k, char[] passPhrase) { int keySize = GetKeySize(algorithm); byte[] pBytes = Strings.ToByteArray(new string(passPhrase)); byte[] keyBytes = new byte[(keySize + 7) / 8]; int generatedBytes = 0; int loopCount = 0; while (generatedBytes < keyBytes.Length) { IDigest digest; if (s2k != null) { string digestName = GetDigestName(s2k.HashAlgorithm); try { digest = DigestUtilities.GetDigest(digestName); } catch (Exception e) { throw new PgpException("can't find S2k digest", e); } for (int i = 0; i != loopCount; i++) { digest.Update(0); } byte[] iv = s2k.GetIV(); switch (s2k.Type) { case S2k.Simple: digest.BlockUpdate(pBytes, 0, pBytes.Length); break; case S2k.Salted: digest.BlockUpdate(iv, 0, iv.Length); digest.BlockUpdate(pBytes, 0, pBytes.Length); break; case S2k.SaltedAndIterated: long count = s2k.IterationCount; digest.BlockUpdate(iv, 0, iv.Length); digest.BlockUpdate(pBytes, 0, pBytes.Length); count -= iv.Length + pBytes.Length; while (count > 0) { if (count < iv.Length) { digest.BlockUpdate(iv, 0, (int)count); break; } else { digest.BlockUpdate(iv, 0, iv.Length); count -= iv.Length; } if (count < pBytes.Length) { digest.BlockUpdate(pBytes, 0, (int)count); count = 0; } else { digest.BlockUpdate(pBytes, 0, pBytes.Length); count -= pBytes.Length; } } break; default: throw new PgpException("unknown S2k type: " + s2k.Type); } } else { try { digest = DigestUtilities.GetDigest("MD5"); for (int i = 0; i != loopCount; i++) { digest.Update(0); } digest.BlockUpdate(pBytes, 0, pBytes.Length); } catch (Exception e) { throw new PgpException("can't find MD5 digest", e); } } byte[] dig = DigestUtilities.DoFinal(digest); if (dig.Length > (keyBytes.Length - generatedBytes)) { Array.Copy(dig, 0, keyBytes, generatedBytes, keyBytes.Length - generatedBytes); } else { Array.Copy(dig, 0, keyBytes, generatedBytes, dig.Length); } generatedBytes += dig.Length; loopCount++; } Array.Clear(pBytes, 0, pBytes.Length); return(MakeKey(algorithm, keyBytes)); }
public FailedToCreateAdminAuditLogItemException(string responseclass, string code, string error, Exception innerException) : base(Strings.FailedToCreateAdminAuditLogItem(responseclass, code, error), innerException) { this.responseclass = responseclass; this.code = code; this.error = error; }
/// <summary> /// Habilita la pagina /// </summary> /// <param name="levelIndex">Indice del nivel a cargar en la pagina</param> private void EnablePage(int levelIndex) { anim.SetBool("Enabled", true); //Asigna valor a los textos de la pagina for (int i = 0; i < transArray.Length; i++) { switch (transArray[i].name) { case "LevelText": transArray[i].gameObject.GetComponent <TextMeshProUGUI>().text = (Strings.GetString(TEXT_TAG.TXT_LEVEL)) + " " + (LSM.WorldIndex + 1) + "-" + (levelIndex + 1); break; case "InfoText": transArray[i].gameObject.GetComponent <TextMeshProUGUI>().text = levelIndex < 4 ? Strings.GetString(TEXT_TAG.TXT_LEVEL_BLOCKED_INFO) : Strings.GetString(TEXT_TAG.TXT_SPECIAL_LEVEL_BLOCKED_INFO); break; case "TextBlocked": transArray[i].gameObject.GetComponent <TextMeshProUGUI>().text = Strings.GetString(TEXT_TAG.TXT_LEVEL_BLOCKED); break; } } }
private Options.ExplicitOptions GenerateOptions(Project.Configuration conf, FileInfo projectFileInfo) { Options.ExplicitOptions options = new Options.ExplicitOptions(); // CompilerToUse SelectOption(conf, Options.Option(Options.Makefile.General.PlatformToolset.Gcc, () => { options["CompilerToUse"] = "g++"; }), Options.Option(Options.Makefile.General.PlatformToolset.Clang, () => { options["CompilerToUse"] = "clang++"; }) ); // IntermediateDirectory options["IntermediateDirectory"] = PathMakeUnix(Util.PathGetRelative(projectFileInfo.DirectoryName, conf.IntermediatePath)); // OutputDirectory string outputDirectory = PathMakeUnix(GetOutputDirectory(conf, projectFileInfo)); options["OutputDirectory"] = outputDirectory; #region Compiler // Defines Strings defines = new Strings(); defines.AddRange(conf.Defines); defines.InsertPrefix("-D"); options["Defines"] = defines.JoinStrings(" "); // Includes OrderableStrings includePaths = new OrderableStrings(); includePaths.AddRange(Util.PathGetRelative(projectFileInfo.DirectoryName, Util.PathGetCapitalized(conf.IncludePrivatePaths))); includePaths.AddRange(Util.PathGetRelative(projectFileInfo.DirectoryName, Util.PathGetCapitalized(conf.IncludePaths))); includePaths.AddRange(Util.PathGetRelative(projectFileInfo.DirectoryName, Util.PathGetCapitalized(conf.DependenciesIncludePaths))); PathMakeUnix(includePaths); includePaths.InsertPrefix("-I"); options["Includes"] = includePaths.JoinStrings(" "); if (conf.ForcedIncludes.Count > 0) { OrderableStrings relativeForceIncludes = new OrderableStrings(Util.PathGetRelative(projectFileInfo.DirectoryName, conf.ForcedIncludes)); PathMakeUnix(relativeForceIncludes); relativeForceIncludes.InsertPrefix("-include "); options["Includes"] += " " + relativeForceIncludes.JoinStrings(" "); } // CFLAGS { StringBuilder cflags = new StringBuilder(); // ExtraWarnings SelectOption(conf, Options.Option(Options.Makefile.Compiler.ExtraWarnings.Enable, () => { cflags.Append("-Wextra "); }), Options.Option(Options.Makefile.Compiler.ExtraWarnings.Disable, () => { cflags.Append(""); }) ); // GenerateDebugInformation SelectOption(conf, Options.Option(Options.Makefile.Compiler.GenerateDebugInformation.Enable, () => { cflags.Append("-g "); }), Options.Option(Options.Makefile.Compiler.GenerateDebugInformation.Disable, () => { cflags.Append(""); }) ); // OptimizationLevel SelectOption(conf, Options.Option(Options.Makefile.Compiler.OptimizationLevel.Disable, () => { cflags.Append(""); }), Options.Option(Options.Makefile.Compiler.OptimizationLevel.Standard, () => { cflags.Append("-O1 "); }), Options.Option(Options.Makefile.Compiler.OptimizationLevel.Full, () => { cflags.Append("-O2 "); }), Options.Option(Options.Makefile.Compiler.OptimizationLevel.FullWithInlining, () => { cflags.Append("-O3 "); }), Options.Option(Options.Makefile.Compiler.OptimizationLevel.ForSize, () => { cflags.Append("-Os "); }) ); // Warnings SelectOption(conf, Options.Option(Options.Makefile.Compiler.Warnings.NormalWarnings, () => { cflags.Append(""); }), Options.Option(Options.Makefile.Compiler.Warnings.MoreWarnings, () => { cflags.Append("-Wall "); }), Options.Option(Options.Makefile.Compiler.Warnings.Disable, () => { cflags.Append("-w "); }) ); // WarningsAsErrors SelectOption(conf, Options.Option(Options.Makefile.Compiler.TreatWarningsAsErrors.Enable, () => { cflags.Append("-Werror "); }), Options.Option(Options.Makefile.Compiler.TreatWarningsAsErrors.Disable, () => { cflags.Append(""); }) ); // AdditionalCompilerOptions cflags.Append(conf.AdditionalCompilerOptions.JoinStrings(" ")); options["CFLAGS"] = cflags.ToString(); } // CXXFLAGS { StringBuilder cxxflags = new StringBuilder(); // CppLanguageStandard SelectOption(conf, Options.Option(Options.Makefile.Compiler.CppLanguageStandard.Cpp17, () => { cxxflags.Append("-std=c++17 "); }), Options.Option(Options.Makefile.Compiler.CppLanguageStandard.Cpp14, () => { cxxflags.Append("-std=c++14 "); }), Options.Option(Options.Makefile.Compiler.CppLanguageStandard.Cpp11, () => { cxxflags.Append("-std=c++11 "); }), Options.Option(Options.Makefile.Compiler.CppLanguageStandard.Cpp98, () => { cxxflags.Append("-std=c++98 "); }), Options.Option(Options.Makefile.Compiler.CppLanguageStandard.GnuCpp11, () => { cxxflags.Append("-std=gnu++11 "); }), Options.Option(Options.Makefile.Compiler.CppLanguageStandard.GnuCpp98, () => { cxxflags.Append("-std=gnu++98 "); }), Options.Option(Options.Makefile.Compiler.CppLanguageStandard.Default, () => { cxxflags.Append(""); }) ); // Exceptions SelectOption(conf, Options.Option(Options.Makefile.Compiler.Exceptions.Enable, () => { cxxflags.Append("-fexceptions "); }), Options.Option(Options.Makefile.Compiler.Exceptions.Disable, () => { cxxflags.Append("-fno-exceptions "); }) ); // RTTI SelectOption(conf, Options.Option(Options.Makefile.Compiler.Rtti.Enable, () => { cxxflags.Append("-frtti "); }), Options.Option(Options.Makefile.Compiler.Rtti.Disable, () => { cxxflags.Append("-fno-rtti "); }) ); options["CXXFLAGS"] = cxxflags.ToString(); } #endregion #region Linker // OutputFile options["OutputFile"] = FormatOutputFileName(conf); // DependenciesLibraryFiles OrderableStrings dependenciesLibraryFiles = new OrderableStrings(conf.DependenciesLibraryFiles); PathMakeUnix(dependenciesLibraryFiles); dependenciesLibraryFiles.InsertPrefix("-l"); options["DependenciesLibraryFiles"] = dependenciesLibraryFiles.JoinStrings(" "); // LibraryFiles OrderableStrings libraryFiles = new OrderableStrings(conf.LibraryFiles); libraryFiles.InsertPrefix("-l"); options["LibraryFiles"] = libraryFiles.JoinStrings(" "); // LibraryPaths OrderableStrings libraryPaths = new OrderableStrings(); libraryPaths.AddRange(Util.PathGetRelative(projectFileInfo.DirectoryName, conf.LibraryPaths)); libraryPaths.AddRange(Util.PathGetRelative(projectFileInfo.DirectoryName, conf.DependenciesOtherLibraryPaths)); libraryPaths.AddRange(Util.PathGetRelative(projectFileInfo.DirectoryName, conf.DependenciesBuiltTargetsLibraryPaths)); PathMakeUnix(libraryPaths); libraryPaths.InsertPrefix("-L"); options["LibraryPaths"] = libraryPaths.JoinStrings(" "); // Dependencies var deps = new OrderableStrings(); foreach (Project.Configuration depConf in conf.ResolvedDependencies) { switch (depConf.Output) { case Project.Configuration.OutputType.None: continue; case Project.Configuration.OutputType.Lib: case Project.Configuration.OutputType.Dll: case Project.Configuration.OutputType.DotNetClassLibrary: deps.Add(Path.Combine(depConf.TargetLibraryPath, FormatOutputFileName(depConf)), depConf.TargetFileOrderNumber); break; default: deps.Add(Path.Combine(depConf.TargetPath, FormatOutputFileName(depConf)), depConf.TargetFileOrderNumber); break; } } var depsRelative = Util.PathGetRelative(projectFileInfo.DirectoryName, deps); PathMakeUnix(depsRelative); options["LDDEPS"] = depsRelative.JoinStrings(" "); // LinkCommand if (conf.Output == Project.Configuration.OutputType.Lib) { options["LinkCommand"] = Template.Project.LinkCommandLib; } else { options["LinkCommand"] = Template.Project.LinkCommandExe; } string linkerAdditionalOptions = conf.AdditionalLinkerOptions.JoinStrings(" "); options["AdditionalLinkerOptions"] = linkerAdditionalOptions; // this is supported in both gcc and clang SelectOption(conf, Options.Option(Options.Makefile.Linker.LibGroup.Enable, () => { options["LibsStartGroup"] = " -Wl,--start-group "; options["LibsEndGroup"] = " -Wl,--end-group "; }), Options.Option(Options.Makefile.Linker.LibGroup.Disable, () => { options["LibsStartGroup"] = string.Empty; options["LibsEndGroup"] = string.Empty; }) ); #endregion return(options); }
public IEnumerator <LocalizedString> GetEnumerator() { return(Strings.GetEnumerator()); }
public static void AddApplicationError(this HttpResponse response, string message) { response.Headers.Add("Application-Error", Strings.RemoveAllNonPrintableCharacters(message)); response.Headers.Add("access-control-expose-headers", "Application-Error"); }
public InvalidVersionException(string version, string format, Exception innerException) : base(Strings.InvalidVersion(version, format), innerException) { this.version = version; this.format = format; }
public byte[] GetOctets() { return(Strings.ToAsciiByteArray(str)); }
/* * Format style note * ---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ---- * Comment: ******* * <base64-encoded body> * ---- END SSH2 ENCRYPTED PRIVATE KEY ---- * * body = MAGIC_VAL || body-length || type(string) || encryption-algorithm-name(string) || encrypted-body(string) * encrypted-body = array of BigInteger(algorithm-specific) */ public static SSH2UserAuthKey FromSECSHStyleStream(Stream strm, string passphrase) { StreamReader r = new StreamReader(strm, Encoding.ASCII); string l = r.ReadLine(); if (l == null || (l != "---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----")) { throw new SSHException("Wrong key format"); } l = r.ReadLine(); StringBuilder buf = new StringBuilder(); while (l != "---- END SSH2 ENCRYPTED PRIVATE KEY ----") { if (l.IndexOf(':') == -1) { buf.Append(l); } else { while (l.EndsWith("\\")) { l = r.ReadLine(); } } l = r.ReadLine(); if (l == null) { throw new SSHException("Key is broken"); } } r.Close(); byte[] keydata = Base64.Decode(Encoding.ASCII.GetBytes(buf.ToString())); //Debug.WriteLine(DebugUtil.DumpByteArray(keydata)); /* * FileStream fs = new FileStream("C:\\IOPort\\keydata1.bin", FileMode.Create); * fs.Write(keydata, 0, keydata.Length); * fs.Close(); */ SSH2DataReader re = new SSH2DataReader(keydata); int magic = re.ReadInt32(); if (magic != MAGIC_VAL) { throw new SSHException("key file is broken"); } int privateKeyLen = re.ReadInt32(); string type = Encoding.ASCII.GetString(re.ReadString()); string ciphername = Encoding.ASCII.GetString(re.ReadString()); int bufLen = re.ReadInt32(); if (ciphername != "none") { CipherAlgorithm algo = CipherFactory.SSH2NameToAlgorithm(ciphername); byte[] key = PassphraseToKey(passphrase, CipherFactory.GetKeySize(algo)); Cipher c = CipherFactory.CreateCipher(SSHProtocol.SSH2, algo, key); byte[] tmp = new Byte[re.Image.Length - re.Offset]; c.Decrypt(re.Image, re.Offset, re.Image.Length - re.Offset, tmp, 0); re = new SSH2DataReader(tmp); } int parmLen = re.ReadInt32(); if (parmLen < 0 || parmLen > re.Rest) { throw new SSHException(Strings.GetString("WrongPassphrase")); } if (type.IndexOf("if-modn") != -1) { //mindterm mistaken this order of BigIntegers BigInteger e = re.ReadBigIntWithBits(); BigInteger d = re.ReadBigIntWithBits(); BigInteger n = re.ReadBigIntWithBits(); BigInteger u = re.ReadBigIntWithBits(); BigInteger p = re.ReadBigIntWithBits(); BigInteger q = re.ReadBigIntWithBits(); return(new SSH2UserAuthKey(new RSAKeyPair(e, d, n, u, p, q))); } else if (type.IndexOf("dl-modp") != -1) { if (re.ReadInt32() != 0) { throw new SSHException("DSS Private Key File is broken"); } BigInteger p = re.ReadBigIntWithBits(); BigInteger g = re.ReadBigIntWithBits(); BigInteger q = re.ReadBigIntWithBits(); BigInteger y = re.ReadBigIntWithBits(); BigInteger x = re.ReadBigIntWithBits(); return(new SSH2UserAuthKey(new DSAKeyPair(p, g, q, y, x))); } else { throw new SSHException("unknown authentication method " + type); } }
private static UnlockerPointOfInterest ReadUnlockerPointOfInterest( JsonElement json, MissingMemberBehavior missingMemberBehavior ) { OptionalMember <string> name = new("name"); RequiredMember <int> floor = new("floor"); RequiredMember <PointF> coordinates = new("coord"); RequiredMember <int> id = new("id"); RequiredMember <string> chatLink = new("chat_link"); RequiredMember <string> icon = new("icon"); foreach (var member in json.EnumerateObject()) { if (member.NameEquals("type")) { if (!member.Value.ValueEquals("unlock")) { throw new InvalidOperationException( Strings.InvalidDiscriminator(member.Value.GetString()) ); } } else if (member.NameEquals(name.Name)) { name.Value = member.Value; } else if (member.NameEquals(floor.Name)) { floor.Value = member.Value; } else if (member.NameEquals(coordinates.Name)) { coordinates.Value = member.Value; } else if (member.NameEquals(id.Name)) { id.Value = member.Value; } else if (member.NameEquals(chatLink.Name)) { chatLink.Value = member.Value; } else if (member.NameEquals(icon.Name)) { icon.Value = member.Value; } else if (missingMemberBehavior == MissingMemberBehavior.Error) { throw new InvalidOperationException(Strings.UnexpectedMember(member.Name)); } } return(new UnlockerPointOfInterest { Id = id.GetValue(), Name = name.GetValueOrEmpty(), Floor = floor.GetValue(), Coordinates = coordinates.Select(value => ReadPointF(value, missingMemberBehavior)), ChatLink = chatLink.GetValue(), Icon = icon.GetValue() }); }
protected override void InternalValidate() { if (this.Server != null) { Server server = (Server)base.GetDataObject <Server>(this.Server, base.GlobalConfigSession, null, new LocalizedString?(Strings.ErrorServerNotFound(this.Server.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(this.Server.ToString()))); this.internalFilter = new ComparisonFilter(ComparisonOperator.Equal, OfflineAddressBookSchema.Server, server.Id); } base.InternalValidate(); }
public ExchangeSettingsAssemblyNotFoundException(string name, string path, string type, Exception innerException) : base(Strings.ExchangeSettingsAssemblyNotFound(name, path, type), innerException) { this.name = name; this.path = path; this.type = type; }
public static void Render() { GL.BeginVertical("box"); GL.BeginHorizontal(); GL.Label(RichText.MainCategoryFormat(Strings.GetText("mainCategory_DevTools"))); GL.FlexibleSpace(); MenuTools.AddFavouriteButton("DevToolsRender"); GL.EndHorizontal(); MenuTools.ToggleButton(ref settings.toggleDevTools, "misc_Enable", "tooltip_DevTools"); if (Strings.ToBool(settings.toggleDevTools)) { MenuTools.SingleLineLabel(Strings.GetText("label_SmartConsoleInfo")); GL.Space(10); MenuTools.ToggleButton(ref settings.toggleDevToolsLogToUMM, "buttonToggle_LogToUMM", "tooltip_LogToUMM"); GL.Space(10); if (GL.Button( MenuTools.TextWithTooltip("buttonToggle_UberLogger", "tooltip_UberLogger", $"{settings.toggleUberLogger}" + " "), GL.ExpandWidth(false))) { if (settings.toggleUberLogger == Storage.isFalseString) { UberLogger.Logger.Enabled = true; settings.toggleUberLogger = Storage.isTrueString; } else if (settings.toggleUberLogger == Storage.isTrueString) { UberLogger.Logger.ForwardMessages = false; UberLogger.Logger.Enabled = false; settings.toggleUberLoggerForwardPrefix = Storage.isFalseString; settings.toggleUberLoggerForward = Storage.isFalseString; settings.toggleUberLogger = Storage.isFalseString; } } if (Strings.ToBool(settings.toggleUberLogger)) { if (GL.Button( MenuTools.TextWithTooltip("buttonToggle_UberLoggerForward", "tooltip_UberLoggerForward", $"{settings.toggleUberLoggerForward}" + " "), GL.ExpandWidth(false))) { if (settings.toggleUberLoggerForward == Storage.isFalseString) { UberLogger.Logger.ForwardMessages = true; settings.toggleUberLoggerForward = Storage.isTrueString; } else if (settings.toggleUberLogger == Storage.isTrueString) { UberLogger.Logger.ForwardMessages = false; settings.toggleUberLoggerForwardPrefix = Storage.isFalseString; settings.toggleUberLoggerForward = Storage.isFalseString; } } if (Strings.ToBool(settings.toggleUberLoggerForward)) { MenuTools.ToggleButton(ref settings.toggleUberLoggerForwardPrefix, "buttonToggle_UberLoggerForwardPrefix", "tooltip_UberLoggerForwardPrefix"); } } if (settings.settingShowDebugInfo) { GL.Space(10); MenuTools.SingleLineLabel("Application.persistentDataPath: " + UnityEngine.Application.persistentDataPath); MenuTools.SingleLineLabel("UberLogger.Logger.Enable: " + UberLogger.Logger.Enabled); MenuTools.SingleLineLabel("UberLogger.Logger.ForwardMessages: " + UberLogger.Logger.ForwardMessages); } } GL.EndVertical(); }
public static void ClassSetup(TestContext _) { Logger.Setup(false, true); Strings.Setup(); AsaTelemetry.Setup(test: true); }
/// <summary> /// 转换为简体中文 /// </summary> /// <param name="text">繁体中文</param> public static string ToSimplifiedChinese(string text) { return(Strings.StrConv(text, VbStrConv.SimplifiedChinese)); }
protected override void InternalProcessRecord() { base.InternalProcessRecord(); ADComputer adcomputer = null; ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(this.DomainController, false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 213, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\SystemConfigurationTasks\\ComponentStates\\SetServerComponentState.cs"); string fqdn = this.serverId.Fqdn; string text = fqdn; int num = fqdn.IndexOf('.'); if (num > 0) { text = fqdn.Substring(0, num); } Server server = topologyConfigurationSession.FindServerByName(text); if (server == null) { topologyConfigurationSession.UseConfigNC = false; topologyConfigurationSession.UseGlobalCatalog = true; adcomputer = topologyConfigurationSession.FindComputerByHostName(text); if (adcomputer == null) { base.WriteError(new ADServerNotFoundException(fqdn), ErrorCategory.InvalidArgument, null); } } if (!this.LocalOnly) { if (server != null) { server.ComponentStates = ServerComponentStates.UpdateRemoteState(server.ComponentStates, this.Requester, this.Component, this.State); topologyConfigurationSession.Save(server); } else { adcomputer.ComponentStates = ServerComponentStates.UpdateRemoteState(adcomputer.ComponentStates, this.Requester, this.Component, this.State); topologyConfigurationSession.Save(adcomputer); } } if (!this.RemoteOnly) { string serverFqdn = (server != null) ? server.Fqdn : adcomputer.DnsHostName; TimeSpan invokeTimeout = TimeSpan.FromSeconds((double)this.TimeoutInSeconds); Exception ex = null; try { InvokeWithTimeout.Invoke(delegate() { ServerComponentStates.UpdateLocalState(serverFqdn, this.Requester, this.Component, this.State); }, null, invokeTimeout, true, null); } catch (IOException ex2) { ex = ex2; } catch (UnauthorizedAccessException ex3) { ex = ex3; } catch (SecurityException ex4) { ex = ex4; } if (ex != null && this.LocalOnly) { base.WriteError(new ArgumentException(Strings.SetServerComponentStateServerUnreachable(serverFqdn, ex.Message)), ErrorCategory.ResourceUnavailable, null); } } }
public void AddColumnMapping(ColumnMappingBuilder columnMappingBuilder) { Check.NotNull(columnMappingBuilder, "columnMappingBuilder"); if (!columnMappingBuilder.PropertyPath.Any() || _columnMappings.Contains(columnMappingBuilder)) { throw new ArgumentException(Strings.InvalidColumnBuilderArgument("columnBuilderMapping")); } DebugCheck.NotNull(columnMappingBuilder.ColumnProperty); _columnMappings.Add(columnMappingBuilder); StructuralTypeMapping structuralTypeMapping = this; EdmProperty property; // Turn the property path into a mapping fragment nested tree structure. var i = 0; for (; i < columnMappingBuilder.PropertyPath.Count - 1; i++) { // The first n-1 properties are complex so we just need to build // a corresponding tree of complex type mappings. property = columnMappingBuilder.PropertyPath[i]; var complexPropertyMapping = structuralTypeMapping .PropertyMappings .OfType <ComplexPropertyMapping>() .SingleOrDefault(pm => ReferenceEquals(pm.Property, property)); ComplexTypeMapping complexTypeMapping = null; if (complexPropertyMapping == null) { complexTypeMapping = new ComplexTypeMapping(false); complexTypeMapping.AddType(property.ComplexType); complexPropertyMapping = new ComplexPropertyMapping(property); complexPropertyMapping.AddTypeMapping(complexTypeMapping); structuralTypeMapping.AddPropertyMapping(complexPropertyMapping); } structuralTypeMapping = complexTypeMapping ?? complexPropertyMapping.TypeMappings.Single(); } // The last property has to be a scalar mapping to the target column. // Extract it and create the scalar mapping leaf node, ensuring that we // set the target column. property = columnMappingBuilder.PropertyPath[i]; var scalarPropertyMapping = structuralTypeMapping .PropertyMappings .OfType <ScalarPropertyMapping>() .SingleOrDefault(pm => ReferenceEquals(pm.Property, property)); if (scalarPropertyMapping == null) { scalarPropertyMapping = new ScalarPropertyMapping(property, columnMappingBuilder.ColumnProperty); structuralTypeMapping.AddPropertyMapping(scalarPropertyMapping); columnMappingBuilder.SetTarget(scalarPropertyMapping); } else { scalarPropertyMapping.Column = columnMappingBuilder.ColumnProperty; } }
/// <summary> /// 转换为繁体中文 /// </summary> /// <param name="text">简体中文</param> public static string ToTraditionalChinese(string text) { return(Strings.StrConv(text, VbStrConv.TraditionalChinese)); }