public override void WriteFile(string url, ResourceData resource) { #if COHERENT_UNITY_UNSUPPORTED_PLATFORM throw new ApplicationException("Coherent UI doesn't support the target platform!"); #else IntPtr buffer = resource.GetBuffer(); if (buffer == IntPtr.Zero) { resource.SignalFailure(); return; } byte[] bytes = new byte[resource.GetSize()]; Marshal.Copy(buffer, bytes, 0, bytes.Length); string cleanUrl = GetFilepath(url); try { File.WriteAllBytes(cleanUrl, bytes); } catch (IOException ex) { Console.Error.WriteLine(ex.Message); resource.SignalFailure(); return; } resource.SignalSuccess(); #endif }
internal static CodeCompileUnit Create(IDictionary resourceList, string baseName, string generatedCodeNamespace, string resourcesNamespace, CodeDomProvider codeProvider, bool internalClass, out string[] unmatchable) { if (resourceList == null) { throw new ArgumentNullException("resourceList"); } Dictionary<string, ResourceData> dictionary = new Dictionary<string, ResourceData>(StringComparer.InvariantCultureIgnoreCase); foreach (DictionaryEntry entry in resourceList) { ResourceData data; ResXDataNode node = entry.Value as ResXDataNode; if (node != null) { string key = (string) entry.Key; if (key != node.Name) { throw new ArgumentException(Microsoft.Build.Tasks.SR.GetString("MismatchedResourceName", new object[] { key, node.Name })); } Type type = Type.GetType(node.GetValueTypeName((AssemblyName[]) null)); string valueIfItWasAString = null; if (type == typeof(string)) { valueIfItWasAString = (string) node.GetValue((AssemblyName[]) null); } data = new ResourceData(type, valueIfItWasAString); } else { Type type2 = (entry.Value == null) ? typeof(object) : entry.Value.GetType(); data = new ResourceData(type2, entry.Value as string); } dictionary.Add((string) entry.Key, data); } return InternalCreate(dictionary, baseName, generatedCodeNamespace, resourcesNamespace, codeProvider, internalClass, out unmatchable); }
public override void WriteFile(string url, ResourceData resource) { IntPtr buffer = resource.GetBuffer(); if (buffer == IntPtr.Zero) { resource.SignalFailure(); return; } byte[] bytes = new byte[resource.GetSize()]; Marshal.Copy(buffer, bytes, 0, bytes.Length); string cleanUrl = GetFilepath(url); try { File.WriteAllBytes(cleanUrl, bytes); } catch (IOException ex) { Console.Error.WriteLine(ex.Message); resource.SignalFailure(); return; } resource.SignalSuccess(); }
public override ResourceData FilterCatalog(long size, string fileName) { var lastDot = fileName.LastIndexOf(".") + 1; var fileType = fileName.Substring(lastDot, fileName.Length - lastDot); var data = new ResourceData(size, fileName, fileType); return data; }
public ResourceData Union(ResourceData data) { ResourceData res = GetData(data.id); if (res == null) { List.Add(data); return data; } foreach (ResourceData r in List) { if (r.id < 0 || r.amount <= 0) { r.id = data.id; r.amount = data.amount; return r; } } res.amount += data.amount; return res; }
private static bool CheckReferenceProjectInObjectData(NodeObjectData parentNode, Project project, ResourceData projectPath) { bool result; if (parentNode == null) { result = false; } else { ProjectNodeObjectData projectNodeObjectData = parentNode as ProjectNodeObjectData; if (projectNodeObjectData != null) { ResourceItemData fileData = projectNodeObjectData.FileData; if (projectPath.Equals(fileData)) { result = true; return(result); } if (fileData != null) { Project project2 = Services.ProjectsService.CurrentResourceGroup.FindResourceItem(fileData) as Project; if (project2 != null) { bool flag = project2.HasReferencedProject(project); if (flag) { result = true; return(result); } } } } if (parentNode.Children != null) { foreach (NodeObjectData current in parentNode.Children) { bool flag2 = GameProjectContent.CheckReferenceProjectInObjectData(current, project, projectPath); if (flag2) { result = true; return(result); } } } result = false; } return(result); }
public override ICompilation ToCompilation() { // TODO: only copy COR headers for single-assembly build and for composite build with embedded MSIL IEnumerable <EcmaModule> inputModules = _compilationGroup.CompilationModuleSet; EcmaModule singleModule = _compilationGroup.IsCompositeBuildMode ? null : inputModules.First(); CopiedCorHeaderNode corHeaderNode = new CopiedCorHeaderNode(singleModule); // TODO: proper support for multiple input files DebugDirectoryNode debugDirectoryNode = new DebugDirectoryNode(singleModule, _outputFile); // Produce a ResourceData where the IBC PROFILE_DATA entry has been filtered out // TODO: proper support for multiple input files ResourceData win32Resources = new ResourceData(inputModules.First(), (object type, object name, ushort language) => { if (!(type is string) || !(name is string)) { return(true); } if (language != 0) { return(true); } string typeString = (string)type; string nameString = (string)name; if ((typeString == "IBC") && (nameString == "PROFILE_DATA")) { return(false); } return(true); }); ReadyToRunFlags flags = ReadyToRunFlags.READYTORUN_FLAG_NonSharedPInvokeStubs; if (inputModules.All(module => module.IsPlatformNeutral)) { flags |= ReadyToRunFlags.READYTORUN_FLAG_PlatformNeutralSource; } flags |= _compilationGroup.GetReadyToRunFlags(); NodeFactory factory = new NodeFactory( _context, _compilationGroup, _nameMangler, corHeaderNode, debugDirectoryNode, win32Resources, flags); IComparer <DependencyNodeCore <NodeFactory> > comparer = new SortableDependencyNode.ObjectNodeComparer(new CompilerComparer()); DependencyAnalyzerBase <NodeFactory> graph = CreateDependencyGraph(factory, comparer); List <CorJitFlag> corJitFlags = new List <CorJitFlag> { CorJitFlag.CORJIT_FLAG_DEBUG_INFO }; switch (_optimizationMode) { case OptimizationMode.None: corJitFlags.Add(CorJitFlag.CORJIT_FLAG_DEBUG_CODE); break; case OptimizationMode.PreferSize: corJitFlags.Add(CorJitFlag.CORJIT_FLAG_SIZE_OPT); break; case OptimizationMode.PreferSpeed: corJitFlags.Add(CorJitFlag.CORJIT_FLAG_SPEED_OPT); break; default: // Not setting a flag results in BLENDED_CODE. break; } if (_ibcTuning) { corJitFlags.Add(CorJitFlag.CORJIT_FLAG_BBINSTR); } JitConfigProvider.Initialize(_context.Target, corJitFlags, _ryujitOptions, _jitPath); return(new ReadyToRunCodegenCompilation( graph, factory, _compilationRoots, _ilProvider, _logger, new DependencyAnalysis.ReadyToRun.DevirtualizationManager(_compilationGroup), _inputFiles, _instructionSetSupport, _resilient, _generateMapFile, _parallelism, _profileData, _r2rMethodLayoutAlgorithm, _r2rFileLayoutAlgorithm)); }
private static bool DefineResourceFetchingProperty(string propertyName, string resourceName, ResourceData data, CodeTypeDeclaration srClass, bool internalClass, bool useStatic) { CodeMethodReturnStatement statement; CodeMemberProperty property = new CodeMemberProperty { Name = propertyName, HasGet = true, HasSet = false }; Type baseType = data.Type; if (baseType == null) { return false; } if (baseType == typeof(MemoryStream)) { baseType = typeof(UnmanagedMemoryStream); } while (!baseType.IsPublic) { baseType = baseType.BaseType; } CodeTypeReference targetType = new CodeTypeReference(baseType); property.Type = targetType; if (internalClass) { property.Attributes = MemberAttributes.Assembly; } else { property.Attributes = MemberAttributes.Public; } if (useStatic) { property.Attributes |= MemberAttributes.Static; } CodePropertyReferenceExpression targetObject = new CodePropertyReferenceExpression(null, "ResourceManager"); CodeFieldReferenceExpression expression2 = new CodeFieldReferenceExpression(useStatic ? null : new CodeThisReferenceExpression(), "resourceCulture"); bool flag = baseType == typeof(string); bool flag2 = (baseType == typeof(UnmanagedMemoryStream)) || (baseType == typeof(MemoryStream)); string methodName = string.Empty; string text = string.Empty; string b = TruncateAndFormatCommentStringForOutput(data.ValueAsString); string a = string.Empty; if (!flag) { a = TruncateAndFormatCommentStringForOutput(baseType.ToString()); } if (flag) { methodName = "GetString"; } else if (flag2) { methodName = "GetStream"; } else { methodName = "GetObject"; } if (flag) { text = System.Design.SR.GetString("StringPropertyComment", new object[] { b }); } else if ((b == null) || string.Equals(a, b)) { text = System.Design.SR.GetString("NonStringPropertyComment", new object[] { a }); } else { text = System.Design.SR.GetString("NonStringPropertyDetailedComment", new object[] { a, b }); } property.Comments.Add(new CodeCommentStatement("<summary>", true)); property.Comments.Add(new CodeCommentStatement(text, true)); property.Comments.Add(new CodeCommentStatement("</summary>", true)); CodeExpression expression = new CodeMethodInvokeExpression(targetObject, methodName, new CodeExpression[] { new CodePrimitiveExpression(resourceName), expression2 }); if (flag || flag2) { statement = new CodeMethodReturnStatement(expression); } else { CodeVariableDeclarationStatement statement2 = new CodeVariableDeclarationStatement(typeof(object), "obj", expression); property.GetStatements.Add(statement2); statement = new CodeMethodReturnStatement(new CodeCastExpression(targetType, new CodeVariableReferenceExpression("obj"))); } property.GetStatements.Add(statement); srClass.Members.Add(property); return true; }
// Use this for initialization void Start() { console = GameObject.Find ("Console"); dev = console.GetComponent<DevOptions>(); resourceData = resourceValues.GetComponent<ResourceData> (); troopData = troopNumbers.GetComponent<TroopData> (); windowManager = window.GetComponent<WindowManager> (); var repo = ConsoleCommandsRepository.Instance; repo.RegisterCommand ("changetroops", ChangeTroops); repo.RegisterCommand ("closewindow", CloseWindow); repo.RegisterCommand ("debug", DebugOn); repo.RegisterCommand ("exit", Exit); repo.RegisterCommand ("foodrate", FoodRate); repo.RegisterCommand("help", Help); repo.RegisterCommand("load", Load); repo.RegisterCommand ("metalrate", MetalRate); repo.RegisterCommand ("openwindow", OpenWindow); repo.RegisterCommand ("stonerate", StoneRate); repo.RegisterCommand ("woodrate", WoodRate); }
public DefaultRefreshToken(ResourceData data) : base(data) { }
private void LoadResourceInfo(BinaryReaderEx reader) { this.ResourceInfoStart = reader.BaseStream.Position; // Load Resources this.Resources = new List<ResourceData>(this.ResourceHeader.NumResources); for (var i = 0; i < this.ResourceHeader.NumResources; i++) { ResourceData resource = new ResourceData(); resource.Index = reader.ReadInt32(); resource.Offset = reader.ReadInt32(); resource.Size = reader.ReadInt32(); resource.Type = reader.ReadInt32(); this.Resources.Add(resource); } this.BasePosition = reader.BaseStream.Position; }
private static bool DefineResourceFetchingProperty(String propertyName, String resourceName, ResourceData data, CodeTypeDeclaration srClass, bool internalClass, bool useStatic) { CodeMemberProperty prop = new CodeMemberProperty(); prop.Name = propertyName; prop.HasGet = true; prop.HasSet = false; Type type = data.Type; if (type == null) { return false; } if (type == typeof(MemoryStream)) type = typeof(UnmanagedMemoryStream); // Ensure type is internalally visible. This is necessary to ensure // users can access classes via a base type. Imagine a class like // Image or Stream as a internalally available base class, then an // internal type like MyBitmap or __UnmanagedMemoryStream as an // internal implementation for that base class. For internalally // available strongly typed resource classes, we must return the // internal type. For simplicity, we'll do that for internal strongly // typed resource classes as well. Ideally we'd also like to check // for interfaces like IList, but I don't know how to do that without // special casing collection interfaces & ignoring serialization // interfaces or IDisposable. while(!type.IsPublic) type = type.BaseType; CodeTypeReference valueType = new CodeTypeReference(type); prop.Type = valueType; if (internalClass) prop.Attributes = MemberAttributes.Assembly; else prop.Attributes = MemberAttributes.Public; if (useStatic) prop.Attributes |= MemberAttributes.Static; // For Strings, emit this: // return ResourceManager.GetString("name", _resCulture); // For Streams, emit this: // return ResourceManager.GetStream("name", _resCulture); // For Objects, emit this: // Object obj = ResourceManager.GetObject("name", _resCulture); // return (MyValueType) obj; CodePropertyReferenceExpression resMgr = new CodePropertyReferenceExpression(null, "ResourceManager"); CodeFieldReferenceExpression resCultureField = new CodeFieldReferenceExpression((useStatic) ? null : new CodeThisReferenceExpression(), CultureInfoFieldName); bool isString = type == typeof(String); bool isStream = type == typeof(UnmanagedMemoryStream) || type == typeof(MemoryStream); String getMethodName = String.Empty; String text = String.Empty; String valueAsString = TruncateAndFormatCommentStringForOutput(data.ValueAsString); String typeName = String.Empty; if (!isString) // Stream or Object typeName = TruncateAndFormatCommentStringForOutput(type.ToString()); if (isString) getMethodName = "GetString"; else if (isStream) getMethodName = "GetStream"; else getMethodName = "GetObject"; if (isString) text = SR.GetString(SR.StringPropertyComment, valueAsString); else { // Stream or Object if (valueAsString == null || String.Equals(typeName, valueAsString)) // If the type did not override ToString, ToString just returns the type name. text = SR.GetString(SR.NonStringPropertyComment, typeName); else text = SR.GetString(SR.NonStringPropertyDetailedComment, typeName, valueAsString); } prop.Comments.Add(new CodeCommentStatement(DocCommentSummaryStart, true)); prop.Comments.Add(new CodeCommentStatement(text, true)); prop.Comments.Add(new CodeCommentStatement(DocCommentSummaryEnd, true)); CodeExpression getValue = new CodeMethodInvokeExpression(resMgr, getMethodName, new CodePrimitiveExpression(resourceName), resCultureField); CodeMethodReturnStatement ret; if (isString || isStream) { ret = new CodeMethodReturnStatement(getValue); } else { CodeVariableDeclarationStatement returnObj = new CodeVariableDeclarationStatement(typeof(Object), "obj", getValue); prop.GetStatements.Add(returnObj); ret = new CodeMethodReturnStatement(new CodeCastExpression(valueType, new CodeVariableReferenceExpression("obj"))); } prop.GetStatements.Add(ret); srClass.Members.Add(prop); return true; }
private static void RenderProperty(StringBuilder builder, ResourceData resourceString) { builder.AppendFormat(" internal static string {0}", resourceString.Name) .AppendLine() .AppendLine(" {") .AppendFormat(@" get {{ return GetString(""{0}""); }}", resourceString.Name) .AppendLine() .AppendLine(" }"); }
internal static CodeCompileUnit Create(IDictionary resourceList, String baseName, String generatedCodeNamespace, String resourcesNamespace, CodeDomProvider codeProvider, bool internalClass, out String[] unmatchable) { if (resourceList == null) throw new ArgumentNullException("resourceList"); Dictionary<String, ResourceData> resourceTypes = new Dictionary<String, ResourceData>(StringComparer.InvariantCultureIgnoreCase); foreach(DictionaryEntry de in resourceList) { ResXDataNode node = de.Value as ResXDataNode; ResourceData data; if (node != null) { string keyname = (string) de.Key ; if (keyname != node.Name) throw new ArgumentException(SR.GetString(SR.MismatchedResourceName, keyname, node.Name)); String typeName = node.GetValueTypeName((AssemblyName[])null); Type type = Type.GetType(typeName); String valueAsString = node.GetValue((AssemblyName[])null).ToString(); data = new ResourceData(type, valueAsString); } else { // If the object is null, we don't have a good way of guessing the // type. Use Object. This will be rare after WinForms gets away // from their resource pull model in Whidbey M3. Type type = (de.Value == null) ? typeof(Object) : de.Value.GetType(); data = new ResourceData(type, de.Value == null ? null : de.Value.ToString()); } resourceTypes.Add((String) de.Key, data); } // Note we still need to verify the resource names are valid language // keywords, etc. So there's no point to duplicating the code above. return InternalCreate(resourceTypes, baseName, generatedCodeNamespace, resourcesNamespace, codeProvider, internalClass, out unmatchable); }
internal static CodeCompileUnit Create(String resxFile, String baseName, String generatedCodeNamespace, String resourcesNamespace, CodeDomProvider codeProvider, bool internalClass, out String[] unmatchable) { if (resxFile == null) throw new ArgumentNullException("resxFile"); // Read the resources from a ResX file into a dictionary - name & type name Dictionary<String, ResourceData> resourceList = new Dictionary<String, ResourceData>(StringComparer.InvariantCultureIgnoreCase); using(ResXResourceReader rr = new ResXResourceReader(resxFile)) { rr.UseResXDataNodes = true; foreach(DictionaryEntry de in rr) { ResXDataNode node = (ResXDataNode) de.Value; String typeName = node.GetValueTypeName((AssemblyName[])null); Type type = Type.GetType(typeName); String valueAsString = node.GetValue((AssemblyName[])null).ToString(); ResourceData data = new ResourceData(type, valueAsString); resourceList.Add((String) de.Key, data); } } // Note we still need to verify the resource names are valid language // keywords, etc. So there's no point to duplicating the code above. return InternalCreate(resourceList, baseName, generatedCodeNamespace, resourcesNamespace, codeProvider, internalClass, out unmatchable); }
public DragClass(int item_id, object data = null, float scale = 1) { Resource = new ResourceData(item_id,1); Data = data; Scale = scale; }
public DragClass(ResourceData res, object data = null) { Resource = res; Data = data; }
// Use this for initialization void Start() { popup = GameObject.Find("Resource Values").GetComponent<ResourceData>(); }
public override ICompilation ToCompilation() { ModuleTokenResolver moduleTokenResolver = new ModuleTokenResolver(_compilationGroup, _context); SignatureContext signatureContext = new SignatureContext(_inputModule, moduleTokenResolver); CopiedCorHeaderNode corHeaderNode = new CopiedCorHeaderNode(_inputModule); AttributePresenceFilterNode attributePresenceFilterNode = null; // Core library attributes are checked FAR more often than other dlls // attributes, so produce a highly efficient table for determining if they are // present. Other assemblies *MAY* benefit from this feature, but it doesn't show // as useful at this time. if (_inputModule == _inputModule.Context.SystemModule) { attributePresenceFilterNode = new AttributePresenceFilterNode(_inputModule); } // Produce a ResourceData where the IBC PROFILE_DATA entry has been filtered out ResourceData win32Resources = new ResourceData(_inputModule, (object type, object name, ushort language) => { if (!(type is string) || !(name is string)) { return(true); } if (language != 0) { return(true); } string typeString = (string)type; string nameString = (string)name; if ((typeString == "IBC") && (nameString == "PROFILE_DATA")) { return(false); } return(true); }); ReadyToRunCodegenNodeFactory factory = new ReadyToRunCodegenNodeFactory( _context, _compilationGroup, _nameMangler, moduleTokenResolver, signatureContext, corHeaderNode, win32Resources, attributePresenceFilterNode); IComparer <DependencyNodeCore <NodeFactory> > comparer = new SortableDependencyNode.ObjectNodeComparer(new CompilerComparer()); DependencyAnalyzerBase <NodeFactory> graph = CreateDependencyGraph(factory, comparer); List <CorJitFlag> corJitFlags = new List <CorJitFlag> { CorJitFlag.CORJIT_FLAG_DEBUG_INFO }; switch (_optimizationMode) { case OptimizationMode.None: corJitFlags.Add(CorJitFlag.CORJIT_FLAG_DEBUG_CODE); break; case OptimizationMode.PreferSize: corJitFlags.Add(CorJitFlag.CORJIT_FLAG_SIZE_OPT); break; case OptimizationMode.PreferSpeed: corJitFlags.Add(CorJitFlag.CORJIT_FLAG_SPEED_OPT); break; default: // Not setting a flag results in BLENDED_CODE. break; } if (_ibcTuning) { corJitFlags.Add(CorJitFlag.CORJIT_FLAG_BBINSTR); } corJitFlags.Add(CorJitFlag.CORJIT_FLAG_FEATURE_SIMD); var jitConfig = new JitConfigProvider(corJitFlags, _ryujitOptions, _jitPath); return(new ReadyToRunCodegenCompilation( graph, factory, _compilationRoots, _ilProvider, _logger, new DependencyAnalysis.ReadyToRun.DevirtualizationManager(_compilationGroup), jitConfig, _inputFilePath, new ModuleDesc[] { _inputModule }, _resilient, _generateMapFile, _parallelism)); }
protected virtual ResourceData getBiomeData(string bodyName, string biomeName, string resourceName, int resourceType) { ResourceData data, mapData; string resourceTypeStr = resourceType.ToString(); string key; //If the data exists in our biome map, then retrieve it. key = bodyName + biomeName + resourceName + resourceTypeStr; if (resourceDataMap.ContainsKey(key)) { data = resourceDataMap[key]; return data; } //No biome data. Look in the planetary map. key = bodyName + resourceName + resourceTypeStr; if (resourceDataMap.ContainsKey(key)) { mapData = resourceDataMap[key]; data = new ResourceData(); data.BiomeName = biomeName; data.PlanetName = mapData.PlanetName; data.ResourceName = mapData.ResourceName; data.ResourceType = mapData.ResourceType; data.Distribution = new DistributionData(); data.Distribution.Dispersal = mapData.Distribution.Dispersal; data.Distribution.MaxAbundance = mapData.Distribution.MaxAbundance; data.Distribution.MaxAbundance = mapData.Distribution.MaxAltitude; data.Distribution.MaxRange = mapData.Distribution.MaxRange; data.Distribution.MinAbundance = mapData.Distribution.MinAbundance; data.Distribution.MinAltitude = mapData.Distribution.MinAltitude; data.Distribution.MinRange = mapData.Distribution.MinRange; data.Distribution.PresenceChance = mapData.Distribution.PresenceChance; data.Distribution.Variance = mapData.Distribution.Variance; ResourceCache.Instance.BiomeResources.Add(data); resourceDataMap.Add(bodyName + biomeName + resourceName + resourceTypeStr, data); return data; } //No planetary data. Look in the global map. key = resourceName + resourceTypeStr; if (resourceDataMap.ContainsKey(key)) { mapData = resourceDataMap[key]; data = new ResourceData(); data.BiomeName = biomeName; data.PlanetName = bodyName; data.ResourceName = mapData.ResourceName; data.ResourceType = mapData.ResourceType; data.Distribution = new DistributionData(); data.Distribution.Dispersal = mapData.Distribution.Dispersal; data.Distribution.MaxAbundance = mapData.Distribution.MaxAbundance; data.Distribution.MaxAbundance = mapData.Distribution.MaxAltitude; data.Distribution.MaxRange = mapData.Distribution.MaxRange; data.Distribution.MinAbundance = mapData.Distribution.MinAbundance; data.Distribution.MinAltitude = mapData.Distribution.MinAltitude; data.Distribution.MinRange = mapData.Distribution.MinRange; data.Distribution.PresenceChance = mapData.Distribution.PresenceChance; data.Distribution.Variance = mapData.Distribution.Variance; ResourceCache.Instance.BiomeResources.Add(data); resourceDataMap.Add(bodyName + biomeName + resourceName + resourceTypeStr, data); return data; } //Uh oh... return null; }
/// <summary> /// Gets if the player has enough resources. /// </summary> public bool HasEnoughResources(ResourceData Data, int Count) { return(this.CommoditySlots.GetCommodityCount(CommodityType.Resource, Data) >= Count); }
private static bool DefineResourceFetchingProperty(string propertyName, string resourceName, ResourceData data, CodeTypeDeclaration srClass, bool internalClass, bool useStatic) { CodeMethodReturnStatement statement; CodeMemberProperty property = new CodeMemberProperty { Name = propertyName, HasGet = true, HasSet = false }; Type baseType = data.Type; if (baseType == null) { return false; } if (baseType == typeof(MemoryStream)) { baseType = typeof(UnmanagedMemoryStream); } while (!baseType.IsPublic) { baseType = baseType.BaseType; } CodeTypeReference targetType = new CodeTypeReference(baseType); property.Type = targetType; if (internalClass) { property.Attributes = MemberAttributes.Assembly; } else { property.Attributes = MemberAttributes.Public; } if (useStatic) { property.Attributes |= MemberAttributes.Static; } CodePropertyReferenceExpression targetObject = new CodePropertyReferenceExpression(null, "ResourceManager"); CodeFieldReferenceExpression expression2 = new CodeFieldReferenceExpression(useStatic ? null : new CodeThisReferenceExpression(), "resourceCulture"); bool flag = baseType == typeof(string); bool flag2 = (baseType == typeof(UnmanagedMemoryStream)) || (baseType == typeof(MemoryStream)); string methodName = "GetObject"; if (flag) { methodName = "GetString"; string valueIfString = data.ValueIfString; if (valueIfString == null) { valueIfString = string.Empty; } if (valueIfString.Length > 0x200) { valueIfString = Microsoft.Build.Tasks.SR.GetString("StringPropertyTruncatedComment", new object[] { valueIfString.Substring(0, 0x200) }); } valueIfString = SecurityElement.Escape(valueIfString); string text = string.Format(CultureInfo.CurrentCulture, Microsoft.Build.Tasks.SR.GetString("StringPropertyComment"), new object[] { valueIfString }); property.Comments.Add(new CodeCommentStatement("<summary>", true)); property.Comments.Add(new CodeCommentStatement(text, true)); property.Comments.Add(new CodeCommentStatement("</summary>", true)); } else if (flag2) { methodName = "GetStream"; } CodeExpression expression = new CodeMethodInvokeExpression(targetObject, methodName, new CodeExpression[] { new CodePrimitiveExpression(resourceName), expression2 }); if (flag || flag2) { statement = new CodeMethodReturnStatement(expression); } else { CodeVariableDeclarationStatement statement2 = new CodeVariableDeclarationStatement(typeof(object), "obj", expression); property.GetStatements.Add(statement2); statement = new CodeMethodReturnStatement(new CodeCastExpression(targetType, new CodeVariableReferenceExpression("obj"))); } property.GetStatements.Add(statement); srClass.Members.Add(property); return true; }
public AbstractProviderData(ResourceData data) : base(data) { this.SetProperty(ProviderIdPropertyName, this.ConcreteProviderId); }
public TransportObject(int slots, int amountMax) { ID = transportID++; Amount = amountMax; for (int i = 0; i < slots; i++) { ResourceData data = new ResourceData(); Slots.Add(data); } }
public static guiSlot Create(Transform parent, ResourceData worker, SlotType type, DragType drag, object data = null) { GameObject obj = Instantiate<GameObject>(Resources.Load<GameObject>("Slot")); obj.transform.SetParent(parent); obj.transform.localScale = Vector3.one; guiSlot slot = obj.GetComponent<guiSlot>(); slot.Worker = worker; slot.Type = type; slot.Drag = drag; slot.Data = data; return slot; }
public override void SetBuilding(GameObject objectBuild) { CurrentBuilding = objectBuild.GetComponent<Building>(); Caption = CurrentBuilding.Caption; ActiveLaborers.AddLaborers(CurrentBuilding.Laborers); //Pievieno pieejamos darbus AwailableWorks.ClearItems(); foreach (ResourceData data in CurrentBuilding.Resource.Available.List) { if (data.id < 0) continue; GameObject obj = AwailableWorks.AddItem(AwailablePrefab); guiSlot slot = obj.GetComponent<guiSlot>(); slot.Type = guiSlot.SlotType.NORMAL; slot.Drag = guiSlot.DragType.DRAG; slot.Worker = new ResourceData(data.id, 0); } //Pievienojam darbu slotus while (ActiveSlots.childCount > 0) { GameObject.DestroyImmediate(ActiveSlots.GetChild(0).gameObject); } ActiveWorks.ClearItems(); for (int i = 0; i < CurrentBuilding.ActiveWorks.List.Count; i++) { ResourceData worker; if (CurrentBuilding.ActiveWorks.List[i] != null && CurrentBuilding.ActiveWorks.List[i].Resource != null) { worker = new ResourceData(CurrentBuilding.ActiveWorks.List[i].Resource.ID, 0); } else { worker = new ResourceData(); } GameObject obj = ActiveWorks.AddItem(); guiSlot slot = obj.GetComponent<guiSlot>(); slot.Type = guiSlot.SlotType.PROGRESS; slot.Drag = guiSlot.DragType.NONE; slot.Data = i; slot.Worker = worker; slot.OnSlotClick = OnWorkerClick; } //Vekala panelis ShopPanel.ShopData = CurrentBuilding.ShopList; //Pievienojam noliktavas paneļus InventoryPanel.Inventory = CurrentBuilding.Inventory; //Iezīmētais darbs SelectedWorker.Worker = null; SelectedWorker.ListID = -1; SelectedWorker.gameObject.SetActive(false); }
internal static CodeCompileUnit Create(string resxFile, string baseName, string generatedCodeNamespace, string resourcesNamespace, CodeDomProvider codeProvider, bool internalClass, out string[] unmatchable) { if (resxFile == null) { throw new ArgumentNullException("resxFile"); } Dictionary<string, ResourceData> resourceList = new Dictionary<string, ResourceData>(StringComparer.InvariantCultureIgnoreCase); using (ResXResourceReader reader = new ResXResourceReader(resxFile)) { reader.UseResXDataNodes = true; foreach (DictionaryEntry entry in reader) { ResXDataNode node = (ResXDataNode) entry.Value; Type type = Type.GetType(node.GetValueTypeName((AssemblyName[]) null)); string valueIfItWasAString = null; if (type == typeof(string)) { valueIfItWasAString = (string) node.GetValue((AssemblyName[]) null); } ResourceData data = new ResourceData(type, valueIfItWasAString); resourceList.Add((string) entry.Key, data); } } return InternalCreate(resourceList, baseName, generatedCodeNamespace, resourcesNamespace, codeProvider, internalClass, out unmatchable); }
private static SortedList VerifyResourceNames(Dictionary <String, ResourceData> resourceList, CodeDomProvider codeProvider, ArrayList errors, out Hashtable reverseFixupTable) { reverseFixupTable = new Hashtable(0, StringComparer.InvariantCultureIgnoreCase); SortedList cleanedResourceList = new SortedList(StringComparer.InvariantCultureIgnoreCase, resourceList.Count); foreach (KeyValuePair <String, ResourceData> entry in resourceList) { String key = entry.Key; // Disallow a property named ResourceManager or Culture - we add // those. (Any other properties we add also must be listed here) // Also disallow resource values of type Void. if (String.Equals(key, ResMgrPropertyName) || String.Equals(key, CultureInfoPropertyName) || typeof(void) == entry.Value.Type) { errors.Add(key); continue; } // Ignore WinForms design time and hierarchy information. // Skip resources starting with $ or >>, like "$this.Text", // ">>$this.Name" or ">>treeView1.Parent". if ((key.Length > 0 && key[0] == '$') || (key.Length > 1 && key[0] == '>' && key[1] == '>')) { continue; } if (!codeProvider.IsValidIdentifier(key)) { String newKey = VerifyResourceName(key, codeProvider, false); if (newKey == null) { errors.Add(key); continue; } // Now see if we've already mapped another key to the // same name. String oldDuplicateKey = (String)reverseFixupTable[newKey]; if (oldDuplicateKey != null) { // We can't handle this key nor the previous one. // Remove the old one. if (!errors.Contains(oldDuplicateKey)) { errors.Add(oldDuplicateKey); } if (cleanedResourceList.Contains(newKey)) { cleanedResourceList.Remove(newKey); } errors.Add(key); continue; } reverseFixupTable[newKey] = key; key = newKey; } ResourceData value = entry.Value; if (!cleanedResourceList.Contains(key)) { cleanedResourceList.Add(key, value); } else { // There was a case-insensitive conflict between two keys. // Or possibly one key was fixed up in a way that conflicts // with another key (ie, "A B" and "A_B"). String fixedUp = (String)reverseFixupTable[key]; if (fixedUp != null) { if (!errors.Contains(fixedUp)) { errors.Add(fixedUp); } reverseFixupTable.Remove(key); } errors.Add(entry.Key); cleanedResourceList.Remove(key); } } return(cleanedResourceList); }
private static bool DefineResourceFetchingProperty(String propertyName, String resourceName, ResourceData data, CodeTypeDeclaration srClass, bool internalClass, bool useStatic) { CodeMemberProperty prop = new CodeMemberProperty(); prop.Name = propertyName; prop.HasGet = true; prop.HasSet = false; Type type = data.Type; if (type == null) { return(false); } if (type == typeof(MemoryStream)) { type = typeof(UnmanagedMemoryStream); } // Ensure type is internalally visible. This is necessary to ensure // users can access classes via a base type. Imagine a class like // Image or Stream as a internalally available base class, then an // internal type like MyBitmap or __UnmanagedMemoryStream as an // internal implementation for that base class. For internalally // available strongly typed resource classes, we must return the // internal type. For simplicity, we'll do that for internal strongly // typed resource classes as well. Ideally we'd also like to check // for interfaces like IList, but I don't know how to do that without // special casing collection interfaces & ignoring serialization // interfaces or IDisposable. while (!type.IsPublic) { type = type.BaseType; } CodeTypeReference valueType = new CodeTypeReference(type); prop.Type = valueType; if (internalClass) { prop.Attributes = MemberAttributes.Assembly; } else { prop.Attributes = MemberAttributes.Public; } if (useStatic) { prop.Attributes |= MemberAttributes.Static; } // For Strings, emit this: // return ResourceManager.GetString("name", _resCulture); // For Streams, emit this: // return ResourceManager.GetStream("name", _resCulture); // For Objects, emit this: // Object obj = ResourceManager.GetObject("name", _resCulture); // return (MyValueType) obj; CodePropertyReferenceExpression resMgr = new CodePropertyReferenceExpression(null, "ResourceManager"); CodeFieldReferenceExpression resCultureField = new CodeFieldReferenceExpression((useStatic) ? null : new CodeThisReferenceExpression(), CultureInfoFieldName); bool isString = type == typeof(String); bool isStream = type == typeof(UnmanagedMemoryStream) || type == typeof(MemoryStream); String getMethodName = String.Empty; String text = String.Empty; String valueAsString = TruncateAndFormatCommentStringForOutput(data.ValueAsString); String typeName = String.Empty; if (!isString) // Stream or Object { typeName = TruncateAndFormatCommentStringForOutput(type.ToString()); } if (isString) { getMethodName = "GetString"; } else if (isStream) { getMethodName = "GetStream"; } else { getMethodName = "GetObject"; } if (isString) { text = SR.GetString(SR.StringPropertyComment, valueAsString); } else // Stream or Object { if (valueAsString == null || String.Equals(typeName, valueAsString)) // If the type did not override ToString, ToString just returns the type name. { text = SR.GetString(SR.NonStringPropertyComment, typeName); } else { text = SR.GetString(SR.NonStringPropertyDetailedComment, typeName, valueAsString); } } prop.Comments.Add(new CodeCommentStatement(DocCommentSummaryStart, true)); prop.Comments.Add(new CodeCommentStatement(text, true)); prop.Comments.Add(new CodeCommentStatement(DocCommentSummaryEnd, true)); CodeExpression getValue = new CodeMethodInvokeExpression(resMgr, getMethodName, new CodePrimitiveExpression(resourceName), resCultureField); CodeMethodReturnStatement ret; if (isString || isStream) { ret = new CodeMethodReturnStatement(getValue); } else { CodeVariableDeclarationStatement returnObj = new CodeVariableDeclarationStatement(typeof(Object), "obj", getValue); prop.GetStatements.Add(returnObj); ret = new CodeMethodReturnStatement(new CodeCastExpression(valueType, new CodeVariableReferenceExpression("obj"))); } prop.GetStatements.Add(ret); srClass.Members.Add(prop); return(true); }
public ItemStudyMaterial(ResourceData data) : base(data) { this.studyMaterialData = (StudyMaterialData)data; }
void Awake() { logger = Logger; string pluginfolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); resource = new ResourceData(MODNAME, "gigastations", pluginfolder); resource.LoadAssetBundle("gigastations"); ProtoRegistry.AddResource(resource); //General gridXCount = Config.Bind("-|0|- General", "-| 1 Grid X Max. Count", 1, new ConfigDescription("Amount of slots visible horizontally.\nIf this value is bigger than 1, layout will form a grid", new AcceptableValueRange <int>(1, 3))).Value; gridYCount = Config.Bind("-|0|- General", "-| 2 Grid Y Max. Count", 5, new ConfigDescription("Amount of slots visible vertically", new AcceptableValueRange <int>(3, 12))).Value; stationColor = Config.Bind("-|0|- General", "-| 3 Station Color", new Color(0.3726f, 0.8f, 1f, 1f), "Color tint of giga stations").Value; //ILS ilsMaxSlots = Config.Bind("-|1|- ILS", "-| 1 Max. Item Slots", 12, new ConfigDescription("The maximum Item Slots the Station can have.\nVanilla: 5", new AcceptableValueRange <int>(5, 12))).Value; ilsMaxStorage = Config.Bind("-|1|- ILS", "-| 2 Max. Storage", 30000, "The maximum Storage capacity per Item-Slot.\nVanilla: 10000").Value; ilsMaxVessels = Config.Bind("-|1|- ILS", "-| 3 Max. Vessels", 30, new ConfigDescription("The maximum Logistic Vessels amount.\nVanilla: 10", new AcceptableValueRange <int>(10, 30))).Value; ilsMaxDrones = Config.Bind("-|1|- ILS", "-| 4 Max. Drones", 150, new ConfigDescription("The maximum Logistic Drones amount.\nVanilla: 50", new AcceptableValueRange <int>(50, 150))).Value; ilsMaxAcuGJ = Config.Bind("-|1|- ILS", "-| 5 Max. Accu Capacity (GJ)", 50, "The Stations maximum Accumulator Capacity in GJ.\nVanilla: 12 GJ").Value; ilsMaxWarps = Config.Bind("-|1|- ILS", "-| 6 Max. Warps", 150, "The maximum Warp Cells amount.\nVanilla: 50").Value; //PLS plsMaxSlots = Config.Bind("-|2|- PLS", "-| 1 Max. Item Slots", 12, new ConfigDescription("The maximum Item Slots the Station can have.\nVanilla: 3", new AcceptableValueRange <int>(3, 12))).Value; plsMaxStorage = Config.Bind("-|2|- PLS", "-| 2 Max. Storage", 15000, "The maximum Storage capacity per Item-Slot.\nVanilla: 5000").Value; plsMaxDrones = Config.Bind("-|2|- PLS", "-| 3 Max. Drones", 150, new ConfigDescription("The maximum Logistic Drones amount.\nVanilla: 50", new AcceptableValueRange <int>(50, 150))).Value; plsMaxAcuMJ = Config.Bind("-|2|- PLS", "-| 4 Max. Accu Capacity (GJ)", 500, "The Stations maximum Accumulator Capacity in MJ.\nVanilla: 180 MJ").Value; //Collector colSpeedMultiplier = Config.Bind("-|3|- Collector", "-| 1 Collect Speed Multiplier", 3, "Multiplier for the Orbital Collectors Collection-Speed.\nVanilla: 1").Value; colMaxStorage = Config.Bind("-|3|- Collector", "-| 2 Max. Storage", 15000, "The maximum Storage capacity per Item-Slot.\nVanilla: 5000").Value; //VesselCapacity vesselCapacityMultiplier = Config.Bind("-|4|- Vessel", "-| 1 Max. Capacity", 3, "Vessel Capacity Multiplier\n1 == 1000 Vessel Capacity at max Level").Value; //DroneCapacity droneCapacityMultiplier = Config.Bind("-|5|- Drone", "-| 1 Max. Capacity", 3, "Drone Capacity Multiplier\n1 == 100 Drone Capacity at max Level").Value; ProtoRegistry.RegisterString("PLS_Name", "Planetary Giga Station"); ProtoRegistry.RegisterString("PLS_Desc", "Has more Slots, Capacity, etc. than a usual PLS."); ProtoRegistry.RegisterString("ILS_Name", "Interstellar Giga Station"); ProtoRegistry.RegisterString("ILS_Desc", "Has more Slots, Capacity, etc. than a usual ILS."); ProtoRegistry.RegisterString("Collector_Name", "Orbital Giga Collector"); ProtoRegistry.RegisterString("Collector_Desc", $"Has more Capacity and collects {colSpeedMultiplier}x faster than a usual Collector."); ProtoRegistry.RegisterString("ModificationWarn", " - [GigaStationsUpdated] Replaced {0} buildings"); ProtoRegistry.RegisterString("CantDowngradeWarn", "Downgrading logistic station is not possible!"); pls = ProtoRegistry.RegisterItem(2110, "PLS_Name", "PLS_Desc", "assets/gigastations/texture2d/icon_pls", 2701); ils = ProtoRegistry.RegisterItem(2111, "ILS_Name", "ILS_Desc", "assets/gigastations/texture2d/icon_ils", 2702); collector = ProtoRegistry.RegisterItem(2112, "Collector_Name", "Collector_Desc", "assets/gigastations/texture2d/icon_collector", 2703); collector.BuildInGas = true; ProtoRegistry.RegisterRecipe(410, ERecipeType.Assemble, 2400, new[] { 2103, 1103, 1106, 1303, 1206 }, new[] { 1, 40, 40, 40, 20 }, new[] { pls.ID }, new[] { 1 }, "PGS_Desc", 1604); ProtoRegistry.RegisterRecipe(411, ERecipeType.Assemble, 3600, new[] { 2110, 1107, 1206 }, new[] { 1, 40, 20 }, new[] { ils.ID }, new[] { 1 }, "ILS_Desc", 1605); ProtoRegistry.RegisterRecipe(412, ERecipeType.Assemble, 3600, new[] { 2111, 1205, 1406, 2207 }, new[] { 1, 50, 20, 20 }, new[] { collector.ID }, new[] { 1 }, "Collector_Desc", 1606); plsModel = ProtoRegistry.RegisterModel(300, pls, "Entities/Prefabs/logistic-station", null, new[] { 24, 38, 12, 10, 1 }, 605, 2, new [] { 2103, 0 }); ilsModel = ProtoRegistry.RegisterModel(301, ils, "Entities/Prefabs/interstellar-logistic-station", null, new[] { 24, 38, 12, 10, 1 }, 606, 2, new [] { 2104, 0 }); collectorModel = ProtoRegistry.RegisterModel(302, collector, "Entities/Prefabs/orbital-collector", null, new[] { 18, 11, 32, 1 }, 607, 2, new [] { 2105, 0 }); ProtoRegistry.onLoadingFinished += AddGigaPLS; ProtoRegistry.onLoadingFinished += AddGigaILS; ProtoRegistry.onLoadingFinished += AddGigaCollector; var harmony = new Harmony(MODGUID); harmony.PatchAll(typeof(StationEditPatch)); harmony.PatchAll(typeof(SaveFixPatch)); harmony.PatchAll(typeof(StationUpgradePatch)); harmony.PatchAll(typeof(UIStationWindowPatch)); harmony.PatchAll(typeof(BlueprintBuilding_Patch)); harmony.PatchAll(typeof(UIEntityBriefInfo_Patch)); foreach (var pluginInfo in BepInEx.Bootstrap.Chainloader.PluginInfos) { if (pluginInfo.Value.Metadata.GUID != WARPERS_MOD_GUID) { continue; } ((ConfigEntry <bool>)pluginInfo.Value.Instance.Config["General", "ShowWarperSlot"]).Value = true; logger.LogInfo("Overriding Distribute Space Warpers config: ShowWarperSlot = true"); break; } UtilSystem.AddLoadMessageHandler(SaveFixPatch.GetFixMessage); logger.LogInfo("GigaStations is initialized!"); }
public DefaultOrganizationAccountStoreMapping(ResourceData data) : base(data) { }
public Win32ResourcesNode(ResourceData resourceData) { _resourceData = resourceData; }
public DefaultLinkedInProvider(ResourceData data) : base(data) { }
public DefaultAccountResult(ResourceData data) : base(data) { }
public Mesh(ResourceData data, VBIB vbib) { Data = data; VBIB = vbib; GetBounds(); }
public ItemUser(ResourceData data) : base(data) { this.userData = (UserData)data; }
public void UpdateResources(IReadOnlyCollection <string> selectedCultures, IReadOnlyCollection <Project> selectedProjects, IStatusProgress progress, CancellationToken cancellationToken, UpdateResourcesOptions options) { IReadOnlyDictionary <string, CultureInfo> selectedCultureInfos = selectedCultures.Select(CultureInfo.GetCultureInfo) .ToDictionary(cult => cult.Name, cult => cult); IReadOnlyDictionary <string, Project> projectsDictionary = selectedProjects.ToDictionary(proj => proj.UniqueName, proj => proj); progress.Report(StatusRes.GettingProjectsResources); SolutionResources solutionResources = GetSolutionResources(null, selectedProjects, progress, cancellationToken); progress.Report(StatusRes.GeneratingResx); cancellationToken.ThrowIfCancellationRequested(); int resourceFilesProcessed = 0; int resourceFilesCount = solutionResources.ProjectResources.Sum(pr => pr.Resources.Count); foreach (var projectResources in solutionResources.ProjectResources) { var project = projectsDictionary[projectResources.ProjectId]; foreach (Dictionary <string, ResourceData> resourceFileGroup in projectResources.Resources.Values) { //Removing culture files without neutral culture file. TODO: find if it is required. ResourceData neutralCulture; if (!resourceFileGroup.TryGetValue(InvariantCultureId, out neutralCulture)) { _logger.Log(String.Format(LoggerRes.MissingNeutralCulture, resourceFileGroup.Values.First().ResourcePath, String.Join("\r\n", resourceFileGroup.Values.Select(r => r.ResourcePath)))); foreach (var projectItem in resourceFileGroup.Values) { _logger.Log(String.Format(LoggerRes.RemovedFormat, projectItem.ProjectItem.FileNames[0])); projectItem.ProjectItem.Delete(); } resourceFileGroup.Clear(); project.Save(); continue; } var items2Remove = resourceFileGroup.Where(f => !selectedCultureInfos.ContainsKey(f.Key)).ToList(); List <KeyValuePair <string, ProjectItem> > projectItems2Remove; if (items2Remove.Count == 0) { projectItems2Remove = new List <KeyValuePair <string, ProjectItem> >(0); } else { projectItems2Remove = items2Remove.Select(d => new KeyValuePair <string, ProjectItem>(d.Key, d.Value.ProjectItem)).ToList(); } var cultures2Add = selectedCultureInfos.Where(cult => !resourceFileGroup.ContainsKey(cult.Key)).Select(cult => cult.Value).ToList(); if (options.RemoveNotSelectedCultures) { foreach (var projectItem in projectItems2Remove) { _logger.Log(String.Format(LoggerRes.RemovedFormat, projectItem.Value.FileNames[0])); projectItem.Value.Delete(); resourceFileGroup.Remove(projectItem.Key); } } foreach (var cultureInfo in cultures2Add) { string resourcePath = Path.Combine(Path.GetDirectoryName(neutralCulture.ResourcePath), Path.GetFileName(neutralCulture.ResourceName) + "." + cultureInfo.Name.ToUpper() + ".resx"); using (File.Create(resourcePath)) { } ProjectItem projectItem = project.ProjectItems.AddFromFile(resourcePath); var newFile = new ResourceData ( resourceName: neutralCulture.ResourceName, resourcePath: resourcePath, culture: cultureInfo, projectItem: projectItem, resources: new Dictionary <string, ResXDataNode>(0) ); resourceFileGroup.Add(cultureInfo.Name, newFile); _logger.Log(String.Format(LoggerRes.AddedNewResource, newFile.ResourcePath)); } List <ResourceData> otherCultureResources = resourceFileGroup.Where(resData => resData.Key != InvariantCultureId).Select(resData => resData.Value).ToList(); if (options.EmbeedSubCultures.HasValue) { if (options.EmbeedSubCultures.Value) { EmbeedResources(neutralCulture.ProjectItem, otherCultureResources); } } if (options.UseDefaultCustomTool.HasValue) { Property customToolProperty = neutralCulture.ProjectItem.Properties.Cast <Property>().First(p => p.Name == "CustomTool"); customToolProperty.Value = options.UseDefaultCustomTool.Value ? "PublicResXFileCodeGenerator" : ""; } if (options.UseDefaultContentType.HasValue) { foreach (var resProjectItem in resourceFileGroup.Values.Select(g => g.ProjectItem)) { Property itemTypeProperty = resProjectItem.Properties.Cast <Property>().First(p => p.Name == "ItemType"); itemTypeProperty.Value = options.UseDefaultContentType.Value ? "EmbeddedResource" : "None"; } } UpdateResourceFiles(neutralCulture, otherCultureResources); project.Save(); progress.Report((int)Math.Round((double)100 * (++resourceFilesProcessed) / resourceFilesCount)); cancellationToken.ThrowIfCancellationRequested(); } } }
public bool HasEnoughResources(ResourceData rd, int buildCost) => GetResourceCount(rd) >= buildCost;
public static int GetResourceDiamondCost(int resourceCount, ResourceData resourceData) { var globals = ObjectManager.DataTables.GetGlobals(); return(Globals.GetResourceDiamondCost(resourceCount, resourceData)); }
public override TypeViewerCompatibility CanHandleResource(ResourceData data) { return(TypeViewerCompatibility.Works); }
/// <summary> /// Initializes a new instance of the <see cref="SpellShopItem"/> class. /// </summary> public SpellShopItem(int ShopIndex, int Cost, ResourceData BuyResourceData, SpellData SpellData, int Amount, int RarityIndex) : base(ShopIndex, Cost, BuyResourceData) { this.Amount = Amount; this.RarityIndex = RarityIndex; this.SpellData = SpellData; }
private static void RenderHeader(StringBuilder builder, ResourceData resourceString) { builder.Append(" /// <summary>") .AppendLine(); foreach (var line in resourceString.Value.Split(new[] { '\n' }, StringSplitOptions.None)) { builder.AppendFormat(" /// {0}", new XText(line)) .AppendLine(); } builder.Append(" /// </summary>") .AppendLine(); }
public DefaultProviderAccountAccess(ResourceData data) : base(data) { }
private static void RenderFormatMethod(StringBuilder builder, ResourceData resourceString) { builder.AppendFormat(" internal static string Format{0}({1})", resourceString.Name, resourceString.Parameters) .AppendLine() .AppendLine(" {"); if (resourceString.Arguments.Count > 0) { builder.AppendFormat(@" return string.Format(CultureInfo.CurrentCulture, GetString(""{0}""{1}), {2});", resourceString.Name, resourceString.UsingNamedArgs ? ", " + resourceString.FormatArguments : null, resourceString.ArgumentNames); } else { builder.AppendFormat(@" return GetString(""{0}"");", resourceString.Name); } builder.AppendLine() .AppendLine(" }"); }
internal void ReadResourceFile(string filePath) { try { if (System.IO.File.Exists(filePath)) { System.IO.TextReader tr = System.IO.File.OpenText(filePath); string key = string.Empty; int amount = 0; string city = string.Empty; string region = string.Empty; string line = string.Empty; while (null != (line = tr.ReadLine())) { string[] la = line.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); /* * Acai * Amount Needed City Region * 25 Lodwar, KE Africa East * 50 Moundou, TD Africa East * 150 Antofagasta, CL S. America Lower * 1 Bogota, CO S. America Upper * 1,225 Total Amount */ if (la.Length == 1) // Resource { key = la[0].Trim(); city = string.Empty; region = string.Empty; amount = 0; } else if (la.Length == 2) // summarize { key = string.Empty; city = string.Empty; region = string.Empty; amount = 0; } else if (la.Length == 3) // Resource info { if (la[0].Contains("Amount")) { } else { amount = int.Parse(la[0].Trim()); city = la[1].Trim(); region = la[2].Trim(); if (amount == 1) { amount = 1000; } } } else // maybe empty line { key = string.Empty; city = string.Empty; region = string.Empty; amount = 0; } if (key != string.Empty && amount != 0) { ResourceData ld = new ResourceData { City = city, Amount = amount, Region = region, Resource = key }; //ObservableCollection<ResourceData> list = null; //if ( Configuration.ResourceDictionary.TryGetValue(key, out list) ) //{ //} //else //{ // list = new ObservableCollection<ResourceData>(); // Configuration.ResourceDictionary.Add(key, list); //} //list.Add(ld); Configuration.ResourceList.Add(ld); } } tr.Close(); tr.Dispose(); } } catch (Exception exc) { exc.Source = "Composer"; // to remove compiler warnings } }
protected virtual ResourceData getBiomeData(string bodyName, string biomeName, string resourceName, int resourceType) { ResourceData data, mapData; string resourceTypeStr = resourceType.ToString(); string key; //If the data exists in our biome map, then retrieve it. key = bodyName + biomeName + resourceName + resourceTypeStr; if (resourceDataMap.ContainsKey(key)) { data = resourceDataMap[key]; return(data); } //No biome data. Look in the Planetary map. key = bodyName + resourceName + resourceTypeStr; if (resourceDataMap.ContainsKey(key)) { mapData = resourceDataMap[key]; data = new ResourceData(); data.BiomeName = biomeName; data.PlanetName = mapData.PlanetName; data.ResourceName = mapData.ResourceName; data.ResourceType = mapData.ResourceType; data.Distribution = mapData.Distribution; /* * data.Distribution = new DistributionData(); * data.Distribution.Dispersal = mapData.Distribution.Dispersal; * data.Distribution.MaxAbundance = mapData.Distribution.MaxAbundance; * data.Distribution.MaxAbundance = mapData.Distribution.MaxAltitude; * data.Distribution.MaxRange = mapData.Distribution.MaxRange; * data.Distribution.MinAbundance = mapData.Distribution.MinAbundance; * data.Distribution.MinAltitude = mapData.Distribution.MinAltitude; * data.Distribution.MinRange = mapData.Distribution.MinRange; * data.Distribution.PresenceChance = mapData.Distribution.PresenceChance; * data.Distribution.Variance = mapData.Distribution.Variance; */ ResourceCache.Instance.BiomeResources.Add(data); resourceDataMap.Add(bodyName + biomeName + resourceName + resourceTypeStr, data); return(data); } //No Planetary data. Look in the global map. key = resourceName + resourceTypeStr; if (resourceDataMap.ContainsKey(key)) { mapData = resourceDataMap[key]; data = new ResourceData(); data.BiomeName = biomeName; data.PlanetName = bodyName; data.ResourceName = mapData.ResourceName; data.ResourceType = mapData.ResourceType; data.Distribution = mapData.Distribution; /* * data.Distribution = new DistributionData(); * data.Distribution.Dispersal = mapData.Distribution.Dispersal; * data.Distribution.MaxAbundance = mapData.Distribution.MaxAbundance; * data.Distribution.MaxAbundance = mapData.Distribution.MaxAltitude; * data.Distribution.MaxRange = mapData.Distribution.MaxRange; * data.Distribution.MinAbundance = mapData.Distribution.MinAbundance; * data.Distribution.MinAltitude = mapData.Distribution.MinAltitude; * data.Distribution.MinRange = mapData.Distribution.MinRange; * data.Distribution.PresenceChance = mapData.Distribution.PresenceChance; * data.Distribution.Variance = mapData.Distribution.Variance; */ ResourceCache.Instance.BiomeResources.Add(data); resourceDataMap.Add(bodyName + biomeName + resourceName + resourceTypeStr, data); return(data); } //Uh oh... return(null); }
public ProfileData ParseIBCDataFromModule(EcmaModule ecmaModule) { ResourceData peResources = new ResourceData(ecmaModule); byte[] ibcDataSection = peResources.FindResource("PROFILE_DATA", "IBC", 0); if (ibcDataSection == null) { // If we don't have profile data, return empty ProfileData object return(EmptyProfileData.Singleton); } var reader = new IBCDataReader(); int pos = 0; bool basicBlocksOnly = false; AssemblyData parsedData = reader.Read(ibcDataSection, ref pos, out bool minified); if (parsedData.FormatMajorVersion == 1) { throw new Exception("Unsupported V1 IBC Format"); } Dictionary <IBCBlobKey, BlobEntry> blobs = GetIBCBlobs(parsedData.BlobStream, out HashSet <uint> ignoredIbcMethodSpecTokens); List <MethodProfileData> methodProfileData = new List <MethodProfileData>(); IBCModule ibcModule = new IBCModule(ecmaModule, blobs); // Parse the token lists IBCData.SectionIteratorKind iteratorKind = basicBlocksOnly ? IBCData.SectionIteratorKind.BasicBlocks : IBCData.SectionIteratorKind.TokenFlags; foreach (SectionFormat section in IBCData.SectionIterator(iteratorKind)) { if (!parsedData.Tokens.TryGetValue(section, out List <TokenData> TokenList) || TokenList.Count == 0) { continue; } // In V1 and minified V3+ files, tokens aren't stored with a // scenario mask. In minified V3+ files, it can be treated as // anything nonzero--minified files make no guarantee about // preserving scenario information, but the flags must be left // alone. const uint scenarioMaskIfMissing = 1u; foreach (TokenData entry in TokenList) { // // Discard any token list entries which refer to the ParamMethodSpec blob stream entries // (if any) which were thrown away above. Note that the MethodProfilingData token list is // the only place anywhere in the IBC data which can ever contain an embedded ibcMethodSpec // token. // if (section == SectionFormat.MethodProfilingData) { if (ignoredIbcMethodSpecTokens.Contains(entry.Token)) { continue; } } uint scenarioMask = entry.ScenarioMask ?? scenarioMaskIfMissing; // scenarioMask will be 0 in unprocessed or V1 IBC data. if (scenarioMask == 0) { throw new NotImplementedException(); /* Debug.Assert(fullScenarioMask == 1, "Token entry not owned by one scenario"); * // We have to compute the RunOnceMethod and RunNeverMethod flags. * entry.Flags = result.GetFlags(entry.Flags, section, entry.Token); * scenarioMask = defaultScenarioMask;*/ } // Debug.Assert(((~fullScenarioMask & scenarioMask) == 0), "Illegal scenarios mask"); MethodDesc associatedMethod = null; switch (Cor.Macros.TypeFromToken(entry.Token)) { case CorTokenType.mdtMethodDef: case CorTokenType.mdtMemberRef: case CorTokenType.mdtMethodSpec: associatedMethod = ecmaModule.GetMethod(System.Reflection.Metadata.Ecma335.MetadataTokens.EntityHandle((int)entry.Token)); break; case CorTokenType.ibcMethodSpec: { if (!blobs.TryGetValue(new IBCBlobKey(entry.Token, BlobType.ParamMethodSpec), out BlobEntry blobEntry)) { throw new Exception($"Missing blob entry for ibcMethodSpec {entry.Token:x}"); } BlobEntry.SignatureEntry paramSignatureEntry = blobEntry as BlobEntry.SignatureEntry; if (paramSignatureEntry == null) { throw new Exception($"Blob entry for {entry.Token:x} is invalid"); } unsafe { fixed(byte *pb = ¶mSignatureEntry.Signature[0]) { BlobReader br = new BlobReader(pb, paramSignatureEntry.Signature.Length); associatedMethod = GetSigMethodInstantiationFromIBCMethodSpec(ibcModule, br); } } } break; } if (associatedMethod != null) { methodProfileData.Add(new MethodProfileData(associatedMethod, (MethodProfilingDataFlags)entry.Flags, scenarioMask)); } } } return(new IBCProfileData(parsedData.PartialNGen, methodProfileData)); }
private static bool CheckReferenceProjectInObjectData(NodeObjectData parentNode, Project project, ResourceData projectPath) { if (parentNode == null) { return(false); } ProjectNodeObjectData projectNodeObjectData = parentNode as ProjectNodeObjectData; if (projectNodeObjectData != null) { ResourceItemData fileData = projectNodeObjectData.FileData; if (projectPath.Equals((ResourceData)fileData)) { return(true); } if ((ResourceData)fileData != (ResourceData)null) { Project resourceItem = Services.ProjectsService.CurrentResourceGroup.FindResourceItem((ResourceData)fileData) as Project; if (resourceItem != null && resourceItem.HasReferencedProject(project)) { return(true); } } } if (parentNode.Children != null) { foreach (NodeObjectData child in parentNode.Children) { if (GameProjectContent.CheckReferenceProjectInObjectData(child, project, projectPath)) { return(true); } } } return(false); }
public IActionResult Index() { //After JSON Style or together ResourceData qlikData = new ResourceData() { Streams = new List <ResourceStream>() { new ResourceStream() { Id = "1ea7cac3-8f23-4e48-8e8a-84da319a0785", Applications = new List <ResourceApp> { new ResourceApp() { Id = "9d129694-3829-44be-9ed1-7305a2e8c794", Sheets = new List <ResourceSheet> { new ResourceSheet() { Objects = new List <ResourceObject> { // KPI new ResourceObject() { Id = "5feda11c-f105-4ea9-b46b-465b59473498", Layout = new ResourceObjectLayout() { Measure = new List <Dictionary <string, string> >() { new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "$986,720" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "+$106,720" }, { "9f9e69dd-4153-4001-b88e-6907408c7439", "+7.6%" } } } } }, // Bar Chart with optional Budget new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { TopperValue = "96%", // Dotted line Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "Jan" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "Feb" }, new ResourceDimension() { Id = "9f9e69dd-4153-4001-b88e-6907408c7439", Caption = "Mar" }, new ResourceDimension() { Id = "e3a9a989-7437-4c1b-97eb-b1026cced4f2", Caption = "Apr" }, new ResourceDimension() { Id = "e1cd40d2-90f7-405e-a17f-6321a48ee2f1", Caption = "May" }, new ResourceDimension() { Id = "456691d2-d178-4d9e-bd4c-4e6eece63acc", Caption = "Jun" } }, Measure = new List <Dictionary <string, string> >() { new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "52%" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "17%" }, { "9f9e69dd-4153-4001-b88e-6907408c7439", "11%" }, { "e3a9a989-7437-4c1b-97eb-b1026cced4f2", "68%" }, { "e1cd40d2-90f7-405e-a17f-6321a48ee2f1", "50%" }, { "456691d2-d178-4d9e-bd4c-4e6eece63acc", "27%" } } }, // Text to specify a graphic reading help HelpTips = new Dictionary <string, string>() { { "5ef86250-f844-40e7-aa67-7f26af310a4e", "- - - Budget" } } } }, // Horizontal Bar Chart with optional Budget new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { TopperValue = "96%", // Dotted line level Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "5x5" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "5x10" }, new ResourceDimension() { Id = "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", Caption = "5x15" }, new ResourceDimension() { Id = "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", Caption = "10x10" }, new ResourceDimension() { Id = "9b61760c-dab5-4062-9b92-a059ae37fd75", Caption = "10x15" }, new ResourceDimension() { Id = "4faed222-9c75-4bf7-93d1-b205215cd2ad", Caption = "10x20" }, new ResourceDimension() { Id = "e855f79d-701d-4c18-9f2b-fe6484b4ac84", Caption = "10x25" }, new ResourceDimension() { Id = "5d4673e2-38df-4659-a68e-92468dd78eb9", Caption = "10x30" } }, Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "51" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "65" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "93" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "70" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "22" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "30" }, { "e855f79d-701d-4c18-9f2b-fe6484b4ac84", "96" }, { "5d4673e2-38df-4659-a68e-92468dd78eb9", "90" } } }, // Text to specify a graphic reading help HelpTips = new Dictionary <string, string>() { { "5ef86250-f844-40e7-aa67-7f26af310a4e", "- - - Budget" } } } }, // Stacked Bar Chart new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "5x5" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "5x10" }, new ResourceDimension() { Id = "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", Caption = "5x15" }, new ResourceDimension() { Id = "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", Caption = "10x10" }, new ResourceDimension() { Id = "9b61760c-dab5-4062-9b92-a059ae37fd75", Caption = "10x15" }, new ResourceDimension() { Id = "4faed222-9c75-4bf7-93d1-b205215cd2ad", Caption = "10x20" }, new ResourceDimension() { Id = "e855f79d-701d-4c18-9f2b-fe6484b4ac84", Caption = "10x25" }, new ResourceDimension() { Id = "5d4673e2-38df-4659-a68e-92468dd78eb9", Caption = "10x30" } }, Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "51" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "65" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "93" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "70" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "22" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "30" }, { "e855f79d-701d-4c18-9f2b-fe6484b4ac84", "96" }, { "5d4673e2-38df-4659-a68e-92468dd78eb9", "90" } }, new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "52" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "64" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "91" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "71" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "25" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "35" }, { "e855f79d-701d-4c18-9f2b-fe6484b4ac84", "94" }, { "5d4673e2-38df-4659-a68e-92468dd78eb9", "94" } }, new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "53" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "67" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "95" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "74" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "23" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "31" }, { "e855f79d-701d-4c18-9f2b-fe6484b4ac84", "92" }, { "5d4673e2-38df-4659-a68e-92468dd78eb9", "97" } } } } }, // Stacked Horizontal Bar Chart with optional Budget new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { TopperValue = "96%", // Dotted line level Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "5x5" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "5x10" }, new ResourceDimension() { Id = "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", Caption = "5x15" }, new ResourceDimension() { Id = "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", Caption = "10x10" }, new ResourceDimension() { Id = "9b61760c-dab5-4062-9b92-a059ae37fd75", Caption = "10x15" }, new ResourceDimension() { Id = "4faed222-9c75-4bf7-93d1-b205215cd2ad", Caption = "10x20" }, new ResourceDimension() { Id = "e855f79d-701d-4c18-9f2b-fe6484b4ac84", Caption = "10x25" }, new ResourceDimension() { Id = "5d4673e2-38df-4659-a68e-92468dd78eb9", Caption = "10x30" } }, Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "51" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "65" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "93" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "70" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "22" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "30" }, { "e855f79d-701d-4c18-9f2b-fe6484b4ac84", "96" }, { "5d4673e2-38df-4659-a68e-92468dd78eb9", "90" } }, new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "52" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "64" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "91" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "71" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "25" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "35" }, { "e855f79d-701d-4c18-9f2b-fe6484b4ac84", "94" }, { "5d4673e2-38df-4659-a68e-92468dd78eb9", "94" } }, new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "53" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "67" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "95" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "74" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "23" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "31" }, { "e855f79d-701d-4c18-9f2b-fe6484b4ac84", "92" }, { "5d4673e2-38df-4659-a68e-92468dd78eb9", "97" } } }, // Text to specify a graphic reading help HelpTips = new Dictionary <string, string>() { { "5ef86250-f844-40e7-aa67-7f26af310a4e", "- - - Budget" } }, } }, // Single Horizontal Bar Chart new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "Fees" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "Waived Fees" } }, Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5ef86250-f844-40e7-aa67-7f26af310a4e", "-2,000" }, { "d5cb9356-ff49-4099-a594-2c7949614e95", "14,000" } } } } }, // Single Stacked Horizontal Bar Chart new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { // Text to specify a graphic reading help DimensionGroups = new Dictionary <string, string>() { { "5ef86250-f844-40e7-aa67-7f26af310a4e", "REVENUE" }, { "b922eb88-a93e-47a6-ad18-8d79d1141642", "ALLOWANCES" } }, Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "Accured Rent", GroupId = "5ef86250-f844-40e7-aa67-7f26af310a4e" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "Merchandise", GroupId = "5ef86250-f844-40e7-aa67-7f26af310a4e" }, new ResourceDimension() { Id = "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", Caption = "Fees", GroupId = "5ef86250-f844-40e7-aa67-7f26af310a4e" }, new ResourceDimension() { Id = "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", Caption = "Insurance", GroupId = "5ef86250-f844-40e7-aa67-7f26af310a4e" }, new ResourceDimension() { Id = "9b61760c-dab5-4062-9b92-a059ae37fd75", Caption = "Write-Offs", GroupId = "b922eb88-a93e-47a6-ad18-8d79d1141642" }, new ResourceDimension() { Id = "4faed222-9c75-4bf7-93d1-b205215cd2ad", Caption = "Discounts", GroupId = "b922eb88-a93e-47a6-ad18-8d79d1141642" } }, Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "-10,000" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "-5,000" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "300,000" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "600,000" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "555,000" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "123,000" } } } } }, // Single Line Chart with optional Budget new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "Jan" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "Feb" }, new ResourceDimension() { Id = "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", Caption = "Mar" }, new ResourceDimension() { Id = "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", Caption = "Apr" }, new ResourceDimension() { Id = "9b61760c-dab5-4062-9b92-a059ae37fd75", Caption = "May" }, new ResourceDimension() { Id = "4faed222-9c75-4bf7-93d1-b205215cd2ad", Caption = "Jun" } }, Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "72" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "58" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "41" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "52" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "36" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "74" } } } } }, // Multiple Line Chart new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "Jan" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "Feb" }, new ResourceDimension() { Id = "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", Caption = "Mar" }, new ResourceDimension() { Id = "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", Caption = "Apr" }, new ResourceDimension() { Id = "9b61760c-dab5-4062-9b92-a059ae37fd75", Caption = "May" }, new ResourceDimension() { Id = "4faed222-9c75-4bf7-93d1-b205215cd2ad", Caption = "Jun" } }, Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "72" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "58" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "41" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "52" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "36" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "74" } }, new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "72" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "58" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "41" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "52" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "36" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "74" } }, new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "72" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "58" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "41" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "52" }, { "9b61760c-dab5-4062-9b92-a059ae37fd75", "36" }, { "4faed222-9c75-4bf7-93d1-b205215cd2ad", "74" } } } } }, // Donut Chart new ResourceObject() { Id = "5feda11c-f105-4ea9-b46b-465b59473498", Layout = new ResourceObjectLayout() { Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5ef86250-f844-40e7-aa67-7f26af310a4e", "86" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "6" } } } } }, // Donut Chart with Legend new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "Online" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "In Person" } }, Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5ef86250-f844-40e7-aa67-7f26af310a4e", "9,000" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "6,000" } }, new Dictionary <string, string>() { { "5ef86250-f844-40e7-aa67-7f26af310a4e", "60%" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "40%" } } } } }, // Table new ResourceObject() { Id = "2b9adb45-cc56-44d5-84e4-f1d52bff4e09", Layout = new ResourceObjectLayout() { // Text to specify a graphic reading help DimensionGroups = new Dictionary <string, string>() { { "5ef86250-f844-40e7-aa67-7f26af310a4e", "REVENUE" }, { "b922eb88-a93e-47a6-ad18-8d79d1141642", "TOTAL" }, { "d70e3d98-3565-4e82-90b6-443783a99adb", "BUDGET" } }, Dimensions = new List <ResourceDimension>() { new ResourceDimension() { Id = "5a20d50c-0c50-4702-91f3-d7368c8a4b70", Caption = "Accured Rent", GroupId = "5ef86250-f844-40e7-aa67-7f26af310a4e" }, new ResourceDimension() { Id = "0aa7afde-3ac2-43e8-baa1-285c378ae864", Caption = "Merchandise", GroupId = "5ef86250-f844-40e7-aa67-7f26af310a4e" }, new ResourceDimension() { Id = "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", Caption = "Fees", GroupId = "5ef86250-f844-40e7-aa67-7f26af310a4e" }, new ResourceDimension() { Id = "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", Caption = "Insurance", GroupId = "5ef86250-f844-40e7-aa67-7f26af310a4e" } }, Measure = new List <Dictionary <string, string> > { new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "$143,712" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "$150,00" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "$50,000" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "$10,000" } }, new Dictionary <string, string>() { { "5a20d50c-0c50-4702-91f3-d7368c8a4b70", "+2.3%" }, { "0aa7afde-3ac2-43e8-baa1-285c378ae864", "+0.5%" }, { "5a895e4d-73ee-4209-b8ad-f8fd4ed0d44e", "-1.1%" }, { "35f88e1c-e8ab-47a7-95d2-ad9f8acde46d", "+1.3%" } } } } } } } } } } } } }; return(Ok(qlikData)); }
private void CreateResDataUnderClass(XmlDocument xml, string classname, string name, ResourceData resourceData) { // create new element var langelement = xml.SelectSingleNode("/Resources/ResourceClass[@name='" + classname + "']/Languages/Language[@cultureName='" + resourceData.Lang + "']"); if (langelement == null) { // create language element var langparent = xml.SelectSingleNode("/Resources/ResourceClass[@name='" + classname + "']/Languages"); if (langparent == null) return; langelement = xml.CreateElement("Language"); var cultureNameAttr = xml.CreateAttribute("cultureName"); cultureNameAttr.Value = resourceData.Lang; langelement.Attributes.Append(cultureNameAttr); langparent.AppendChild(langelement); } // create data element under language element var dataelement = xml.CreateElement("data"); var nameAttr = xml.CreateAttribute("name"); nameAttr.Value = name; dataelement.Attributes.Append(nameAttr); langelement.AppendChild(dataelement); // create value element under data element var valueelement = xml.CreateElement("value"); valueelement.InnerText = resourceData.Value; dataelement.AppendChild(valueelement); }
void Load(ResourceData obj) { }
void Add(ResourceData rd) => AddToStack(rd);
internal static void Initialize() { Globals.AllianceCreateResourceData = (ResourceData)CSV.Tables.Get(Gamefile.Resource).GetData(((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_CREATE_RESOURCE")).TextValue); Globals.AllianceCreateCost = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_CREATE_COST")).NumberValue; Globals.StartingDiamonds = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("STARTING_DIAMONDS")).NumberValue; Globals.StartingGold = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("STARTING_GOLD")).NumberValue; Globals.StartingElixir = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("STARTING_ELIXIR")).NumberValue; Globals.StartingGold2 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("STARTING_GOLD2")).NumberValue; Globals.StartingElixir2 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("STARTING_ELIXIR2")).NumberValue; Globals.SpeedUpDiamondCost1Min = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("SPEED_UP_DIAMOND_COST_1_MIN")).NumberValue; Globals.SpeedUpDiamondCost1Hour = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("SPEED_UP_DIAMOND_COST_1_HOUR")).NumberValue; Globals.SpeedUpDiamondCost24Hours = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("SPEED_UP_DIAMOND_COST_24_HOURS")).NumberValue; Globals.SpeedUpDiamondCost1Week = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("SPEED_UP_DIAMOND_COST_1_WEEK")).NumberValue; Globals.Village2SpeedUpDiamondCost1Min = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_SPEED_UP_DIAMOND_COST_1_MIN")).NumberValue; Globals.Village2SpeedUpDiamondCost1Hour = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_SPEED_UP_DIAMOND_COST_1_HOUR")).NumberValue; Globals.Village2SpeedUpDiamondCost24Hours = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_SPEED_UP_DIAMOND_COST_24_HOURS")).NumberValue; Globals.Village2SpeedUpDiamondCost1Week = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_SPEED_UP_DIAMOND_COST_1_WEEK")).NumberValue; Globals.ResourceDiamondCost100 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("RESOURCE_DIAMOND_COST_100")).NumberValue; Globals.ResourceDiamondCost1000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("RESOURCE_DIAMOND_COST_1000")).NumberValue; Globals.ResourceDiamondCost10000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("RESOURCE_DIAMOND_COST_10000")).NumberValue; Globals.ResourceDiamondCost100000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("RESOURCE_DIAMOND_COST_100000")).NumberValue; Globals.ResourceDiamondCost1000000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("RESOURCE_DIAMOND_COST_1000000")).NumberValue; Globals.ResourceDiamondCost10000000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("RESOURCE_DIAMOND_COST_10000000")).NumberValue; Globals.DarkElixirDiamondCost1 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("DARK_ELIXIR_DIAMOND_COST_1")).NumberValue; Globals.DarkElixirDiamondCost10 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("DARK_ELIXIR_DIAMOND_COST_10")).NumberValue; Globals.DarkElixirDiamondCost100 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("DARK_ELIXIR_DIAMOND_COST_100")).NumberValue; Globals.DarkElixirDiamondCost1000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("DARK_ELIXIR_DIAMOND_COST_1000")).NumberValue; Globals.DarkElixirDiamondCost10000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("DARK_ELIXIR_DIAMOND_COST_10000")).NumberValue; Globals.DarkElixirDiamondCost100000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("DARK_ELIXIR_DIAMOND_COST_100000")).NumberValue; Globals.Village2ResourceDiamondCost100 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_RESOURCE_DIAMOND_COST_100")).NumberValue; Globals.Village2ResourceDiamondCost1000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_RESOURCE_DIAMOND_COST_1000")).NumberValue; Globals.Village2ResourceDiamondCost10000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_RESOURCE_DIAMOND_COST_10000")).NumberValue; Globals.Village2ResourceDiamondCost100000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_RESOURCE_DIAMOND_COST_100000")).NumberValue; Globals.Village2ResourceDiamondCost1000000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_RESOURCE_DIAMOND_COST_1000000")).NumberValue; Globals.Village2ResourceDiamondCost10000000 = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("VILLAGE2_RESOURCE_DIAMOND_COST_10000000")).NumberValue; Globals.WorkerCost2Nd = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("WORKER_COST_2ND")).NumberValue; Globals.WorkerCost3Rd = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("WORKER_COST_3RD")).NumberValue; Globals.WorkerCost4Th = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("WORKER_COST_4TH")).NumberValue; Globals.WorkerCost5Th = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("WORKER_COST_5TH")).NumberValue; Globals.TroopTrainingSpeedUpTutorialCost = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("TROOP_TRAINING_SPEED_UP_COST_TUTORIAL")).NumberValue; Globals.HeroHealthSpeedUpCostMultiplier = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("HERO_HEALTH_SPEED_UP_COST_MULTIPLIER")).NumberValue; Globals.TroopRequestSpeedUpCostMultiplier = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("SPELL_SPEED_UP_COST_MULTIPLIER")).NumberValue; Globals.TroopRequestSpeedUpCostMultiplier = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("TROOP_REQUEST_SPEED_UP_COST_MULTIPLIER")).NumberValue; Globals.TrainCancelMultiplier = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("TRAIN_CANCEL_MULTIPLIER")).NumberValue; Globals.BuildCancelMultiplier = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("BUILD_CANCEL_MULTIPLIER")).NumberValue; Globals.SpellCancelMultiplier = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("SPELL_CANCEL_MULTIPLIER")).NumberValue; Globals.AllianceTroopRequestCooldown = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_TROOP_REQUEST_COOLDOWN")).NumberValue; Globals.ClanMailCooldown = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("CLAN_MAIL_COOLDOWN")).NumberValue; Globals.ReplayShareCooldown = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("REPLAY_SHARE_COOLDOWN")).NumberValue; Globals.ElderKickCooldown = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ELDER_KICK_COOLDOWN")).NumberValue; Globals.ChallengeCooldown = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("CHALLENGE_COOLDOWN")).NumberValue; Globals.ArrangeWarCooldown = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ARRANGE_WAR_COOLDOWN")).NumberValue; Globals.ObstacleCountMax = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("OBSTACLE_COUNT_MAX")).NumberValue; Globals.ObstacleRespawnSeconds = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("OBSTACLE_RESPAWN_SECONDS")).NumberValue; Globals.CollectAllResourcesAtOnce = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("COLLECT_ALL_RESOURCES_AT_ONCE")).BooleanValue; Globals.AllianceWarNumAttacks = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_NUM_ATTACKS")).NumberValue; Globals.AllianceWarPreparationDuration = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_PREPARATION_DURATION")).NumberValue; Globals.AllianceWarAttackDuration = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_ATTACK_DURATION")).NumberValue; Globals.AllianceWarLootBonusPercentWin = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_LOOT_BONUS_PERCENT_WIN")).NumberValue; Globals.AllianceWarLootBonusPercentLose = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_LOOT_BONUS_PERCENT_LOSE")).NumberValue; Globals.AllianceWarLootBonusPercentDraw = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_LOOT_BONUS_PERCENT_DRAW")).NumberValue; Globals.AllianceWarStarsBonusPercent = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_STARS_BONUS_PERCENT")).NumberValue; Globals.AllianceWarStarsBonusExp = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_STARS_BONUS_EXP")).NumberValue; Globals.AllianceWarWinBonusExp = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_WIN_BONUS_EXP")).NumberValue; Globals.AllianceWarNewAttackWinExpRules = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_NEW_ATTACK_WIN_EXP_RULES")).BooleanValue; Globals.AllianceWarAttackWinExpMultiplier = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_ATTACK_WIN_EXP_MULTIPLIER")).NumberValue; Globals.AllianceWarAttackWinExp = ((GlobalData)CSV.Tables.Get(Gamefile.Global).GetData("ALLIANCE_WAR_ATTACK_WIN_EXP")).NumberValue; }
private ResourceFile GetResourceFile() { var resourceData = new ResourceData(EnumResourceType.Addin, luaValueConverter.GetStringValue("GetSetTextureResource")); return Services.ProjectsService.CurrentResourceGroup.FindResourceItem(resourceData) as ResourceFile; }
public void Add(ResourceData data) { List.Add(data); }