Reference Article http://www.codeproject.com/KB/tips/SerializedObjectCloner.aspx Provides a method for performing a deep copy of an object. Binary Serialization is used to perform the copy.
        private static void ApplyCoinInformationToViewModel(List <CoinInformation> coinInformationModels, string coinSymbol, DeviceViewModel deviceViewModel)
        {
            CoinInformation coinInformationModel = coinInformationModels.SingleOrDefault(c => c.Symbol.Equals(coinSymbol, StringComparison.OrdinalIgnoreCase));

            if (coinInformationModel != null)
            {
                ObjectCopier.CopyObject(coinInformationModel, deviceViewModel, "Name", "Exchange");
            }
        }
        public void OnCloningAttrTest()
        {
            var src  = new ByRefClass();
            var copy = ObjectCopier.Clone(src, null);

            Assert.NotNull(copy);
            Assert.AreEqual(src.GetHashCode(), copy.GetHashCode());
            Assert.AreEqual(src.member.GetHashCode(), copy.member.GetHashCode());
        }
Example #3
0
        public void Copy()
        {
            var o    = new ObjectForObjectCopierTest(1, "foo");
            var copy = (ObjectForObjectCopierTest)ObjectCopier.Copy(o, commandAssembly);

            Assert.AreNotSame(o, copy);
            Assert.AreEqual(o.X, copy.X);
            Assert.AreEqual(o.Y, copy.Y);
        }
Example #4
0
        public MinerSettingsForm(MultiMiner.Engine.Data.Configuration.Xgminer minerConfiguration, Application applicationConfiguration)
        {
            InitializeComponent();
            this.minerConfiguration        = minerConfiguration;
            this.workingMinerConfiguration = ObjectCopier.CloneObject <MultiMiner.Engine.Data.Configuration.Xgminer, MultiMiner.Engine.Data.Configuration.Xgminer>(minerConfiguration);

            this.applicationConfiguration        = applicationConfiguration;
            this.workingApplicationConfiguration = ObjectCopier.CloneObject <Application, Application>(applicationConfiguration);
        }
        public Transformer Fit(FeatureVector featureVector)
        {
            var vector = ObjectCopier.Clone(featureVector);

            Shuffle(vector);
            FeatureVector[] folds        = Partition(vector);
            Transformer[]   transformers = GetTransformersAndAccuracy(folds);
            return(new CrossValidatorModel(transformers));
        }
        public static Remoting.Data.Transfer.Configuration.Application ToTransferObject(this Data.Configuration.Application modelObject)
        {
            Remoting.Data.Transfer.Configuration.Application transferObject = new Remoting.Data.Transfer.Configuration.Application();

            ObjectCopier.CopyObject(modelObject, transferObject, "HiddenColumns");
            transferObject.HiddenColumns = modelObject.HiddenColumns.ToArray();

            return(transferObject);
        }
Example #7
0
        public AdvancedSettingsForm(XgminerConfiguration minerConfiguration, ApplicationConfiguration applicationConfiguration)
        {
            InitializeComponent();
            this.minerConfiguration        = minerConfiguration;
            this.workingMinerConfiguration = ObjectCopier.CloneObject <XgminerConfiguration, XgminerConfiguration>(minerConfiguration);

            this.applicationConfiguration        = applicationConfiguration;
            this.workingApplicationConfiguration = ObjectCopier.CloneObject <ApplicationConfiguration, ApplicationConfiguration>(applicationConfiguration);
        }
        public static Data.Configuration.Application ToModelObject(this Remoting.Data.Transfer.Configuration.Application transferObject)
        {
            Data.Configuration.Application modelObject = new Data.Configuration.Application();

            ObjectCopier.CopyObject(transferObject, modelObject, "HiddenColumns");
            modelObject.HiddenColumns = transferObject.HiddenColumns.ToList();

            return(modelObject);
        }
Example #9
0
        public NumberProvider(NumberProvider originalNumberProvider)
        {
            ListsOfUnorderedNumbers       = ObjectCopier.Clone(originalNumberProvider.ListsOfUnorderedNumbers);
            ArraysOfUnorderedNumbers      = ObjectCopier.Clone(originalNumberProvider.ArraysOfUnorderedNumbers);
            LinkedListsOfUnorderedNumbers = ObjectCopier.Clone(originalNumberProvider.LinkedListsOfUnorderedNumbers);

            ListsOfOrderedNumbers       = ObjectCopier.Clone(originalNumberProvider.ListsOfOrderedNumbers);
            ArraysOfOrderedNumbers      = ObjectCopier.Clone(originalNumberProvider.ArraysOfOrderedNumbers);
            LinkedListsOfOrderedNumbers = ObjectCopier.Clone(originalNumberProvider.LinkedListsOfOrderedNumbers);
        }
        public ObjectCopierTests()
        {
            fieldCache = new Mock<IFieldCache>();
            fieldCache.Setup(c => c.GetFields(It.IsAny<Type>())).Returns((Type t) => t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField | BindingFlags.SetField).Where(field => !field.IsInitOnly));

            propertyCache = new Mock<IPropertyCache>();
            propertyCache.Setup(c => c.GetProperties(It.IsAny<Type>())).Returns((Type t) => t.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.SetProperty).Where(property => property.CanRead && property.CanWrite));

            copier = new ObjectCopier(fieldCache.Object, propertyCache.Object);
        }
Example #11
0
        private void ButtonDuplicateSettings_Click(object sender, RoutedEventArgs e)
        {
            var newSettings = ObjectCopier.Clone(settingsArray.GetSelectedSettings());

            settingsArray.SettingsList.Add(newSettings);
            settingsArray.SelectedSettingsIndex = settingsArray.SettingsList.IndexOf(newSettings);

            DteHelper.ShowInfo("The profile chosen has been duplicated, and the duplicate is now the " +
                               "selected profile.", "Profile duplicated!");
        }
Example #12
0
 /// <summary>
 /// 修改变量属性
 /// </summary>
 /// <param name="variable">修改前变量</param>
 /// <param name="newVariable">修改后变量</param>
 /// <returns>修改后的变量,修改失败返回null</returns>
 public virtual VariableBase EditVariable(VariableBase variable, VariableBase newVariable)
 {
     if (variable.Name != newVariable.Name && IsExistName(newVariable.Name, variable.ParentGroup))
     {
         throw new Exception(Resource1.VariableUnitOfWork_EditVariable_AvarialeNameExist);
     }
     ObjectCopier.CopyProperties(variable, newVariable);
     RealTimeRepositoryBase.RtDbContext.SaveAllChanges();
     return(variable);
 }
Example #13
0
        public ObjectCopierTests()
        {
            fieldCache = new Mock <IFieldCache>();
            fieldCache.Setup(c => c.GetFields(It.IsAny <Type>())).Returns((Type t) => t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField | BindingFlags.SetField).Where(field => !field.IsInitOnly));

            propertyCache = new Mock <IPropertyCache>();
            propertyCache.Setup(c => c.GetProperties(It.IsAny <Type>())).Returns((Type t) => t.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.SetProperty).Where(property => property.CanRead && property.CanWrite));

            copier = new ObjectCopier(fieldCache.Object, propertyCache.Object);
        }
Example #14
0
        public void Copy(IData obj)
        {
            IData item = ObjectCopier.Clone(obj as PrintingData) as IData;

            if (obj != null)
            {
                item.ParentDirectory = this;
                data.Add(item);
            }
        }
Example #15
0
        private void ProcessCommAlarm_PDC(ref CHCNetSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser, string commType)
        {
            CHCNetSDK.NET_DVR_PDC_ALRAM_INFO struPDCInfo = new CHCNetSDK.NET_DVR_PDC_ALRAM_INFO();
            uint dwSize = (uint)Marshal.SizeOf(struPDCInfo);

            struPDCInfo = (CHCNetSDK.NET_DVR_PDC_ALRAM_INFO)Marshal.PtrToStructure(pAlarmInfo, typeof(CHCNetSDK.NET_DVR_PDC_ALRAM_INFO));

            string stringAlarm = "客流量统计,进入人数:" + struPDCInfo.dwEnterNum + ",离开人数:" + struPDCInfo.dwLeaveNum;

            uint   dwUnionSize = (uint)Marshal.SizeOf(struPDCInfo.uStatModeParam);
            IntPtr ptrPDCUnion = Marshal.AllocHGlobal((Int32)dwUnionSize);

            Marshal.StructureToPtr(struPDCInfo.uStatModeParam, ptrPDCUnion, false);

            if (struPDCInfo.byMode == 0) //单帧统计结果,此处为UTC时间
            {
                m_struStatFrame = (CHCNetSDK.UNION_STATFRAME)Marshal.PtrToStructure(ptrPDCUnion, typeof(CHCNetSDK.UNION_STATFRAME));
                stringAlarm     = stringAlarm + ",单帧统计,相对时标:" + m_struStatFrame.dwRelativeTime + ",绝对时标:" + m_struStatFrame.dwAbsTime;
            }
            if (struPDCInfo.byMode == 1) //最小时间段统计结果
            {
                m_struStatTime = (CHCNetSDK.UNION_STATTIME)Marshal.PtrToStructure(ptrPDCUnion, typeof(CHCNetSDK.UNION_STATTIME));

                //开始时间
                string strStartTime = string.Format("{0:D4}", m_struStatTime.tmStart.dwYear) +
                                      string.Format("{0:D2}", m_struStatTime.tmStart.dwMonth) +
                                      string.Format("{0:D2}", m_struStatTime.tmStart.dwDay) + " "
                                      + string.Format("{0:D2}", m_struStatTime.tmStart.dwHour) + ":"
                                      + string.Format("{0:D2}", m_struStatTime.tmStart.dwMinute) + ":"
                                      + string.Format("{0:D2}", m_struStatTime.tmStart.dwSecond);

                //结束时间
                string strEndTime = string.Format("{0:D4}", m_struStatTime.tmEnd.dwYear) +
                                    string.Format("{0:D2}", m_struStatTime.tmEnd.dwMonth) +
                                    string.Format("{0:D2}", m_struStatTime.tmEnd.dwDay) + " "
                                    + string.Format("{0:D2}", m_struStatTime.tmEnd.dwHour) + ":"
                                    + string.Format("{0:D2}", m_struStatTime.tmEnd.dwMinute) + ":"
                                    + string.Format("{0:D2}", m_struStatTime.tmEnd.dwSecond);

                stringAlarm = stringAlarm + ",最小时间段统计,开始时间:" + strStartTime + ",结束时间:" + strEndTime;
            }
            Marshal.FreeHGlobal(ptrPDCUnion);

            //报警设备IP地址
            string strIP = pAlarmer.sDeviceIP;

            if (NoticeAlarmEvent != null)
            {
                string ccommType    = ObjectCopier.Clone <string>(commType);
                string cstrIP       = ObjectCopier.Clone <string>(strIP);
                string cstringAlarm = ObjectCopier.Clone <string>(stringAlarm);

                NoticeAlarmEvent(ccommType, DateTime.Now.ToString(), cstrIP, cstringAlarm);
            }
        }
Example #16
0
        private void ProcessCommAlarm_FaceSnap(ref CHCNetSDK.NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser, string commType)
        {
            CHCNetSDK.NET_VCA_FACESNAP_RESULT struFaceSnapInfo = new CHCNetSDK.NET_VCA_FACESNAP_RESULT();
            uint dwSize = (uint)Marshal.SizeOf(struFaceSnapInfo);

            struFaceSnapInfo = (CHCNetSDK.NET_VCA_FACESNAP_RESULT)Marshal.PtrToStructure(pAlarmInfo, typeof(CHCNetSDK.NET_VCA_FACESNAP_RESULT));

            //报警设备IP地址
            string strIP       = pAlarmer.sDeviceIP;
            string strFilePath = null;

            if (struFaceSnapInfo.dwFacePicLen != 0 && (struFaceSnapInfo.dwFaceScore >= _traceFaceScore * 100D))
            {
                if (!Directory.Exists(m_OutputDir + strIP + "\\"))
                {
                    Directory.CreateDirectory(m_OutputDir + strIP + "\\");
                }
                strFilePath = m_OutputDir + strIP + "\\" + DateTime.Now.ToString("yyyyMMddHHmissfff") + "_Score_" + struFaceSnapInfo.dwFaceScore + ".jpg";
                FileStream fs   = new FileStream(strFilePath, FileMode.Create);
                int        iLen = (int)struFaceSnapInfo.dwFacePicLen;
                byte[]     by   = new byte[iLen];
                Marshal.Copy(struFaceSnapInfo.pBuffer1, by, 0, iLen);
                fs.Write(by, 0, iLen);
                fs.Close();

                Log4NetHelper.Instance.Info("图像存储文件:" + strFilePath);
            }
            else
            {
                return;
            }

            //报警时间:年月日时分秒
            string strTimeYear   = ((struFaceSnapInfo.dwAbsTime >> 26) + 2000).ToString();
            string strTimeMonth  = ((struFaceSnapInfo.dwAbsTime >> 22) & 15).ToString("d2");
            string strTimeDay    = ((struFaceSnapInfo.dwAbsTime >> 17) & 31).ToString("d2");
            string strTimeHour   = ((struFaceSnapInfo.dwAbsTime >> 12) & 31).ToString("d2");
            string strTimeMinute = ((struFaceSnapInfo.dwAbsTime >> 6) & 63).ToString("d2");
            string strTimeSecond = ((struFaceSnapInfo.dwAbsTime >> 0) & 63).ToString("d2");
            string strTime       = strTimeYear + "-" + strTimeMonth + "-" + strTimeDay + " " + strTimeHour + ":" + strTimeMinute + ":" + strTimeSecond;

            Rectangle rectFace = new Rectangle((int)(struFaceSnapInfo.struRect.fX * 100D), (int)(struFaceSnapInfo.struRect.fY * 100D),
                                               (int)(struFaceSnapInfo.struRect.fWidth * 100D), (int)(struFaceSnapInfo.struRect.fHeight * 100D));

            // string stringAlarm = "人脸抓拍结果,前端设备:" + struFaceSnapInfo.struDevInfo.struDevIP.sIpV4 + ",报警时间:" + strTime;
            if (NoticeFaceSnapEvent != null)
            {
                string    cstrTime     = ObjectCopier.Clone <string>(strTime);
                string    cstrIP       = ObjectCopier.Clone <string>(strIP);
                string    cstrFilePath = ObjectCopier.Clone <string>(strFilePath);
                Rectangle crectangle   = ObjectCopier.Clone <Rectangle>(rectFace);

                NoticeFaceSnapEvent(cstrTime, cstrIP, cstrFilePath, crectangle);
            }
        }
Example #17
0
        private Engine.Data.Configuration.Coin AddCoinConfiguration(PoolGroup poolGroup)
        {
            //don't allow two configurations for the same coin symbol
            Engine.Data.Configuration.Coin configuration = configurations.SingleOrDefault(c => c.PoolGroup.Id.Equals(poolGroup.Id, StringComparison.OrdinalIgnoreCase));
            if (configuration == null)
            {
                //don't allow two configurations for the same coin name
                configuration = configurations.SingleOrDefault(c => c.PoolGroup.Name.Equals(poolGroup.Name, StringComparison.OrdinalIgnoreCase));
            }

            if (configuration != null)
            {
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }
            else
            {
                configuration = new Engine.Data.Configuration.Coin();

                configuration.PoolGroup = knownCoins.SingleOrDefault(c => c.Id.Equals(poolGroup.Id, StringComparison.OrdinalIgnoreCase));

                //user may have manually entered a coin or may be using a Multipool
                if (configuration.PoolGroup == null)
                {
                    configuration.PoolGroup = new PoolGroup();
                    ObjectCopier.CopyObject(poolGroup, configuration.PoolGroup);
                }

                //at this point, configuration.CryptoCoin.Algorithm MAY be the CoinAlgorithm.FullName
                //that is how data from Coin API is stored
                //but coin configurations are based on CoinAlgorithm.Name
                CoinAlgorithm algorithm = MinerFactory.Instance.Algorithms.SingleOrDefault(a =>
                                                                                           a.FullName.Equals(configuration.PoolGroup.Algorithm, StringComparison.OrdinalIgnoreCase));
                if (algorithm != null)
                {
                    configuration.PoolGroup.Algorithm = algorithm.Name;
                }

                MiningPool miningPool = new MiningPool()
                {
                    Host = UX.Data.Configuration.PoolDefaults.HostPrefix,
                    Port = UX.Data.Configuration.PoolDefaults.Port
                };
                configuration.Pools.Add(miningPool);

                configurations.Add(configuration);

                coinListBox.Items.Add(configuration.PoolGroup.Name);
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }

            hostEdit.Focus();
            hostEdit.SelectionStart = hostEdit.SelectionLength;

            return(configuration);
        }
Example #18
0
        private void api_FaceEvent(int frameId, Bitmap image, int faceId, int faceSerial, double score)
        {
            if (image == null)
            {
                return;
            }

            if (score > _traceFaceScore && faceSerial == 3)
            {
                ///////////////////////////////////
                // 增加发送到Kafka
                try
                {
                    string outputfile = score.ToString() + "_" + faceId.ToString() + ".jpg";

                    string filedir = _faceFilePath + DateTime.Today.ToString("yyyy-M-d") + "\\";
                    if (!Directory.Exists(filedir))
                    {
                        Directory.CreateDirectory(filedir);
                    }
                    image.Save(filedir + outputfile, ImageFormat.Jpeg);

                    Log4NetHelper.Instance.Info("图像存储文件:" + outputfile);
                    // 将数据进行组合后重新发送
                    string serveroutputPath = GetResultImageServerPath(filedir + outputfile);

                    var resultkafka = new FaceImg4kafka();
                    resultkafka.ImgNum   = frameId.ToString();
                    resultkafka.PassTime = DateTime.Now.ToString("yyyyMMddHHmmss");
                    resultkafka.CameraIp = "127.0.0.1";
                    resultkafka.FaceUrl  = serveroutputPath;

                    string resultjson = Newtonsoft.Json.JsonConvert.SerializeObject(resultkafka);
                    _imgkafkaActor.Send2Quere(resultjson);
                }
                catch (Exception ex)
                {
                    Log4NetHelper.Instance.Error("FaceEvent生成Kakfa数据出现错误:" + ex.Message);
                }
                ///////////////////////////////////

                if (NoticeFaceEvent != null)
                {
                    Image          faceImg  = ObjectCopier.Clone(image);
                    SnapVideoImage videoImg = new SnapVideoImage(_videoSrcUrl, frameId.ToString(), faceId, DateTime.Now, faceImg);
                    NoticeFaceEvent(videoImg);
                }
                image.Dispose();
            }
            else
            {
                image.Dispose();
            }
        }
Example #19
0
        // Caller must specify a the tagIds and the initial distribution of states for this interaction.
        public virtual void initialize(List <string> tagIds, ConcurrentDictionary <TState, double> initialHistogram)
        {
            this.tagIds    = ObjectCopier.Clone <List <string> >(tagIds);
            this.histogram = initialHistogram;

            // Verify that the initial distribution's probabilities sum to 1
            if (!this.verifyHistogram())
            {
                throw new Exception("Initial distribution doesn't sum to 1.");
            }
        }
Example #20
0
 // Get the most likely state if it's greater than a certain threshold value, otherwise return null.
 public virtual TState getMostLikelyStateIfProbable(double threshold)
 {
     if (this.mostLikelyStateProb > threshold)
     {
         return(ObjectCopier.Clone <TState>(this.mostLikelyState));
     }
     else
     {
         return(null);
     }
 }
Example #21
0
        /// <summary>
        /// Возвращает полные копии экземпляров из хранилища
        /// </summary>
        /// <returns></returns>
        public IEnumerable <Ec2Instance> Get()
        {
            var result = new List <Ec2Instance>();

            foreach (var instance in ec2instances)
            {
                result.Add(ObjectCopier.Clone <Ec2Instance>(instance.Value));
            }

            return(result);
        }
Example #22
0
        private void ShowProjectDetails(Message.M_EditTile msg)
        {
            if (msg.Sender is View.V_Tiles | msg.Sender is App)
            {
                SelectedItem = msg.SelectedTile;

                EditedItem = ObjectCopier.CloneJson <Project>(SelectedItem);

                Messenger.Default.Send(new Message.M_ChangeView(Message.M_ChangeView.ViewToSelect.DisplayAddNewTab));
            }
        }
Example #23
0
        public override void afterUpdate()
        {
            // Check the most likely state.
            this.mostLikelyState = (SimonInteractionState)this.interaction.getMostLikelyStateIfProbable(this.snapThreshold);
            if (this.mostLikelyState == null)
            {
                return;
            }

            /*
             * // Update the state of the GUI to reflect which tags were touched.
             * List<string> desiredTouchedTags = this.desiredState.getTouchedTags();
             * bool error = false;
             * foreach (string touchedTag in this.mostLikelyState.getTouchedTags())
             * {
             *  if (desiredTouchedTags.Contains(touchedTag)) {
             *      Console.WriteLine("Yay!");
             *      this.form.markTagCorrect(touchedTag);
             *  }
             *  else
             *  {
             *      Console.WriteLine("Mistake...");
             *      this.form.markTagMistake(touchedTag);
             *      error = true;
             *  }
             * }
             * if (error)
             * {
             *  // They lose, and it automatically starts again.
             *  Console.WriteLine("You lose!");
             *  this.requestTagTouch();
             * }
             */

            // Check if we are in a new state, and then check if player followed Simon's instructions correctly.
            // Console.WriteLine("most likely state exists " + this.mostLikelyState);
            // Console.WriteLine(this.mostLikelyState);
            if (!this.mostLikelyState.Equals(this.lastObservedState))
            {
                Console.WriteLine("noticed state change to " + this.mostLikelyState);
                this.lastObservedState = ObjectCopier.Clone <SimonInteractionState>(this.mostLikelyState);
                if (this.mostLikelyState.Equals(this.desiredState))
                {
                    // Player is correct.
                    Console.WriteLine("Well done! Score ");
                }
                else
                {
                    // Player is incorrect.
                    Console.WriteLine("Incorrect. Simon is disappointed.");
                }
                this.requestNewState();
            }
        }
Example #24
0
        }         // end startlevel

        // call this once per level to set all the dynamic colors as a function of depth
        void updateColors()
        {
            short i;

            for (i = 0; i < RogueH.NUMBER_DYNAMIC_COLORS; i++)
            {
                //*(dynamicColors[i,0]) = *(dynamicColors[i,1]);
                ObjectCopier.CopyFrom(dynamicColors[i, 0], dynamicColors[i, 1]);
                IO.applyColorAverage(dynamicColors[i, 0], dynamicColors[i, 2], (short)Math.Min(100, Math.Max(0, rogue.depthLevel * 100 / RogueH.AMULET_LEVEL)));
            }
        }
        private void addOption(object obj)
        {
            _currentOption.Id        = _idCounter;
            _currentOption.CostPrice = _currentOption.PositionPrice;
            var option = ObjectCopier.Clone(_currentOption);

            option.PropertyChanged += evaluatePortfolio;
            OptionsPortfolio.Add(option);
            _idCounter++;
            computePortfolio();
        }
Example #26
0
        public async Task <OwletSignInResponse> RefreshLoginAsync(string refreshToken = null)
        {
            // short-circuit if provided
            if (string.IsNullOrWhiteSpace(refreshToken))
            {
                refreshToken = this._owletUserSession?.SignInResponse?.RefreshToken;
            }
            var signInResponse = await this._aylaUserServiceClient.RefreshTokenAsync(refreshToken);

            this._owletUserSession?.SetSession(ObjectCopier.Clone(signInResponse));
            return(signInResponse);
        }
        public static List <Remoting.Data.Transfer.Configuration.Device> ToTransferObjects(this List <Engine.Data.Configuration.Device> modelObjects)
        {
            List <Remoting.Data.Transfer.Configuration.Device> transferObjects = new List <Remoting.Data.Transfer.Configuration.Device>();

            foreach (Engine.Data.Configuration.Device modelConfig in modelObjects)
            {
                Device transferObject = ObjectCopier.CloneObject <Engine.Data.Configuration.Device, Remoting.Data.Transfer.Configuration.Device>(modelConfig);
                transferObjects.Add(transferObject);
            }

            return(transferObjects);
        }
        private void saveButton_Click(object sender, EventArgs e)
        {
            CopyLogFilesIfChanged();

            //don't persist default values
            ClearDefaultValues();

            ObjectCopier.CopyObject(workingPathConfiguration, pathConfiguration);
            ObjectCopier.CopyObject(workingApplicationConfiguration, applicationConfiguration);

            DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Example #29
0
        public MinerSettingsForm(LiquidHash.Engine.Data.Configuration.Xgminer minerConfiguration, Application applicationConfiguration,
                                 Perks perksConfiguration)
        {
            InitializeComponent();
            this.minerConfiguration        = minerConfiguration;
            this.workingMinerConfiguration = ObjectCopier.CloneObject <LiquidHash.Engine.Data.Configuration.Xgminer, LiquidHash.Engine.Data.Configuration.Xgminer>(minerConfiguration);

            this.applicationConfiguration        = applicationConfiguration;
            this.workingApplicationConfiguration = ObjectCopier.CloneObject <Application, Application>(applicationConfiguration);

            this.perksConfiguration = perksConfiguration;
        }
 public object GetObjectClone(string key, object defaultVal = null)
 {
     if (data.objects.ContainsKey(key))
     {
         object result = data.objects[key];
         return(result != null?ObjectCopier.Clone(result) : null);
     }
     else
     {
         return(defaultVal);
     }
 }
Example #31
0
        private static List <CoinInformation> CopyCoinInformation(List <CoinInformation> coinInformation)
        {
            List <CoinInformation> coinInformationCopy = new List <CoinInformation>();

            foreach (CoinInformation realCoin in coinInformation)
            {
                CoinInformation coinCopy = new CoinInformation();
                ObjectCopier.CopyObject(realCoin, coinCopy);
                coinInformationCopy.Add(coinCopy);
            }
            return(coinInformationCopy);
        }