public Asset_Gif(string url, MaxSize maxSize, Action <ITexture, AssetPromise_Texture> OnSuccess, Action OnFail = null) { this.url = url; this.maxSize = maxSize; this.OnSuccessEvent = OnSuccess; this.OnFailEvent = OnFail; }
protected override void Execute(CodeActivityContext context) { var settings = new ConnectionSettings(new Uri(URL.Get(context))); settings.ThrowExceptions(alwaysThrow: true); settings.PrettyJson(); if (AuthenticationRequired.Get(context) == true) { settings.BasicAuthentication(Username.Get(context), Password.Get(context)); } var esClient = new ElasticClient(settings); var searchData = esClient.Search <UiPathESLog>(sd => sd .Index(Index.Get(context)) .Size(MaxSize.Get(context)) .Query(q => q. Match(m => m .Field(f => f.processName) .Query(ProcessName.Get(context) == string.Empty ? "*" : ProcessName.Get(context))) && q. Match(m => m .Field(f => f.robotName) .Query(RobotName.Get(context) == string.Empty ? "*" : RobotName.Get(context))) && q .DateRange(r => r .Field(f => f.timeStamp) .GreaterThanOrEquals(StartTime.Get(context)) .LessThanOrEquals(EndTime.Get(context))))); Logs.Set(context, searchData.Documents.ToArray()); }
private void OnGUI() { EditorGUILayout.Space(); EditorGUILayout.HelpBox("设置UI文件夹路径,Assets/Res/UI/ 为默认值", MessageType.Info); this.texturePath = EditorGUILayout.TextField("resources folder:", this.texturePath); EditorGUILayout.Space(); this.platform = (Platform)EditorGUILayout.EnumPopup("平台:", this.platform); textureType = (TextureImporterType)EditorGUILayout.EnumPopup("类型:", textureType); textureFormat = (TextureImporterFormat)EditorGUILayout.EnumPopup("格式:", textureFormat); textureSize = (MaxSize)EditorGUILayout.EnumPopup("尺寸:", textureSize); textureCompression = (TextureImporterCompression)EditorGUILayout.EnumPopup("压缩:", textureCompression); ifAllowsAlphaSplitting = EditorGUILayout.Toggle("是否允许透明分离:", ifAllowsAlphaSplitting); ifMipmapEnabled = EditorGUILayout.Toggle("是否允许Mipmap:", ifMipmapEnabled); over_ride = EditorGUILayout.Toggle("是否允许Override:", this.over_ride); EditorGUILayout.Space(); if (GUILayout.Button("设置")) { TextureImporterPlatformSettings t = new TextureImporterPlatformSettings(); t.allowsAlphaSplitting = ifAllowsAlphaSplitting; t.overridden = over_ride; t.format = textureFormat; t.maxTextureSize = (int)textureSize; t.textureCompression = textureCompression; this.ChangeTextureFormatSettings(t); } }
private void OnGUI() { EditorGUILayout.Space(); EditorGUILayout.HelpBox("设置选中图片或选中路径下的图片属性", MessageType.Info); EditorGUILayout.Space(); textureType = (TextureImporterType)EditorGUILayout.EnumPopup("类型:", textureType); textureFormat = (TextureImporterFormat)EditorGUILayout.EnumPopup("格式:", textureFormat); textureSize = (MaxSize)EditorGUILayout.EnumPopup("尺寸:", textureSize); textureCompression = (TextureImporterCompression)EditorGUILayout.EnumPopup("压缩:", textureCompression); ifAllowsAlphaSplitting = EditorGUILayout.Toggle("是否允许透明分离:", ifAllowsAlphaSplitting); ifMipmapEnabled = EditorGUILayout.Toggle("是否允许Mipmap:", ifMipmapEnabled); packingTag = EditorGUILayout.TextField("PackTag:", packingTag); EditorGUILayout.Space(); if (GUILayout.Button("设置")) { TextureImporterPlatformSettings t = new TextureImporterPlatformSettings(); t.allowsAlphaSplitting = ifAllowsAlphaSplitting; t.format = textureFormat; t.maxTextureSize = (int)textureSize; t.textureCompression = textureCompression; SelectedChangeTextureFormatSettings(t, textureType); } }
public static string GetFileSize(long bytes, MaxSize maxsize) { if (bytes >= 1099511627776 && maxsize >= MaxSize.MsTera) { decimal size = decimal.Divide(bytes, 1099511627776); return($"{size:##.##} {OtherStrings.TerabyteShort}"); } if (bytes >= 1073741824 && maxsize >= MaxSize.MsGiga) { decimal size = decimal.Divide(bytes, 1073741824); return($"{size:N} {OtherStrings.GigabyteShort}"); } if (bytes >= 1048576 && maxsize >= MaxSize.MsMega) { decimal size = decimal.Divide(bytes, 1048576); return($"{size:##.##} {OtherStrings.MegabyteShort}"); } if (bytes >= 1024 && maxsize >= MaxSize.MsKilo) { decimal size = decimal.Divide(bytes, 1024); return($"{size:##.##} {OtherStrings.KilobyteShort}"); } if (bytes > 0 && maxsize >= MaxSize.MsByte) { decimal size = bytes; return($"{size:##.##} {OtherStrings.Byte[0]}"); } return("0.00 " + OtherStrings.Byte[0]); }
void OnGUI_Filter() { GUILayout.BeginHorizontal(); GUILayout.Label("最大尺寸", GUILayout.Width(columnWidth)); sizeFilter = (MaxSize)EditorGUILayout.EnumPopup("", sizeFilter, GUILayout.Width(columnWidth)); above = GUILayout.Toggle(above, "以上"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("搜索文件夹", GUILayout.Width(buttonWidth + 20))) { Clear(); EditorUtility.DisplayProgressBar("Searching", "Searching Textures", 0); Texture[] ts = Selection.GetFiltered <Texture> (SelectionMode.DeepAssets); ProcessAllTex(ts); } if (GUILayout.Button("搜索场景", GUILayout.Width(buttonWidth + 20))) { Clear(); EditorUtility.DisplayProgressBar("Searching", "Searching Textures", 0); Texture[] ts = LsyTextureCommon.GetSceneTextures(); ProcessAllTex(ts); } if (GUILayout.Button("清除", GUILayout.Width(buttonWidth))) { Clear(); } GUILayout.EndHorizontal(); }
protected override void OutputResult(AsyncCodeActivityContext context) { //Parse collection options if defined var capped = Capped.Get(context); if (capped is null) { capped = true; } var maxSize = MaxSize.Get(context); if (maxSize is null) { maxSize = 1024; } var maxCount = MaxCount.Get(context); if (maxCount is null) { maxCount = 1000; } var database = Database.Get(context); var collection = Collection.Get(context); var mongoProperty = context.DataContext.GetProperties()[ParentScope.ParentContainerPropertyTag].GetValue(context.DataContext) as MongoProperty; var connectionString = mongoProperty.URL; var mongoClient = new MongoClient(connectionString); mongoClient.GetDatabase(database).CreateCollectionAsync(collection, new CreateCollectionOptions { Capped = capped, MaxSize = maxSize, MaxDocuments = maxCount, }).Wait(); }
public static string GetFileSize(long bytes, MaxSize maxsize) { if (bytes >= 1099511627776 && maxsize >= MaxSize.msTera) { Decimal size = Decimal.Divide(bytes, 1099511627776); return(String.Format("{0:##.##} {1}", size, OtherStrings.TerabyteShort)); } else if (bytes >= 1073741824 && maxsize >= MaxSize.msGiga) { Decimal size = Decimal.Divide(bytes, 1073741824); return(String.Format("{0:##.##} {1}", size, OtherStrings.GigabyteShort)); } else if (bytes >= 1048576 && maxsize >= MaxSize.msMega) { Decimal size = Decimal.Divide(bytes, 1048576); return(String.Format("{0:##.##} {1}", size, OtherStrings.MegabyteShort)); } else if (bytes >= 1024 && maxsize >= MaxSize.msKilo) { Decimal size = Decimal.Divide(bytes, 1024); return(String.Format("{0:##.##} {1}", size, OtherStrings.KilobyteShort)); } else if ((bytes > 0) && maxsize >= MaxSize.msByte) { Decimal size = bytes; return(String.Format("{0:##.##} {1}", size, OtherStrings.Byte[0])); } else { return("0 " + OtherStrings.Byte[0]); } }
public void Save(XmlDocument doc) { Config.SafeNodeSelect(doc, "/Settings/History/MaxSize", MaxSize.ToString()); Config.SafeNodeSelect(doc, "/Settings/History/SaveOnExit", SaveOnExit.ToString()); XmlNode n = Config.SafeNodeSelect(doc, "/Settings/History/Files"); n.RemoveAll(); //delete all history if (SaveOnExit) { foreach (TextRepresentationEntry tre in history) { XmlElement e = doc.CreateElement("File"); e.InnerText = tre.FullName; if (tre.ArchiveFile != String.Empty) { XmlAttribute attrib = doc.CreateAttribute("archive"); attrib.Value = tre.ArchiveFile; e.Attributes.Append(attrib); } n.AppendChild(e); } } }
public void GetMaxSize_Should_Find_And_Return_The_Correxct_MaxSize() { var fake = new MaxSize("MyMaxSize1"); var actual = new MaxSize("MyMaxSize"); _sut._maxSizes.Add(fake); _sut._maxSizes.Add(actual); Assert.AreEqual(actual,_sut.GetMaxSize("MyMaxSize")); }
public void WithMaxSize_Should_Add_MaxSize_And_Set_Parent() { var actual = new MaxSize("MyMaxSize"); _sut.With(() => actual); Assert.AreEqual(1, _sut._maxSizes.Count); Assert.AreEqual(actual, _sut.GetMaxSize("MyMaxSize")); Assert.AreEqual(_sut, actual.Parent); }
public override int GetHashCode() { unchecked { var hashCode = ImageSizeRange.GetHashCode(); hashCode = (hashCode * 397) ^ SizeSpecificImageMaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ MaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ MaxFilenameLength.GetHashCode(); return(hashCode); } }
protected static void RegisterPropertyType <T>( string typeName, int format, MaxSize <T> maxSize, FromBytes <T> fromBytes, ToBytes <T> toBytes ) { Converter <T> .Format = format; Converter <T> .TypeName = typeName; Converter <T> .MaxSize = maxSize; Converter <T> .FromBytes = fromBytes; Converter <T> .ToBytes = toBytes; }
public void AddValidation(ClientModelValidationContext context) { CustomAttributes.MergeAttribute(context.Attributes, "data-val", "true"); var errorMessage = FormatErrorMessage(context.ModelMetadata.GetDisplayName()); CustomAttributes.MergeAttribute(context.Attributes, "data-val-minsize", MinSize.ToString()); CustomAttributes.MergeAttribute(context.Attributes, "data-val-maxsize", MaxSize.ToString()); CustomAttributes.MergeAttribute(context.Attributes, "data-val-maxfilesize", MaxFileSize.ToString()); CustomAttributes.MergeAttribute(context.Attributes, "data-val-canbenull", CanBeNull.ToString()); CustomAttributes.MergeAttribute(context.Attributes, "data-val-photovalidation", errorMessage); //todo: client side part not implemented }
public IDictionary <string, string> GetArguments() { var arguments = new Dictionary <string, string>(); arguments["max-size"] = MaxSize.ToString(); arguments["player-sort"] = PlayerSort; arguments["initial-state"] = InitialState; arguments["fixed-pixels"] = string.Join(string.Empty, FixedPixels.Select(p => CLIObject.ToString(p, "X", "Y")).ToArray() ); return(arguments); }
public override int GetHashCode() { unchecked { var hashCode = MaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ BinaryExists.GetHashCode(); hashCode = (hashCode * 397) ^ ValidArticle.GetHashCode(); hashCode = (hashCode * 397) ^ ContainsIndexFile.GetHashCode(); hashCode = (hashCode * 397) ^ MaxFilenameLength.GetHashCode(); hashCode = (hashCode * 397) ^ (SupportedFileFormats?.GetHashCode() ?? 0); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = ImageSizeRange.GetHashCode(); hashCode = (hashCode * 397) ^ BinaryExists.GetHashCode(); hashCode = (hashCode * 397) ^ ValidImage.GetHashCode(); hashCode = (hashCode * 397) ^ ExtensionMatchContentFormat.GetHashCode(); hashCode = (hashCode * 397) ^ MaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ MaxFilenameLength.GetHashCode(); return(hashCode); } }
/// <summary> /// returns the string representation of the statistics. /// </summary> /// <returns></returns> public override string ToString() { lock (this) { System.Text.StringBuilder ret = new System.Text.StringBuilder(); ret.Append("Stats[Sch:" + ClassName + ", Cnt:" + Count.ToString() + ", "); ret.Append("Hi:" + HiCount.ToString() + ", "); ret.Append("MxS:" + MaxSize.ToString() + ", "); ret.Append("MxC:" + MaxCount.ToString() + ", "); ret.Append("Hit:" + HitCount.ToString() + ", "); ret.Append("Miss:" + MissCount.ToString() + "]"); return(ret.ToString()); } }
public string ListCalculateData(int index) { string[] list = new string[8]; list[0] = AdversaryX.ToString(); list[1] = AdversaryY.ToString(); list[2] = InitialSpeed.ToString(); list[3] = AltilleryX.ToString(); list[4] = AltilleryY.ToString(); list[5] = ProjectileAngle.ToString(); list[6] = FlightDuration.ToString(); list[7] = MaxSize.ToString(); return(list[index]); }
public override int GetHashCode() { unchecked { var hashCode = MaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ BinaryExists.GetHashCode(); hashCode = (hashCode * 397) ^ ValidImage.GetHashCode(); hashCode = (hashCode * 397) ^ ExtensionMatchContentFormat.GetHashCode(); hashCode = (hashCode * 397) ^ MaxFilenameLength.GetHashCode(); hashCode = (hashCode * 397) ^ (SupportedFileFormats?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (SupportedImageSizes?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ IsAlphaChannelRequired.GetHashCode(); return(hashCode); } }
/// <summary> /// Returns the hash code for this instance. /// </summary> /// <returns> /// A 32-bit signed integer that is the hash code for this instance. /// </returns> public override int GetHashCode() { unchecked { var hashCode = Size.GetHashCode(); hashCode = (hashCode * 397) ^ MaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ (RestrictedSizes?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (int)ResizeMode; hashCode = (hashCode * 397) ^ (int)AnchorPosition; hashCode = (hashCode * 397) ^ Upscale.GetHashCode(); hashCode = (hashCode * 397) ^ (CenterCoordinates?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ AnchorPoint.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = MaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ MaxFilenameLength.GetHashCode(); hashCode = (hashCode * 397) ^ BinaryExists.GetHashCode(); hashCode = (hashCode * 397) ^ ValidImage.GetHashCode(); hashCode = (hashCode * 397) ^ WithoutBitmaps.GetHashCode(); hashCode = (hashCode * 397) ^ WithoutNonRenderedElements.GetHashCode(); hashCode = (hashCode * 397) ^ WithoutUrlInStyles.GetHashCode(); hashCode = (hashCode * 397) ^ WithoutGradient.GetHashCode(); hashCode = (hashCode * 397) ^ PathsAreClosed.GetHashCode(); hashCode = (hashCode * 397) ^ (SupportedFileFormats != null ? SupportedFileFormats.GetHashCode() : 0); return(hashCode); } }
public void SetMaxTextureSize(MaxSize size) { if (!isLoaded) { return; } if (size == MaxSize.DONT_RESIZE) { return; } int texturesCount = gifTextures.Count; for (int i = 0; i < texturesCount; i++) { TextureHelpers.EnsureTexture2DMaxSize(ref gifTextures[i].m_texture2d, (int)size); } }
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of System.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (Path.Expression != null) { targetCommand.AddParameter("Path", Path.Get(context)); } if (FileFormat.Expression != null) { targetCommand.AddParameter("FileFormat", FileFormat.Get(context)); } if (MaxSize.Expression != null) { targetCommand.AddParameter("MaxSize", MaxSize.Get(context)); } if (InputObject.Expression != null) { targetCommand.AddParameter("InputObject", InputObject.Get(context)); } if (Force.Expression != null) { targetCommand.AddParameter("Force", Force.Get(context)); } if (Circular.Expression != null) { targetCommand.AddParameter("Circular", Circular.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
public void Save(XmlTextWriter writer) { writer.WriteElementString("maxSize", MaxSize.ToString()); writer.WriteElementString("playerSort", PlayerSort); writer.WriteElementString("initialState", InitialState); if (FixedPixels.Count > 0) { writer.WriteStartElement("fixedPixels"); foreach (var point in FixedPixels) { writer.WriteStartElement("pixel"); writer.WriteElementString("x", point.X.ToString()); writer.WriteElementString("y", point.Y.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); } }
protected override Task RunTestAsync( ImplicitPin implicitPin, DisposableDirectory directory, Func <Context, IContentSession, Task> funcAsync) { if (directory is not null) { return(Task.CompletedTask); } _tests.MaxSize = MaxSize.ToString(); _tests.ConfigureWithOneMaster(d => { d.UseFullEvictionSort = true; }); return(_tests.RunTestAsync(1, (testContext) => { return funcAsync(testContext, testContext.Sessions[0]); }, implicitPin)); }
public override int GetHashCode() { int hash = 1; if (MaxSize != 0) { hash ^= MaxSize.GetHashCode(); } if (IdleTimeout != 0UL) { hash ^= IdleTimeout.GetHashCode(); } if (MaxConcurrentStreamsLowWatermark != 0) { hash ^= MaxConcurrentStreamsLowWatermark.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Set the MongoDB logger options based on the key/value application configuration properties. /// </summary> /// <param name="configuration">Represents a set of key/value application configuration properties. See <see cref="IConfiguration"/>.</param> public override void ReadFromConfiguration(IConfiguration configuration) { var mongoConfiguration = configuration?.GetSection("XLogger:MongoDB"); if (mongoConfiguration == null) { throw new System.Exception("Could not load the adapter configuration properties. Make sure the application settings have the XLogger:MongoDB section."); } var logLevel = mongoConfiguration[nameof(LogLevel)]; if (!string.IsNullOrEmpty(logLevel)) { LogLevel = (LogLevel)int.Parse(logLevel); } OnDemand = bool.Parse(mongoConfiguration[nameof(OnDemand)] ?? OnDemand.ToString()); DatabaseUrl = mongoConfiguration[nameof(DatabaseUrl)] ?? DatabaseUrl; CollectionName = mongoConfiguration[nameof(CollectionName)] ?? CollectionName; Capped = bool.Parse(mongoConfiguration[nameof(Capped)] ?? Capped.ToString()); MaxSize = long.Parse(mongoConfiguration[nameof(MaxSize)] ?? MaxSize.ToString()); MaxDocuments = long.Parse(mongoConfiguration[nameof(MaxDocuments)] ?? MaxDocuments.ToString()); }
public static string GetFileSize(long bytes, MaxSize maxsize) { if (bytes >= 1099511627776 && maxsize >= MaxSize.msTera) { Decimal size = Decimal.Divide(bytes, 1099511627776); return String.Format("{0:##.##} {1}", size, OtherStrings.TerabyteShort); } else if (bytes >= 1073741824 && maxsize >= MaxSize.msGiga) { Decimal size = Decimal.Divide(bytes, 1073741824); return String.Format("{0:##.##} {1}", size, OtherStrings.GigabyteShort); } else if (bytes >= 1048576 && maxsize >= MaxSize.msMega) { Decimal size = Decimal.Divide(bytes, 1048576); return String.Format("{0:##.##} {1}", size, OtherStrings.MegabyteShort); } else if (bytes >= 1024 && maxsize >= MaxSize.msKilo) { Decimal size = Decimal.Divide(bytes, 1024); return String.Format("{0:##.##} {1}", size, OtherStrings.KilobyteShort); } else if ((bytes > 0) && maxsize >= MaxSize.msByte) { Decimal size = bytes; return String.Format("{0:##.##} {1}", size, OtherStrings.Byte[0]); } else { return "0 " + OtherStrings.Byte[0]; } }
public override void Save() { XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("particleemitter"); doc.AppendChild(root); root.AppendChild(doc.CreateElement("material").SimpleTag("name", Material)); root.AppendChild(doc.CreateElement("numparticles").SimpleTag("value", NumParticles.ToString())); root.AppendChild(doc.CreateElement("updateinvisible").SimpleTag("enable", UpdateInvisible ? "true" : "false")); root.AppendChild(doc.CreateElement("relative").SimpleTag("enable", Relative ? "true" : "false")); root.AppendChild(doc.CreateElement("scaled").SimpleTag("enable", Scaled ? "true" : "false")); root.AppendChild(doc.CreateElement("sorted").SimpleTag("enable", Sorted ? "true" : "false")); root.AppendChild(doc.CreateElement("animlodbias").SimpleTag("value", AnimLodBias.ToString())); root.AppendChild(doc.CreateElement("emittertype").ValueTag(Type.ToString().ToLower())); if (EmitterSize != null) { root.AppendChild(doc.CreateElement("emittersize").ValueTag(EmitterSize.ToString())); } root.AppendChild(doc.CreateElement("emitterradius").ValueTag(EmitterRadius.ToString())); XmlElement dir = doc.CreateElement("direction"); dir.SetAttribute("min", DirectionMin.ToString()); dir.SetAttribute("max", DirectionMax.ToString()); root.AppendChild(dir); root.AppendChild(doc.CreateElement("constantforce").ValueTag(ConstantForce.ToString())); root.AppendChild(doc.CreateElement("dampingforce").ValueTag(DampingForce.ToString())); root.AppendChild(doc.CreateElement("activetime").ValueTag(ActiveTime.ToString())); root.AppendChild(doc.CreateElement("inactivetime").ValueTag(InActiveTime.ToString())); root.AppendChild(Interval.ToElement(doc.CreateElement("interval"))); root.AppendChild(EmissionRate.ToElement(doc.CreateElement("emissionrate"))); XmlElement psize = doc.CreateElement("particlesize"); psize.SetAttribute("min", MinSize.ToString()); psize.SetAttribute("max", MaxSize.ToString()); root.AppendChild(psize); root.AppendChild(TimeToLive.ToElement(doc.CreateElement("timetolive"))); root.AppendChild(Velocity.ToElement(doc.CreateElement("velocity"))); root.AppendChild(Rotation.ToElement(doc.CreateElement("rotation"))); root.AppendChild(RotationSpeed.ToElement(doc.CreateElement("rotationspeed"))); //SIZE DELTA XmlElement sized = doc.CreateElement("sizedelta"); sized.SetAttribute("add", SizeDelta.X.ToString()); sized.SetAttribute("mul", SizeDelta.Y.ToString()); root.AppendChild(sized); foreach (ParticleColorFade f in ColorFade) { XmlElement e = doc.CreateElement("colorfade"); e.SetAttribute("color", f.Color.ToString()); e.SetAttribute("time", f.Time.ToString()); root.AppendChild(e); } foreach (ParticleTexAnim a in TextureAnim) { XmlElement e = doc.CreateElement("texanim"); e.SetAttribute("uv", a.Animation.ToString()); e.SetAttribute("time", a.Time.ToString()); root.AppendChild(e); } XmlWriterSettings xws = new XmlWriterSettings { OmitXmlDeclaration = true, Indent = true }; using (XmlWriter xw = XmlWriter.Create(System.IO.Path.ChangeExtension(Name, "xml"), xws)) doc.Save(xw); }
private void OnGUI() { Texturetype = (TextureImporterType)EditorGUILayout.EnumPopup("Texture Type", Texturetype); switch (Texturetype) { case TextureImporterType.Default: TexShape = (TextureImporterShape)EditorGUILayout.EnumPopup("Texture Shape", TexShape); IsSrgb = EditorGUILayout.Toggle("sRGB(Color Texture)", IsSrgb); AlphaSource = (TextureImporterAlphaSource)EditorGUILayout.EnumPopup("Alpha Source", AlphaSource); IsAlphaIsTransparency = EditorGUILayout.Toggle("Alpha Is Transparency", IsAlphaIsTransparency); NpotScale = (TextureImporterNPOTScale)EditorGUILayout.EnumPopup("Non Power of 2", NpotScale); IsRead = EditorGUILayout.Toggle("Read/Write Enabled", IsRead); IsStreamingMipMap = EditorGUILayout.Toggle("Streaming Mip Maps", IsStreamingMipMap); IsGenerateMipmap = EditorGUILayout.Toggle("Generate Mip Maps", IsGenerateMipmap); DefalutWarpMode = (TextureWrapMode)EditorGUILayout.EnumPopup("Wrap Mode", DefalutWarpMode); MaxSize = (MaxSize)EditorGUILayout.EnumPopup("Max Size", MaxSize); Compression = (TextureImporterCompression)EditorGUILayout.EnumPopup("Compression", Compression); break; case TextureImporterType.NormalMap: break; case TextureImporterType.GUI: break; case TextureImporterType.Sprite: SpriteImportMode = (SpriteImportMode)EditorGUILayout.EnumPopup("Sprite Mode", SpriteImportMode); PackingTag = EditorGUILayout.TextField("Packing Tag", PackingTag); IsSrgb = EditorGUILayout.Toggle("sRGB(Color Texture)", IsSrgb); AlphaSource = (TextureImporterAlphaSource)EditorGUILayout.EnumPopup("Alpha Source", AlphaSource); IsAlphaIsTransparency = EditorGUILayout.Toggle("Alpha Is Transparency", IsAlphaIsTransparency); IsRead = EditorGUILayout.Toggle("Read/Write Enabled", IsRead); IsGenerateMipmap = EditorGUILayout.Toggle("Generate Mip Maps", IsGenerateMipmap); SpriteWarpMode = (TextureWrapMode)EditorGUILayout.EnumPopup("Wrap Mode", SpriteWarpMode); MaxSize = (MaxSize)EditorGUILayout.EnumPopup("Max Size", MaxSize); Compression = (TextureImporterCompression)EditorGUILayout.EnumPopup("Compression", Compression); break; case TextureImporterType.Cursor: break; case TextureImporterType.Cookie: break; case TextureImporterType.Lightmap: break; case TextureImporterType.SingleChannel: break; } if (GUILayout.Button("设置图片属性后、导入或修改前,请点击本按钮!")) { IsApply = true; Debug.Log("已应用设置"); } if (GUILayout.Button("还原设置: 请点击本按钮 或者 直接关闭面板 !")) { IsApply = false; Debug.Log("已还原设置"); } }
public static void Init() { if (Initialized) { return; } if (!parseConfig()) { throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError); } FreeSpace = MaxSize; NameServerAddress = Environment.GetEnvironmentVariable("NAMING_ADDRESS"); Console.WriteLine("Name Server address is " + NameServerAddress); try { Port = File.OpenText("Port").ReadLine(); } catch { Console.WriteLine("Port file wasn't found"); return; } string id = ""; Random rng = new Random(); if (File.Exists("IDAtNameServer")) { Console.WriteLine("from file id"); StreamReader reader = new StreamReader(File.Open("IDAtNameServer", FileMode.Open)); id = reader.ReadLine(); reader.Close(); long size = 0; if (Directory.Exists(storageRoot + id + '/')) { size = DirSize(new DirectoryInfo(storageRoot + id + '/')); } FreeSpace -= size; var response = Api.Get(NameServerAddress, String.Format("/storageConn?id={0}&port={1}&free_space={2}", id, Port, FreeSpace.ToString())); if (response == 200) { StoragePath = storageRoot + id + '/'; StorageID = id; Initialized = true; } else if (response == 409) { id = rng.Next().ToString(); response = Api.Get(NameServerAddress, String.Format("/storageReg?id={0}&port={1}&free_space={2}", id, Port, MaxSize.ToString())); for (int i = 0; i < 20 && response == 409; i++) { id = rng.Next().ToString(); response = Api.Get(NameServerAddress, String.Format("/storageReg?id={0}&port={1}&free_space={2}", id, Port, MaxSize.ToString())); } if (response == 200) { var writer = new StreamWriter(File.Open("IDAtNameServer", FileMode.Create)); writer.WriteLine(id); writer.Flush(); writer.BaseStream.Close(); writer.Close(); StoragePath = storageRoot + id + '/'; StorageID = id; Initialized = true; } else { throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError); } } } else { id = rng.Next().ToString(); var response = Api.Get(NameServerAddress, String.Format("/storageReg?id={0}&port={1}&free_space={2}", id, Port, MaxSize.ToString())); for (int i = 0; i < 20 && response == 409; i++) { id = rng.Next().ToString(); response = Api.Get(NameServerAddress, String.Format("/storageReg?id={0}&port={1}&free_space={2}", id, Port, MaxSize.ToString())); } if (response == 500) { Console.WriteLine("Storage with this IP:PORT already registered"); throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError); } if (response == 200) { var writer = new StreamWriter(File.Open("IDAtNameServer", FileMode.Create)); writer.WriteLine(id); writer.Flush(); writer.Close(); StoragePath = storageRoot + id + '/'; StorageID = id; Initialized = true; } else { throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError); } } CreateDirectoryRecursively(StoragePath); }
public void Setup() { _sut = MaxSize.Create("MyMaxSize", "Group1", "100px"); }
public override void RenderControlToScript(StringBuilder script, bool useApplyTo) { if (DidRenderScript) { return; } script.Append("new Ext.TabPanel("); script.Append("{"); if (useApplyTo) { if (UnMinify) { script.Append("\n "); } script.Append("applyTo:'" + this.ClientID + "'"); } else { if (UnMinify) { script.Append("\n "); } script.Append("contentEl:'" + this.ClientID + "'"); } if (UnMinify) { script.Append("\n "); } script.Append(",id:'tp" + this.ClientID + "'"); if (Title.Length > 0) { if (UnMinify) { script.Append("\n "); } script.Append(",title:'" + this.Title + "'"); } if (Region.Length > 0) { if (UnMinify) { script.Append("\n "); } script.Append(",region:'" + this.Region + "'"); } if ((AutoHeight) && (FixedPixelHeight == 0)) { if (UnMinify) { script.Append("\n "); } script.Append(",autoHeight:true"); } if (FixedPixelHeight > 0) { if (UnMinify) { script.Append("\n "); } script.Append(",height:'" + FixedPixelHeight.ToString() + "'"); } if ((AutoWidth) && (FixedPixelWidth == 0)) { if (UnMinify) { script.Append("\n "); } script.Append(",autoWidth:true"); } if (FixedPixelWidth > 0) { if (UnMinify) { script.Append("\n "); } script.Append(",width: " + FixedPixelHeight.ToString()); } if (!Header) { //if (UnMinify) script.Append("\n "); //script.Append(", header:false "); } if (Plain) { if (UnMinify) { script.Append("\n "); } script.Append(",plain:true"); } if (enableTabScroll) { if (UnMinify) { script.Append("\n "); } script.Append(",enableTabScroll:true"); } if (Frame) { if (UnMinify) { script.Append("\n "); } script.Append(",frame:true"); } if (!DeferredRender) { if (UnMinify) { script.Append("\n "); } script.Append(",deferredRender:false"); } if (Split) { if (UnMinify) { script.Append("\n "); } script.Append(", split: true "); if (MinSize > 0) { if (UnMinify) { script.Append("\n "); } script.Append(", minSize: " + MinSize.ToString()); } if (MaxSize > 0) { if (UnMinify) { script.Append("\n "); } script.Append(", maxSize: " + MaxSize.ToString()); } } SelectTab(script); if (UnMinify) { script.Append("\n "); } script.Append(",items:["); AddTabs(script); if (UnMinify) { script.Append("\n "); } script.Append("]"); if (UnMinify) { script.Append("\n "); } script.Append("}"); if (UnMinify) { script.Append("\n "); } script.Append(")"); DidRenderScript = true; }