Example #1
0
        private static List <DbDataSource> ReadDataSourcesFromXml(ASVersion version)
        {
            var pathbuilder = new PathBuilder(version);
            var doc         = new XmlDocument();
            var filename    = pathbuilder.ConfigPath;

            if (Utils.IsRevit(version))
            {
                filename = @"C:\ProgramData\Autodesk\Revit Steel Connections 2020\pl-PL\DatabaseConfiguration.xml";
            }

            doc.Load(filename);

            var _datasources = new List <DbDataSource>();
            var nodes        = doc.DocumentElement.SelectNodes("/AdvanceSteel/DataSource");

            foreach (XmlNode node in nodes)
            {
                _datasources.Add(new DbDataSource
                {
                    Name  = node.Attributes["Name"].Value,
                    Value = node.Attributes["Value"].Value
                });
            }
            return(_datasources);
        }
        public SFInitParams2(int dummy)
        {
            TheASVersion              = ASVersion.AS3;
            InitVideo              = false;
            InitSound              = true;
            TheVideoSoundSystem       = VideoSoundSystem.SystemSound;
            IsInitIME                = false;
            IsProgLoading     = EnableAmpProfiling.Yes;
            IsSetFontCacheParams     = true;
            IsEnableDynamicCache     = true;
            SetFontPackParams      = true;
            IsInitIME                = false;
            ProgLoading            = EnableProgressiveLoading.Yes;

            TheFontCacheConfig.TextureHeight      = 1024;
            TheFontCacheConfig.TextureWidth       = 1024;
            TheFontCacheConfig.MaxNumTextures     = 1;
            TheFontCacheConfig.MaxSlotHeight      = 48;

            TheFontPackParams.NominalSize     = 32;
            TheFontPackParams.PadPixels       = 2;
            TheFontPackParams.TextureWidth    = 512;
            TheFontPackParams.TextureHeight   = 512;

            SetFontPackParams      = true;
            GlyphCountLimit        = 1000;
            SoundVolume             = 10;
            IsMute                  = false;
            Sentinal                = SFSentinal.Sentinal;
        }
Example #3
0
 public static ZDbConfig ReadCurrent(ASVersion version)
 {
     try
     {
         var config = new ZDbConfig
         {
             Version = version,
             Name    = "Current config for AS" + version.ToString(),
         };
         if (Utils.IsRevit(version))
         {
             config.Name = "Current config for RVT" + Utils.RevitVersion(version).ToString();
         }
         if (!Utils.IsRevit(version))
         {
             config.SupportDirIsLink = NativeMethods.IsSymbolicLink(config.PathBuilder.SupportPath);
             config.SupportDirLink   = NativeMethods.NormalizePath(NativeMethods.GetFinalPathName(config.PathBuilder.SupportPath));
         }
         config.DataSources = ReadDataSourcesFromXml(version);
         return(config);
     }
     catch (Win32Exception)
     {
         return(null);
     }
 }
Example #4
0
        void  AstoolCli_Main(object genericArgs)
        {
            string[] args = (string[])genericArgs;
            // HACK : reusings Main from CLI for first tests

            int Version = ASVersion.SetVersion(0x01, 0x00, 0x00, 0x00);

            Options opt = Options.InitializeOptions(args);

            if (opt == null)
            {
                Options o = new Options();
                o.LogInformation("ASTool: Internal Error");
                return;
            }
            List <Options> list = new List <Options>();

            list.Add(opt);


            if (list == null)
            {
                ServiceEventSource.Current.ServiceMessage(this.Context, "ASTool: Internal Error : empty parameter list");
                return;
            }

            foreach (Options option in list)
            {
                if (option.ASToolAction == Options.Action.PullPush)
                {
                    mainTask = ASTool.Core.ASToolEngine.PullPush(option);
                    //OptionsLauncher.LaunchThread(ASTool.Core.ASToolEngine.PullPush, option);
                }
            }

            //bool bCompleted = false;
            //while (bCompleted == false)
            //{
            //    int StoppedThreadCounter = 0;
            //    foreach (Options option in list)
            //    {
            //        if (option.Status == Options.TheadStatus.Stopped)
            //        {
            //            StoppedThreadCounter++;
            //        }
            //        else
            //        {
            //            if ((DateTime.Now - option.ThreadCounterTime).TotalSeconds > option.CounterPeriod)
            //            {
            //                option.ThreadCounterTime = DateTime.Now;
            //                option.LogInformation("\r\nCounters for feature : " + option.ASToolAction.ToString() + " " + option.Name + "\r\n" + option.GetCountersInformation());
            //            }
            //        }
            //    }
            //    if (StoppedThreadCounter == list.Count)
            //        bCompleted = true;
            //}
        }
 public static string VersionString(ASVersion version)
 {
     if ((int)version < 3000)
     {
         return("Advance Steel " + ((int)version).ToString());
     }
     else
     {
         return("Revit " + ((int)version - 90000).ToString());
     }
 }
        //private static readonly NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();

        #endregion Private Fields

        #region Public Constructors

        public DbSwitcherControl(ASVersion version)
        {
            InitializeComponent();

            ConfigChanged += SetBtnStyles;

            Version    = version;
            WorkingDir = AppDomain.CurrentDomain.BaseDirectory;

            ConfigEntries = ZConfigEntry.GetEntries(ConfigDir, Version);

            ComposeUI();
        }
        public static List <ZConfigEntry> GetEntries(string dirpath, ASVersion version)
        {
            var    files = Directory.GetFiles(dirpath);
            string pattern;
            string verstr;

            if ((int)version < 3000)
            {
                verstr  = "AS" + ((int)version).ToString();
                pattern = "(?<asversion>" + verstr + ")_(?<name>[A-Za-z_-]+).config.json$";
            }
            else
            {
                verstr  = "RVT" + ((int)version - 90000).ToString();
                pattern = "(?<asversion>" + verstr + ")_(?<name>[A-Za-z_-]+).config.json$";
            }

            var result = new List <ZConfigEntry>();

            foreach (var filename in files)
            {
                var match = Regex.Match(filename, pattern);
                if (match.Success)
                {
                    var          jsonstr = File.ReadAllText(filename);
                    ZConfigEntry entry   = new ZConfigEntry
                    {
                        Version  = version,
                        FileName = filename,
                        Name     = Path.GetFileNameWithoutExtension(filename),
                        Config   = ZDbConfig.Deserialize(jsonstr)
                    };
                    result.Add(entry);
                }
            }

            return(result);
        }
        public SFInitParams2(SFInitParams initParams)
        {
            TheASVersion    = (ASVersion)initParams.TheASVersion;
            InitVideo    = initParams.InitVideo;
            InitSound    = initParams.InitSound;
            TheVideoSoundSystem       = (VideoSoundSystem) initParams.TheVideoSoundSystem;
            IsInitIME                = initParams.IsInitIME;
            IsProgLoading     = (EnableAmpProfiling) initParams.IsProgLoading;
            IsSetFontCacheParams     = initParams.SetFontCacheParams;
            IsEnableDynamicCache     = initParams.IsEnableDynamicCache;
            SetFontPackParams      = initParams.SetFontPackParams;
            IsInitIME                = initParams.IsInitIME;
            ProgLoading            = (EnableProgressiveLoading) initParams.ProgLoading;

            TheFontCacheConfig.TextureHeight      = initParams.TheFontCacheConfig.TextureHeight;
            TheFontCacheConfig.TextureWidth       = initParams.TheFontCacheConfig.TextureWidth;
            TheFontCacheConfig.MaxNumTextures     = initParams.TheFontCacheConfig.MaxNumTextures;
            TheFontCacheConfig.MaxSlotHeight      = initParams.TheFontCacheConfig.MaxSlotHeight;

            TheFontPackParams.NominalSize         = initParams.TheFontPackParams.NominalSize;
            TheFontPackParams.PadPixels           = initParams.TheFontPackParams.PadPixels;
            TheFontPackParams.TextureWidth        = initParams.TheFontPackParams.TextureWidth;
            TheFontPackParams.TextureHeight       = initParams.TheFontPackParams.TextureHeight;

            SetFontPackParams      = initParams.SetFontCacheParams;
            GlyphCountLimit        = initParams.GlyphCountLimit;
            SoundVolume             = initParams.SoundVolume;
            IsMute                  = initParams.IsMute;
            Sentinal                = SFSentinal.Sentinal;
        }
Example #9
0
 /// <summary>
 /// Konstruktor wymaga wersji AS dla ktorej beda budowoane sciezki
 /// </summary>
 /// <param name="version"></param>
 public PathBuilder(ASVersion version)
 {
     Version = version;
 }
Example #10
0
 public static int RevitVersion(ASVersion version)
 {
     return((int)version - 90000);
 }
Example #11
0
 public static bool IsRevit(ASVersion version)
 {
     return((int)version > 3000);
 }