Пример #1
0
 public GrblConf(GrblVersionInfo GrblVersion, Dictionary <int, decimal> configTable)
     : this(GrblVersion)
 {
     foreach (KeyValuePair <int, decimal> kvp in configTable)
     {
         mData.Add(kvp.Key, kvp.Value);
     }
 }
Пример #2
0
        private void UpdateAndSend(GrblCore Core)
        {
            //invia i dati solo almeno ad un giorno di distanza o al cambio version/grblversion
            Version current  = typeof(GitHub).Assembly.GetName().Version;
            bool    mustsend = DateTime.UtcNow.Subtract(LastSent).TotalDays > 1 || Version != current || (Core.Configuration.GrblVersion != null && GrblVersion != Core.Configuration.GrblVersion);

            Version     = current;
            GrblVersion = Core.Configuration.GrblVersion != null ? Core.Configuration.GrblVersion : GrblVersion;
            Locale      = System.Threading.Thread.CurrentThread.CurrentCulture.LCID;
            UiLang      = System.Threading.Thread.CurrentThread.CurrentUICulture.LCID;

            if (UsageTime < TimeSpan.Zero)
            {
                UsageTime = TimeSpan.Zero;                                     //fix wrong values
            }
            if (Tools.TimingBase.TimeFromApplicationStartup() > TimeSpan.Zero) //prevent wrong values
            {
                UsageTime = UsageTime.Add(Tools.TimingBase.TimeFromApplicationStartup());
            }

            Wrapper = Settings.GetObject("ComWrapper Protocol", ComWrapper.WrapperType.UsbSerial);

            LaserGRBL.Firmware fw = Settings.GetObject("Firmware Type", LaserGRBL.Firmware.Grbl);
            if (fw == LaserGRBL.Firmware.Grbl && Core.IsOrturBoard)
            {
                FirmwareString = "Ortur";
            }
            else
            {
                FirmwareString = fw.ToString();
            }

            if (Counters == null)
            {
                Counters = new UsageCounters();
            }
            Counters.Update(Core.UsageCounters);

            if (mustsend)
            {
                try
                {
                    if (TrueSend())
                    {
                        LastSent = DateTime.UtcNow;
                    }
                }
                catch (Exception)
                {
                }
            }
        }
        public int CompareTo(Object version)
        {
            if (version == null)
            {
                return(1);
            }

            GrblVersionInfo v = version as GrblVersionInfo;

            if (v == null)
            {
                throw new ArgumentException("Argument must be GrblVersionInfo");
            }

            if (this.mMajor != v.mMajor)
            {
                if (this.mMajor > v.mMajor)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }

            if (this.mMinor != v.mMinor)
            {
                if (this.mMinor > v.mMinor)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }

            if (this.mBuild != v.mBuild)
            {
                if (this.mBuild > v.mBuild)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }

            return(0);
        }
Пример #4
0
        public static void LoadAppropriateSettings(GrblVersionInfo value)
        {
            try
            {
                string ResourceName;
                if (value.IsOrtur)
                {
                    ResourceName = String.Format("LaserGRBL.CSV.setting_codes.ortur.v1.0.csv");
                }
                else
                {
                    ResourceName = String.Format("LaserGRBL.CSV.setting_codes.v{0}.{1}.csv", value.Major, value.Minor);
                }


                Settings = new CsvDictionary(ResourceName, 3);
            }
            catch { }
        }
Пример #5
0
 public GrblConf(GrblVersionInfo GrblVersion)
     : this()
 {
     mVersion = GrblVersion;
 }
        public override bool Equals(object obj)
        {
            GrblVersionInfo v = obj as GrblVersionInfo;

            return(v != null && this.mMajor == v.mMajor && this.mMinor == v.mMinor && this.mBuild == v.mBuild && this.mOrtur == v.mOrtur);
        }