Esempio n. 1
0
 public Udl()
 {
     mUdlHeadstream = new UdlHeadstream();
     mStringTable = new StringTable();
     m_tUflCreate = null;
     m_tUflLoad = null;
 }
Esempio n. 2
0
    void LoadConverTable()
    {
        cont_String = new Dictionary<string, TB_Conversation>();

        StringTable st = new StringTable();

        if (false == st.Build("Table/TB_Conversation")) { return; }

        int iRowCount = st.row;

        for (int x = 0; x < iRowCount; ++x)
        {
            TB_Conversation tbString = new TB_Conversation();

            tbString.mStringNo = st.GetValueAsInt(x, "NPCNo");
            tbString.mScenarioNo= st.GetValueAsInt(x, "ScenarioNo");
            tbString.stString = st.GetValue(x, "String");

            string key = tbString.mStringNo.ToString() + "_" + tbString.mScenarioNo.ToString();
            if (cont_String.ContainsKey(key))
            {
                Debug.LogError("Already exist key. " + key.ToString());
            }

            cont_String.Add(key, tbString);
        }
    }
Esempio n. 3
0
        public string GetValue()
        {
            StringTable table = new StringTable();

            //table.Add("LimitType", LimitType.ToString());
            table.Add("LimitType", ((byte)LimitType).ToString());


            foreach (KeyValuePair<Guid, List<Guid>> item in ExcludeRoles)
            {

                if (item.Value != null)
                {

                    StringList roles = new StringList();
                    foreach (Guid roleID in item.Value)
                    {
                        roles.Add(roleID.ToString());
                    }

                    table.Add("ExcludeRoles-" + item.Key.ToString("N"), roles.ToString());

                }

            }

            return table.ToString();
        }
Esempio n. 4
0
        public DBCReader(string fileName)
        {
            using (var reader = BinaryReaderExtensions.FromFile(fileName))
            {
                if (reader.BaseStream.Length < HeaderSize)
                {
                    throw new InvalidDataException(String.Format("File {0} is corrupted!", fileName));
                }

                if (reader.ReadUInt32() != DBCFmtSig)
                {
                    throw new InvalidDataException(String.Format("File {0} isn't valid DBC file!", fileName));
                }

                RecordsCount = reader.ReadInt32();
                FieldsCount = reader.ReadInt32();
                RecordSize = reader.ReadInt32();
                StringTableSize = reader.ReadInt32();

                m_rows = new byte[RecordsCount][];

                for (int i = 0; i < RecordsCount; i++)
                    m_rows[i] = reader.ReadBytes(RecordSize);

                int stringTableStart = (int)reader.BaseStream.Position;

                StringTable = new StringTable();

                while (reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    int index = (int)reader.BaseStream.Position - stringTableStart;
                    StringTable[index] = reader.ReadStringNull();
                }
            }
        }
Esempio n. 5
0
		public ExtendedFieldSettings()
		{
			Version = string.Empty;
			Fields = new ExtendedFieldCollection();
            PassportSorts = new StringTable();
            IsEnables = new StringTable();
		}
		public static ExtendedFieldSearchInfo Parse(StringTable values)
		{
			ExtendedFieldSearchInfo result = new ExtendedFieldSearchInfo();

			ExtendedField[] fileds = AllSettings.Current.ExtendedFieldSettings.FieldsWithPassport.ToArray();

			foreach (DictionaryEntry item in values)
			{
				if (item.Value == null || (string)item.Value == string.Empty)
					continue;

				ExtendedField field = Array.Find<ExtendedField>(fileds, match => match.Key == (string)item.Key);

				if (field != null)
				{
					ExtendedFieldType type = UserBO.Instance.GetExtendedFieldType(field.FieldTypeName);

					if (type != null)
					{
						if (result.Items == null)
							result.Items = new List<ExtendedFieldSearchInfoItem>();

						result.Items.Add(new ExtendedFieldSearchInfoItem((string)item.Key, (string)item.Value, type.NeedExactMatch));
					}
				}
			}

			return result;
		}
Esempio n. 7
0
        public frmCsfEntryEdit(StringTable st)
        {
            InitializeComponent();

            translateData = st;
            LanguageParser.ParseLanguage(st, this);
        }
Esempio n. 8
0
 public void LoadString(string key, StringTable.Language language, StringTable.Platform platform, string translation)
 {
     foreach( StringTableEntry entry in m_tables )
     {
         if( entry.language == language && entry.platform == platform )
         {
             entry.table.LoadString( key, translation );
         }
     }
 }
Esempio n. 9
0
        public void Constructor_NoStringTable_NoItemsLoaded()
        {
            // Act

            _stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object);
            _stringTable.Setup();

            // Assert
            Assert.AreEqual(0, ((IDictionary<string, object>)_stringTable.Items).Count);
        }
Esempio n. 10
0
        public DB2Reader(string fileName)
        {
            using (var reader = BinaryReaderExtensions.FromFile(fileName))
            {
                if (reader.BaseStream.Length < HeaderSize)
                {
                    throw new InvalidDataException(String.Format("File {0} is corrupted!", fileName));
                }

                if (reader.ReadUInt32() != DB2FmtSig)
                {
                    throw new InvalidDataException(String.Format("File {0} isn't valid DBC file!", fileName));
                }

                RecordsCount = reader.ReadInt32();
                FieldsCount = reader.ReadInt32();
                RecordSize = reader.ReadInt32();
                StringTableSize = reader.ReadInt32();

                // WDB2 specific fields
                uint tableHash = reader.ReadUInt32(); // new field in WDB2
                uint build = reader.ReadUInt32(); // new field in WDB2

                int unk1 = reader.ReadInt32(); // new field in WDB2

                if (build > 12880) // new extended header
                {
                    int unk2 = reader.ReadInt32(); // new field in WDB2
                    int unk3 = reader.ReadInt32(); // new field in WDB2 (index table?)
                    int locale = reader.ReadInt32(); // new field in WDB2
                    int unk5 = reader.ReadInt32(); // new field in WDB2

                    if (unk3 != 0)
                    {
                        reader.ReadBytes(unk3 * 4 - HeaderSize);     // an index for rows
                        reader.ReadBytes(unk3 * 2 - HeaderSize * 2); // a memory allocation bank
                    }
                }

                m_rows = new byte[RecordsCount][];

                for (int i = 0; i < RecordsCount; i++)
                    m_rows[i] = reader.ReadBytes(RecordSize);

                int stringTableStart = (int)reader.BaseStream.Position;

                StringTable = new StringTable();

                while (reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    int index = (int)reader.BaseStream.Position - stringTableStart;
                    StringTable[index] = reader.ReadStringNull();
                }
            }
        }
Esempio n. 11
0
        public DB2Reader(string fileName)
        {
            using (var reader = BinaryReaderExtensions.FromFile(fileName))
            {
                if (reader.BaseStream.Length < HeaderSize)
                {
                    Console.WriteLine("File {0} is corrupted!", fileName);
                    return;
                }

                var signature = reader.ReadUInt32();

                if (signature != DB2FmtSig && signature != ADBFmtSig)
                {
                    Console.WriteLine("File {0} isn't valid DBC file!", fileName);
                    return;
                }

                RecordsCount = reader.ReadInt32();
                FieldsCount = reader.ReadInt32(); // not fields count in WCH2
                RecordSize = reader.ReadInt32();
                StringTableSize = reader.ReadInt32();

                // WDB2/WCH2 specific fields
                uint tableHash = reader.ReadUInt32(); // new field in WDB2
                uint build = reader.ReadUInt32(); // new field in WDB2

                int unk1 = reader.ReadInt32(); // new field in WDB2 (Unix time in WCH2)
                int unk2 = reader.ReadInt32(); // new field in WDB2
                int unk3 = reader.ReadInt32(); // new field in WDB2 (index table?)
                int locale = reader.ReadInt32(); // new field in WDB2
                int unk5 = reader.ReadInt32(); // new field in WDB2

                if (unk3 != 0)
                {
                    reader.ReadBytes(unk3 * 4 - HeaderSize);     // an index for rows
                    reader.ReadBytes(unk3 * 2 - HeaderSize * 2); // a memory allocation bank
                }

                m_rows = new byte[RecordsCount][];

                for (int i = 0; i < RecordsCount; i++)
                    m_rows[i] = reader.ReadBytes(RecordSize);

                int stringTableStart = (int)reader.BaseStream.Position;

                StringTable = new StringTable();

                while (reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    int index = (int)reader.BaseStream.Position - stringTableStart;
                    StringTable[index] = reader.ReadStringNull();
                }
            }
        }
Esempio n. 12
0
 public CompilationContext(HostCallTable hostCallTable,
                           StringTable stringTable,
                           EnumDefineTable enumTable,
                           TypeBindingTable typeBindingTable,
                           EventBindingTable eventBindingTable)
 {
     m_HostCallTable = hostCallTable;
     m_StringTable = stringTable;
     m_EnumTable = enumTable;
     m_TypeBindingTable = typeBindingTable;
     m_EventBindingTable = eventBindingTable;
 }
Esempio n. 13
0
        public CacheFile(string Filename, string Build)
            : base(Filename, Build)
        {
            Version = DefinitionSet.Halo1AE;

            Header = new CacheH1P.CacheHeader(this);
            IndexHeader = new CacheH1P.CacheIndexHeader(this);
            IndexItems = new CacheH1P.IndexTable(this);
            Strings = new StringTable(this);

            LocaleTables = new List<LocaleTable>();
        }
Esempio n. 14
0
        public CacheFile(string Filename, string Build)
            : base(Filename, Build)
        {
            Reader.EndianType = EndianFormat.LittleEndian;
            Version = DefinitionSet.Halo1PC;

            Header = new CacheHeader(this);
            IndexHeader = new CacheIndexHeader(this);
            IndexItems = new IndexTable(this);
            Strings = new StringTable(this);

            LocaleTables = new List<LocaleTable>();
        }
Esempio n. 15
0
        public void Constructor_StringTableFound_ItemsLoadedCorrectly()
        {
            // Assign
            _fileReader.Setup(x => x.LoadXDocument(It.IsAny<string>())).Returns(XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><item name=\"SiteTitle\" value=\"Your site title!\" /></items>"));

            // Act

            _stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object);
            _stringTable.Setup();

            // Assert
            Assert.AreEqual("Your site title!", _stringTable.Items.SiteTitle);
        }
Esempio n. 16
0
		public override string ToString()
		{
			StringTable values = new StringTable();

			if (Items != null)
			{
				foreach (ExtendedFieldSearchInfoItem item in Items)
				{
					values.Add(item.FieldKey, item.SearchValue);
				}
			}

			return values.ToString();
		}
Esempio n. 17
0
        public void Constructor_CurrentLanguageEqualToDefaultLanguage_DefaultItemsNotLoaded()
        {
            // Assign

            _languageManager.SetupGet(x => x.Language).Returns("en");
            _fileReader.Setup(x => x.LoadXDocument(It.IsAny<string>())).Returns(XDocument.Parse("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><item name=\"SiteTitle\" value=\"Your site title!\" /></items>"));

            // Act

            _stringTable = new StringTable(_stringTableFiles, DefaultLanguage, _languageManagerProvider.Object, _fileReader.Object);
            _stringTable.Setup();

            // Assert
            _fileReader.Verify(x => x.LoadXDocument(It.IsAny<string>(), It.IsAny<string>()), Times.Never);
        }
Esempio n. 18
0
        public void Update(StringTable table, int numEntries, byte[] data)
        {
            using (var stream = Bitstream.CreateWith(data))
            {
                var option = stream.ReadBool();
                if (option)
                {
                    throw new ArgumentException("Unknown option " + option);
                }

                var keyHistory = new List<string>();

                var entryId = uint.MaxValue;
                uint read = 0;

                while (read < numEntries)
                {
                    if (!stream.ReadBool())
                    {
                        entryId = stream.ReadBits(table.EntryBits);
                    }
                    else
                    {
                        entryId = unchecked(entryId + 1);
                    }

                    var key = ReadKeyIfIncluded(stream, keyHistory);
                    var value = ReadValueIfIncluded(stream, table.UserDataFixedSize,
                        table.UserDataSizeBits);

                    if (entryId < table.Count)
                    {
                        var entry = table.Get(entryId);

                        if (value != null)
                        {
                            entry.Value = value;
                        }
                    }
                    else
                    {
                        table.Put(entryId, new StringTable.Entry(key, value));
                    }

                    ++read;
                }
            }
        }
Esempio n. 19
0
        public override void Intro( params object [] args )
        {
            contentManager = new ResourceTable ( FileSystemManager.GetFileSystem ( FileSystemManager.ManifestFileSystem ) );

            Core.GraphicsDevice.ImmediateContext.BlendState = BlendState.AlphaBlend;
            Add ( InputHelper.Instance );

            stt = contentManager.Load<StringTable> ( "Resources/stringTable.json" );

            font = contentManager.Load<TrueTypeFont> ( "Resources/test.ttf", 22 );
            font.IsPrerenderMode = true;
            font2 = contentManager.Load<TrueTypeFont> ( "Resources/test.ttf", 32 );
            font2.SeconaryFont = contentManager.Load<TrueTypeFont> ( "Resources/segoeui.ttf", 32 );

            base.Intro ( args );
        }
Esempio n. 20
0
        public CacheFile(string Filename, string Build)
            : base(Filename, Build)
        {
            Version = DefinitionSet.Halo3Retail;

            Header = new CacheHeader(this);
            IndexHeader = new Halo3Beta.CacheFile.CacheIndexHeader(this);
            IndexItems = new Halo3Beta.CacheFile.IndexTable(this);
            Strings = new StringTable(this);

            LocaleTables = new List<LocaleTable>();
            try
            {
                for (int i = 0; i < int.Parse(buildNode.Attributes["languageCount"].Value); i++)
                    LocaleTables.Add(new LocaleTable(this, (GameLanguage)i));
            }
            catch { LocaleTables.Clear(); }
        }
Esempio n. 21
0
        public unsafe override void Export(string outPath)
        {
            StringTable table = new StringTable();
            table.Add(_name);

            int dataLen = OnCalculateSize(true);
            int totalLen = dataLen + table.GetTotalSize();

            using (FileStream stream = new FileStream(outPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 8, FileOptions.RandomAccess))
            {
                stream.SetLength(totalLen);
                using (FileMap map = FileMap.FromStream(stream))
                {
                    AnimationConverter.EncodeCHR0Keyframes(Keyframes, map.Address, map.Address + _entryLen);
                    table.WriteTable(map.Address + dataLen);
                    PostProcess(map.Address, table);
                }
            }
        }
Esempio n. 22
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            StringTable gender = new StringTable();
            gender.setIndexes(
                StringTableEntry.NumericCode,
                StringTableEntry.LetterCode,
                StringTableEntry.FullText,
                "requireSecondOfficer"
                );
            gender.addItem("1", "m", "Male", "false");
            gender.addItem("2", "f", "Female", "true");
            gender.addItem("99", "u", "Unknown", "true");

            gender["Male", StringTableEntry.FullText][StringTableEntry.NumericCode] = "3";

            int value = int.Parse(gender["Male", StringTableEntry.FullText][StringTableEntry.NumericCode]); //retrieve numeric code for a Male

            StringTable bob = new StringTable();

            MessageBox.Show(value.ToString());
        }
        /// <summary>
        /// Initializes the context with a session.
        /// </summary>
        /// <param name="requestHeader">The request header.</param>
        /// <param name="requestType">Type of the request.</param>
        public OperationContext(RequestHeader requestHeader, RequestType requestType)
        {
            if (requestHeader == null) throw new ArgumentNullException("requestHeader");
            
            m_channelContext    = SecureChannelContext.Current;
            m_session           = null;
            m_identity          = null;
            m_preferredLocales  = new string[0];
            m_diagnosticsMask   = (DiagnosticsMasks)requestHeader.ReturnDiagnostics;
            m_stringTable       = new StringTable();
            m_auditLogEntryId   = requestHeader.AuditEntryId;
            m_requestId         = Utils.IncrementIdentifier(ref s_lastRequestId);
            m_requestType       = requestType;
            m_clientHandle      = requestHeader.RequestHandle;
            m_operationDeadline = DateTime.MaxValue;

            if (requestHeader.TimeoutHint > 0)
            {
                m_operationDeadline = DateTime.UtcNow.AddMilliseconds(requestHeader.TimeoutHint);
            }
        }
Esempio n. 24
0
        public static string FormatStringTable(StringTable data)
        {
            StringBuilder result = new StringBuilder(100);
            StringBuilder values = new StringBuilder(100);

            foreach (string key in data.Keys)
            {
                string value = data[key];

                result.Append(key);
                result.Append(",");
                result.Append(value.Length.ToString());
                result.Append(";");

                values.Append(value);
            }

            result.Append("|");
            result.Append(values.ToString());

            return result.ToString();
        }
        private void SaveList()
        {
            StringTable passportSorts = new StringTable();
            StringTable passportEnables = new StringTable();

            string keys = _Request.Get("extendfieldEnable", Method.Post,string.Empty);

            List<string> enableKeys = StringUtil.Split2<string>(keys);

            ExtendedFieldSettings fieldSetting = SettingManager.CloneSetttings<ExtendedFieldSettings>(AllSettings.Current.ExtendedFieldSettings);

            ExtendedFieldCollection fields = new ExtendedFieldCollection();
            foreach (ExtendedField field in fieldSetting.FieldsWithPassport)
            {
                int sortOrder = _Request.Get<int>(field.Key + "_sortOrder", Method.Post, 0);;
                if (field.IsPassport)
                {
                    passportSorts.Add(field.Key, sortOrder.ToString());
                    if (enableKeys.Contains(field.Key) == false)
                        passportEnables.Add(field.Key, "0");
                    //field.SortOrder = sortOrder;
                }
                else
                {
                    field.SortOrder = sortOrder;
                    fields.Add(field);
                }

            }

            fieldSetting.Fields = fields;
            fieldSetting.PassportSorts = passportSorts;
            fieldSetting.IsEnables = passportEnables;


            SettingManager.SaveSettings(fieldSetting);

            UserBO.Instance.RemoveAllUserCache();
        }
Esempio n. 26
0
        /// <summary>
        /// Constructs the server.
        /// </summary>
        public ServerObject(string applicationUri, NodeManager nodeManager)
        {
            // the namespace table is used for the namepace indexes in NodeIds and QualifiedNames
            // The first index (added by default) is the UA namespace. The second is the application uri.
            m_namespaceUris = new NamespaceTable();
            m_namespaceUris.Append(applicationUri);

            // the server table is used for the server index in remote NodeIds (a.k.a. ExpandedNodeIds)
            // The first index is always the current server.
            m_serverUris = new StringTable();
            m_serverUris.Append(applicationUri);

            m_serviceLevel = 100;

            m_serverStatus = new ServerStatusDataType();
            m_serverStatus.StartTime = DateTime.UtcNow;
            m_serverStatus.CurrentTime = DateTime.UtcNow;
            m_serverStatus.State = ServerState.Running_0;
            m_serverStatus.SecondsTillShutdown = 0;
            m_serverStatus.ShutdownReason = null;

            m_serverStatus.BuildInfo = new BuildInfo();
            m_serverStatus.BuildInfo.BuildDate = new DateTime(2008, 7, 1);
            m_serverStatus.BuildInfo.SoftwareVersion = "1.00";
            m_serverStatus.BuildInfo.BuildNumber = "218.0";
            m_serverStatus.BuildInfo.ManufacturerName = "My Company";
            m_serverStatus.BuildInfo.ProductName = "My Sample Server";
            m_serverStatus.BuildInfo.ProductUri = "http://mycompany.com/MySampleServer/v1.0";

            // tell the node manager to call this object whenever the value of these attributes are read.
            nodeManager.SetReadValueCallback(new NodeId(Variables.Server_NamespaceArray), GetNamespaceArray);
            nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerArray), GetServerArray);
            nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServiceLevel), GetServiceLevel);
            nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerStatus), GetServerStatus);
            nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerStatus_StartTime), GetServerStatus_StartTime);
            nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerStatus_CurrentTime), GetServerStatus_CurrentTime);
            nodeManager.SetReadValueCallback(new NodeId(Variables.Server_ServerStatus_State), GetServerStatus_State);
        }
Esempio n. 27
0
        public static StringTable ParseStringTable(string value)
        {
            StringTable result = new StringTable();

            int endOfHeader = value.IndexOf('|');

            string header = value.Substring(0, endOfHeader);
            string values = value.Substring(endOfHeader + 1);

            int endOfItem = -1;
            int valueCursor = 0;

            while (true)
            {
                int endOfOldItem = endOfItem + 1;

                endOfItem = header.IndexOf(';', endOfItem + 1);

                if (endOfItem < 0)
                    break;

                int endOfItemName = header.IndexOf(',', endOfOldItem + 1, endOfItem - endOfOldItem - 1);

                string itemName = header.Substring(endOfOldItem, endOfItemName - endOfOldItem);

                int itemLength = int.Parse(header.Substring(endOfItemName + 1, endOfItem - endOfItemName - 1));

                string itemValue = values.Substring(valueCursor, itemLength);

                valueCursor += itemLength;

                result.Add(itemName, itemValue);
            }

            return result;
        }
Esempio n. 28
0
        public PackageInfo( string packageName, string author, string copyright, string description, Version version, DateTime releaseDate,
			bool isSubPackage, Guid [] mainPackageIds, StringTable stringTable, ResourceTable resourceTable, ImageInfo imageInfo = null, Guid? packageId = null )
        {
            PackageName = packageName;

            Author = author;
            Copyright = copyright;
            Description = description;

            PackageID = ( packageId == null ) ? Guid.NewGuid () : packageId.Value;
            Version = version;
            ReleaseDate = releaseDate;

            if ( imageInfo != null )
                PackageCover = imageInfo;

            IsSubPackage = isSubPackage;
            MainPackageIDs = mainPackageIds;

            StringTable = stringTable;
            ResourceTable = resourceTable;

            IsSettingCompleted = true;
        }
Esempio n. 29
0
 public abstract bool TryGetDeclaredSymbolInfo(StringTable stringTable, SyntaxNode node, string rootNamespace, out DeclaredSymbolInfo declaredSymbolInfo);
Esempio n. 30
0
 protected static Pip FindPipByTag(IEnumerable <Pip> pips, string tag, StringTable stringTable)
 {
     return(pips.FirstOrDefault(p => p.Tags.Contains(StringId.Create(stringTable, tag))));
 }
        // Token: 0x060159E3 RID: 88547 RVA: 0x00580AB8 File Offset: 0x0057ECB8
        protected override IEnumerator OnBasicVersionUnmatch()
        {
            global::Debug.LogError("Pre-Update Client failed: OnBasicVersionUnmatch");
            yield return(new WaitForSecondsRealtime(3f));

            yield return(DialogBox.Show(this.m_mainCtrl.gameObject, "Assets/GameProject/Resources/UI/DialogBox.prefab", StringTable.Get("MsgUpdateClinetByAppStore"), StringTable.Get("ButtonIKnow"), string.Empty, delegate(DialogBoxResult ret)
            {
                if (PDSDK.Instance != null)
                {
                    Application.OpenURL(PDSDK.Instance.DownloadClientURL);
                }
                Application.Quit();
            }));

            yield break;
        }
Esempio n. 32
0
 protected static void AssertEdges(PipGraph pipGraph, SimpleGraph file2file, List <Pip> pips, StringTable stringTable)
 {
     Assert.All(
         file2file.Edges,
         edge =>
     {
         var srcPip  = FindPipByTag(pips, GetProcTag(edge.Src), stringTable);
         var destPip = FindPipByTag(pips, GetProcTag(edge.Dest), stringTable);
         var deps    = pipGraph.RetrievePipImmediateDependencies(srcPip).ToList();
         if (!deps.Contains(destPip))
         {
             XAssert.Fail($"Edge ({edge.Src})->({edge.Dest}) not found: expected an edge between {srcPip} <-- {destPip}; dependencies of Pip {srcPip} are: {XAssert.SetToString(deps)}");
         }
     });
 }
Esempio n. 33
0
 /// <summary>
 /// Creates the default regular expression descriptor (for errors).
 /// Currently, it matches everything.
 /// </summary>
 public static RegexDescriptor CreateDefaultForErrors(StringTable stringTable)
 {
     Contract.Requires(stringTable != null, "stringTable can't be null.");
     return(new RegexDescriptor(StringId.Create(stringTable, ".*"), DefaultOptions));
 }
Esempio n. 34
0
        public static Slice Create(FdoCache cache, string editor, int flid, XmlNode node, ICmObject obj,
                                   StringTable stringTbl, IPersistenceProvider persistenceProvider, Mediator mediator, XmlNode caller, ObjSeqHashMap reuseMap)
        {
            Slice slice;

            switch (editor)
            {
            case "multistring":                     // first, these are the most common slices.
            {
                if (flid == 0)
                {
                    throw new ApplicationException("field attribute required for multistring " + node.OuterXml);
                }
                string wsSpec  = XmlUtils.GetOptionalAttributeValue(node, "ws");
                int    wsMagic = WritingSystemServices.GetMagicWsIdFromName(wsSpec);
                if (wsMagic == 0)
                {
                    throw new ApplicationException(
                              "ws must be 'all vernacular', 'all analysis', 'analysis vernacular', or 'vernacular analysis'"
                              + " it said '" + wsSpec + "'.");
                }


                bool forceIncludeEnglish = XmlUtils.GetOptionalBooleanAttributeValue(node, "forceIncludeEnglish", false);
                bool spellCheck          = XmlUtils.GetOptionalBooleanAttributeValue(node, "spell", true);
                // Either the part or the caller can specify that it isn't editable.
                // (The part may 'know' this, e.g. because it's a virtual attr not capable of editing;
                // more commonly the caller knows there isn't enough context for safe editing.
                bool editable = XmlUtils.GetOptionalBooleanAttributeValue(caller, "editable", true) &&
                                XmlUtils.GetOptionalBooleanAttributeValue(node, "editable", true);
                string           optionalWsSpec  = XmlUtils.GetOptionalAttributeValue(node, "optionalWs");
                int              wsMagicOptional = WritingSystemServices.GetMagicWsIdFromName(optionalWsSpec);
                MultiStringSlice msSlice         = reuseMap.GetSliceToReuse("MultiStringSlice") as MultiStringSlice;
                if (msSlice == null)
                {
                    slice = new MultiStringSlice(obj, flid, wsMagic, wsMagicOptional, forceIncludeEnglish, editable, spellCheck);
                }
                else
                {
                    slice = msSlice;
                    msSlice.Reuse(obj, flid, wsMagic, wsMagicOptional, forceIncludeEnglish, editable, spellCheck);
                }
                break;
            }

            case "defaultvectorreference":                     // second most common.
            {
                var rvSlice = reuseMap.GetSliceToReuse("ReferenceVectorSlice") as ReferenceVectorSlice;
                if (rvSlice == null)
                {
                    slice = new ReferenceVectorSlice(cache, obj, flid);
                }
                else
                {
                    slice = rvSlice;
                    rvSlice.Reuse(obj, flid);
                }
                break;
            }

            case "possvectorreference":
            {
                var prvSlice = reuseMap.GetSliceToReuse("PossibilityReferenceVectorSlice") as PossibilityReferenceVectorSlice;
                if (prvSlice == null)
                {
                    slice = new PossibilityReferenceVectorSlice(cache, obj, flid);
                }
                else
                {
                    slice = prvSlice;
                    prvSlice.Reuse(obj, flid);
                }
                break;
            }

            case "semdomvectorreference":
            {
                var prvSlice = reuseMap.GetSliceToReuse("SemanticDomainReferenceVectorSlice") as SemanticDomainReferenceVectorSlice;
                if (prvSlice == null)
                {
                    slice = new SemanticDomainReferenceVectorSlice(cache, obj, flid);
                }
                else
                {
                    slice = prvSlice;
                    prvSlice.Reuse(obj, flid);
                }
                break;
            }

            case "string":
            {
                if (flid == 0)
                {
                    throw new ApplicationException("field attribute required for basic properties " + node.OuterXml);
                }
                int ws = GetWs(mediator, cache, node);
                if (ws != 0)
                {
                    slice = new StringSlice(obj, flid, ws);
                }
                else
                {
                    slice = new StringSlice(obj, flid);
                }
                var fShowWsLabel = XmlUtils.GetOptionalBooleanAttributeValue(node, "labelws", false);
                if (fShowWsLabel)
                {
                    (slice as StringSlice).ShowWsLabel = true;
                }
                int wsEmpty = GetWs(mediator, cache, node, "wsempty");
                if (wsEmpty != 0)
                {
                    (slice as StringSlice).DefaultWs = wsEmpty;
                }
                break;
            }

            case "jtview":
            {
                string layout = XmlUtils.GetOptionalAttributeValue(caller, "param");
                if (layout == null)
                {
                    layout = XmlUtils.GetManditoryAttributeValue(node, "layout");
                }
                // Editable if BOTH the caller (part ref) AND the node itself (the slice) say so...or at least if neither says not.
                bool editable = XmlUtils.GetOptionalBooleanAttributeValue(caller, "editable", true) &&
                                XmlUtils.GetOptionalBooleanAttributeValue(node, "editable", true);
                slice = new ViewSlice(new XmlView(obj.Hvo, layout, stringTbl, editable));
                break;
            }

            case "summary":
            {
                slice = new SummarySlice();
                break;
            }

            case "enumcombobox":
            {
                slice = new EnumComboSlice(cache, obj, flid, stringTbl, node["deParams"]);
                break;
            }

            case "referencecombobox":
            {
                slice = new ReferenceComboBoxSlice(cache, obj, flid, persistenceProvider);
                break;
            }

            case "typeaheadrefatomic":
            {
                slice = new AtomicRefTypeAheadSlice(obj, flid);
                break;
            }

            case "msareferencecombobox":
            {
                slice = new MSAReferenceComboBoxSlice(cache, obj, flid, persistenceProvider);
                break;
            }

            case "lit":                     // was "message"
            {
                string message = XmlUtils.GetManditoryAttributeValue(node, "message");
                if (stringTbl != null)
                {
                    string sTranslate = XmlUtils.GetOptionalAttributeValue(node, "translate", "");
                    if (sTranslate.Trim().ToLower() != "do not translate")
                    {
                        message = stringTbl.LocalizeLiteralValue(message);
                    }
                }
                slice = new MessageSlice(message);
                break;
            }

            case "picture":
            {
                slice = new PictureSlice((ICmPicture)obj);
                break;
            }

            case "image":
            {
                try
                {
                    slice = new ImageSlice(FwDirectoryFinder.CodeDirectory, XmlUtils.GetManditoryAttributeValue(node, "param1"));
                }
                catch (Exception error)
                {
                    slice = new MessageSlice(String.Format(DetailControlsStrings.ksImageSliceFailed,
                                                           error.Message));
                }
                break;
            }

            case "checkbox":
            {
                slice = new CheckboxSlice(cache, obj, flid, node);
                break;
            }

            case "checkboxwithrefresh":
            {
                slice = new CheckboxRefreshSlice(cache, obj, flid, node);
                break;
            }

            case "time":
            {
                slice = new DateSlice(cache, obj, flid);
                break;
            }

            case "integer":                 // produced in the auto-generated parts from the conceptual model
            case "int":                     // was "integer"
            {
                slice = new IntegerSlice(cache, obj, flid);
                break;
            }

            case "gendate":
            {
                slice = new GenDateSlice(cache, obj, flid);
                break;
            }

            case "morphtypeatomicreference":
            {
                slice = new MorphTypeAtomicReferenceSlice(cache, obj, flid);
                break;
            }

            case "atomicreferencepos":
            {
                slice = new AtomicReferencePOSSlice(cache, obj, flid, persistenceProvider, mediator);
                break;
            }

            case "possatomicreference":
            {
                slice = new PossibilityAtomicReferenceSlice(cache, obj, flid);
                break;
            }

            case "atomicreferenceposdisabled":
            {
                slice = new AutomicReferencePOSDisabledSlice(cache, obj, flid, persistenceProvider, mediator);
                break;
            }

            case "defaultatomicreference":
            {
                slice = new AtomicReferenceSlice(cache, obj, flid);
                break;
            }

            case "defaultatomicreferencedisabled":
            {
                slice = new AtomicReferenceDisabledSlice(cache, obj, flid);
                break;
            }

            case "derivmsareference":
            {
                slice = new DerivMSAReferenceSlice(cache, obj, flid);
                break;
            }

            case "inflmsareference":
            {
                slice = new InflMSAReferenceSlice(cache, obj, flid);
                break;
            }

            case "phoneenvreference":
            {
                slice = new PhoneEnvReferenceSlice(cache, obj, flid);
                break;
            }

            case "sttext":
            {
                slice = new StTextSlice(obj, flid, GetWs(mediator, cache, node));
                break;
            }

            case "custom":
            {
                slice = (Slice)DynamicLoader.CreateObject(node);
                break;
            }

            case "customwithparams":
            {
                slice = (Slice)DynamicLoader.CreateObject(node,
                                                          new object[] { cache, editor, flid, node, obj, stringTbl,
                                                                         persistenceProvider, GetWs(mediator, cache, node) });
                break;
            }

            case "ghostvector":
            {
                slice = new GhostReferenceVectorSlice(cache, obj, node);
                break;
            }

            case "command":
            {
                slice = new CommandSlice(node["deParams"]);
                break;
            }

            case null:                          //grouping nodes do not necessarily have any editor
            {
                slice = new Slice();
                break;
            }

            case "message":
                // case "integer": // added back in to behave as "int" above
                throw new Exception("use of obsolete editor type (message->lit, integer->int)");

            case "autocustom":
                slice = MakeAutoCustomSlice(cache, obj, caller, node);
                if (slice == null)
                {
                    return(null);
                }
                break;

            case "defaultvectorreferencedisabled":                     // second most common.
            {
                ReferenceVectorDisabledSlice rvSlice = reuseMap.GetSliceToReuse("ReferenceVectorDisabledSlice") as ReferenceVectorDisabledSlice;
                if (rvSlice == null)
                {
                    slice = new ReferenceVectorDisabledSlice(cache, obj, flid);
                }
                else
                {
                    slice = rvSlice;
                    rvSlice.Reuse(obj, flid);
                }
                break;
            }

            default:
            {
                //Since the editor has not been implemented yet,
                //is there a bitmap file that we can show for this editor?
                //Such bitmaps belong in the distFiles xde directory
                string fwCodeDir = FwDirectoryFinder.CodeDirectory;
                string editorBitmapRelativePath = "xde/" + editor + ".bmp";
                if (File.Exists(Path.Combine(fwCodeDir, editorBitmapRelativePath)))
                {
                    slice = new ImageSlice(fwCodeDir, editorBitmapRelativePath);
                }
                else
                {
                    slice = new MessageSlice(String.Format(DetailControlsStrings.ksBadEditorType, editor));
                }
                break;
            }
            }
            slice.AccessibleName = editor;

            return(slice);
        }
Esempio n. 35
0
        /// <summary>
        /// Overrides ConstructAction.OnSetAction. Provides the input fields and some initialsation
        /// </summary>
        public override void OnSetAction()
        {
            base.TitleId         = "Constr.Picture";
            widthValue           = 1; // default value
            heightValue          = 1; // default value
            keepAspectRatioValue = true;
            rectangularValue     = true;

            // Create and initialize the filename input field
            fileNameInput = new StringInput("Picture.Object"); // Resource ID must be defined in StringTable
            fileNameInput.IsFileNameInput = true;              // to enable the openfile dialog
            fileNameInput.InitOpenFile    = true;
            fileNameInput.FileNameFilter  = StringTable.GetString("Picture.Open.Filter");
            // you may also wnat to set fileNameInput.FileNameFilter
            fileNameInput.GetStringEvent += new StringInput.GetStringDelegate(OnGetFileName);
            fileNameInput.SetStringEvent += new StringInput.SetStringDelegate(OnSetFileName);
            fileName = ""; // initial filename is empty

            // Create and initialize the position input field
            positionInput = new GeoPointInput("Picture.Location"); // Resource ID must be defined in StringTable
            positionInput.GetGeoPointEvent   += new GeoPointInput.GetGeoPointDelegate(OnGetPosition);
            positionInput.SetGeoPointExEvent += new GeoPointInput.SetGeoPointExDelegate(OnSetPosition);
            positionInput.DefinesBasePoint    = true;

            // Create and initialize the scaling factor input field
            scalingFactorInput = new DoubleInput("Picture.Scale"); // Resource ID must be defined in StringTable
            scalingFactorInput.GetDoubleEvent       += new DoubleInput.GetDoubleDelegate(OnGetScalingFactor);
            scalingFactorInput.SetDoubleEvent       += new DoubleInput.SetDoubleDelegate(OnSetScalingFactor);
            scalingFactorInput.CalculateDoubleEvent += new DoubleInput.CalculateDoubleDelegate(CalculateScalingFactorEvent);
            // scalingFactorInput.Optional = true; // optinal input
            // scalingFactorInput.ForwardMouseInputTo = positionInput; // no mouse input, forward to position input
            scalingFactor = 1.0; // default scaling factor


            width = new LengthInput("Picture.Width");
            width.GetLengthEvent     += new ConstructAction.LengthInput.GetLengthDelegate(OnGetWidth);
            width.SetLengthEvent     += new ConstructAction.LengthInput.SetLengthDelegate(OnSetWidth);
            width.Optional            = true;          // optinal input
            width.ForwardMouseInputTo = positionInput; // no mouse input, forward to position input


            height = new LengthInput("Picture.Height");
            height.GetLengthEvent     += new LengthInput.GetLengthDelegate(OnGetHeight);
            height.SetLengthEvent     += new LengthInput.SetLengthDelegate(OnSetHeight);
            height.Optional            = true;          // optinal input
            height.ForwardMouseInputTo = positionInput; // no mouse input, forward to position input

            GeoVectorInput dirWidth = new GeoVectorInput("Picture.DirWidth");

            dirWidth.GetGeoVectorEvent += new GeoVectorInput.GetGeoVectorDelegate(OnGetDirWidth);
            dirWidth.SetGeoVectorEvent += new GeoVectorInput.SetGeoVectorDelegate(OnSetDirWidth);
            dirWidth.Optional           = true;

            GeoVectorInput dirHeight = new GeoVectorInput("Picture.DirHeight");

            dirHeight.GetGeoVectorEvent += new GeoVectorInput.GetGeoVectorDelegate(OnGetDirHeight);
            dirHeight.SetGeoVectorEvent += new GeoVectorInput.SetGeoVectorDelegate(OnSetDirHeight);
            dirHeight.Optional           = true;

            BooleanInput keepAspectRatio = new BooleanInput("Picture.KeepAspectRatio", "YesNo.Values", keepAspectRatioValue);

            keepAspectRatio.SetBooleanEvent += new ConstructAction.BooleanInput.SetBooleanDelegate(OnKeepAspectRatioChanged);

            BooleanInput rectangular = new BooleanInput("Picture.Rectangular", "YesNo.Values", rectangularValue);

            rectangular.SetBooleanEvent += new ConstructAction.BooleanInput.SetBooleanDelegate(OnRectangularChanged);

            // picture must exist prior to SetInput
            // because picture.Location is required by positionInput
            picture = Picture.Construct();

            // Define the input fields for the ConstructAction
            base.SetInput(fileNameInput, positionInput, scalingFactorInput, width, height, dirWidth, dirHeight, keepAspectRatio, rectangular);
            base.OnSetAction(); // Default implementation must be called

            // force the snapmode to include SnapToFaceSurface
            base.Frame.SnapMode |= SnapPointFinder.SnapModes.SnapToFaceSurface;
        }
        /// <summary>
        /// Exports a ExpandedNodeId
        /// </summary>
        private string Export(Opc.Ua.ExpandedNodeId source, NamespaceTable namespaceUris, StringTable serverUris)
        {
            if (Opc.Ua.NodeId.IsNull(source))
            {
                return(String.Empty);
            }

            if (source.ServerIndex <= 0 && source.NamespaceIndex <= 0 && String.IsNullOrEmpty(source.NamespaceUri))
            {
                return(source.ToString());
            }

            ushort namespaceIndex = 0;

            if (String.IsNullOrEmpty(source.NamespaceUri))
            {
                namespaceIndex = ExportNamespaceIndex(source.NamespaceIndex, namespaceUris);
            }
            else
            {
                namespaceIndex = ExportNamespaceUri(source.NamespaceUri, namespaceUris);
            }

            uint serverIndex = ExportServerIndex(source.ServerIndex, serverUris);

            source = new Opc.Ua.ExpandedNodeId(source.Identifier, namespaceIndex, null, serverIndex);
            return(source.ToString());
        }
        /// <summary>
        /// Imports a ExpandedNodeId
        /// </summary>
        private Opc.Ua.ExpandedNodeId ImportExpandedNodeId(string source, NamespaceTable namespaceUris, StringTable serverUris)
        {
            if (String.IsNullOrEmpty(source))
            {
                return(Opc.Ua.ExpandedNodeId.Null);
            }
            // lookup aliases
            if (this.Aliases != null)
            {
                for (int ii = 0; ii < this.Aliases.Length; ii++)
                {
                    if (this.Aliases[ii].Alias == source)
                    {
                        source = this.Aliases[ii].Value;
                        break;
                    }
                }
            }

            // parse the node.
            Opc.Ua.ExpandedNodeId nodeId = Opc.Ua.ExpandedNodeId.Parse(source);

            if (nodeId.ServerIndex <= 0 && nodeId.NamespaceIndex <= 0 && String.IsNullOrEmpty(nodeId.NamespaceUri))
            {
                return(nodeId);
            }

            uint   serverIndex    = ImportServerIndex(nodeId.ServerIndex, serverUris);
            ushort namespaceIndex = ImportNamespaceIndex(nodeId.NamespaceIndex, namespaceUris);

            if (serverIndex > 0)
            {
                string namespaceUri = nodeId.NamespaceUri;

                if (String.IsNullOrEmpty(nodeId.NamespaceUri))
                {
                    namespaceUri = namespaceUris.GetString(namespaceIndex);
                }

                nodeId = new Opc.Ua.ExpandedNodeId(nodeId.Identifier, 0, namespaceUri, serverIndex);
                return(nodeId);
            }


            nodeId = new Opc.Ua.ExpandedNodeId(nodeId.Identifier, namespaceIndex, null, 0);
            return(nodeId);
        }
Esempio n. 38
0
 public QualifierSpaceEntryComparerByKey(StringTable stringTable)
 {
     Contract.RequiresNotNull(stringTable);
     m_stringTable = stringTable;
 }
Esempio n. 39
0
 protected void OneTimeSetUp()
 {
     Context       = new ServiceMessageContext();
     NameSpaceUris = Context.NamespaceUris;
     ServerUris    = new StringTable();
 }
Esempio n. 40
0
        private void LoadTagDataFromFile(EndianBinaryReader reader)
        {
            long tagStart = reader.BaseStream.Position;

            string tagName = reader.ReadString(4);
            int    tagSize = reader.ReadInt32();

            LoopMode = (LoopType)reader.ReadByte();
            byte angleMultiplier = reader.ReadByte(); // Probably just padding in BRK

            AnimLengthInFrames = reader.ReadInt16();
            short colorAnimEntryCount = reader.ReadInt16();
            short konstAnimEntryCount = reader.ReadInt16();

            short numColorREntries = reader.ReadInt16();
            short numColorGEntries = reader.ReadInt16();
            short numColorBEntries = reader.ReadInt16();
            short numColorAEntries = reader.ReadInt16();

            short numKonstREntries = reader.ReadInt16();
            short numKonstGEntries = reader.ReadInt16();
            short numKonstBEntries = reader.ReadInt16();
            short numKonstAEntries = reader.ReadInt16();

            int colorAnimDataOffset = reader.ReadInt32();
            int konstAnimDataOffset = reader.ReadInt32();

            int colorRemapTableOffset = reader.ReadInt32();
            int konstRemapTableOffset = reader.ReadInt32();

            int colorStringTableOffset = reader.ReadInt32();
            int konstStringTableOffset = reader.ReadInt32();

            int colorRTableOffset = reader.ReadInt32();
            int colorGTableOffset = reader.ReadInt32();
            int colorBTableOffset = reader.ReadInt32();
            int colorATableOffset = reader.ReadInt32();

            int konstRTableOffset = reader.ReadInt32();
            int konstGTableOffset = reader.ReadInt32();
            int konstBTableOffset = reader.ReadInt32();
            int konstATableOffset = reader.ReadInt32();

            reader.Skip(8); // padding

            float[] colorRData = new float[numColorREntries];
            reader.BaseStream.Position = tagStart + colorRTableOffset;
            for (int i = 0; i < numColorREntries; i++)
            {
                colorRData[i] = reader.ReadInt16();
            }

            float[] colorGData = new float[numColorGEntries];
            reader.BaseStream.Position = tagStart + colorGTableOffset;
            for (int i = 0; i < numColorGEntries; i++)
            {
                colorGData[i] = reader.ReadInt16();
            }

            float[] colorBData = new float[numColorBEntries];
            reader.BaseStream.Position = tagStart + colorBTableOffset;
            for (int i = 0; i < numColorBEntries; i++)
            {
                colorBData[i] = reader.ReadInt16();
            }

            float[] colorAData = new float[numColorAEntries];
            reader.BaseStream.Position = tagStart + colorATableOffset;
            for (int i = 0; i < numColorAEntries; i++)
            {
                colorAData[i] = reader.ReadInt16();
            }

            float[] konstRData = new float[numKonstREntries];
            reader.BaseStream.Position = tagStart + konstRTableOffset;
            for (int i = 0; i < numKonstREntries; i++)
            {
                konstRData[i] = reader.ReadInt16();
            }

            float[] konstGData = new float[numKonstGEntries];
            reader.BaseStream.Position = tagStart + konstGTableOffset;
            for (int i = 0; i < numKonstGEntries; i++)
            {
                konstGData[i] = reader.ReadInt16();
            }

            float[] konstBData = new float[numKonstBEntries];
            reader.BaseStream.Position = tagStart + konstBTableOffset;
            for (int i = 0; i < numKonstBEntries; i++)
            {
                konstBData[i] = reader.ReadInt16();
            }

            float[] konstAData = new float[numKonstAEntries];
            reader.BaseStream.Position = tagStart + konstATableOffset;
            for (int i = 0; i < numKonstAEntries; i++)
            {
                konstAData[i] = reader.ReadInt16();
            }

            m_colorRemapTable          = new int[colorAnimEntryCount];
            reader.BaseStream.Position = tagStart + colorRemapTableOffset;
            for (int i = 0; i < colorAnimEntryCount; i++)
            {
                m_colorRemapTable[i] = reader.ReadInt16();
            }

            m_konstRemapTable          = new int[konstAnimEntryCount];
            reader.BaseStream.Position = tagStart + konstRemapTableOffset;
            for (int i = 0; i < konstAnimEntryCount; i++)
            {
                m_konstRemapTable[i] = reader.ReadInt16();
            }

            reader.BaseStream.Position = tagStart + colorStringTableOffset;
            m_colorStringTable         = StringTable.FromStream(reader);

            reader.BaseStream.Position = tagStart + konstStringTableOffset;
            m_konstStringTable         = StringTable.FromStream(reader);

            m_colorAnimationData = new List <RegisterAnim>();

            reader.BaseStream.Position = tagStart + colorAnimDataOffset;
            for (int i = 0; i < colorAnimEntryCount; i++)
            {
                AnimIndex colorRIndex = ReadAnimIndex(reader);
                AnimIndex colorGIndex = ReadAnimIndex(reader);
                AnimIndex colorBIndex = ReadAnimIndex(reader);
                AnimIndex colorAIndex = ReadAnimIndex(reader);
                int       colorID     = reader.ReadByte();
                reader.Skip(3);

                RegisterAnim regAnim = new RegisterAnim();
                regAnim.ColorID = colorID;

                regAnim.RedChannel   = ReadComp(colorRData, colorRIndex);
                regAnim.GreenChannel = ReadComp(colorGData, colorGIndex);
                regAnim.BlueChannel  = ReadComp(colorBData, colorBIndex);
                regAnim.AlphaChannel = ReadComp(colorAData, colorAIndex);

                foreach (Key key in regAnim.RedChannel)
                {
                    key.Value      = key.Value / 255.0f;
                    key.TangentIn  = (float)key.TangentIn / 65535.0f;
                    key.TangentOut = (float)key.TangentOut / 65535.0f;
                }

                foreach (Key key in regAnim.GreenChannel)
                {
                    key.Value      = key.Value / 255.0f;
                    key.TangentIn  = (float)key.TangentIn / 65535.0f;
                    key.TangentOut = (float)key.TangentOut / 65535.0f;
                }

                foreach (Key key in regAnim.BlueChannel)
                {
                    key.Value      = key.Value / 255.0f;
                    key.TangentIn  = (float)key.TangentIn / 65535.0f;
                    key.TangentOut = (float)key.TangentOut / 65535.0f;
                }

                foreach (Key key in regAnim.AlphaChannel)
                {
                    key.Value      = key.Value / 255.0f;
                    key.TangentIn  = (float)key.TangentIn / 65535.0f;
                    key.TangentOut = (float)key.TangentOut / 65535.0f;
                }

                m_colorAnimationData.Add(regAnim);
            }

            m_konstAnimationData = new List <RegisterAnim>();

            reader.BaseStream.Position = tagStart + konstAnimDataOffset;
            for (int i = 0; i < konstAnimEntryCount; i++)
            {
                AnimIndex konstRIndex = ReadAnimIndex(reader);
                AnimIndex konstGIndex = ReadAnimIndex(reader);
                AnimIndex konstBIndex = ReadAnimIndex(reader);
                AnimIndex konstAIndex = ReadAnimIndex(reader);
                int       colorID     = reader.ReadByte();
                reader.Skip(3);

                RegisterAnim regAnim = new RegisterAnim();
                regAnim.ColorID = colorID;

                regAnim.RedChannel   = ReadComp(konstRData, konstRIndex);
                regAnim.GreenChannel = ReadComp(konstGData, konstGIndex);
                regAnim.BlueChannel  = ReadComp(konstBData, konstBIndex);
                regAnim.AlphaChannel = ReadComp(konstAData, konstAIndex);

                foreach (Key key in regAnim.RedChannel)
                {
                    key.Value      = key.Value / 65535.0f;
                    key.TangentIn  = (float)key.TangentIn / 65535.0f;
                    key.TangentOut = (float)key.TangentOut / 65535.0f;
                }

                foreach (Key key in regAnim.GreenChannel)
                {
                    key.Value      = key.Value / 255.0f;
                    key.TangentIn  = (float)key.TangentIn / 65535.0f;
                    key.TangentOut = (float)key.TangentOut / 65535.0f;
                }

                foreach (Key key in regAnim.BlueChannel)
                {
                    key.Value      = key.Value / 255.0f;
                    key.TangentIn  = (float)key.TangentIn / 65535.0f;
                    key.TangentOut = (float)key.TangentOut / 65535.0f;
                }

                foreach (Key key in regAnim.AlphaChannel)
                {
                    key.Value      = key.Value / 255.0f;
                    key.TangentIn  = (float)key.TangentIn / 65535.0f;
                    key.TangentOut = (float)key.TangentOut / 65535.0f;
                }

                m_konstAnimationData.Add(regAnim);
            }
        }
 public CategoryContentConverter()
 {
     _localizedStrings = App.Current.Resources["StringTable"] as StringTable;
 }
Esempio n. 42
0
        private void BtnIssueLaunch_Click(object sender, RoutedEventArgs e)
        {
            bool ret = false;

            using (AlertDialog dlg = new AlertDialog(Application.Current.MainWindow, StringTable.GetInstance().GetString("STR_ALERT_DLG_TITLE", iLang), StringTable.GetInstance().GetString("STR_ISSUE_ASSET_QUESTION", iLang)))
            {
                ret = (bool)dlg.ShowDialog();
            }

            if (ret == false)
            {
                return;
            }

            try
            {
                Global.Helper.SignAndShowInformation(issueTx);
                StaticUtils.ShowMessageBox(StaticUtils.GreenBrush, StringTable.GetInstance().GetString("STR_SUC_TX_SUCCESSED", iLang));
            }
            catch (Exception)
            {
                StaticUtils.ShowMessageBox(StaticUtils.ErrorBrush, StringTable.GetInstance().GetString("STR_ERR_INCOMPLETEDSIGNATUREMESSAGE", iLang));
            }

            TxbIssueTxResult.Text = "";
            txbIssueFee.Text      = String.Format(StringTable.GetInstance().GetString("STR_SMART_CONTRACT_FEE", iLang), "0");

            BtnIssueLaunch.IsEnabled = false;
            BtnIssueLaunch.Style     = FindResource("QurasDisableAddAssetButtonStyle") as Style;
        }
Esempio n. 43
0
        ParseNameQual(char *name, StringTable strTable)
        {
            string qName;
            char * tmpStr = name;
            int    tmpLen;

            // look for end of Uri: first NS separator
            while (*tmpStr != NSSep && *tmpStr != NullChar)
            {
                tmpStr++;
            }

            if (*tmpStr == NullChar) // not a qualified name, QName = local name
            {
                tmpLen = unchecked ((int)(tmpStr - name));
                qName  = strTable.Intern(name, tmpLen);
            }
            else         // a namespace separator was found
            {
                tmpStr++;
                name = tmpStr; // save start of local name
                // look for end of local name: second NS separator could be found
                while (*tmpStr != NSSep && *tmpStr != NullChar)
                {
                    tmpStr++;
                }
                tmpLen = unchecked ((int)(tmpStr - name)); // length of local name

                if (*tmpStr == NullChar)                   // no prefix, QName = local name
                {
                    qName = strTable.Intern(name, tmpLen);
                }
                else         // we have a prefix
                {
                    tmpStr++;
                    char *prefix = tmpStr; // save start of prefix
                    while (*tmpStr != NullChar)
                    {
                        tmpStr++;
                    }
                    // use saved length of local name to calculate length of QName
                    tmpLen = unchecked ((int)(tmpStr - prefix) + tmpLen + 1);
                    char *qNameBuf = stackalloc char[tmpLen];
                    tmpStr = qNameBuf;
                    // first, copy prefix to QName buffer
                    while (*prefix != NullChar)
                    {
                        *tmpStr++ = *prefix++;
                    }
                    // then, copy colon
                    *tmpStr++ = Colon;
                    // finally, copy local name - name variable still poinst to it
                    while (*name != NSSep)
                    {
                        *tmpStr++ = *name++;
                    }
                    qName = strTable.Intern(qNameBuf, tmpLen);
                }
            }
            return(qName);
        }
        // Token: 0x060159E6 RID: 88550 RVA: 0x00580B3C File Offset: 0x0057ED3C
        private IEnumerator CheckNetwork()
        {
            if (SceneManager.Instance == null)
            {
                yield return(null);
            }
            for (;;)
            {
                if (Application.internetReachability == NetworkReachability.NotReachable)
                {
                    yield return(DialogBox.Show(this.m_mainCtrl.gameObject, "Assets/GameProject/Resources/UI/DialogBox.prefab", StringTable.Get("MsgCheckYourNetworkPlease"), StringTable.Get("ButtonOK"), string.Empty, null));
                }
                else
                {
                    Hostname2Ip[] h2is = new Hostname2Ip[]
                    {
                        new Hostname2Ip("www.baidu.com"),
                        new Hostname2Ip("www.qq.com"),
                        new Hostname2Ip("www.taobao.com"),
                        new Hostname2Ip("www.google.com"),
                        new Hostname2Ip("www.facebook.com")
                    };
                    float t = Time.unscaledTime + 5f;
                    yield return(new WaitUntil(delegate()
                    {
                        foreach (Hostname2Ip hostname2Ip2 in h2is)
                        {
                            if (hostname2Ip2.isDone && !string.IsNullOrEmpty(hostname2Ip2.ip))
                            {
                                return true;
                            }
                        }
                        return Time.unscaledTime > t;
                    }));

                    foreach (Hostname2Ip hostname2Ip in h2is)
                    {
                        hostname2Ip.Destroy();
                    }
                    if (Time.unscaledTime < t)
                    {
                        break;
                    }
                    yield return(DialogBox.Show(this.m_mainCtrl.gameObject, "Assets/GameProject/Resources/UI/DialogBox.prefab", StringTable.Get("MsgCheckYourNetworkPlease"), StringTable.Get("ButtonOK"), string.Empty, null));
                }
            }
            yield break;
        }
Esempio n. 45
0
 private static bool IsModuleConfigFileName(PathAtom fileName, StringTable stringTable)
 {
     return(ExtensionUtilities.IsModuleConfigurationFile(fileName.ToString(stringTable)));
 }
 // Token: 0x060159FA RID: 88570 RVA: 0x00580FEC File Offset: 0x0057F1EC
 protected override void OnStartAudioManagerStart()
 {
     this.m_mainCtrl.SetMesssage(StringTable.Get("MsgLoaingAudio"));
 }
Esempio n. 47
0
        public void RefreshLanguage()
        {
            TxbHeader.Text        = StringTable.GetInstance().GetString("STR_AAP_TITLE", iLang);
            TxbComment.Text       = StringTable.GetInstance().GetString("STR_AAP_COMMENT", iLang);
            TxbRegAssetTitle.Text = StringTable.GetInstance().GetString("STR_AAP_REG_ASSET_TITLE", iLang);
            TxbRegComment1.Text   = StringTable.GetInstance().GetString("STR_AAP_REG_COMMENT1", iLang);
            TxbRegComment2.Text   = StringTable.GetInstance().GetString("STR_AAP_REG_COMMENT2", iLang);

            fHAssetType.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_TYPE", iLang);
            fCAssetType.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_TYPE", iLang);

            fHAssetName.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_NAME", iLang);
            fCAssetName.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_NAME", iLang);
            TxbAssetName.Tag = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_NAME", iLang);

            fHAssetAmount.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_AMOUNT", iLang);
            fCAssetAmount.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_AMOUNT", iLang);
            TxbAssetAmount.Tag = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_AMOUNT", iLang);

            fHAssetPrecision.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_PRECISION", iLang);
            fCAssetPrecision.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_PRECISION", iLang);
            TxbAssetPrecision.Tag = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_PRECISION", iLang);

            fHAssetAFee.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_AFEE", iLang);
            fCAssetAFee.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_AFEE", iLang);
            TxbAssetAFee.Tag = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_AFEE", iLang);

            fHAssetTFeeMin.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_TFEE_MIN", iLang);
            fCAssetTFeeMin.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_TFEE_MIN", iLang);
            TxbAssetTFeeMin.Tag = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_TFEE_MIN", iLang);

            fHAssetTFeeMax.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_TFEE_MAX", iLang);
            fCAssetTFeeMax.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_TFEE_MAX", iLang);
            TxbAssetTFeeMax.Tag = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_TFEE_MAX", iLang);

            fHAssetFeeAddress.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_FEE_ADDRESS", iLang);
            fCAssetFeeAddress.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_FEE_ADDRESS", iLang);
            TxbAssetFeeAddress.Tag = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_FEE_ADDRESS", iLang);

            fHAssetOwner.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_OWNER", iLang);
            fCAssetOwner.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_OWNER", iLang);

            fHAssetAdmin.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_ADMIN", iLang);
            fCAssetAdmin.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_ADMIN", iLang);

            fHAssetIssuer.Text = StringTable.GetInstance().GetString("STR_AAP_FH_ASSET_ISSUER", iLang);
            fCAssetIssuer.Text = StringTable.GetInstance().GetString("STR_AAP_FC_ASSET_ISSUER", iLang);

            BtnMakeTransaction.Content = StringTable.GetInstance().GetString("STR_AAP_BTN_MAKE_TRANSACTION", iLang);

            tbMakeTxHeader.Text = StringTable.GetInstance().GetString("STR_AAP_HDR_MAKE_TX", iLang);

            tbTxScriptHashComment.Text = StringTable.GetInstance().GetString("STR_AAP_SCRIPT_HASH_COMMENT", iLang);
            TxbTxScriptHash.Tag        = StringTable.GetInstance().GetString("STR_AAP_SCRIPT_HASH_COMMENT", iLang);

            tbTxResult.Text = StringTable.GetInstance().GetString("STR_AAP_TX_RESULT_COMMENT", iLang);
            TxbTxResult.Tag = StringTable.GetInstance().GetString("STR_AAP_TX_RESULT_COMMENT", iLang);

            tbAssetID.Text = StringTable.GetInstance().GetString("STR_AAP_ASSET_ID", iLang);
            TxbAssetID.Tag = StringTable.GetInstance().GetString("STR_AAP_ASSET_ID", iLang);

            BtnLaunch.Content = StringTable.GetInstance().GetString("STR_AAP_BTN_LAUNCH", iLang);

            ChkNoLimit.Content = StringTable.GetInstance().GetString("STR_AAP_NO_LIMIT", iLang);
            txbFee.Text        = String.Format(StringTable.GetInstance().GetString("STR_SMART_CONTRACT_FEE", iLang), currentFee.ToString());

            TxbIssueAssetTitle.Text    = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_TITLE", iLang);
            TxbIssueAssetComment1.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_COMMENT", iLang);
            TxbIssueAssetComment2.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_COMMENT1", iLang);

            fHIssueAssetID.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_ID", iLang);
            fCIssueAssetID.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_ID_COMMENT", iLang);
            TxbIssueAssetID.Tag = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_ID", iLang);

            fhIssueAssetName.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_NAME", iLang);
            fCIssueAssetName.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_NAME_COMMENT", iLang);
            TxbIssueAssetName.Tag = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_NAME", iLang);

            fhIssueAssetIssued.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_ISSUED", iLang);
            fCIssueAssetIssued.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_ISSUED_COMMENT", iLang);
            TxbIssueAssetIssued.Tag = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_ISSUED", iLang);

            fhIssueAssetPrecision.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_PRECISION", iLang);
            fCIssueAssetPrecision.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_PRECISION_COMMENT", iLang);
            TxbIssueAssetPrecision.Tag = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_PRECISION", iLang);

            fhIssueAssetAdmin.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_ADMIN", iLang);
            fCIssueAssetAdmin.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_ADMIN_COMMENT", iLang);
            TxbIssueAssetAdmin.Tag = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_ADMIN", iLang);

            fhIssueAssetOwner.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_OWNER", iLang);
            fCIssueAssetOwner.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_OWNER_COMMENT", iLang);
            TxbIssueAssetOwner.Tag = StringTable.GetInstance().GetString("STR_AAP_ISSUE_ASSET_OWNER", iLang);

            BtnMakeOutput.Content = StringTable.GetInstance().GetString("STR_AAP_ISSUE_BTN_MAKE_OUTPUT", iLang);

            tbIssueMakeTxHeader.Text = StringTable.GetInstance().GetString("STR_AAP_ISSUE_MAKE_TX_HEADER", iLang);

            tbIssueTxResult.Text   = StringTable.GetInstance().GetString("STR_AAP_ISSUE_TX_RESULT", iLang);
            TxbIssueTxResult.Tag   = StringTable.GetInstance().GetString("STR_AAP_ISSUE_TX_RESULT", iLang);
            txbIssueFee.Text       = String.Format(StringTable.GetInstance().GetString("STR_SMART_CONTRACT_FEE", iLang), currentFee.ToString());
            BtnIssueLaunch.Content = StringTable.GetInstance().GetString("STR_AAP_BTN_LAUNCH", iLang);
        }
Esempio n. 48
0
 protected override string UpdateText()
 {
     return(StringTable.GetInstance().GetWord(key) + Hero.GetInstance().Life);
 }
 // Token: 0x060159FB RID: 88571 RVA: 0x00581004 File Offset: 0x0057F204
 protected override void OnStartAudioManagerEnd(bool ret)
 {
     if (!ret)
     {
         this.m_mainCtrl.StartCoroutine(DialogBox.Show(this.m_mainCtrl.gameObject, "Assets/GameProject/Resources/UI/DialogBox.prefab", StringTable.Get("MsgLoadAudioFailed"), StringTable.Get("ButtonOK"), string.Empty, delegate(DialogBoxResult result)
         {
             Application.Quit();
         }));
         return;
     }
     this.m_mainCtrl.AddProgress(0.04f, 1f);
 }
Esempio n. 50
0
        private void BtnLaunch_Click(object sender, RoutedEventArgs e)
        {
            bool ret = false;

            using (AlertDialog dlg = new AlertDialog(Application.Current.MainWindow, StringTable.GetInstance().GetString("STR_ALERT_DLG_TITLE", iLang), StringTable.GetInstance().GetString("STR_ADD_ASSET_DEPLOY", iLang)))
            {
                ret = (bool)dlg.ShowDialog();
            }

            if (ret == false)
            {
                return;
            }
            try
            {
                Fixed8 fee = tx.Gas.Equals(Fixed8.Zero) ? net_fee : Fixed8.Zero;
                InvocationTransaction finalTx = Constant.CurrentWallet.MakeTransaction(new InvocationTransaction
                {
                    Version    = tx.Version,
                    Script     = tx.Script,
                    Gas        = tx.Gas,
                    Attributes = tx.Attributes,
                    Inputs     = tx.Inputs,
                    Outputs    = tx.Outputs
                }, fee: fee);

                if (finalTx == null)
                {
                    StaticUtils.ShowMessageBox(StaticUtils.ErrorBrush, StringTable.GetInstance().GetString("STR_ERR_TX_INSUFFICIENTFUND", iLang));
                    return;
                }

                Global.Helper.SignAndShowInformation(finalTx);
                StaticUtils.ShowMessageBox(StaticUtils.GreenBrush, StringTable.GetInstance().GetString("STR_SUC_TX_SUCCESSED", iLang));
                TxbAssetID.Text = finalTx.Hash.ToString();
            }
            catch (Exception)
            {
                StaticUtils.ShowMessageBox(StaticUtils.ErrorBrush, StringTable.GetInstance().GetString("STR_ERR_INCOMPLETEDSIGNATUREMESSAGE", iLang));
            }
        }
 // Token: 0x060159F9 RID: 88569 RVA: 0x00580F5C File Offset: 0x0057F15C
 protected override void OnLoadConfigDataEnd(bool ret)
 {
     Utility.LogMemorySize("ProjectLGameEntryUITask.OnLoadConfigDataEnd");
     this.m_isUpdateLoadConfigProgress = false;
     if (!ret)
     {
         this.m_mainCtrl.StartCoroutine(DialogBox.Show(this.m_mainCtrl.gameObject, "Assets/GameProject/Resources/UI/DialogBox.prefab", StringTable.Get("MsgLoadConfigFailed"), StringTable.Get("ButtonOK"), string.Empty, delegate(DialogBoxResult result)
         {
             Application.Quit();
         }));
         return;
     }
     PDSDK.Instance.printGameEventLog("19", string.Empty);
 }
 protected internal override void PostProcess(VoidPtr mdlAddress, VoidPtr dataAddress, StringTable stringTable)
 {
     MDL0FurPosData* header = (MDL0FurPosData*)dataAddress;
     header->_mdl0Offset = (int)mdlAddress - (int)dataAddress;
     header->_stringOffset = (int)stringTable[Name] + 4 - (int)dataAddress;
     header->_index = Index;
 }
 // Token: 0x060159F6 RID: 88566 RVA: 0x00580E84 File Offset: 0x0057F084
 protected override void OnStartLuaManagerStart()
 {
     this.m_mainCtrl.SetMesssage(StringTable.Get("MsgLoadingScripts"));
 }
Esempio n. 54
0
 public void Add(Language language, StringTable stringTable)
 {
     stringTable.ResourceChanged += new EventHandler(OnResourceChanged);
     _stringTables.Add(language, stringTable);
     foreach (KeyValuePair<ulong, string> kvp in stringTable)
         this[kvp.Key, stringTable.Language] = kvp.Value;
 }
        // Token: 0x060159F5 RID: 88565 RVA: 0x00580DF0 File Offset: 0x0057EFF0
        protected override void OnLoadDynamicAssemblysEnd(bool ret)
        {
            if (!ret)
            {
                this.m_mainCtrl.StartCoroutine(DialogBox.Show(this.m_mainCtrl.gameObject, "Assets/GameProject/Resources/UI/DialogBox.prefab", StringTable.Get("MsgLoadProgramFailed"), StringTable.Get("ButtonOK"), string.Empty, delegate(DialogBoxResult result)
                {
                    Application.Quit();
                }));
                return;
            }
            ProjectLGameManager projectLGameManager = GameManager.Instance as ProjectLGameManager;

            if (projectLGameManager == null)
            {
                return;
            }
            if (!projectLGameManager.InitLogicInterface())
            {
                global::Debug.LogError("ProjectLGameEntryUITask.OnLoadDynamicAssemblysEnd ProjectLGameManager.InitLogicInterface failed.");
                return;
            }
        }
Esempio n. 56
0
 protected abstract void AssertPipGraphContent(PipGraph pipGraph, SimpleGraph file2file, StringTable stringTable);
 // Token: 0x060159F4 RID: 88564 RVA: 0x00580DD8 File Offset: 0x0057EFD8
 protected override void OnLoadDynamicAssemblysStart()
 {
     this.m_mainCtrl.SetMesssage(StringTable.Get("MsgLoadingProgram"));
 }
Esempio n. 58
0
 private static StringTable GetStringTable(Project project)
 => s_projectStringTable.GetValue(project, _ => StringTable.GetInstance());
Esempio n. 59
0
        /// <summary>
        /// Creates a qualifier from a given input qualifier such that the resulting qualifier respects this qualifier space.
        /// </summary>
        internal bool TryCreateQualifierForQualifierSpace(
            StringTable stringTable,
            PathTable pathTable,
            LoggingContext loggingContext,
            Qualifier currentQualifier,
            out Qualifier qualifier,
            out UnsupportedQualifierValue error,
            bool useDefaults)
        {
            Contract.RequiresNotNull(stringTable);
            Contract.RequiresNotNull(pathTable);
            Contract.RequiresNotNull(loggingContext);

            StringId[] keys;
            StringId[] values;
            currentQualifier.GetInternalKeyValueArrays(out keys, out values);

            var targetKeys   = new StringId[m_keys.Length];
            var targetValues = new StringId[m_keys.Length];

            int qIndex = 0;
            int sIndex = 0;

            while (sIndex < m_keys.Length)
            {
                var sKey = m_keys[sIndex];

                if (qIndex < keys.Length && keys[qIndex] == sKey)
                {
                    var qValue = values[qIndex];
                    if (m_valueValues[sIndex].Contains(qValue))
                    {
                        targetKeys[sIndex]   = keys[qIndex];
                        targetValues[sIndex] = qValue;

                        qIndex++;
                        sIndex++;
                    }
                    else
                    {
                        error = new UnsupportedQualifierValue
                        {
                            QualifierKey = sKey.ToString(stringTable),
                            InvalidValue = qValue.ToString(stringTable),
                            LegalValues  = string.Join(", ", m_valueValues[sIndex].Select(id => id.ToString(stringTable))),
                        };

                        qualifier = Qualifier.Empty;
                        return(false);
                    }
                }
                else
                {
                    // Check if we have any key from the currentQualifier left. If not, we'll 'trick' the compare below be a 'missing'
                    // value we can treat it to insert the default value for the remaining space keys
                    var compare = qIndex < keys.Length ? stringTable.OrdinalComparer.Compare(keys[qIndex], sKey) : 1;
                    Contract.Assume(compare != 0, "expected above equals to handle that case");

                    if (compare < 0)
                    {
                        // Given that the lists are sorted and the qualifier key is less than the space key, it means that key is not in the target space.
                        // so we can skip it.
                        qIndex++;
                    }
                    else
                    {
                        if (useDefaults == false)
                        {
                            qualifier = Qualifier.Empty;

                            // var lineInfo = location.Value.ToLogLocation(pathTable);
                            // TODO: Consider adding a more specific exception for the no defaults case
                            error = new UnsupportedQualifierValue
                            {
                                // Location = lineInfo,
                                QualifierKey = sKey.ToString(stringTable),
                                InvalidValue = string.Empty,
                                LegalValues  = string.Join(", ", m_valueValues[sIndex].Select(id => id.ToString(stringTable))),
                            };

                            return(false);
                        }

                        // It is larger, so we need to add the default value of the space to the target if enabled.
                        targetKeys[sIndex]   = sKey;
                        targetValues[sIndex] = m_defaults[sIndex];

                        sIndex++;
                    }
                }
            }

            qualifier = new Qualifier(targetKeys, targetValues);
            error     = default(UnsupportedQualifierValue);

            return(true);
        }
Esempio n. 60
0
        protected internal override void PostProcess(VoidPtr mdlAddress, VoidPtr dataAddress, StringTable stringTable)
        {
            MDL0Polygon *header = (MDL0Polygon *)dataAddress;

            header->_mdl0Offset   = (int)mdlAddress - (int)dataAddress;
            header->_stringOffset = (int)stringTable[Name] + 4 - (int)dataAddress;
        }