public DataFileInfo(ExtensionInfo extensionInfo, string fullPath, string relativePath, string parentName, string propertyName) { ExtensionInfo = extensionInfo; FullPath = fullPath; RelativePath = relativePath; ParentName = parentName; PropertyName = propertyName; }
internal ExtensionPointViewExtensionNode(ExtensionInfo ext) { _ext = ext; }
protected override T OnGetExtension <T>(ExtensionInfo info) { return(Instantiate <T>(info.ClassName)); }
public object ExportGLTFExtension <T1, T2>(T1 babylonObject, ref T2 gltfObject, ref GLTF gltf, GLTFExporter exporter, ExtensionInfo extInfo) { var babylonMesh = babylonObject as BabylonMesh; if (babylonMesh != null) { GLTFExtensionAsoboFade fade = new GLTFExtensionAsoboFade(); List <GLTFExtensionFade> fadeObjects = new List <GLTFExtensionFade>(); fade.fades = fadeObjects; Guid guid = Guid.Empty; Guid.TryParse(babylonMesh.id, out guid); IINode maxNode = Tools.GetINodeByGuid(guid); foreach (IINode node in maxNode.DirectChildren()) { IObject obj = node.ObjectRef; if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(SphereFadeClassID)) { GLTFExtensionFade fadeSphere = new GLTFExtensionFade(); GLTFExtensionAsoboFadeSphereParams sphereParams = new GLTFExtensionAsoboFadeSphereParams(); float radius = FlightSimExtensionUtility.GetGizmoParameterFloat(node, "SphereGizmo", "radius"); fadeSphere.Translation = FlightSimExtensionUtility.GetTranslation(node, maxNode); sphereParams.radius = radius; fadeSphere.Type = "sphere"; fadeSphere.Params = sphereParams; fadeObjects.Add(fadeSphere); } } if (fadeObjects.Count > 0) { return(fade); } } return(null); }
public YahooSettings(HydraTaskSettings settings) : base(settings) { ExtensionInfo.TryAdd("CandleDayStep", 30); }
public Info(Assembly asm, ExtensionInfo info) { Assembly = asm; ExtensionInfo = info; }
//--------------------------------------------------------------------- /// <summary> /// Adds a new extension to the dataset. /// </summary> /// <param name="extension"> /// Information about the new extension. /// </param> /// <exception cref="InvalidOperationException"> /// There is already a extension with the same name in the dataset. /// </exception> public void Add(ExtensionInfo extension) { if (extension == null) throw new ArgumentNullException(); if (string.IsNullOrEmpty(extension.Name)) throw new ArgumentException("The extension's name is null or empty."); if (this[extension.Name] != null) { string mesg = string.Format("A extension with the name \"{0}\" is already in the dataset", extension.Name); throw new InvalidOperationException(mesg); } extensions.Add(extension); }
public void StartRecording(ExtensionInfo info) { lock (sync) { recordings.Add(info); } }
public void StopRecording(ExtensionInfo info) { lock (sync) { recordings.Remove(info); } }
private void ExportGLTFExtension <T1, T2>(T1 babylonObject, ref T2 gltfObject, GLTF gltf, ExtensionInfo extInfo = null) where T2 : GLTFProperty { GLTFExtensions nodeExtensions = gltfObject.extensions; if (nodeExtensions == null) { nodeExtensions = new GLTFExtensions(); } foreach (var extensionExporter in babylonScene.BabylonToGLTFExtensions) { if (extensionExporter.Value.gltfType == typeof(T2)) { string extensionName = extensionExporter.Key.GetGLTFExtensionName(); object extensionObject = extensionExporter.Key.ExportGLTFExtension(babylonObject, ref gltfObject, ref gltf, this, extInfo); if (extensionObject != null && !string.IsNullOrEmpty(extensionName) && !nodeExtensions.ContainsKey(extensionName)) { nodeExtensions.Add(extensionName, extensionObject); } } } if (nodeExtensions.Count > 0) { gltfObject.extensions = nodeExtensions; if (gltf.extensionsUsed == null) { gltf.extensionsUsed = new System.Collections.Generic.List <string>(); } foreach (KeyValuePair <string, object> extension in gltfObject.extensions) { if (!gltf.extensionsUsed.Contains(extension.Key)) { gltf.extensionsUsed.Add(extension.Key); } } } }
public UpsertContextOptionsExtension() { Info = new ExtensionInfo(this); }
/// <summary> /// Tests the specified extension against the criteria of this filter. /// </summary> /// <param name="extension">The extension to test.</param> /// <returns>True if the extension meets the criteria, false otherwise.</returns> public abstract bool Test(ExtensionInfo extension);
public ExportSettings(HydraTaskSettings settings) : base(settings) { ExtensionInfo.TryAdd("Header", string.Empty); }
public object ExportGLTFExtension <T1, T2>(T1 babylonObject, ref T2 gltfObject, ref GLTF gltf, GLTFExporter exporter, ExtensionInfo info) { var babylonMaterial = babylonObject as BabylonMaterial; var gltfAnimation = gltfObject as GLTFAnimation; AnimationExtensionInfo animationExtensionInfo = info as AnimationExtensionInfo; if (babylonMaterial == null) { return(null); } if (gltfAnimation != null && FlightSimMaterialUtilities.class_ID.Equals(new MaterialUtilities.ClassIDWrapper(babylonMaterial.maxGameMaterial.MaxMaterial.ClassID))) { GLTFMaterial gltfMaterial; if (!exporter.materialToGltfMaterialMap.TryGetValue(babylonMaterial, out gltfMaterial)) { return(gltfObject); } int samlerIndex = gltfAnimation.SamplerList.Count; AddParameterSamplerAnimation(babylonMaterial, gltfAnimation, exporter, gltf, animationExtensionInfo.startFrame, animationExtensionInfo.endFrame); GLTFExtensionAsoboPropertyAnimation gltfExtension = new GLTFExtensionAsoboPropertyAnimation(); //in case more material are animated in the same animation group // the extension used on the animation need to be stored if (gltfAnimation.extensions != null && gltfAnimation.extensions.Count > 0) { foreach (KeyValuePair <string, object> ext in gltfAnimation.extensions) { if (ext.Key == FlightSimAsoboPropertyAnimationExtension.SerializedName) { gltfExtension = (GLTFExtensionAsoboPropertyAnimation)ext.Value; } } } List <GLTFAnimationPropertyChannel> matAnimationsPropertyChannels = new List <GLTFAnimationPropertyChannel>(); if (gltfExtension.channels != null) { matAnimationsPropertyChannels.AddRange(gltfExtension.channels); } IIGameProperty property = babylonMaterial.maxGameMaterial.IPropertyContainer.QueryProperty("materialType"); int material_value = 0; if (!property.GetPropertyValue(ref material_value, 0)) { return(null); } MaterialType materialType = FlightSimMaterialHelper.GetMaterialType(material_value); foreach (BabylonAnimation anim in babylonMaterial.animations) { GLTFAnimationPropertyChannel propertyChannel = new GLTFAnimationPropertyChannel(); propertyChannel.sampler = samlerIndex; if (materialType == MaterialType.Windshield && anim.property == "wiperAnimState1") { propertyChannel.target = $"materials/{gltfMaterial.index}/extensions/{GLTFExtensionAsoboWindshield.SerializedName}/wiper1State"; } else if (materialType == MaterialType.Windshield && anim.property == "wiperAnimState2") { propertyChannel.target = $"materials/{gltfMaterial.index}/extensions/{GLTFExtensionAsoboWindshield.SerializedName}/wiper2State"; } else if (materialType == MaterialType.Windshield && anim.property == "wiperAnimState3") { propertyChannel.target = $"materials/{gltfMaterial.index}/extensions/{GLTFExtensionAsoboWindshield.SerializedName}/wiper3State"; } else if (materialType == MaterialType.Windshield && anim.property == "wiperAnimState4") { propertyChannel.target = $"materials/{gltfMaterial.index}/extensions/{GLTFExtensionAsoboWindshield.SerializedName}/wiper4State"; } else if (materialType == MaterialType.Standard && anim.property == "emissive") { propertyChannel.target = $"materials/{gltfMaterial.index}/emissiveFactor"; } else if (materialType == MaterialType.Standard && anim.property == "baseColor") { propertyChannel.target = $"materials/{gltfMaterial.index}/pbrMetallicRoughness/baseColorFactor"; } else if (materialType == MaterialType.Standard && anim.property == "roughness") { propertyChannel.target = $"materials/{gltfMaterial.index}/pbrMetallicRoughness/roughnessFactor"; } else if (materialType == MaterialType.Standard && anim.property == "metallic") { propertyChannel.target = $"materials/{gltfMaterial.index}/pbrMetallicRoughness/metallicFactor"; } else if (materialType != MaterialType.EnvironmentOccluder && anim.property == "UVOffsetU") { propertyChannel.target = $"materials/{gltfMaterial.index}/extensions/{GLTFExtensionAsoboMaterialUVOptions.SerializedName}/UVOffsetU"; } else if (materialType != MaterialType.EnvironmentOccluder && anim.property == "UVOffsetV") { propertyChannel.target = $"materials/{gltfMaterial.index}/extensions/{GLTFExtensionAsoboMaterialUVOptions.SerializedName}/UVOffsetV"; } else if (materialType != MaterialType.EnvironmentOccluder && anim.property == "UVTilingU") { propertyChannel.target = $"materials/{gltfMaterial.index}/extensions/{GLTFExtensionAsoboMaterialUVOptions.SerializedName}/UVTilingU"; } else if (materialType != MaterialType.EnvironmentOccluder && anim.property == "UVTilingV") { propertyChannel.target = $"materials/{gltfMaterial.index}/extensions/{GLTFExtensionAsoboMaterialUVOptions.SerializedName}/UVTilingV"; } else if (materialType != MaterialType.EnvironmentOccluder && anim.property == "UVRotation") { propertyChannel.target = $"materials/{gltfMaterial.index}/extensions/{GLTFExtensionAsoboMaterialUVOptions.SerializedName}/UVRotation"; } if (propertyChannel.isValid()) { matAnimationsPropertyChannels.Add(propertyChannel); samlerIndex += 1; } } gltfExtension.channels = matAnimationsPropertyChannels.ToArray(); return(gltfExtension); } return(null); }
public HydraServerSettings(HydraTaskSettings settings) : base(settings) { ExtensionInfo.TryAdd("IgnoreWeekends", true); }
//--------------------------------------------------------------------- public static int CompareNames(ExtensionInfo x, ExtensionInfo y) { return(x.Name.CompareTo(y.Name)); }
public bool CompareKeyExtensions(ExtensionInfo[] aei1, ExtensionInfo[] aei2) { bool bRes = true; if (aei1.Length != aei2.Length) { Log.Comment("Key extensions lenghts are different"); return false; } for(int i = 0; i<aei1.Length; i++) { bool bSubRes = false; for(int j = 0; j<aei2.Length; j++) // we will remove spaces for now if ( CompareStrings( aei1[i].Type.Replace(" ", "").Replace("-","").Trim() , aei2[j].Type.Replace(" ", "").Replace("-","").Replace("\0","").Trim() ) && CompareStrings( aei1[i].Data.Replace(" ", "").Replace("-","").Trim() , aei2[j].Data.Replace(" ", "").Replace("-","").Replace("\0","").Trim() ) ) { bSubRes = true; // found a match } bRes = bSubRes && bRes; if (!bSubRes) { Log.Comment("Could not find a match for extension:\n" + aei1[i].Type.Replace(" ", "").Trim() + " : " + aei1[i].Data.Replace(" ", "").Trim()); Log.Comment("It didn't match any of:"); foreach(ExtensionInfo xi in aei2) Log.Comment(xi.Type.Replace(" ", "") + " : " + xi.Data.Replace(" ", "")); } } if (bRes == true) Log.Comment("Key extensions compared EQUAL"); return bRes; }
//--------------------------------------------------------------------- /// <summary> /// Initialize a new instance. /// </summary> /// <param name="extensionInfo"> /// Information about the extension. /// </param> /// <param name="initFile"> /// The path to the extension's initialization file. /// </param> public ExtensionAndInitFile(ExtensionInfo extensionInfo, string initFile) { this.info = extensionInfo; this.initFile = initFile; }
public void AddExtension(string extension) { _extensions[extension] = new ExtensionInfo(extension); }
public ExtensionInfo Register <E, S>(Expression <Func <E, S> > extensionLambda, Func <string> niceName, string key, bool replace = false) { var extension = new ExtensionInfo(typeof(E), extensionLambda, typeof(S), key, niceName); return(Register(extension)); }
public ConvertTaskSettings(HydraTaskSettings settings) : base(settings) { ExtensionInfo.TryAdd("DestinationStorageFormat", StorageFormats.Binary.To <string>()); }
public RtsCompetitionSettings(HydraTaskSettings settings) : base(settings) { ExtensionInfo.TryAdd("IgnoreWeekends", true); }
public Vector2 Draw(SpriteBatch sb, Rectangle dest, ExtensionInfo info) { this.ActiveInfo = info; if (!this.HasInitializedSteamCallbacks) { this.InitSteamCallbacks(); } this.Update(); Vector2 vector2 = new Vector2((float)dest.X, (float)dest.Y); bool flag1 = info.WorkshopPublishID != "NONE"; this.currentStatusMessage = flag1 ? "Ready to push Updates" : "Ready to create in steam"; if (!flag1 && string.IsNullOrWhiteSpace(this.currentBodyMessage)) { this.currentBodyMessage = "By submitting this item, you agree to the workshop terms of service\nhttp://steamcommunity.com/sharedfiles/workshoplegalagreement"; } Vector2 pos1 = new Vector2(vector2.X + (float)(dest.Width / 2), vector2.Y); TextItem.doFontLabel(pos1, this.currentStatusMessage, GuiData.font, new Color?(Color.Gray), (float)dest.Width / 2f, 30f, false); pos1.Y += 30f; TextItem.doFontLabel(pos1, this.currentTitleMessage, GuiData.font, new Color?(Color.White), (float)dest.Width / 2f, 30f, false); pos1.Y += 30f; Vector2 pos2 = pos1; if (this.showLoadingSpinner) { pos1.X += 16f; this.spinnerRot += 0.1f; Rectangle destinationRectangle = new Rectangle((int)pos1.X, (int)pos1.Y + 20, 40, 40); sb.Draw(this.spinnerTex, destinationRectangle, new Rectangle?(), Color.White, this.spinnerRot, this.spinnerTex.GetCentreOrigin(), SpriteEffects.None, 0.5f); pos2.X += 45f; } if (this.isInUpload) { Rectangle rectangle = new Rectangle((int)pos2.X, (int)pos2.Y + 6, dest.Width / 2, 20); ulong punBytesProcessed = 0; ulong punBytesTotal = 1; int itemUpdateProgress = (int)SteamUGC.GetItemUpdateProgress(this.updateHandle, out punBytesProcessed, out punBytesTotal); double val1 = (double)punBytesProcessed / (double)punBytesTotal; if ((long)punBytesTotal == 0L) { val1 = 0.0; } sb.Draw(Utils.white, Utils.InsetRectangle(rectangle, -1), Utils.AddativeWhite * 0.7f); sb.Draw(Utils.white, rectangle, Utils.VeryDarkGray); rectangle.Width = (int)((double)rectangle.Width * val1); sb.Draw(Utils.white, rectangle, Color.LightBlue); pos2.Y += 31f; if (punBytesTotal > 0UL) { string format = "{0}% - {1}mb of {2}mb Transfered"; string str1 = (val1 * 100.0).ToString("00.00"); ulong num = punBytesProcessed / 1000000UL; string str2 = num.ToString("0.00"); num = punBytesTotal / 1000000UL; string str3 = num.ToString("0.00"); string text1 = string.Format(format, (object)str1, (object)str2, (object)str3); Utils.DrawStringMonospace(sb, text1, GuiData.smallfont, pos2, Color.White, 9f); pos2.Y += 20f; TimeSpan time = DateTime.Now - this.transferStarted; string text2 = string.Format("ETA: {0} // Elapsed : {1}", (object)this.getTimespanDisplayString(TimeSpan.FromSeconds(time.TotalSeconds / Math.Max(val1, 0.01))), (object)this.getTimespanDisplayString(time)); Utils.DrawStringMonospace(sb, text2, GuiData.smallfont, pos2, Color.White, 9f); pos2.Y += 25f; } } TextItem.doFontLabel(pos2, this.currentBodyMessage, GuiData.smallfont, new Color?(Color.White * 0.8f), (float)dest.Width / 2f, 30f, false); int height = 40; int width = 450; bool flag2 = !this.showLoadingSpinner; if (!this.isInUpload) { if (Button.doButton(371711001, (int)vector2.X, (int)vector2.Y, width, height, flag1 ? " - Item Created -" : "Create Entry in Steam Workshop", new Color?(flag1 ? Color.LightBlue : Color.Gray)) && !flag1 && flag2) { this.CreateExtensionInSteam(info); } vector2.Y += (float)(height + 4); if (Button.doButton(371711003, (int)vector2.X, (int)vector2.Y, width, height, "Upload to Steam Workshop", new Color?(flag1 ? Color.LightBlue : Color.Gray)) && flag2) { this.PerformUpdate(info); } vector2.Y += (float)(height + 4); if (Button.doButton(371711005, (int)vector2.X, (int)vector2.Y + 10, width, height - 10, "Back to Extension Menu", new Color?(Color.Black)) && flag2 && this.GoBack != null) { this.GoBack(); } vector2.Y += (float)(height + 4); } return(vector2); }
/// <summary> /// Tests whether or not the input <see cref="ExtensionInfo.ExtensionClass"/>' full name matches /// the name supplied to the filter constructor. /// </summary> public override bool Test(ExtensionInfo extension) { return(extension.ExtensionClass.FullName.Equals(_name)); }
private void CreateExtensionInSteam(ExtensionInfo info) { this.m_CreateItemResult.Set(SteamUGC.CreateItem(this.hacknetAppID, EWorkshopFileType.k_EWorkshopFileTypeFirst), (CallResult <CreateItemResult_t> .APIDispatchDelegate)null); this.showLoadingSpinner = true; this.currentTitleMessage = "Creating Extension with Steam..."; }
public new T GetExtension <T>(ExtensionInfo extensionInfo) where T : class { return(base.GetExtension <T>(extensionInfo)); }
private Vector2 DrawExtensionCreateNewUserOrLoadScreen(Vector2 drawpos, Rectangle dest, SpriteBatch sb, ScreenManager screenMan, ExtensionInfo info) { this.SaveScreen.Draw(sb, dest); return(drawpos); }
public BitStampSettings(HydraTaskSettings settings) : base(settings) { ExtensionInfo.TryAdd("Key", new SecureString()); ExtensionInfo.TryAdd("Secret", new SecureString()); }
private Vector2 DrawExtensionInfoDetail(Vector2 drawpos, Rectangle dest, SpriteBatch sb, ScreenManager screenMan, ExtensionInfo info) { sb.DrawString(GuiData.titlefont, info.Name.ToUpper(), drawpos, Utils.AddativeWhite * 0.66f); drawpos.Y += 80f; int height1 = sb.GraphicsDevice.Viewport.Height; int num1 = 256; if (height1 < 900) { num1 = 120; } Rectangle dest1 = new Rectangle((int)drawpos.X, (int)drawpos.Y, num1, num1); Texture2D texture = this.DefaultModImage; if (info.LogoImage != null) { texture = info.LogoImage; } FlickeringTextEffect.DrawFlickeringSprite(sb, dest1, texture, 2f, 0.5f, (object)null, Color.White); Vector2 position = drawpos + new Vector2((float)num1 + 40f, 20f); float num2 = (float)dest.Width - (drawpos.X - (float)dest.X); string text1 = Utils.SuperSmartTwimForWidth(info.Description, (int)num2, GuiData.smallfont); sb.DrawString(GuiData.smallfont, text1, position, Utils.AddativeWhite * 0.7f); drawpos.Y += (float)num1 + 10f; if (this.IsInPublishScreen) { Rectangle fullscreen = Utils.GetFullscreen(); Rectangle dest2 = new Rectangle((int)drawpos.X, (int)drawpos.Y, fullscreen.Width - (int)drawpos.X * 2, fullscreen.Height - ((int)drawpos.Y + 50)); return(this.workshopPublishScreen.Draw(sb, dest2, info)); } if (this.ReportOverride != null) { string text2 = Utils.SuperSmartTwimForWidth(this.ReportOverride, 800, GuiData.smallfont); sb.DrawString(GuiData.smallfont, text2, drawpos + new Vector2(460f, 0.0f), this.ReportOverride.Length > 250 ? Utils.AddativeRed : Utils.AddativeWhite); } int val1 = 40; int num3 = 5; int num4 = info.AllowSave ? 4 : 2; int num5 = height1 - (int)drawpos.Y - 55; int height2 = Math.Min(val1, (num5 - num4 * num3) / num4); if (Button.doButton(7900010, (int)drawpos.X, (int)drawpos.Y, 450, height2, string.Format(LocaleTerms.Loc("New {0} Account"), (object)info.Name), new Color?(MainMenu.buttonColor))) { this.State = ExtensionsMenuScreen.EMSState.GetUsername; this.SaveScreen.ResetForNewAccount(); } drawpos.Y += (float)(height2 + num3); if (info.AllowSave) { bool flag = !string.IsNullOrWhiteSpace(SaveFileManager.LastLoggedInUser.FileUsername); if (Button.doButton(7900019, (int)drawpos.X, (int)drawpos.Y, 450, height2, flag ? "Continue Account : " + SaveFileManager.LastLoggedInUser.Username : "******", new Color?(flag ? MainMenu.buttonColor : Color.Black))) { OS.WillLoadSave = true; if (this.LoadAccountForExtension_FileAndUsername != null) { this.LoadAccountForExtension_FileAndUsername(SaveFileManager.LastLoggedInUser.FileUsername, SaveFileManager.LastLoggedInUser.Username); } } drawpos.Y += (float)(height2 + num3); if (Button.doButton(7900020, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Login") + "...", new Color?(flag ? MainMenu.buttonColor : Color.Black))) { this.State = ExtensionsMenuScreen.EMSState.ShowAccounts; this.SaveScreen.ResetForLogin(); } drawpos.Y += (float)(height2 + num3); } if (Button.doButton(7900030, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Run Verification Tests"), new Color?(MainMenu.buttonColor))) { int errorsAdded = 0; string str1 = ExtensionTests.TestExtensionForRuntime(screenMan, info.FolderPath, out errorsAdded); try { ExtensionInfo.VerifyExtensionInfo(info); } catch (Exception ex) { str1 = str1 + "\nExtension Metadata Error:\n" + Utils.GenerateReportFromException(ex); ++errorsAdded; } if (errorsAdded == 0) { this.ReportOverride = LocaleTerms.Loc("Testing...") + "\n" + LocaleTerms.Loc("All tests complete") + "\n0 " + LocaleTerms.Loc("Errors Found"); } else { this.ReportOverride = LocaleTerms.Loc("Errors Found") + ". " + string.Format(LocaleTerms.Loc("Writing report to {0}"), (object)(info.FolderPath + "/report.txt\n").Replace("\\", "/")) + str1; string str2 = info.FolderPath + "/report.txt"; if (File.Exists(str2)) { File.Delete(str2); } Utils.writeToFile(this.ReportOverride, str2); } MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped"); ExtensionLoader.ActiveExtensionInfo = this.ExtensionInfoToShow; } drawpos.Y += (float)(height2 + num3); if (Settings.AllowExtensionPublish && PlatformAPISettings.Running) { if (Button.doButton(7900031, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Steam Workshop Publishing"), new Color?(MainMenu.buttonColor))) { this.IsInPublishScreen = true; } drawpos.Y += (float)(height2 + num3); } if (Button.doButton(7900040, (int)drawpos.X, (int)drawpos.Y, 450, 25, LocaleTerms.Loc("Back to Extension List"), new Color?(MainMenu.exitButtonColor))) { this.ExtensionInfoToShow = (ExtensionInfo)null; } drawpos.Y += 30f; return(drawpos); }
/// <summary> /// performs wise heuristics to identify a file. /// this will attempt to return early if a confident result can be produced. /// </summary> public FileIDResults Identify(IdentifyParams p) { IdentifyJob job = new IdentifyJob() { Stream = p.SeekableStream, Disc = p.Disc }; //if we have a disc, that's a separate codepath if (job.Disc != null) { return(IdentifyDisc(job)); } FileIDResults ret = new FileIDResults(); string ext = p.Extension; if (ext != null) { ext = ext.TrimStart('.').ToUpper(); job.Extension = ext; } if (job.Extension == "CUE") { ret.ShouldTryDisc = true; return(ret); } if (job.Extension != null) { //first test everything associated with this extension ExtensionInfo handler = null; if (ExtensionHandlers.TryGetValue(ext, out handler)) { foreach (var del in handler.Testers) { var fidr = del(job); if (fidr.FileIDType == FileIDType.None) { continue; } ret.Add(fidr); } ret.Sort(); //add a low confidence result just based on extension, if it doesnt exist if (ret.Find((x) => x.FileIDType == handler.DefaultForExtension) == null) { var fidr = new FileIDResult(handler.DefaultForExtension, 5); ret.Add(fidr); } } } ret.Sort(); //if we didnt find anything high confidence, try all the testers (TODO) return(ret); }
public object ExportGLTFExtension <T1, T2>(T1 babylonObject, ref T2 gltfObject, ref GLTF gltf, GLTFExporter exporter, ExtensionInfo extInfo) { var babylonMesh = babylonObject as BabylonMesh; if (babylonMesh != null) { GLTFExtensionAsoboGizmo gltfExtensionAsoboGizmo = new GLTFExtensionAsoboGizmo(); List <GLTFExtensionGizmo> collisions = new List <GLTFExtensionGizmo>(); gltfExtensionAsoboGizmo.gizmos = collisions; Guid guid = Guid.Empty; Guid.TryParse(babylonMesh.id, out guid); IINode maxNode = Tools.GetINodeByGuid(guid); foreach (IINode node in maxNode.DirectChildren()) { IObject obj = node.ObjectRef; List <AsoboTag> tags = new List <AsoboTag>(); GLTFExtensionGizmo gizmo = new GLTFExtensionGizmo();; if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(BoxColliderClassID)) { GLTFExtensionAsoboBoxParams boxParams = new GLTFExtensionAsoboBoxParams(); float height = FlightSimExtensionUtility.GetGizmoParameterFloat(node, "BoxGizmo", "height"); float width = FlightSimExtensionUtility.GetGizmoParameterFloat(node, "BoxGizmo", "width"); float length = FlightSimExtensionUtility.GetGizmoParameterFloat(node, "BoxGizmo", "length"); gizmo.Translation = FlightSimExtensionUtility.GetTranslation(node, maxNode); float[] rotation = FlightSimExtensionUtility.GetRotation(node, maxNode); if (!FlightSimExtensionUtility.IsDefaultRotation(rotation)) { gizmo.Rotation = rotation; } boxParams.width = width; boxParams.height = height; boxParams.length = length; gizmo.Params = boxParams; gizmo.Type = "box"; bool isRoad = FlightSimExtensionUtility.GetGizmoParameterBoolean(node, "BoxCollider", "IsRoad", IsSubClass: false); bool isCollision = FlightSimExtensionUtility.GetGizmoParameterBoolean(node, "BoxCollider", "IsCollider", IsSubClass: false); if (isCollision) { tags.Add(AsoboTag.Collision); } if (isRoad) { tags.Add(AsoboTag.Road); } ParseTags(ref gizmo, ref gltf, ref tags); collisions.Add(gizmo); } else if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(CylinderColliderClassID)) { GLTFExtensionAsoboCylinderParams cylinderParams = new GLTFExtensionAsoboCylinderParams(); float radius = FlightSimExtensionUtility.GetGizmoParameterFloat(node, "CylGizmo", "radius"); float height = FlightSimExtensionUtility.GetGizmoParameterFloat(node, "CylGizmo", "height"); gizmo.Translation = FlightSimExtensionUtility.GetTranslation(node, maxNode); float[] rotation = FlightSimExtensionUtility.GetRotation(node, maxNode); if (!FlightSimExtensionUtility.IsDefaultRotation(rotation)) { gizmo.Rotation = rotation; } cylinderParams.height = height; cylinderParams.radius = radius; gizmo.Params = cylinderParams; gizmo.Type = "cylinder"; bool isRoad = FlightSimExtensionUtility.GetGizmoParameterBoolean(node, "CylCollider", "IsRoad", IsSubClass: false); bool isCollision = FlightSimExtensionUtility.GetGizmoParameterBoolean(node, "CylCollider", "IsCollider", IsSubClass: false); if (isCollision) { tags.Add(AsoboTag.Collision); } if (isRoad) { tags.Add(AsoboTag.Road); } ParseTags(ref gizmo, ref gltf, ref tags); collisions.Add(gizmo); } else if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(SphereColliderClassID)) { GLTFExtensionAsoboSphereParams sphereParams = new GLTFExtensionAsoboSphereParams(); float radius = FlightSimExtensionUtility.GetGizmoParameterFloat(node, "SphereGizmo", "radius"); gizmo.Translation = FlightSimExtensionUtility.GetTranslation(node, maxNode); sphereParams.radius = radius; gizmo.Type = "sphere"; gizmo.Params = sphereParams; bool isRoad = FlightSimExtensionUtility.GetGizmoParameterBoolean(node, "SphereCollider", "IsRoad", IsSubClass: false); bool isCollision = FlightSimExtensionUtility.GetGizmoParameterBoolean(node, "SphereCollider", "IsCollider", IsSubClass: false); if (isCollision) { tags.Add(AsoboTag.Collision); } if (isRoad) { tags.Add(AsoboTag.Road); } ParseTags(ref gizmo, ref gltf, ref tags); collisions.Add(gizmo); } } if (collisions.Count > 0) { return(gltfExtensionAsoboGizmo); } } return(null); }
// // Returns true is all available data in CertificateInfo matches the corresponding data in X509Certificate2 object // public bool Matches(X509Certificate2 cert) { bool bRes = true; if (PrivateKeyFile != null) { // TODO: implement } // get the public key PublicKey pk = cert.PublicKey; // compare the algorithm if available if ( !CompareStrings( pk.Oid.Value , PublicKeyAlg ) ) { Log.Comment("Public key algorithm mismatch (1): " + pk.Oid.Value + " != " + PublicKeyAlg); bRes = false; } if ( !CompareStrings( cert.GetKeyAlgorithm() , PublicKeyAlg) ) { Log.Comment("Public key algorithm mismatch (2): " + cert.GetKeyAlgorithm() + " != " + PublicKeyAlg); bRes = false; } // compare the public key blob if (PublicKeyBlob != null) if (!XmlDriver.Compare(pk.EncodedKeyValue.RawData, PublicKeyBlob)) { Log.Comment("Public key blob mismatch: " + "\n" + BitConverter.ToString(pk.EncodedKeyValue.RawData) + " != " + BitConverter.ToString(PublicKeyBlob)); bRes = false; } // compare the private key // TODO: enhance, compare the actual value // The idea for now is that if there is a password that means there is a private key if (Password != null) { if (cert.PrivateKey == null) { Log.Comment("BAD: PrivateKey is null"); bRes = false; } else { Log.Comment("Private Key is there - " + cert.PrivateKey); } } // compare the version if (Version != -1) if (cert.Version != Version) { Log.Comment("Version mismatch: " + cert.Version + " != " + Version); bRes = false; } // compare the subject if (Subject != null) if ( !CompareStrings( cert.SubjectName.Name , Subject) ) { Log.Comment("Subject mismatch: " + cert.SubjectName.Name + " != " + Subject); bRes = false; } // compare the Issuer if (Issuer != null) if ( !CompareStrings( cert.IssuerName.Name , Issuer) ) { Log.Comment("Issuer mismatch: " + cert.IssuerName.Name + " != " + Issuer); bRes = false; } // compare the serial number if (SerialNumber != null) if ( !CompareStrings( cert.SerialNumber , SerialNumber) ) { Log.Comment("Serial number mismatch: " + cert.SerialNumber + " != " + SerialNumber); bRes = false; } // compare the NotBefore if (NotBefore != DateTime.MinValue) if (cert.NotBefore.CompareTo(NotBefore) != 0) { Log.Comment("NotBefore mismatch: " + cert.NotBefore + " != " + NotBefore); bRes = false; } // compare the NotAfter if (NotAfter != DateTime.MinValue) if (cert.NotAfter.CompareTo(NotAfter) != 0) { Log.Comment("NotAfter mismatch: " + cert.NotAfter + " != " + NotAfter); bRes = false; } // compare the signature algorithm if (SignatureAlg != null) if ( !CompareStrings( cert.SignatureAlgorithm.FriendlyName , SignatureAlg)) { Log.Comment("Signature algorithm mismatch: " + cert.SignatureAlgorithm.FriendlyName + " != " + SignatureAlg); bRes = false; } // compare the thumbprint if (Thumbprint != null) if ( !CompareStrings( cert.Thumbprint.ToLower() , Thumbprint.ToLower()) ) { Log.Comment("Thumbprint mismatch: " + cert.Thumbprint + " != " + Thumbprint); bRes = false; } // compare the ToString baselines /* if (ToStringBaseLine != null) // if ( (cert.ToString().Replace("\0", "").Replace( " " , "" ).Replace("\n", "").Trim() // != ToStringBaseLine.Replace( " " , "" ) )) // || (cert.ToString(false).Trim() != ToStringBaseLine) ) if( !CompareToStrings( cert.ToString() , ToStringBaseLine ) ) { Log.Comment("ToString() baseline mismatch: " + "\n" + cert.ToString().Replace("\0", "").Replace("\n", "").Trim() + "\n" + " != " + "\n" + ToStringBaseLine); bRes = false; }*/ if (ToStringVerboseBaseLine != null) // if (cert.ToString(true).Replace("\0", "").Replace("\n\n", "\n").Replace("\n", "").Trim() // != ToStringVerboseBaseLine) if( !CompareToStrings( ToStringVerboseBaseLine , cert.ToString(true) ) ) { Log.Comment("ToString(true) baseline mismatch: " + "\n" + cert.ToString(true).Replace("\0", "").Replace("\n", "").Trim() + "\n" + " != " + "\n" + ToStringVerboseBaseLine); bRes = false; } // TODO: Thumbprint Alg comparions if we get a property for it // compare extensions ArrayList alCertExt = new ArrayList(); foreach(X509Extension ext in cert.Extensions) { ExtensionInfo ei = null; if (ext is X509KeyUsageExtension) { ei = new ExtensionInfo("KeyUsage", DumpFlags(typeof(X509KeyUsageFlags), ((X509KeyUsageExtension)ext).KeyUsages)); ei.Data += "(" + (((byte)((X509KeyUsageExtension)ext).KeyUsages)).ToString("X").ToLower() + ")"; } else if (ext is X509BasicConstraintsExtension) { X509BasicConstraintsExtension bce = (X509BasicConstraintsExtension)ext; string data = bce.CertificateAuthority.ToString() + ", " + bce.HasPathLengthConstraint + ", " + bce.PathLengthConstraint; ei = new ExtensionInfo("BasicConstraints", data); } else if (ext is X509EnhancedKeyUsageExtension) { OidCollection oids = ((X509EnhancedKeyUsageExtension)ext).EnhancedKeyUsages; string data = ""; foreach(Oid oid in oids) data += oid.FriendlyName + " (" + oid.Value +"), "; data = data.Substring(0, data.Length-1); //.Replace("-", ""); ei = new ExtensionInfo("EnhancedKeyUsage", data); } else if (ext is X509SubjectKeyIdentifierExtension) { ei = new ExtensionInfo("SubjectKeyIdentifier", ((X509SubjectKeyIdentifierExtension)ext).SubjectKeyIdentifier.ToLower()); } else { ei = new ExtensionInfo(ext.Oid.FriendlyName, ext.Format(false)); } alCertExt.Add(ei); } if (false == CompareKeyExtensions(Extentions, (ExtensionInfo[])alCertExt.ToArray(typeof(ExtensionInfo)))) { Log.Comment("Key extensions mismatch."); bRes = false; } return bRes; }
public object ExportGLTFExtension <T1, T2>(T1 babylonObject, ref T2 gltfObject, ref GLTF gltf, GLTFExporter exporter, ExtensionInfo extInfo) { var babylonLight = babylonObject as BabylonNode; if (babylonLight != null) { GLTFExtensionAsoboMacroLight macroLightExt = new GLTFExtensionAsoboMacroLight(); Guid guid = Guid.Empty; Guid.TryParse(babylonLight.id, out guid); IINode maxNode = Tools.GetINodeByGuid(guid); if (maxNode != null) { IObject obj = maxNode.ObjectRef; if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(MacroLightOmniClassID)) { exporter.logger?.RaiseCriticalError($"{maxNode.NodeName} is type of MacroLightOmni and it is DEPRECATED, use FlightSimLight"); return(null); } else if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(MacroLightSpotClassID)) { exporter.logger?.RaiseCriticalError($"{maxNode.NodeName} is type of MacroLightSpot and it is DEPRECATED, use FlightSimLight"); return(null); } else if (new MaterialUtilities.ClassIDWrapper(obj.ClassID).Equals(FlightSimLightClassID)) { macroLightExt.color = GetColor(maxNode); macroLightExt.intensity = GetIntensity(maxNode); macroLightExt.coneAngle = GetConeAngle(maxNode); macroLightExt.hasSimmetry = GetHasSimmetry(maxNode); macroLightExt.flashFrequency = GetFlashFrequency(maxNode); macroLightExt.dayNightCycle = GetDayNightCycle(maxNode); macroLightExt.flashDuration = GetFlashDuration(maxNode); macroLightExt.flashPhase = GetFlashPhase(maxNode); macroLightExt.rotationSpeed = GetRotationSpeed(maxNode); return(macroLightExt); } } } return(null); }
public object ExportGLTFExtension <T1, T2>(T1 babylonObject, ref T2 gltfObject, ref GLTF gltf, GLTFExporter exporter, ExtensionInfo info) { var babylonCamera = babylonObject as BabylonCamera; var gltfAnimation = gltfObject as GLTFAnimation; AnimationExtensionInfo animationExtensionInfo = info as AnimationExtensionInfo; if (babylonCamera == null) { return(null); } Guid guid = Guid.Empty; Guid.TryParse(babylonCamera.id, out guid); IINode camNode = Tools.GetINodeByGuid(guid); var maxCamera = CameraUtilities.GetGenCameraFromNode(camNode, exporter.logger); if (maxCamera == null) { exporter.logger.RaiseError($"Impossible to export {FlightSimAsoboPropertyAnimationExtension.SerializedName} for {camNode.Name}, camera node must be a TargetCamera type"); return(null); } if (babylonCamera != null && gltfAnimation != null && FlightSimCameraUtilities.class_ID.Equals(new MaterialUtilities.ClassIDWrapper(maxCamera.ClassID))) { GLTFNode gltfNode = null; GLTFCamera gltfCamera = null; if (!exporter.nodeToGltfNodeMap.TryGetValue(babylonCamera, out gltfNode)) { return(gltfObject); } if (gltfNode != null && gltfNode.camera >= 0) { gltfCamera = gltf.CamerasList[gltfNode.camera.GetValueOrDefault()]; } int samplerIndex = AddParameterSamplerAnimation(babylonCamera, gltfAnimation, exporter, gltf, animationExtensionInfo.startFrame, animationExtensionInfo.endFrame); if (samplerIndex > -1) { GLTFExtensionAsoboPropertyAnimation gltfExtension = new GLTFExtensionAsoboPropertyAnimation(); List <GLTFAnimationPropertyChannel> animationPropertyChannels = new List <GLTFAnimationPropertyChannel>(); //TODO: for each animated property in the camera //TODO: this should be generated based on the property itself GLTFAnimationPropertyChannel propertyChannel = new GLTFAnimationPropertyChannel(); propertyChannel.sampler = samplerIndex; propertyChannel.target = $"cameras/{gltfCamera.index}/perspective/yfov"; animationPropertyChannels.Add(propertyChannel); gltfExtension.channels = animationPropertyChannels.ToArray(); return(gltfExtension); } } return(null); }
public ExtensionDescriptor(Type extensionPoint, Type extension, Func <object> creator = null) { _info = new ExtensionInfo(extension, extensionPoint, extension.Name, extension.AssemblyQualifiedName, true); _extensionType = extension; _creator = creator; }
public MfdSettings(HydraTaskSettings settings) : base(settings) { ExtensionInfo.TryAdd("UseTemporaryFiles", TempFiles.UseAndDelete.To <string>()); }
public TransaqSettings(HydraTaskSettings settings) : base(settings) { ExtensionInfo.TryAdd("OverrideDll", true); }
public void AddExtension(string extension, string method, string returnType, bool useExtension = false) { _extensions[extension] = new ExtensionInfo(extension, method, returnType, useExtension); }
static ListViewItem GetItemFromExtensionInfo(ExtensionInfo info) { var item = new ListViewItem(info.PhoneNumber) { Checked = info.ExtensionType == ExtensionType.Extension ? SettingsHelper.RecordableExtensions.Contains(info.PhoneNumber) : SettingsHelper.RecordableOutsideLines.Contains(info.PhoneNumber), Tag = info }; item.SubItems.Add(info.Type); return item; }
/// <summary> /// Tests whether or not the input <see cref="ExtensionInfo.ExtensionClass"/>' full name matches /// the name supplied to the filter constructor. /// </summary> public override bool Test(ExtensionInfo extension) { return extension.ExtensionClass.FullName.Equals(_name); }
//--------------------------------------------------------------------- public static int CompareNames(ExtensionInfo x, ExtensionInfo y) { return x.Name.CompareTo(y.Name); }