Ejemplo n.º 1
0
        /// <summary>
        /// Splits the split again but by } and determines to start over the stringbuilder or to continue it
        /// </summary>
        /// <param name="sb">The current gdfs stringbuilder</param>
        /// <param name="i">the line in the gdf</param>
        /// <param name="fileName">The name of the gdt to add to the gdf property</param>
        private StringBuilder SeperateGDT(StringBuilder sb, string i, string fileName)
        {
            if (i.Contains("}"))
            {
                string[] lsplit = i.Split('}');
                sb.AppendLine(lsplit[0]);
                GDF mgdf = new GDF();

                //mgdf.PassBackMessage = ReportCurrentMessage;//background worker stuff taken out
                //Console.WriteLine(sb.ToString());
                if (MessageBar != null)
                {
                    try
                    {
                        MessageBar(sb.ToString().Trim().Split('\n')[0].Split('\"')[1]);
                    }
                    catch
                    {
                        //either the length wasn't long enough, or didn't include new line or "
                    }
                }
                mgdf.GatherGDFS(sb.ToString(), fileName);
                this.gdfs.Add(mgdf);

                sb = new StringBuilder();
                sb.AppendLine(lsplit[1]);
                return(sb);
            }
            sb.AppendLine(i);
            return(sb);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a prefix to the name and if inherited adds to the inheritied name
 /// </summary>
 /// <param name="gdf">GDF object</param>
 /// <param name="prefix">String to add as prefix</param>
 /// <param name="duplicate">If it is already prefixed, do you want to duplicate it?</param>
 public static void AddPrefixToName(GDF gdf, string prefix, bool duplicate = false)
 {
     gdf.Name = AddToNameOrType(gdf.Name.StartsWith(prefix), duplicate, gdf.Name, prefix);
     if (gdf.inherited)
     {
         gdf.Type = AddToNameOrType(gdf.Type.StartsWith(prefix), duplicate, gdf.Type, prefix);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds a suffix to the name and if inherited adds to the inheritied name
        /// </summary>
        /// <param name="gdf">GDF object</param>
        /// <param name="suffix">String to add as suffix</param>
        /// <param name="duplicate">If it is already prefixed, do you want to duplicate it?</param>
        public static void AddSuffixToName(GDF gdf, string suffix, bool duplicate = false)
        {
            gdf.Name = AddToNameOrType(gdf.Name.EndsWith(suffix), duplicate, gdf.Name, "", suffix);

            if (gdf.inherited)
            {
                gdf.Type = AddToNameOrType(gdf.Type.StartsWith(suffix), duplicate, gdf.Type, "", suffix);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Pass a gdf object to get name and type string
 /// </summary>
 /// <param name="g">GDF object</param>
 /// <returns></returns>
 public static string AssetNameAndType(GDF g)
 {
     return(AssetNameAndType(g.Name, g.Type, g.inherited));
 }