Esempio n. 1
0
        /// <summary>
        /// Store the selected options into a <see cref="VMTProperties"/> class
        /// </summary>
        /// <returns></returns>
        private VMTProperties GetVMTData()
        {
            VMTProperties vmt = new VMTProperties
            {
                Shader         = GetShader(),
                BaseTexture    = GetBaseTexture(),
                ParametersList = GetParameters()
            };

            return(vmt);
        }
Esempio n. 2
0
 /// <summary>
 /// Event Handler for the Preview Button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PreviewButton_Click(object sender, RoutedEventArgs e)
 {
     if (VTF_ListBox.Items.Count > 0) // Atleast 1 VTF loaded
     {
         VMTProperties vmt   = GetVMTData();
         int           index = VTF_ListBox.SelectedIndex;
         if (index == -1) // No VTF selected
         {
             index = 0;
         }
         string vtfFile = (string)((ListBoxItem)VTF_ListBox.Items.GetItemAt(index)).Content;
         string vtfName = System.IO.Path.GetFileNameWithoutExtension(vtfFile);
         Preview_Box.Text = VMTUtils.GetVMTString(vmt, vtfName);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Returns the VMT string for the given VMT properties and VTF name
        /// </summary>
        /// <param name="vmt">VMT data</param>
        /// <param name="vtfName">VTF name</param>
        /// <returns>The VMT content</returns>
        public static string GetVMTString(VMTProperties vmt, string vtfName)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(GetKeyLine(vmt.Shader));
            sb.AppendLine(GetLine(CurlyBracketOpen));
            string vtfPath = vmt.BaseTexture + vtfName;

            sb.AppendLine(GetKeyValueLine(KeyBaseTexture, vtfPath, DefaultIndent));
            foreach (KeyValuePair <string, string> item in vmt.ParametersList)
            {
                sb.AppendLine(GetKeyValueLine(item.Key, item.Value, DefaultIndent));
            }
            sb.Append(GetLine(CurlyBracketClose));
            return(sb.ToString());
        }