Пример #1
0
        /// <summary>
        /// Creates a new GSA file. Email address and server address is needed for logging purposes.
        /// </summary>
        /// <param name="emailAddress">User email address</param>
        /// <param name="serverAddress">Speckle server address</param>
        public void NewFile(bool showWindow = true, object gsaInstance = null)
        {
            ExecuteWithLock(() =>
            {
                if (GSAObject != null)
                {
                    try
                    {
                        GSAObject.Close();
                    }
                    catch { }
                    GSAObject = null;
                }

                GSAObject = (IComAuto)gsaInstance ?? new ComAuto();

                GSAObject.LogFeatureUsage("api::specklegsa::" +
                                          FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location)
                                          .ProductVersion + "::GSA " + GSAObject.VersionString()
                                          .Split(new char[] { '\n' })[0]
                                          .Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries)[1]);

                GSAObject.NewFile();
                GSAObject.SetLocale(Locale.LOC_EN_GB);
                if (showWindow)
                {
                    GSAObject.DisplayGsaWindow(true);
                }
            });
        }
Пример #2
0
        public void SendTelemetry(params string[] messagePortions)
        {
            var finalMessagePortions = new List <string> {
                "SpeckleGSA", SpeckleGsaVersion, GSAObject.VersionString()
            };

            finalMessagePortions.AddRange(messagePortions);
            var message = string.Join("::", finalMessagePortions);

            GSAObject.LogFeatureUsage(message);
        }
Пример #3
0
        /// <summary>
        /// Opens an existing GSA file. Email address and server address is needed for logging purposes.
        /// </summary>
        /// <param name="path">Absolute path to GSA file</param>
        /// <param name="emailAddress">User email address</param>
        /// <param name="serverAddress">Speckle server address</param>
        public bool OpenFile(string path, bool showWindow = true, object gsaInstance = null)
        {
            if (!File.Exists(path))
            {
                return(false);
            }
            ExecuteWithLock(() =>
            {
                if (GSAObject != null)
                {
                    try
                    {
                        GSAObject.Close();
                    }
                    catch { }
                    GSAObject = null;
                }

                GSAObject = (IComAuto)gsaInstance ?? new ComAuto();

                GSAObject.LogFeatureUsage("api::specklegsa::" +
                                          FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location)
                                          .ProductVersion + "::GSA " + GSAObject.VersionString()
                                          .Split(new char[] { '\n' })[0]
                                          .Split(new char[] { GwaDelimiter }, StringSplitOptions.RemoveEmptyEntries)[1]);

                GSAObject.Open(path);
                FilePath = path;
                GSAObject.SetLocale(Locale.LOC_EN_GB);

                if (showWindow)
                {
                    GSAObject.DisplayGsaWindow(true);
                }
            });
            return(true);
        }