コード例 #1
0
 public Form1(ILogger logger, ICopy copy, int valueToEdit)
 {
     this._processRepository = logger;
     this._copy       = copy;
     this.ValueToEdit = valueToEdit;
     InitializeComponent();
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OperationSubCopy{TSource,TTarget, TSubCopy}" /> class.
        /// </summary>
        public OperationSubCopy(
            ICopy <TValue> copy)
        {
            copy.NotNull(nameof(copy));

            this.copy = copy;
        }
コード例 #3
0
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-01-13</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            CopyBase.Copy(this, target, typeof(ICard), progressDelegate);

            //copy media objects
            ICard targetCard = target as ICard;

            if (targetCard != null)
            {
                foreach (IMedia media in QuestionMedia)
                {
                    targetCard.AddMedia(media, Side.Question);
                }
                foreach (IMedia media in AnswerMedia)
                {
                    targetCard.AddMedia(media, Side.Answer);
                }
                try
                {
                    if (targetCard is MLifter.DAL.XML.XmlCard)
                    {
                        (targetCard as MLifter.DAL.XML.XmlCard).Id = Id;
                    }
                }
                catch (Exception ex)
                {
                    Trace.WriteLine("Tried to set the card id for XML but failed: " + ex.ToString());
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// 将对象转化为json格式字符串
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static T CopyTo <T>(this ICopy obj) where T : new()
        {
            if (obj == null)
            {
                return(default(T));
            }
            var result = new T();

            var sourceProps = obj.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
            var targetProps = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);

            foreach (var tp in targetProps)
            {
                if (!tp.CanWrite)
                {
                    continue;
                }

                foreach (var sp in sourceProps)
                {
                    if (!string.Equals(tp.Name, sp.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    tp.SetValue(result, sp.GetValue(obj));
                    break;
                }
            }
            return(result);
        }
コード例 #5
0
        private void Copy()
        {
            Request R = new Request();
            Request R2;

            R2 = ICopy.Clone <Request>(R); /*  ICopy.Clone<Request>(   */
        }
コード例 #6
0
 public void CopyValue(ICopy copyTo)
 {
     if (copyTo.IsList)
     {
         var l = copyTo as PList <T>;
         if (mIsSet)
         {
             l.Add(mValue);
         }
         else
         {
             l.Remove(mValue);
         }
     }
     else
     {
         var p = copyTo as PValue <T>;
         if (p == null)
         {
             return;
         }
         p.mValue = mValue;
         p.mIsSet = mIsSet;
     }
 }
コード例 #7
0
ファイル: Copy.cs プロジェクト: KenanHussein/Memory-Lifter
        /// <summary>
        /// Copies the specified source.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="type">The type the source and target should be interpreded as.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        public static void Copy(ICopy source, ICopy target, Type type, CopyToProgress progressDelegate)
        {
            if (!(type.IsAssignableFrom(source.GetType()) && type.IsAssignableFrom(target.GetType())))
            {
                throw new ArgumentException("Source and Target must implement " + type.ToString());
            }

            foreach (PropertyInfo info in type.GetProperties())
            {
                if (type.GetProperty(info.Name).IsDefined(typeof(IgnoreCopyAttribute), true) ||
                    source.GetType().GetProperty(info.Name).IsDefined(typeof(IgnoreCopyAttribute), true) ||
                    target.GetType().GetProperty(info.Name).IsDefined(typeof(IgnoreCopyAttribute), true))
                {
                    continue;
                }

                if (typeof(ICopy).IsAssignableFrom(info.PropertyType))
                {
                    ICopy copyObject = (info.GetValue(source, null) as ICopy);
                    if (copyObject != null)
                    {
                        copyObject.CopyTo(info.GetValue(target, null) as ICopy, progressDelegate);
                    }
                }

                if (info.IsDefined(typeof(ValueCopyAttribute), true))
                {
                    object value = info.GetValue(source, null);
                    if (value != null)
                    {
                        info.SetValue(target, value, null);
                    }
                }
            }
        }
        public CopyOperationPostProcessingUsingParamsIntTests()
        {
            var container = TestIocContainer.Initialize();

            container.Bind <ICopyRegistrations <ITestClass> >().To <TestClassCopyRegistrations>();
            this.copy = container.Get <ICopy <ITestClass> >();
        }
コード例 #9
0
ファイル: Copy.cs プロジェクト: Stoner19/Memory-Lifter
        /// <summary>
        /// Copies the specified source.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev05, 2012-01-11</remarks>
        public static void Copy(ICopy source, ICopy target, CopyToProgress progressDelegate)
        {
            if (source.GetType() != target.GetType())
                throw new ArgumentException("Source and Target must be the same type!");

            Copy(source, target, source.GetType(), progressDelegate);
        }
コード例 #10
0
ファイル: Copy.cs プロジェクト: Stoner19/Memory-Lifter
        /// <summary>
        /// Copies the specified source.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="type">The type the source and target should be interpreded as.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        public static void Copy(ICopy source, ICopy target, Type type, CopyToProgress progressDelegate)
        {
            if (!(type.IsAssignableFrom(source.GetType()) && type.IsAssignableFrom(target.GetType())))
                throw new ArgumentException("Source and Target must implement " + type.ToString());

            foreach (PropertyInfo info in type.GetProperties())
            {
                if (type.GetProperty(info.Name).IsDefined(typeof(IgnoreCopyAttribute), true) ||
                    source.GetType().GetProperty(info.Name).IsDefined(typeof(IgnoreCopyAttribute), true) ||
                    target.GetType().GetProperty(info.Name).IsDefined(typeof(IgnoreCopyAttribute), true))
                    continue;

                if (typeof(ICopy).IsAssignableFrom(info.PropertyType))
                {
                    ICopy copyObject = (info.GetValue(source, null) as ICopy);
                    if (copyObject != null)
                        copyObject.CopyTo(info.GetValue(target, null) as ICopy, progressDelegate);
                }

                if (info.IsDefined(typeof(ValueCopyAttribute), true))
                {
                    object value = info.GetValue(source, null);
                    if (value != null)
                        info.SetValue(target, value, null);
                }
            }
        }
        public CopyOperationPostProcessingWithoutUsingParamsIntTest()
        {
            var kernel = TestIocContainer.Initialize();

            kernel.Bind <ICopyRegistrations <ITestClass> >().To <TestClassCopyRegistrations>();

            this.testCandidate = kernel.Get <ICopy <ITestClass> >();
        }
        public CopyOperationInlineValueProcessingTests()
        {
            var kernel = TestIocContainer.Initialize();

            kernel.Bind <ICopyRegistrations <TestClass> >().To <TestClassCopyRegistrations>();

            this.testCandidate = kernel.Get <ICopy <TestClass> >();
        }
コード例 #13
0
        public CopyOperationSubCopyIntTests()
        {
            var kernel = TestIocContainer.Initialize();

            kernel.Bind <ICopyRegistrations <TestClassChild> >().To <TestClassChildCopyRegistrations>();
            kernel.Bind <ICopyRegistrations <TestClassParent> >().To <TestClassParentCopyRegistrations>();

            this.testCandidate = kernel.Get <ICopy <TestClassChild> >();
        }
        public CopyOperationCreateToManyWithReverseRelationIntTests()
        {
            var kernel = TestIocContainer.Initialize();

            kernel.Bind <ICopyRegistrations <IParentTestClass> >().To <TestClassCopyRegistrations>();
            kernel.Bind <ICopyRegistrations <IChildTestClass> >().To <ChildTestClassCopyRegistrations>();

            this.testCandidate = kernel.Get <ICopy <IParentTestClass> >();
        }
コード例 #15
0
ファイル: Copy.cs プロジェクト: KenanHussein/Memory-Lifter
        /// <summary>
        /// Copies the specified source.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev05, 2012-01-11</remarks>
        public static void Copy(ICopy source, ICopy target, CopyToProgress progressDelegate)
        {
            if (source.GetType() != target.GetType())
            {
                throw new ArgumentException("Source and Target must be the same type!");
            }

            Copy(source, target, source.GetType(), progressDelegate);
        }
コード例 #16
0
        public CopyOperationRegisterCreateFromFactoryTests()
        {
            var kernel = TestIocContainer.Initialize();

            kernel.Bind <ICopyRegistrations <TestClass> >().To <TestClassCopyRegistrations>();
            kernel.Bind <ITestFactory>().To <TestFactory>();

            this.testCandidate = kernel.Get <ICopy <TestClass> >();
        }
コード例 #17
0
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-01-13</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            IChapters targetChapters = target as IChapters;

            if (targetChapters != null)
            {
                ChaptersHelper.Copy(this, targetChapters, progressDelegate);
            }
        }
コード例 #18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericCopyStrategy{TBase, TDerived, TConcrete}"/> class.
        /// </summary>
        public GenericCopyStrategy(
            IInstanceCreator <TDerived, TConcrete> creator,
            ICopy <TDerived> copier)
        {
            creator.NotNull(nameof(creator));
            copier.NotNull(nameof(copier));

            this.creator = creator;
            this.copier  = copier;
        }
コード例 #19
0
        public CopierIntegrationTests()
        {
            var kernel = TestIocContainer.Initialize();

            kernel.Bind <ICopyRegistrations <IParentTestClass> >().To <TestClassCopyRegistrations>();
            kernel.Bind <ICopyRegistrations <IChildTestClass> >().To <ChildTestClassCopyRegistrations>();
            kernel.Bind <ICopyRegistrations <IChildTestClass2> >().To <ChildTestClass2CopyRegistrations>();

            this.testCandidate = kernel.Get <ICopy <IParentTestClass> >();
        }
        public CopyOperationCrossReferenceProcessingIntTests()
        {
            var kernel = TestIocContainer.Initialize();

            kernel.Bind <ICopyRegistrations <TestClass> >().To <TestClassCopyRegistrations>();
            kernel.Bind <ICopyRegistrations <TestClassChild> >().To <TestClassChildCopyRegistrations>();
            kernel.Bind <ICopyRegistrations <TestClassCrossReferencedChild> >().To <TestClassCrossReferencedChildCopyRegistrations>();

            this.testCandidate = kernel.Get <ICopy <TestClass> >();
        }
コード例 #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CreateCopyHelper{TChild,TConcreteChild,TParent}"/> class.
        /// </summary>
        public CreateCopyHelper(
            IInstanceCreator <TChild, TConcreteChild> instanceCreator,
            ICopy <TChild> copy)
        {
            instanceCreator.NotNull(nameof(instanceCreator));
            copy.NotNull(nameof(copy));

            this.instanceCreator = instanceCreator;
            this.copy            = copy;
        }
コード例 #22
0
 public PostXMLStoreOrderListUseCase(
     DrugstoreDbContext context,
     ILogger <PostXMLStoreOrderListUseCase> logger,
     ISerializer <MemoryStream, XmlMedicineSupplyModel> serializer,
     ICopy fileCopy)
 {
     this.context    = context;
     this.logger     = logger;
     this.serializer = serializer;
     this.fileCopy   = fileCopy;
 }
コード例 #23
0
 public UploadSoldMedicinesListUseCase(
     DrugstoreDbContext context,
     ILogger <UploadSoldMedicinesListUseCase> logger,
     ISerializer <MemoryStream, XmlMedicineSupplyModel> serializer,
     ICopy fileCopy)
 {
     this.context    = context;
     this.logger     = logger;
     this.serializer = serializer;
     this.fileCopy   = fileCopy;
 }
コード例 #24
0
        public CopyOperationCreateToManyFromGenericStrategyWithReverseRelationIntTests()
        {
            var kernel = TestIocContainer.Initialize();

            kernel.Bind <IGenericStrategyProvider <TestStrategy, IChildTestClass> >().To <TestFactory>();
            kernel.Bind <ITestStrategy>().To <TestStrategy>();
            kernel.Bind <ICopyRegistrations <IParentTestClass> >().To <TestClassCopyRegistrations>();
            kernel.Bind <ICopyRegistrations <IChildTestClass> >().To <ChildTestClassCopyRegistrations>();

            this.testCandidate = kernel.Get <ICopy <IParentTestClass> >();
        }
コード例 #25
0
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-01-13</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            CopyBase.Copy(this, target, typeof(IDictionary), progressDelegate);

            //copy extensions
            foreach (IExtension extension in Extensions)
            {
                IExtension newExtension = ((IDictionary)target).ExtensionFactory(extension.Id);
                extension.CopyTo(newExtension, progressDelegate);
            }
        }
コード例 #26
0
        public MultiCopyFunctional(IPrint print, IScan scan, ICopy copy)
        {
            print = print ?? throw new ArgumentNullException(nameof(print));
            scan  = scan ?? throw new ArgumentNullException(nameof(scan));
            copy  = copy ?? throw new ArgumentNullException(nameof(copy));


            this.print = print;
            this.scan  = scan;
            this.copy  = copy;
        }
コード例 #27
0
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-01-13</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            IChapter targetChapter = target as IChapter;

            if (targetChapter != null && targetChapter.Settings == null && this.Settings != null)
            {
                targetChapter.Settings = targetChapter.Parent.GetParentDictionary().CreateSettings();
            }

            CopyBase.Copy(this, target, typeof(IChapter), progressDelegate);
        }
コード例 #28
0
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="progressDelegate">The progress delegate.</param>
 /// <remarks>Documented by Dev03, 2009-01-13</remarks>
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     CopyBase.Copy(this, target, typeof(ICardStyle), progressDelegate);
     if (target is DbCardStyle)
     {
         CopyMediaTo((DbCardStyle)target);
     }
     if (target is DbCardStyle)
     {
         ((DbCardStyle)target).FlushToDB();
     }
 }
コード例 #29
0
ファイル: IMachine.cs プロジェクト: mshd3techs/SOLID-6
 public SuperMegaPrinterMachine(
     IPrinter printer,
     IScan scanner,
     IStaple stapler,
     IFax fax,
     ICopy copier)
 {
     _printer = printer;
     _scanner = scanner;
     _stapler = stapler;
     _fax     = fax;
     _copier  = copier;
 }
コード例 #30
0
ファイル: IMachine.cs プロジェクト: richardvaldivieso/SOLID
 public SuperMegaPrinterMachine(
     IPrinter printer,
     IScan scanner,
     IStaple stapler,
     IFax fax,
     ICopy copier)
 {
     _printer = printer;
     _scanner = scanner;
     _stapler = stapler;
     _fax = fax;
     _copier = copier;
 }
コード例 #31
0
            public void CopyValue(ICopy copyTo)
            {
                if (Count == 0)
                {
                    return;
                }
                var p = copyTo as PList <T>;

                if (p != null)
                {
                    p.AddRange(this);
                }
            }
コード例 #32
0
ファイル: frmMain.cs プロジェクト: Venseer/tools
        private void ReplaceSelectedZone(IZone ReplaceZone, ICopy CopyParams)
        {
            IZone zone = worldmap.GetSelectedZone();

            if (zone == null)
            {
                return;
            }

            if (ReplaceZone != null)
            {
                worldmap.ReplaceSelectedZone(ReplaceZone, CopyParams);
            }
        }
コード例 #33
0
ファイル: Copier.cs プロジェクト: nofear/Mara
        public ICopy Get( ICopy other )
        {
            ICopy copy;
            if( !m_Map.TryGetValue( other.Id, out copy ) )
            {
                copy		= other.New();
                other.Id	= m_Map.Count + 1;

                m_Map[ other.Id ]	= copy;

                copy.Copy( this, other );
            }

            return copy;
        }
コード例 #34
0
        public ICopy Get(ICopy other)
        {
            ICopy copy;

            if (!m_Map.TryGetValue(other.Id, out copy))
            {
                copy     = other.New();
                other.Id = m_Map.Count + 1;

                m_Map[other.Id] = copy;

                copy.Copy(this, other);
            }

            return(copy);
        }
コード例 #35
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            SetControls(false);

            Copy CopyObj = new Copy();
            CopyObj.CopyChance = chkChance.Checked;
            CopyObj.CopyTerrain = chkTerrain.Checked;
            CopyObj.CopyDifficulty = chkDifficulty.Checked;
            CopyObj.CopyGroups = chkGroups.Checked;
            CopyObj.CopyLocations = chkLocations.Checked;
            CopyObj.CopyFlags = chkFlags.Checked;
            CopyObj.Overwrite = chkOverwrite.Checked;

            ICopyObj = CopyObj;

            this.Close();
        }
コード例 #36
0
ファイル: DbChapter.cs プロジェクト: Stoner19/Memory-Lifter
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-01-13</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            IChapter targetChapter = target as IChapter;
            if (targetChapter != null && targetChapter.Settings == null && this.Settings != null)
                targetChapter.Settings = targetChapter.Parent.GetParentDictionary().CreateSettings();

            CopyBase.Copy(this, target, typeof(IChapter), progressDelegate);
        }
コード例 #37
0
ファイル: DbCardStyle.cs プロジェクト: Stoner19/Memory-Lifter
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="progressDelegate">The progress delegate.</param>
 /// <remarks>Documented by Dev03, 2009-01-13</remarks>
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     CopyBase.Copy(this, target, typeof(ICardStyle), progressDelegate);
     if (target is DbCardStyle) CopyMediaTo((DbCardStyle)target);
     if (target is DbCardStyle) ((DbCardStyle)target).FlushToDB();
 }
コード例 #38
0
ファイル: DbWords.cs プロジェクト: hmehr/OSS
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     WordsHelper.CopyWords(this, target as IWords);
 }
コード例 #39
0
ファイル: XmlCardStyle.cs プロジェクト: hmehr/OSS
 /// <summary>
 /// Copies this instance to the specified target.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="progressDelegate">The progress delegate.</param>
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     CopyBase.Copy(this, target, typeof(ICardStyle), progressDelegate);
     if (target is MLifter.DAL.DB.DbCardStyle)
     {
         string basePath = Path.GetDirectoryName(this.Parent.GetParentDictionary().Connection);
         ITextStyle[] styles = { (target as MLifter.DAL.DB.DbCardStyle).Question, (target as MLifter.DAL.DB.DbCardStyle).QuestionExample, (target as MLifter.DAL.DB.DbCardStyle).Answer, (target as MLifter.DAL.DB.DbCardStyle).AnswerExample, (target as MLifter.DAL.DB.DbCardStyle).AnswerCorrect, (target as MLifter.DAL.DB.DbCardStyle).AnswerWrong };
         foreach (ITextStyle style in styles)
         {
             string[] keys = new String[style.OtherElements.Keys.Count];
             style.OtherElements.Keys.CopyTo(keys, 0);
             foreach (string key in keys)
             {
                 String value = style.OtherElements[key];
                 Match urlValue = m_ResourceFinder.Match(value);
                 Match m = m_ResourceFinder.Match(value);
                 if (m.Success)
                 {
                     string url = m.Groups["url"].Value.Trim(new char[] { '"', '\'' });
                     Uri uri;
                     Match extractId = m_extractSingleMediaId.Match(url);
                     if (!extractId.Success)
                     {
                         if (Uri.IsWellFormedUriString(url, UriKind.Absolute))
                         {
                             uri = new Uri(url);
                         }
                         else
                         {
                             uri = new Uri(new Uri(basePath + "/"), url);
                         }
                         style.OtherElements[key] = style.OtherElements[key].Replace(url, uri.AbsoluteUri);
                     }
                 }
             }
         }
         (target as MLifter.DAL.DB.DbCardStyle).FlushToDB();
     }
 }
コード例 #40
0
ファイル: DbExtension.cs プロジェクト: hmehr/OSS
        /// <summary>
        /// Copies this instance to the specified target.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            CopyBase.Copy(this, target, typeof(IExtension), progressDelegate);

            //copy data stream
            using (Stream data = this.Data)
            {
                if (data != null)
                    ((IExtension)target).Data = data;
            }

            //copy actions
            IList<ExtensionAction> actions = ((IExtension)target).Actions;
            actions.Clear();
            foreach (ExtensionAction action in this.Actions)
                actions.Add(action);
        }
コード例 #41
0
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="progressDelegate">The progress delegate.</param>
 /// <remarks>Documented by Dev03, 2008-12-03</remarks>
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     CopyBase.Copy(this, target, typeof(IDictionary), progressDelegate);
 }
コード例 #42
0
ファイル: DbCard.cs プロジェクト: Stoner19/Memory-Lifter
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-01-13</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            CopyBase.Copy(this, target, typeof(ICard), progressDelegate);

            //copy media objects
            ICard targetCard = target as ICard;
            if (targetCard != null)
            {
                foreach (IMedia media in QuestionMedia)
                    targetCard.AddMedia(media, Side.Question);
                foreach (IMedia media in AnswerMedia)
                    targetCard.AddMedia(media, Side.Answer);
                try
                {
                    if (targetCard is MLifter.DAL.XML.XmlCard)
                        (targetCard as MLifter.DAL.XML.XmlCard).Id = Id;
                }
                catch (Exception ex)
                {
                    Trace.WriteLine("Tried to set the card id for XML but failed: " + ex.ToString());
                }
            }
        }
コード例 #43
0
ファイル: DbChapters.cs プロジェクト: Stoner19/Memory-Lifter
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="progressDelegate">The progress delegate.</param>
 /// <remarks>Documented by Dev03, 2009-01-13</remarks>
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     IChapters targetChapters = target as IChapters;
     if (targetChapters != null)
         ChaptersHelper.Copy(this, targetChapters, progressDelegate);
 }
コード例 #44
0
ファイル: XmlCard.cs プロジェクト: Stoner19/Memory-Lifter
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-04-19</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            CopyBase.Copy(this, target, typeof(ICard), progressDelegate);

            //copy media objects
            ICard targetCard = target as ICard;
            if (targetCard != null)
            {
                foreach (IMedia media in QuestionMedia)
                    try
                    {
                        targetCard.AddMedia(media, Side.Question);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex, "DbCard.AddMedia() throws an exception.");
                    }
                foreach (IMedia media in AnswerMedia)
                    try
                    {
                        targetCard.AddMedia(media, Side.Answer);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex, "DbCard.AddMedia() throws an exception.");
                    }
            }
        }
コード例 #45
0
ファイル: PreviewCard.cs プロジェクト: Stoner19/Memory-Lifter
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-03-23</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            CopyBase.Copy(this, target, typeof(ICard), progressDelegate);

            //copy media objects
            ICard targetCard = target as ICard;
            if (targetCard != null)
            {
                foreach (IMedia media in QuestionMedia)
                    targetCard.AddMedia(media, Side.Question);
                foreach (IMedia media in AnswerMedia)
                    targetCard.AddMedia(media, Side.Answer);
            }
        }
コード例 #46
0
ファイル: frmMain.cs プロジェクト: SnakeSolidNL/tools
        private void ReplaceSelectedZone(IZone ReplaceZone, ICopy CopyParams)
        {
            IZone zone = worldmap.GetSelectedZone();
            if (zone == null)
                return;

            if (ReplaceZone != null)
                worldmap.ReplaceSelectedZone(ReplaceZone, CopyParams);
        }
コード例 #47
0
ファイル: PreviewSettings.cs プロジェクト: hmehr/OSS
 /// <summary>
 /// Copies this instance to the specified target.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="progressDelegate">The progress delegate.</param>
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     throw new NotImplementedException();
 }
コード例 #48
0
ファイル: WorldMap.cs プロジェクト: SnakeSolidNL/tools
        public void ReplaceSelectedZone(IZone zone, ICopy ICopyParams)
        {
            int x = SelectedZone.X;
            int y = SelectedZone.Y;

            IZone copyzone = zone.Clone();

            if (ICopyParams is Copy)
            {
                Copy CopyParams = (Copy)ICopyParams;
                IExtZone ExtSelectedZone = (IExtZone)SelectedZone;
                IExtZone ExtCopyZone = (IExtZone)copyzone;

                if (CopyParams.CopyDifficulty)
                    ExtSelectedZone.Difficulty = ExtCopyZone.Difficulty;
                if (CopyParams.CopyGroups)
                {
                    if (CopyParams.Overwrite)
                        ExtSelectedZone.EncounterGroups = ExtCopyZone.EncounterGroups;
                    else
                    {
                        ExtSelectedZone.EncounterGroups.AddRange(ExtCopyZone.EncounterGroups);
                        ExtSelectedZone.EncounterGroups = Utils.RemoveDuplicates<EncounterZoneGroup>(ExtSelectedZone.EncounterGroups);
                    }
                }
                if (CopyParams.CopyLocations)
                {
                    if (CopyParams.Overwrite)
                        ExtSelectedZone.EncounterLocations = ExtCopyZone.EncounterLocations;
                    else
                    {
                        ExtSelectedZone.EncounterLocations.AddRange(ExtCopyZone.EncounterLocations);
                        ExtSelectedZone.EncounterLocations = Utils.RemoveDuplicates<EncounterZoneLocation>(ExtCopyZone.EncounterLocations);
                    }
                }

                if (ExtSelectedZone.EncounterGroups == null)
                    ExtSelectedZone.EncounterGroups = new List<EncounterZoneGroup>();
                if (ExtSelectedZone.EncounterLocations == null)
                    ExtSelectedZone.EncounterLocations = new List<EncounterZoneLocation>();
            }

            if (ICopyParams.CopyTerrain)
                SelectedZone.Terrain = copyzone.Terrain;
            if (ICopyParams.CopyChance)
                SelectedZone.Chance = copyzone.Chance;

            SelectedZone.Brushed = copyzone.Brushed;
            SelectedZone.X = x;
            SelectedZone.Y = y;

            SaveSelected();
        }
コード例 #49
0
ファイル: XmlCards.cs プロジェクト: Stoner19/Memory-Lifter
 /// <summary>
 /// Copies this instance to the specified target.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="progressDelegate">The progress delegate.</param>
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     CardsHelper.Copy(this, target as ICards, progressDelegate);
 }
コード例 #50
0
ファイル: frmMain.cs プロジェクト: SnakeSolidNL/tools
 private void copyingToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SettingsCopying.ShowDialog();
     ICopyParams = SettingsCopying.ICopyObj;
 }
コード例 #51
0
        /// <summary>
        /// Copies to.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="progressDelegate">The progress delegate.</param>
        /// <remarks>Documented by Dev03, 2009-01-13</remarks>
        public void CopyTo(ICopy target, CopyToProgress progressDelegate)
        {
            CopyBase.Copy(this, target, typeof(IDictionary), progressDelegate);

            //copy extensions
            foreach (IExtension extension in Extensions)
            {
                IExtension newExtension = ((IDictionary)target).ExtensionFactory(extension.Id);
                extension.CopyTo(newExtension, progressDelegate);
            }
        }
コード例 #52
0
ファイル: XmlCardStyle.cs プロジェクト: hmehr/OSS
 /// <summary>
 /// Copies to.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <param name="progressDelegate">The progress delegate.</param>
 /// <remarks>Documented by Dev03, 2009-01-13</remarks>
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     CopyBase.Copy(this, target, typeof(ITextStyle), progressDelegate);
 }