public Form1(ILogger logger, ICopy copy, int valueToEdit)
 {
     this._processRepository = logger;
     this._copy       = copy;
     this.ValueToEdit = valueToEdit;
     InitializeComponent();
 }
        /// <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;
        }
Exemplo n.º 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());
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
        private void Copy()
        {
            Request R = new Request();
            Request R2;

            R2 = ICopy.Clone <Request>(R); /*  ICopy.Clone<Request>(   */
        }
 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;
     }
 }
Exemplo n.º 7
0
        /// <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> >();
        }
Exemplo n.º 9
0
        /// <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);
        }
Exemplo n.º 10
0
        /// <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> >();
        }
        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> >();
        }
Exemplo n.º 15
0
        /// <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);
        }
Exemplo n.º 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> >();
        }
Exemplo n.º 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);
            }
        }
        /// <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;
        }
Exemplo n.º 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> >();
        }
        /// <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;
        }
 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;
 }
 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;
 }
Exemplo n.º 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> >();
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
     }
 }
Exemplo n.º 29
0
 public SuperMegaPrinterMachine(
     IPrinter printer,
     IScan scanner,
     IStaple stapler,
     IFax fax,
     ICopy copier)
 {
     _printer = printer;
     _scanner = scanner;
     _stapler = stapler;
     _fax     = fax;
     _copier  = copier;
 }
Exemplo n.º 30
0
 public SuperMegaPrinterMachine(
     IPrinter printer,
     IScan scanner,
     IStaple stapler,
     IFax fax,
     ICopy copier)
 {
     _printer = printer;
     _scanner = scanner;
     _stapler = stapler;
     _fax = fax;
     _copier = copier;
 }
            public void CopyValue(ICopy copyTo)
            {
                if (Count == 0)
                {
                    return;
                }
                var p = copyTo as PList <T>;

                if (p != null)
                {
                    p.AddRange(this);
                }
            }
Exemplo n.º 32
0
        private void ReplaceSelectedZone(IZone ReplaceZone, ICopy CopyParams)
        {
            IZone zone = worldmap.GetSelectedZone();

            if (zone == null)
            {
                return;
            }

            if (ReplaceZone != null)
            {
                worldmap.ReplaceSelectedZone(ReplaceZone, CopyParams);
            }
        }
Exemplo n.º 33
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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 36
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);
        }
Exemplo n.º 37
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();
 }
Exemplo n.º 38
0
Arquivo: DbWords.cs Projeto: hmehr/OSS
 public void CopyTo(ICopy target, CopyToProgress progressDelegate)
 {
     WordsHelper.CopyWords(this, target as IWords);
 }
Exemplo n.º 39
0
 /// <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();
     }
 }
Exemplo n.º 40
0
        /// <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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 42
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());
                }
            }
        }
Exemplo n.º 43
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);
 }
Exemplo n.º 44
0
        /// <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.");
                    }
            }
        }
Exemplo n.º 45
0
        /// <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);
            }
        }
Exemplo n.º 46
0
        private void ReplaceSelectedZone(IZone ReplaceZone, ICopy CopyParams)
        {
            IZone zone = worldmap.GetSelectedZone();
            if (zone == null)
                return;

            if (ReplaceZone != null)
                worldmap.ReplaceSelectedZone(ReplaceZone, CopyParams);
        }
Exemplo n.º 47
0
 /// <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();
 }
Exemplo n.º 48
0
        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();
        }
Exemplo n.º 49
0
 /// <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);
 }
Exemplo n.º 50
0
 private void copyingToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SettingsCopying.ShowDialog();
     ICopyParams = SettingsCopying.ICopyObj;
 }
Exemplo n.º 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);
            }
        }
Exemplo n.º 52
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(ITextStyle), progressDelegate);
 }