public void RecursiveRelationshipsAreMappedCorrectly() { var map = new MemberMapper(); var source = new SourceType { ID = 10, Children = new List<SourceType> { new SourceType { ID = 11, }, new SourceType { ID = 12, Children = new List<SourceType> { new SourceType { ID = 13 } } } } }; var result = map.Map<SourceType, DestinationType>(source); }
private FavoriteCollectionResponse Get(float version, int userId, PagerRequest pagerRequest, CoordinateInfo coordinate, FavoriteSortOrder sortOrder, SourceType sourceType) { FavoriteCollectionResponse response; int totalCount; if (version >= 2.1) { var entitys = _favoriteRepository.Get(userId, pagerRequest, out totalCount, sortOrder, sourceType); var list = MappingManager.FavoriteCollectionResponseMapping(entitys, coordinate); response = new FavoriteCollectionResponse(pagerRequest, totalCount) { Favorites = list }; } else { var entitys = _favoriteRepository.GetPagedList(userId, pagerRequest, out totalCount, sortOrder, sourceType); response = MappingManager.FavoriteCollectionResponseMapping(entitys, coordinate); response.Index = pagerRequest.PageIndex; response.Size = pagerRequest.PageSize; response.TotalCount = totalCount; } return response; }
public override Mapping CreateMapping(SourceType source) { // На видеопанеле можно показывать только аппаратные источники if (!source.IsHardware) return null; return new Mapping() {Source = source}; }
public void ClearMapCacheIsRespected() { var mapper = new MemberMapper(); mapper.CreateMap<SourceType, DestinationType>(customMapping: src => new { ID = src.ID * 10, Name = src.Name + src.Name }); var source = new SourceType { ID = 10, Name = "x" }; var result = mapper.Map<DestinationType>(source); Assert.AreEqual(100, result.ID); Assert.AreEqual("xx", result.Name); mapper.ClearMapCache(); result = mapper.Map<DestinationType>(source); Assert.AreEqual(10, result.ID); Assert.AreEqual("x", result.Name); }
protected internal CompatibilitySourceToDispPair(DisplayType disp, SourceType source, Func<Mapping, SourceType, bool> linkPredicate, Func<Mapping> createMappingFunc) : base(disp, source, linkPredicate, createMappingFunc) { _jupiterIn = null; }
public void MappingConditionIsRespected() { var mapper = new MemberMapper(); mapper.CreateMapProposal<SourceType, DestinationType>() .ForMember(dest => dest.Name).OnlyIf(src => src.ID == 0) .FinalizeMap(); var source = new SourceType { ID = 10, Name = "X", Nested = new NestedSourceType { Foo = "Bla" } }; var result = mapper.Map<SourceType, DestinationType>(source); Assert.IsNull(result.Name); source.ID = 0; result = mapper.Map<SourceType, DestinationType>(source); Assert.AreEqual("X", result.Name); }
public override Mapping CreateMapping(SourceType source) { // На обычном компе нельзя показывать аппаратные источники if (source.IsHardware) return null; return new Mapping() { Source = source }; }
internal Source(string name, SourceType type, string code) { _name = name; _type = type; _code = code; _tokens = Lexer.GenerateTokens(code); }
internal Source(string name, SourceType type, IEnumerable<Token<TokenType>> tokens, string code) { _name = name; _type = type; _code = code; _tokens = tokens; }
public void LoadDfs2(string FileName) { _st = SourceType.DFS2; Dfs2File = FileName; DFSdem = new DFS2(_dfs2File); }
public void LoginCreate(string userName, string password, SourceType UserSourceType, string ExternalID, Converter converter, object dataObject) { using (DBAccess dbaccess = new DBAccess()) { SqlParameter parameter1 = new SqlParameter(); parameter1.ParameterName = "@UserName"; parameter1.Value = userName; parameter1.SqlDbType = SqlDbType.VarChar; SqlParameter parameter2 = new SqlParameter(); parameter2.ParameterName = "@UserPassword"; parameter2.Value = password; parameter2.SqlDbType = SqlDbType.VarChar; SqlParameter parameter3 = new SqlParameter(); parameter3.ParameterName = "@ExternalID"; parameter3.Value = ExternalID; parameter3.SqlDbType = SqlDbType.NVarChar; SqlParameter parameter4 = new SqlParameter(); parameter4.ParameterName = "@SourceID"; parameter4.Value = UserSourceType; parameter4.SqlDbType = SqlDbType.Int; SqlParameter[] parameters = new SqlParameter[4] { parameter1, parameter2, parameter3, parameter4 }; SqlDataReader reader = dbaccess.ExecuteProcedure("LoginCreate", this.connectionString, parameters); while (reader.Read()) { converter(reader, dataObject); } } }
public DeathInfo(float LastDamage, WeaponType DamageType, SourceType SourceType, Unit Killer = null) { this.DamageType = DamageType; this.LastDamage = LastDamage; this.SourceType = SourceType; this.Killer = Killer; }
/// <summary> /// 获取指定文件夹 /// </summary> /// <param name="sourceId"></param> /// <param name="sourceType"></param> /// <returns></returns> private static string[] GetFolder(int sourceId, SourceType sourceType) { switch (sourceType) { case SourceType.BrandLogo: case SourceType.CustomerPortrait: case SourceType.CustomerThumbBackground: case SourceType.StoreLogo: var useridstr = sourceId.ToString(CultureInfo.InvariantCulture); var n = String.Empty; if (useridstr.Length < 6) { for (var i = 0; i < (6 - useridstr.Length); i++) { n += "0"; } useridstr = n + useridstr; } var folders = new string[2]; folders[0] = useridstr.Substring(0, 3); folders[1] = useridstr.Substring(3, 3); return folders; default: return new string[0]; } }
public ActionResult List(PagerRequest request, int? sort, SourceType? sourceType, int? sourceId) { int totalCount; var sortOrder = sort ==null?ResourceSortOrder.CreateDate:(ResourceSortOrder)sort.Value; List<ResourceEntity> data; if (sourceType == null) { data = _resourceRepository.GetPagedList(request, out totalCount, sortOrder); } else { data = _resourceRepository.GetPagedList(request, out totalCount, sortOrder, sourceType, sourceId); } var vo = MappingManager.ResourceViewMapping(data); var v = new ResourceCollectionViewModel(request, totalCount) { Resources = vo.ToList() }; var dto = new ListDto { ResourceCollectionViewModel = v, Sort = sort, SourceId = sourceId, SourceType = sourceType }; return View("List", dto); }
public DtsTask(SourceType sourceType, string sourceName, TargetType targetType, ITarget target) { SourceType = sourceType; SourceName = sourceName; TargetType = targetType; Target = target; }
public static Attachment AttachmentNew(int sourceId, SourceType sourceType) { var attachment = AttachmentRepository.AttachmentNew(sourceId, sourceType); attachment.Name = DataHelper.RandomString(50); return attachment; }
public static Attachment AttachmentAdd(int sourceId, SourceType sourceType) { var attachment = AttachmentTestHelper.AttachmentNew(sourceId, sourceType); attachment = AttachmentRepository.AttachmentSave(attachment); return attachment; }
public static Label LabelAdd(SourceType sourceType, int sourceId, string name) { var result = LabelService.LabelNew(sourceType, sourceId, name); result = LabelService.LabelSave(result); return result; }
public CommandInfo(string caller, string args, string source, string commandName, SourceType origin) { this.Caller = caller; this.Arguments = args; this.Source = source; this.Origin = origin; this.CommandName = commandName; }
public static Source SourceAdd(int sourceId, SourceType sourceType, string name) { var source = SourceRepository.SourceNew(sourceId, sourceType, name); source = SourceRepository.SourceSave(source); return source; }
public static Feed FeedAdd(SourceType sourceType, int sourceId) { var feed = FeedTestHelper.FeedNew(sourceType, sourceId); feed = FeedRepository.FeedSave(feed); return feed; }
private List<Source> GetSourceListForSourceType(SourceType sourceType) { if (!_sourcesByType.ContainsKey(sourceType)) { _sourcesByType[sourceType] = new List<Source>(); } return _sourcesByType[sourceType]; }
public ImageInfo(Uri uri) { if (uri.IsFile) this.sourceType = SourceType.LocalDisk; else this.sourceType = SourceType.ExternalResource; this.source = uri; }
public static Attachment AttachmentNew(int sourceId, SourceType sourceType) { var attachment = Attachment.NewAttachment(); attachment.SourceId = sourceId; attachment.SourceTypeId = (int)sourceType; return attachment; }
internal static Source NewSource(int sourceId, SourceType sourceType) { return Csla.DataPortal.Create<Source>( new SourceDataCriteria { SourceId = sourceId, SourceTypeId = (int)sourceType }); }
internal static void DeleteSource(int sourceId, SourceType sourceType) { Csla.DataPortal.Delete<Source>( new SourceDataCriteria { SourceId = sourceId, SourceTypeId = (int)sourceType }); }
/// <summary> /// Gets all the sources. /// </summary> /// <param name="sourceType">Type of the sources.</param> /// <returns></returns> public IEnumerable<Source> GetSources(SourceType sourceType) { string file = GetSourceTypeFile(sourceType); if (_fileSystemService.FileExistsSynchronously(file)) { return Deserialize(file); } return Enumerable.Empty<Source>(); }
/// <summary> /// Constructor for a RuleInfo. /// </summary> /// <param name="name">Name of the rule.</param> /// <param name="commonName">Common Name of the rule.</param> /// <param name="description">Description of the rule.</param> /// <param name="sourceType">Source type of the rule.</param> /// <param name="sourceName">Source name of the rule.</param> public RuleInfo(string name, string commonName, string description, SourceType sourceType, string sourceName, RuleSeverity severity) { RuleName = name; CommonName = commonName; Description = description; SourceType = sourceType; SourceName = sourceName; Severity = severity; }
public static AttachmentInfoList AttachmentFetchInfoList(SourceType sourceType, int sourceId) { return AttachmentService.AttachmentFetchInfoList( new AttachmentCriteria { SourceType = sourceType, SourceId = sourceId }); }
public static NoteInfoList NoteFetchInfoList(SourceType sourceType, int sourceId) { return NoteService.NoteFetchInfoList( new NoteCriteria { SourceType = sourceType, SourceId = new[] { sourceId } }); }
/// <summary> /// Loads a file into the console /// <para>load -f "*.dbc" -s ".mpq/wow dir" -b 11802</para> /// </summary> /// <param name="args"></param> /// public static void LoadCommand(string[] args) { var pmap = ConsoleManager.ParseCommand(args); string file = ParamCheck <string>(pmap, "-f"); string filename = Path.GetFileName(file); string filenoext = Path.GetFileNameWithoutExtension(file); string source = ParamCheck <string>(pmap, "-s", false); int build = ParamCheck <int>(pmap, "-b"); SourceType sType = GetSourceType(source); //Check file exists if loaded from the filesystem if (!File.Exists(file) && sType == SourceType.File) { throw new Exception($" File not found {file}."); } //Check the required definition exists var def = Database.Definitions.Tables.FirstOrDefault(x => x.Build == build && x.Name.Equals(filenoext, IGNORECASE)); if (def == null) { throw new Exception($" Could not find definition for {Path.GetFileName(file)} build {build}."); } Database.BuildNumber = build; var dic = new ConcurrentDictionary <string, MemoryStream>(); string error = string.Empty; switch (sType) { case SourceType.MPQ: Console.WriteLine("Loading from MPQ archive..."); using (MpqArchive archive = new MpqArchive(source, FileAccess.Read)) { string line = string.Empty; bool loop = true; using (MpqFileStream listfile = archive.OpenFile("(listfile)")) using (StreamReader sr = new StreamReader(listfile)) { while ((line = sr.ReadLine()) != null && loop) { if (line.EndsWith(filename, IGNORECASE)) { loop = false; var ms = new MemoryStream(); archive.OpenFile(line).CopyTo(ms); dic.TryAdd(filename, ms); error = Database.LoadFiles(dic).Result.FirstOrDefault(); } } } } break; case SourceType.CASC: Console.WriteLine("Loading from CASC directory..."); using (var casc = new CASCHandler(source)) { string fullname = filename; if (!fullname.StartsWith("DBFilesClient", IGNORECASE)) { fullname = "DBFilesClient\\" + filename; //Ensure we have the current file name structure } var stream = casc.ReadFile(fullname); if (stream != null) { dic.TryAdd(filename, stream); error = Database.LoadFiles(dic).Result.FirstOrDefault(); } } break; default: error = Database.LoadFiles(new string[] { file }).Result.FirstOrDefault(); break; } dic.Clear(); if (!string.IsNullOrWhiteSpace(error)) { throw new Exception(" " + error); } if (Database.Entries.Count == 0) { throw new Exception(" File could not be loaded."); } Console.WriteLine($"{Path.GetFileName(file)} loaded."); Console.WriteLine(""); }
public static void ExtractCommand(string[] args) { var pmap = ConsoleManager.ParseCommand(args); string filter = ParamCheck <string>(pmap, "-f", false); string source = ParamCheck <string>(pmap, "-s"); string output = ParamCheck <string>(pmap, "-o"); SourceType sType = GetSourceType(source); if (string.IsNullOrWhiteSpace(filter)) { filter = "*"; } string regexfilter = "(" + Regex.Escape(filter).Replace(@"\*", @".*").Replace(@"\?", ".") + ")"; Func <string, bool> TypeCheck = t => Path.GetExtension(t).ToLower() == ".dbc" || Path.GetExtension(t).ToLower() == ".db2"; var dic = new ConcurrentDictionary <string, MemoryStream>(); switch (sType) { case SourceType.MPQ: Console.WriteLine("Loading from MPQ archive..."); using (MpqArchive archive = new MpqArchive(source, FileAccess.Read)) { string line = string.Empty; using (MpqFileStream listfile = archive.OpenFile("(listfile)")) using (StreamReader sr = new StreamReader(listfile)) { while ((line = sr.ReadLine()) != null) { if (TypeCheck(line) && Regex.IsMatch(line, regexfilter, RegexOptions.Compiled | RegexOptions.IgnoreCase)) { var ms = new MemoryStream(); archive.OpenFile(line).CopyTo(ms); dic.TryAdd(Path.GetFileName(line), ms); } } } } break; case SourceType.CASC: Console.WriteLine("Loading from CASC directory..."); using (var casc = new CASCHandler(source)) { var files = Constants.ClientDBFileNames.Where(x => Regex.IsMatch(Path.GetFileName(x), regexfilter, RegexOptions.Compiled | RegexOptions.IgnoreCase)); foreach (var file in files) { var stream = casc.ReadFile(file); if (stream != null) { dic.TryAdd(Path.GetFileName(file), stream); } } } break; } if (dic.Count == 0) { throw new Exception(" No matching files found."); } if (!Directory.Exists(output)) { Directory.CreateDirectory(output); } foreach (var d in dic) { using (var fs = new FileStream(Path.Combine(output, d.Key), FileMode.Create)) { fs.Write(d.Value.ToArray(), 0, (int)d.Value.Length); fs.Close(); } } dic.Clear(); Console.WriteLine($" Successfully extracted files."); Console.WriteLine(""); }
public BaseMedia(SourceType sourceType, bool isDynamicLength = false) : base(sourceType, false) { }
public override void OnInspectorGUI() { Settings settings = target as Settings; DrawLinks(); EditorGUI.BeginChangeCheck(); hasBankSourceChanged = false; bool hasBankTargetChanged = false; GUIStyle style = new GUIStyle(GUI.skin.label); style.richText = true; GUI.skin.FindStyle("HelpBox").richText = true; SourceType sourceType = settings.HasSourceProject ? SourceType.Project : (settings.HasPlatforms ? SourceType.Multi : SourceType.Single); EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); sourceType = GUILayout.Toggle(sourceType == SourceType.Project, "Project", "Button") ? 0 : sourceType; sourceType = GUILayout.Toggle(sourceType == SourceType.Single, "Single Platform Build", "Button") ? SourceType.Single : sourceType; sourceType = GUILayout.Toggle(sourceType == SourceType.Multi, "Multiple Platform Build", "Button") ? SourceType.Multi : sourceType; EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); EditorGUILayout.HelpBox( "<size=11>Select the way you wish to connect Unity to the FMOD Studio content:\n" + "<b>• Project</b>\t\tIf you have the complete FMOD Studio project avaliable\n" + "<b>• Single Platform</b>\tIf you have only the contents of the <i>Build</i> folder for a single platform\n" + "<b>• Multiple Platforms</b>\tIf you have only the contents of the <i>Build</i> folder for multiple platforms, each platform in it's own sub directory\n" + "</size>" , MessageType.Info, true); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (sourceType == SourceType.Project) { EditorGUILayout.BeginHorizontal(); string oldPath = settings.SourceProjectPath; EditorGUILayout.PrefixLabel("Studio Project Path", GUI.skin.textField, style); EditorGUI.BeginChangeCheck(); string newPath = EditorGUILayout.TextField(GUIContent.none, settings.SourceProjectPath); if (EditorGUI.EndChangeCheck()) { if (newPath.EndsWith(".fspro")) { settings.SourceProjectPath = newPath; } } if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false))) { GUI.FocusControl(null); string path = EditorUtility.OpenFilePanel("Locate Studio Project", oldPath, "fspro"); if (!string.IsNullOrEmpty(path)) { settings.SourceProjectPath = MakePathRelative(path); Repaint(); } } EditorGUILayout.EndHorizontal(); // Cache in settings for runtime access in play-in-editor mode string bankPath = EditorUtils.GetBankDirectory(); settings.SourceBankPath = bankPath; settings.HasPlatforms = true; settings.HasSourceProject = true; // First time project path is set or changes, copy to streaming assets if (settings.SourceProjectPath != oldPath) { hasBankSourceChanged = true; } } else if (sourceType == SourceType.Single || sourceType == SourceType.Multi) { EditorGUILayout.BeginHorizontal(); string oldPath = settings.SourceBankPath; EditorGUILayout.PrefixLabel("Build Path", GUI.skin.textField, style); EditorGUI.BeginChangeCheck(); string tempPath = EditorGUILayout.TextField(GUIContent.none, settings.SourceBankPath); if (EditorGUI.EndChangeCheck()) { settings.SourceBankPath = tempPath; } if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false))) { GUI.FocusControl(null); string newPath = EditorUtility.OpenFolderPanel("Locate Build Folder", oldPath, null); if (!string.IsNullOrEmpty(newPath)) { settings.SourceBankPath = MakePathRelative(newPath); Repaint(); } } EditorGUILayout.EndHorizontal(); settings.HasPlatforms = (sourceType == SourceType.Multi); settings.HasSourceProject = false; // First time project path is set or changes, copy to streaming assets if (settings.SourceBankPath != oldPath) { hasBankSourceChanged = true; } } bool validBanks; string failReason; EditorUtils.ValidateSource(out validBanks, out failReason); if (!validBanks) { failReason += "\n\nFor detailed setup instructions, please see the getting started guide linked above."; EditorGUILayout.HelpBox(failReason, MessageType.Error, true); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(settings); } return; } if (!RuntimeUtils.VerifyPlatformLibsExist()) { string errMsg = "Unable to find the FMOD '" + RuntimeUtils.GetEditorFMODPlatform() + "' libs. See console for details."; EditorGUILayout.HelpBox(errMsg, MessageType.Error, true); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(settings); } return; } ImportType importType = (ImportType)EditorGUILayout.EnumPopup("Import Type", settings.ImportType); if (importType != settings.ImportType) { hasBankTargetChanged = true; settings.ImportType = importType; bool deleteBanks = EditorUtility.DisplayDialog( "FMOD Bank Import Type Changed", "Do you want to delete the " + (importType == ImportType.AssetBundle ? "StreamingAssets" : "AssetBundle") + " banks in " + (importType == ImportType.AssetBundle ? Application.streamingAssetsPath : Application.dataPath + '/' + settings.TargetAssetPath) , "Yes", "No"); if (deleteBanks) { // Delete the old banks EventManager.removeBanks = true; EventManager.RefreshBanks(); } } // ----- Text Assets ------------- if (settings.ImportType == ImportType.AssetBundle) { GUI.SetNextControlName("targetAssetPath"); targetAssetPath = EditorGUILayout.TextField("FMOD Asset Folder", string.IsNullOrEmpty(targetAssetPath) ? settings.TargetAssetPath : targetAssetPath); if (GUI.GetNameOfFocusedControl() == "targetAssetPath") { focused = true; if (Event.current.isKey) { switch (Event.current.keyCode) { case KeyCode.Return: case KeyCode.KeypadEnter: if (settings.TargetAssetPath != targetAssetPath) { EventManager.RemoveBanks(Application.dataPath + '/' + settings.TargetAssetPath); settings.TargetAssetPath = targetAssetPath; hasBankTargetChanged = true; } break; } } } else if (focused) { if (settings.TargetAssetPath != targetAssetPath) { EventManager.RemoveBanks(Application.dataPath + '/' + settings.TargetAssetPath); settings.TargetAssetPath = targetAssetPath; hasBankTargetChanged = true; } } } // ----- Logging ----------------- EditorGUILayout.Separator(); EditorGUILayout.LabelField("<b>Logging</b>", style); EditorGUI.indentLevel++; settings.LoggingLevel = (FMOD.DEBUG_FLAGS)EditorGUILayout.EnumPopup("Logging Level", settings.LoggingLevel); EditorGUI.indentLevel--; // ----- Loading ----------------- EditorGUI.BeginDisabledGroup(settings.ImportType == ImportType.AssetBundle); EditorGUILayout.Separator(); EditorGUILayout.LabelField("<b>Initialization</b>", style); EditorGUI.indentLevel++; settings.BankLoadType = (BankLoadType)EditorGUILayout.EnumPopup("Load Banks", settings.BankLoadType); switch (settings.BankLoadType) { case BankLoadType.All: break; case BankLoadType.Specified: settings.AutomaticEventLoading = false; Texture upArrowTexture = EditorGUIUtility.Load("FMOD/ArrowUp.png") as Texture; Texture downArrowTexture = EditorGUIUtility.Load("FMOD/ArrowDown.png") as Texture; bankFoldOutState = EditorGUILayout.Foldout(bankFoldOutState, "Specified Banks", true); if (bankFoldOutState) { for (int i = 0; i < settings.BanksToLoad.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUI.indentLevel++; var bankName = settings.BanksToLoad[i]; EditorGUILayout.TextField(bankName.Replace(".bank", "")); if (GUILayout.Button(upArrowTexture, GUILayout.ExpandWidth(false))) { if (i > 0) { var temp = settings.BanksToLoad[i]; settings.BanksToLoad[i] = settings.BanksToLoad[i - 1]; settings.BanksToLoad[i - 1] = temp; } continue; } if (GUILayout.Button(downArrowTexture, GUILayout.ExpandWidth(false))) { if (i < settings.BanksToLoad.Count - 1) { var temp = settings.BanksToLoad[i]; settings.BanksToLoad[i] = settings.BanksToLoad[i + 1]; settings.BanksToLoad[i + 1] = temp; } continue; } if (GUILayout.Button("Browse", GUILayout.ExpandWidth(false))) { GUI.FocusControl(null); string path = EditorUtility.OpenFilePanel("Locate Bank", Application.streamingAssetsPath, "bank"); if (!string.IsNullOrEmpty(path)) { settings.BanksToLoad[i] = path.Replace(Application.streamingAssetsPath + Path.AltDirectorySeparatorChar, ""); Repaint(); } } if (GUILayout.Button("Remove", GUILayout.ExpandWidth(false))) { Settings.Instance.BanksToLoad.RemoveAt(i); continue; } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel--; } GUILayout.BeginHorizontal(); GUILayout.Space(30); if (GUILayout.Button("Add Bank", GUILayout.ExpandWidth(false))) { settings.BanksToLoad.Add(""); } if (GUILayout.Button("Add All Banks", GUILayout.ExpandWidth(false))) { FMODPlatform platform = RuntimeUtils.GetEditorFMODPlatform(); if (platform == FMODPlatform.None) { platform = FMODPlatform.PlayInEditor; } string sourceDir = RuntimeUtils.GetCommonPlatformPath(settings.SourceBankPath + '/' + (settings.HasSourceProject ? settings.GetBankPlatform(platform) + '/' : "")); var banksFound = new List <string>(Directory.GetFiles(sourceDir, "*.bank", SearchOption.AllDirectories)); for (int i = 0; i < banksFound.Count; i++) { string bankShortName = RuntimeUtils.GetCommonPlatformPath(Path.GetFullPath(banksFound[i])).Replace(sourceDir, ""); if (!settings.BanksToLoad.Contains(bankShortName)) { settings.BanksToLoad.Add(bankShortName); } } Repaint(); } if (GUILayout.Button("Clear", GUILayout.ExpandWidth(false))) { settings.BanksToLoad.Clear(); } GUILayout.EndHorizontal(); } break; case BankLoadType.None: settings.AutomaticEventLoading = false; break; default: break; } EditorGUI.BeginDisabledGroup(settings.BankLoadType == BankLoadType.None); settings.AutomaticSampleLoading = EditorGUILayout.Toggle("Load Bank Sample Data", settings.AutomaticSampleLoading); EditorGUI.EndDisabledGroup(); settings.EncryptionKey = EditorGUILayout.TextField("Bank Encryption Key", settings.EncryptionKey); EditorGUI.indentLevel--; EditorGUI.EndDisabledGroup(); // ----- PIE ---------------------------------------------- EditorGUILayout.Separator(); EditorGUILayout.LabelField("<b>Play In Editor Settings</b>", style); EditorGUI.indentLevel++; DisplayEditorBool("Live Update", settings.LiveUpdateSettings, FMODPlatform.PlayInEditor); if (settings.IsLiveUpdateEnabled(FMODPlatform.PlayInEditor)) { EditorGUILayout.BeginHorizontal(); settings.LiveUpdatePort = ushort.Parse(EditorGUILayout.TextField("Live Update Port:", settings.LiveUpdatePort.ToString())); if (GUILayout.Button("Reset", GUILayout.ExpandWidth(false))) { settings.LiveUpdatePort = 9264; } EditorGUILayout.EndHorizontal(); } DisplayEditorBool("Debug Overlay", settings.OverlaySettings, FMODPlatform.PlayInEditor); DisplayChildFreq("Sample Rate", settings.SampleRateSettings, FMODPlatform.PlayInEditor); if (settings.HasPlatforms) { DisplayPIEBuildDirectory("Bank Platform", settings.BankDirectorySettings, FMODPlatform.PlayInEditor); } DisplayPIESpeakerMode("Speaker Mode", settings.SpeakerModeSettings, FMODPlatform.PlayInEditor); if (settings.HasPlatforms) { EditorGUILayout.HelpBox(string.Format("Match the speaker mode to the setting of the platform <b>{0}</b> inside FMOD Studio", settings.GetBankPlatform(FMODPlatform.PlayInEditor)), MessageType.Info, false); } else { EditorGUILayout.HelpBox("Match the speaker mode to the setting inside FMOD Studio", MessageType.Info, false); } EditorGUI.indentLevel--; // ----- Default ---------------------------------------------- EditorGUILayout.Separator(); EditorGUILayout.LabelField("<b>Default Settings</b>", style); EditorGUI.indentLevel++; DisplayParentBool("Live Update", settings.LiveUpdateSettings, FMODPlatform.Default); if (settings.IsLiveUpdateEnabled(FMODPlatform.Default)) { EditorGUILayout.BeginHorizontal(); settings.LiveUpdatePort = ushort.Parse(EditorGUILayout.TextField("Live Update Port:", settings.LiveUpdatePort.ToString())); if (GUILayout.Button("Reset", GUILayout.ExpandWidth(false))) { settings.LiveUpdatePort = 9264; } EditorGUILayout.EndHorizontal(); } DisplayParentBool("Debug Overlay", settings.OverlaySettings, FMODPlatform.Default); DisplayParentFreq("Sample Rate", settings.SampleRateSettings, FMODPlatform.Default); if (settings.HasPlatforms) { bool prevChanged = GUI.changed; DisplayParentBuildDirectory("Bank Platform", settings.BankDirectorySettings, FMODPlatform.Default); hasBankSourceChanged |= !prevChanged && GUI.changed; } DisplayParentSpeakerMode("Speaker Mode", settings.SpeakerModeSettings, FMODPlatform.Default); if (settings.HasPlatforms) { EditorGUILayout.HelpBox(string.Format("Match the speaker mode to the setting of the platform <b>{0}</b> inside FMOD Studio", settings.GetBankPlatform(FMODPlatform.Default)), MessageType.Info, false); } else { EditorGUILayout.HelpBox("Match the speaker mode to the setting inside FMOD Studio", MessageType.Info, false); } DisplayParentInt("Virtual Channel Count", settings.VirtualChannelSettings, FMODPlatform.Default, 1, 2048); DisplayParentInt("Real Channel Count", settings.RealChannelSettings, FMODPlatform.Default, 1, 256); EditorGUI.indentLevel--; // ----- Plugins ---------------------------------------------- EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("<b>Plugins</b>", GUI.skin.button, style); if (GUILayout.Button("Add Plugin", GUILayout.ExpandWidth(false))) { settings.Plugins.Add(""); } EditorGUILayout.EndHorizontal(); EditorGUI.indentLevel++; for (int count = 0; count < settings.Plugins.Count; count++) { EditorGUILayout.BeginHorizontal(); settings.Plugins[count] = EditorGUILayout.TextField("Plugin " + (count + 1).ToString() + ":", settings.Plugins[count]); if (GUILayout.Button("Delete Plugin", GUILayout.ExpandWidth(false))) { settings.Plugins.RemoveAt(count); } EditorGUILayout.EndHorizontal(); } EditorGUI.indentLevel--; // ----- Windows ---------------------------------------------- DisplayPlatform(FMODPlatform.Desktop, null); DisplayPlatform(FMODPlatform.Mobile, new FMODPlatform[] { FMODPlatform.MobileHigh, FMODPlatform.MobileLow, FMODPlatform.AppleTV }); DisplayPlatform(FMODPlatform.Console, new FMODPlatform[] { FMODPlatform.XboxOne, FMODPlatform.PS4, FMODPlatform.Switch, FMODPlatform.Stadia }); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(settings); } if (hasBankSourceChanged) { EventManager.RefreshBanks(); } if (hasBankTargetChanged) { EventManager.RefreshBanks(); } }
/// <summary> /// Makes a list of pages /// </summary> /// <param name="ST">The type of list to create</param> /// <param name="SourceValues">An array of string values to create the list with, e.g. an array of categories. Use null if not appropriate</param> public void MakeList(SourceType st, string[] sourceValues) { btnStop.Visible = true; if (st == SourceType.DatabaseDump) { launchDumpSearcher(); return; } else if (st == SourceType.TextFile) { try { OpenFileDialog openListDialog = new OpenFileDialog(); openListDialog.Filter = "text files|*.txt|All files|*.*"; openListDialog.Multiselect = true; this.Focus(); if (openListDialog.ShowDialog() == DialogResult.OK) { Add(GetLists.FromTextFile(openListDialog.FileNames)); ListFile = openListDialog.FileName; } UpdateNumberOfArticles(); } catch (Exception ex) { ErrorHandler.Handle(ex); } return; } else if (st == SourceType.MyWatchlist) { try { BusyStatus = true; Add(GetLists.FromWatchList()); BusyStatus = false; UpdateNumberOfArticles(); return; } catch { MessageBox.Show("Please ensure you are logged in", "Log In"); } } else { Source = st; strSource = sourceValues; ThreadStart thr_Process = new ThreadStart(MakeList2); ListerThread = new Thread(thr_Process); ListerThread.IsBackground = true; ListerThread.Start(); } if (FilterNonMainAuto) { FilterNonMainArticles(); } if (FilterDuplicates) { removeListDuplicates(); } }
public LoadRespData ReadTorrent(string file, SourceType source) { if (source == SourceType.Torrent) { if (string.IsNullOrEmpty(file)) { P2pProxyApp.Log.Write("Не верная ссылка на торрент", TypeMessage.Error); throw new Exception("Не верная ссылка на торрент"); } file = new Uri(file).ToString(); } Random rand = new Random(DateTime.Now.Millisecond); string req = String.Format("LOADASYNC {2} {0} {1}", source.ToString().ToUpper(), file, rand.Next(100000, 200000)); if (source != SourceType.ContentId) { req = req + " 0 0 0"; } req = req.Replace("CONTENTID", "PID"); //SendMessage("LOADASYNC 126500 PID 1ccf192064ee2d95e91a79f91c6097273d582827"); SendMessage(req.Replace("CONTENTID", "PID")); int cwait = 0; bool exit = false; LoadRespData files = null; try { while (!exit) { Thread.Sleep(24); cwait += 24; if (cwait >= 1000) { break; } lock (_messagePool) { if (!_messagePool.Any()) { continue; } foreach (var msg in _messagePool) { if (msg.Type == MSG_LOADRESP) { exit = true; var data = (msg.InnerData as LoadRespData); if (data == null) { break; } files = msg.InnerData as LoadRespData; break; //resp.files.AddRange(new String[(msg.InnerData as LoadRespData).Files.Count]); //foreach (var f in (msg.InnerData as LoadRespData).Files) // resp.files[(int)f[1]] = f[0].ToString(); } } _messagePool.Clear(); } } } catch (Exception) { } return(files); }
public Source(string name, SourceType type) { this.name = name; this.type = type; }
/// <summary> /// .Net 4.5 非同步方法 /// 取得群組或多人對談中指定使用者檔案 /// </summary> /// <param name="userid"></param> /// <param name="GroupIdOrRoomId"></param> /// <param name="type"></param> /// <returns></returns> public Task <UserProfile> GetGroupOrRoomUserProfileAsync(string userid, string GroupIdOrRoomId, SourceType type) { if (type == SourceType.user) { throw new NotSupportedException("無法使用 SourceType = User"); } return(MessageApi.GetUserProfileAsync(channelAccessToken, userid, GroupIdOrRoomId, type)); }
public static void SetSourceType(Image obj, SourceType value) { obj.SetValue(SourceTypeProperty, value); }
public bool Contains(SourceType sourceType, int sourceId) { return(this.Any(child => child.SourceId == sourceId && child.SourceTypeId == (int)sourceType)); }
public override string ToString() { return(string.Format(CultureInfo.InvariantCulture, @"SourceType : {0}, FriendlyName : {1}, SourceString : {2}", SourceType.ToString(), FriendlyName, SourceString)); }
public DataAccess(SourceType dataType, string targetData) { libraryDataSet = provider.GetAllData(dataType, targetData); }
/// <summary> /// /// </summary> /// <returns></returns> public override int GetHashCode() { return(SourceType.GetHashCode() ^ DestinationType.GetHashCode()); }
/// <summary> /// 将对象序列化到本地 /// </summary> /// <param name="sType"></param> /// <param name="filePath"></param> public void SaveToFile(SourceType sType, string filePath) { data.Serialize(sType, filePath); }
private DataTable GetDataTableFromRepeater() { DataTable table = new DataTable(); table.Columns.Add("FieldName"); table.Columns.Add("FieldValue"); table.Columns.Add("FieldType"); table.Columns.Add("FieldLevel"); foreach (RepeaterItem item in this.RepContentForm.Items) { FieldControl control = (FieldControl)item.FindControl("Field"); DataRow row = table.NewRow(); switch (control.ControlType) { case FieldType.PictureType: { PictureType type2 = (PictureType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type2.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); if ((control.Settings.Count > 7) && DataConverter.CBoolean(control.Settings[7])) { DataRow row2 = table.NewRow(); row2["FieldName"] = "UploadFiles"; row2["FieldValue"] = type2.UploadFiles; row2["FieldType"] = FieldType.TextType; row2["FieldLevel"] = 0; table.Rows.Add(row2); } continue; } case FieldType.FileType: { FileType type3 = (FileType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type3.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); if (DataConverter.CBoolean(control.Settings[3])) { DataRow row3 = table.NewRow(); row3["FieldName"] = control.Settings[4]; row3["FieldValue"] = type3.FileSize; row3["FieldType"] = FieldType.TextType; row3["FieldLevel"] = control.FieldLevel; table.Rows.Add(row3); } continue; } case FieldType.NodeType: { EasyOne.WebSite.Controls.FieldControl.NodeType type7 = (EasyOne.WebSite.Controls.FieldControl.NodeType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type7.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); DataRow row4 = table.NewRow(); row4["FieldName"] = "infoid"; row4["FieldValue"] = type7.InfoNodeId; row4["FieldType"] = FieldType.InfoType; row4["FieldLevel"] = control.FieldLevel; table.Rows.Add(row4); continue; } case FieldType.AuthorType: { AuthorType type8 = (AuthorType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = this.ReplaceQutoChar(type8.FieldValue); row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } case FieldType.SourceType: { SourceType type6 = (SourceType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = this.ReplaceQutoChar(type6.FieldValue); row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } case FieldType.KeywordType: { KeywordType type5 = (KeywordType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = this.ReplaceQutoChar(StringHelper.ReplaceChar(type5.FieldValue, ' ', '|')); row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } case FieldType.ContentType: { ContentType type = (ContentType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type.Content; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } case FieldType.MultiplePhotoType: { MultiplePhotoType type4 = (MultiplePhotoType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type4.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } } row["FieldName"] = control.FieldName; row["FieldValue"] = control.Value; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); } DataRow row5 = table.NewRow(); row5["FieldName"] = "Inputer"; row5["FieldValue"] = PEContext.Current.User.UserName; row5["FieldType"] = FieldType.TextType; row5["FieldLevel"] = 0; table.Rows.Add(row5); return(table); }
/// <summary> /// 取得群組內指定使用者資料 /// /// </summary> /// <param name="userid">指定使用者Id</param> ///<param name="GroupidOrRoomId">群組或對話ID</param> ///<param name="type">群組或對話</param> /// <returns></returns> public UserProfile Get_Group_UserProfile(string userid, string GroupidOrRoomId, SourceType type) { if (type == SourceType.user) { throw new NotSupportedException("無法使用Source = User"); } return(MessageApi.Get_Group_UserProfile(this.channelAccessToken, userid, GroupidOrRoomId, type)); }
/// <summary> /// 执行保存 /// </summary> /// <returns>是否保存成功</returns> private bool SaveBizObjectSchemaProperty(BizObjectSchemaPropertyViewModel model, out ActionResult actionResult) { actionResult = new ActionResult(); string propertyName = model.PropertyName; string displayName = string.IsNullOrWhiteSpace(model.DisplayName) ? propertyName : model.DisplayName; // 检查选中的参数 Data.DataLogicType logicType = (Data.DataLogicType)Enum.Parse(typeof(Data.DataLogicType), model.LogicType); object defaultValue;//默认值 if (model.DefaultValue == string.Empty) { defaultValue = null; } else if (!DataValidator(model, propertyName, logicType, out defaultValue, out actionResult)) {//数据校验 return(false); } // 校验编码规范 System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(BizObjectSchema.CodeRegex); if (!regex.IsMatch(propertyName)) { actionResult.Success = false; actionResult.Message = "EditBizObjectSchemaProperty.Msg2"; return(false); } DataModel.PropertySchema newItem = null; if (logicType == Data.DataLogicType.BizObject || logicType == Data.DataLogicType.BizObjectArray) { //业务对象或业务对象数组 H3.DataModel.BizObjectSchema childSchema = CreateChildSchema(model.PropertyName); newItem = new DataModel.PropertySchema( propertyName, displayName, logicType, childSchema); } else { PropertySerializeMethod method = PropertySerializeMethod.None; int maxLength = 0; if (!model.VirtualField) { DataLogicTypeConvertor.GetSerializeMethod(logicType, ref method, ref maxLength); if (logicType == DataLogicType.Attachment && this.RootSchema.SchemaCode != this.CurrentSchema.SchemaCode) { method = PropertySerializeMethod.Xml; } } SourceType sourceType = logicType == DataLogicType.GlobalData ? SourceType.Metadata : SourceType.Normal; newItem = new DataModel.PropertySchema( propertyName, sourceType, method, model.Global, model.Indexed, displayName, logicType == DataLogicType.GlobalData ? DataLogicType.ShortString : logicType, maxLength, defaultValue, model.Formula, string.Empty, //this.txtDisplayValueFormula.Text, // 显示值公式没有实际作用,已注释 model.RecordTrail, model.Searchable, false, // this.chkAbstract.Checked // 摘要没有实际作用,已注释 false ); } bool result = true; if (!string.IsNullOrEmpty(this.SelectedProperty)) {//更新 DataModel.PropertySchema oldPropertySchema = this.CurrentSchema.GetProperty(this.SelectedProperty); DataModel.BizObjectSchema published = this.Engine.BizObjectManager.GetPublishedSchema(this.RootSchema.SchemaCode); if (published != null && published.GetProperty(propertyName) != null && !Data.DataLogicTypeConvertor.CanConvert(oldPropertySchema.LogicType, newItem.LogicType)) { actionResult.Success = false; actionResult.Message = "EditBizObjectSchemaProperty.Msg1"; return(false); } result = this.CurrentSchema.UpdateProperty(this.SelectedProperty, newItem); } else { result = this.CurrentSchema.AddProperty(newItem); } if (!result) { // 保存失败 actionResult.Success = false; actionResult.Message = "EditBizObjectSchemaProperty.Msg9"; return(false); } // 保存 if (!this.Engine.BizObjectManager.UpdateDraftSchema(this.RootSchema)) { // 保存失败 actionResult.Success = false; actionResult.Message = "msgGlobalString.SaveFailed"; return(false); } return(true); }
public Source(string text, SourceType type, Note note) { Text = text; Type = type; Note = note; }
/// <summary> /// Constructor. Takes all initial parameters, and allocates the necessary underlying arrays /// used for calculations. /// </summary> /// <param name="type">The spread mechanics to use for source values.</param> /// <param name="positionX"> /// The X-value of the position on a map that the source is located at. /// </param> /// <param name="positionY"> /// The Y-value of the position on a map that the source is located at. /// </param> /// <param name="radius"> /// The maximum radius of the source -- this is the maximum distance the source values will /// emanate, provided the area is completely unobstructed. /// </param> /// <param name="distanceCalc"> /// The distance calculation used to determine what shape the radius has (or a type /// implicitly convertible to Distance, eg. Radius). /// </param> public SenseSource(SourceType type, int positionX, int positionY, int radius, Distance distanceCalc) : this(type, Coord.Get(positionX, positionY), radius, distanceCalc) { }
public ShroudSource(SourceType type, PPos[] projectedCells) { Type = type; ProjectedCells = projectedCells; }
public AppSettings(SourceType sourceType) { Source = sourceType; ReadSettings(); }
public override int GetHashCode() => SourceType.GetHashCode() + TargetType.GetHashCode() + (ParameterType?.GetHashCode() ?? 0);
public APISource(string name, SourceType type) : base(name, type) { this.name = name; this.type = type; }
public float GetWeight(SourceType source) { return(weightedTypes.Where(s => s.source == source).Select(s => s.weight).FirstOrDefault()); }
private bool LoadRawExcel() { SourceType = SourceType.stTable; return(AnalyseRaw()); }
public ReplayTopic(ReaderConfigurationData <T> readerConfigurationData, string adminUrl, long @from, long to, long max, Tag tag, bool tagged, SourceType source) { ReaderConfigurationData = readerConfigurationData; From = @from; To = to; Max = max; Tag = tag; Tagged = tagged; Source = source; AdminUrl = adminUrl; }
public DragDropItem(string name, SourceType source) { Name = name; Source = source; }
internal StartReplayTopic(ClientConfigurationData clientConfigurationData, ReaderConfigurationData <T> readerConfigurationData, string adminUrl, long @from, long to, long max, Tag tag, bool tagged, SourceType source) { ClientConfigurationData = clientConfigurationData; ReaderConfigurationData = readerConfigurationData; From = @from; To = to; Max = max; Tag = tag; Tagged = tagged; Source = source; AdminUrl = adminUrl; }
public MainPipe AddSourceTask(MainPipe dataFlow, string Name, string SourceName, SourceType Sourcetype, ConnectionManager conMgrSource, out IDTSComponentMetaData100 sourceTask, bool SQLStatementASVariable = false, string ConnectionString = "") { CManagedComponentWrapper InstanceSource; switch (Sourcetype) { case SourceType.SELECTSQL: sourceTask = dataFlow.AddPipeLine(SSISMoniker.OLEDB_SOURCE, Name + " Source"); break; case SourceType.Table: sourceTask = dataFlow.AddPipeLine(SSISMoniker.OLEDB_SOURCE, Name + " Source"); break; case SourceType.FlatFile: sourceTask = dataFlow.AddPipeLine(SSISMoniker.FLAT_FILE_SOURCE, Name + " Source"); break; case SourceType.Excel: sourceTask = dataFlow.AddPipeLine(SSISMoniker.EXCEL_SOURCE, Name + " Source"); break; case SourceType.TableStorage: sourceTask = dataFlow.AddPipeLine(SSISMoniker.OLEDB_TABLESTORAGE_SOURCE, Name + " Source"); break; case SourceType.SPList: sourceTask = dataFlow.AddPipeLine(SSISMoniker.OLEDB_SPList_SOURCE, Name + " Source"); break; default: throw new Exception("Feature not implemented yet"); } InstanceSource = sourceTask.InitializeTask(); if (Sourcetype != SourceType.TableStorage && Sourcetype != SourceType.SPList) { sourceTask.SetConnection(conMgrSource); } switch (Sourcetype) { case SourceType.SELECTSQL: InstanceSource.SetSQLSource(SourceName, SQLStatementASVariable); break; case SourceType.Table: InstanceSource.SetTableSource(SourceName); break; case SourceType.Excel: InstanceSource.SetTableSource(SourceName); break; case SourceType.FlatFile: break; case SourceType.TableStorage: InstanceSource.SetTableStorageSource(SourceName, ConnectionString); break; case SourceType.SPList: InstanceSource.SetSharePointListSource(SourceName, ConnectionString); break; default: throw new Exception("Feature not implemented yet"); } InstanceSource.ConnectAndReinitializeMetaData(Name); return(dataFlow); }
public GetNumberOfEntries(string topic, string server, SourceType source) { Topic = topic; Server = server; Source = source; }