コード例 #1
0
ファイル: DataSynJob.cs プロジェクト: janproch/datadmin
        public static void Synchronize(IDatabaseSource src, IDatabaseSource dst, IProgressInfo progress, DataSynDef datasyn, DataSynReportEnv repenv, string outFile, DataSynGuiEnv guienv)
        {
            Synchronizer syn = new Synchronizer(src, dst, progress, datasyn, repenv, outFile, guienv);

            syn.Progress = progress;
            syn.Run();
        }
コード例 #2
0
        public OutputProgressWindow(
            string baseName,
            bool showClipping,
            IProgressInfo progressInfo,
            IBufferLoading bufferLoading,
            Synthesizer.IStopTask stopCallback,
            IFinished finished,
            IWaitFinished waitFinished,
            ShowCompletionMethod showError)
        {
            this.stopCallback   = stopCallback;
            this.bufferLoading  = bufferLoading;
            this.progressInfo   = progressInfo;
            this.finished       = finished;
            this.waitFinished   = waitFinished;
            this.showCompletion = showError;

            InitializeComponent();
            this.Icon = OutOfPhase.Properties.Resources.Icon2;

            DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom);

            if (!showClipping)
            {
                labelTotalClippedPoints.Visible = false;
                textTotalClippedPoints.Visible  = false;
            }

            UpdateValues();
            this.Text = String.Format("{0} - {1}", baseName, "Synthesis");
        }
コード例 #3
0
 // GenerateSql can return NULL, if SQL cannot be generated for given dialect
 public string GenerateSql(ISqlDialect dialect, DbTypeBase targetType, IProgressInfo progress)
 {
     try
     {
         return(dialect.GenerateScript(dmp => { dmp.ProgressInfo = progress; GenerateSql(dmp, targetType); }));
     }
     catch (SyntaxNotSupportedError)
     {
         return(null);
     }
 }
コード例 #4
0
 public override void DoLoad(IProgressInfo progressInfo)
 {
     if (m_parent != null)
     {
         if (m_parent.CurrentState != null)
         {
             m_project  = m_parent.CurrentState.Project;
             m_verseRef = m_parent.CurrentState.VerseRef;
             Invoke((Action)(() => ShowProjectInfo()));
         }
     }
 }
コード例 #5
0
        public override string ToString()
        {
            IProgressInfo me  = (IProgressInfo)this;
            TimeSpan      rem = me.Remaining;
            TimeSpan      ela = me.Elapsed;

            return("{0:0.00}% | {1}/{2} | Elap: {3} + Rem: {4} = Total: {5} -> Finish: {6:u}".FormatWith(
                       me.Percentage, current, count,
                       ela.NiceToString(DateTimePrecision.Seconds),
                       rem.NiceToString(DateTimePrecision.Seconds),
                       (ela + rem).NiceToString(DateTimePrecision.Seconds),
                       (DateTime.UtcNow + rem).ToLocalTime()));
        }
コード例 #6
0
 public void Rerun(IProgressInfo progressInfo)
 {
     progressInfo.Initialize("Building list", 100, 0);
     for (int i = 0; i < 100; i++)
     {
         progressInfo.Value = i;
         Thread.Sleep(5 * 1000 / 100);
         if (progressInfo.CancelRequested)
         {
             MessageBox.Show("List generation canceled");
             return;
         }
     }
     IReferenceListWindow refList = m_Host.ReferenceList;
     IReadOnlyList <IReferenceListItem> mylist = refList.AllListItems;
 }
コード例 #7
0
ファイル: MigrateTool.cs プロジェクト: janproch/datadmin
        public static void RemoveNonPk1AutoIncrements(TableStructure table, IProgressInfo progress)
        {
            IPrimaryKey pk = table.FindConstraint <IPrimaryKey>();

            foreach (ColumnStructure col in table.Columns)
            {
                var type = col.DataType;
                if (type is DbTypeInt && ((DbTypeInt)type).Autoincrement)
                {
                    if (pk == null || pk.Columns.Count != 1 || pk.Columns[0].ColumnName != col.ColumnName)
                    {
                        type.SetAutoincrement(false);
                        progress.LogMessage("migrate", LogLevel.Warning, "Removed autoincrement flag, column {0}.{1} is not primary key", table.FullName, col.ColumnName);
                    }
                }
            }
        }
コード例 #8
0
        public static void RaiseErrorEx(this IProgressInfo progress, Exception err, string message, string category)
        {
            string longmsg = String.Format("{0} ({1})", message, err.Message);

            if (category != null)
            {
                progress.LogMessage(category, LogLevel.Error, longmsg);
            }
            Logging.Error("Error: {0}; {1}", message, err);
            if (progress != null)
            {
                progress.RaiseError(longmsg);
            }
            else
            {
                throw new Exception(message, err);
            }
        }
コード例 #9
0
 public Synchronizer(IDatabaseSource src, IDatabaseSource dst, IProgressInfo progress, DataSynDef datasyn, DataSynReportEnv repenv, string outFile, DataSynGuiEnv guienv)
 {
     m_source       = src;
     m_target       = dst;
     m_progress     = progress;
     m_datasyn      = datasyn;
     m_outFile      = outFile;
     m_srcSada      = m_source.Dialect.CreateDataSynAdapter();
     m_dstSada      = m_target.Dialect.CreateDataSynAdapter();
     m_dstDDA       = m_target.GetAnyDDA();
     m_reportEnvObj = repenv;
     m_reportEnv    = repenv;
     m_guienv       = guienv;
     if (m_reportEnv == null)
     {
         m_reportEnv = new DummyDataSynReportEnv();
     }
 }
コード例 #10
0
        /// <summary>
        /// ライブラリを更新します。
        /// </summary>
        /// <param name="progressInfo"></param>
        public void Update(IProgressInfo progressInfo)
        {
            if (SearchDirectoryPaths.Count == 0)
            {
                // 一番使用されているパスを検索対象とする。
                var mostUseDirectoryPath = _movselexLibrary.SelectMostUseDirectoryPath();
                if (!string.IsNullOrEmpty(mostUseDirectoryPath)) _searchDirectoryPaths.Add(mostUseDirectoryPath);
            }

            _searchDirectoryPaths.DebugWriteJson("SearchDirectoryPaths");

            foreach (var searchDirectoryPath in SearchDirectoryPaths)
            {
                // 検索対象ディレクトリからサポートしている拡張子のファイルだけ抜く。
                var registFiles = GetSupportFiles(searchDirectoryPath);

                _movselexLibrary.Regist(registFiles, progressInfo);
            }

            _movselexLibrary.ReScan(_movselexLibrary.GetInCompleteIds());
        }
コード例 #11
0
ファイル: DatabaseAnalyser.cs プロジェクト: janproch/datadmin
        public DatabaseStructure Run(ISqlDialect dialect, IPhysicalConnection conn, string dbname, DatabaseStructureMembers members, IProgressInfo progress)
        {
            AnalyserCache = conn.Cache.GetAnalyserCache(dbname);
            m_conn        = conn;
            //m_serverVersion = m_dbConn.ServerVersion;
            //ParseVersion();
            m_dialect      = dialect;
            m_members      = members;
            m_dbname       = dbname;
            m_progress     = progress;
            m_db.Dialect   = m_dialect;
            m_definedSpecs = m_dialect.GetSpecificTypes();


            PrepareMembers();

            SetCurWork(Texts.Get("s_loading_tables"));
            LoadDomains();
            LoadTableList();
            LoadTableColumns();
            LoadConstraints();
            LoadIndexes();
            AfterLoadIndexesOrConstraints();
            InternalAfterLoadConstraints();
            MarkFilledTableMembers();
            LoadSchemata();
            LoadCharacterSets();
            LoadCollations();

            SetCurWork(Texts.Get("s_loading_objects"));
            LoadSpecificObjects();

            LoadDatabaseOptions();
            LoadViewsAsTables();

            LoadDependencies();

            return(m_db);
        }
コード例 #12
0
        public override void DoLoad(IProgressInfo progressInfo)
        {
            // Actually do the load:
            // Since DoLoad is done on a different thread than what was used
            // to create the control, we need to use the Invoke method.
            Invoke((Action)(() => LoadSavedText()));

            // Illustrate use of progressInfo
            const int MAX_TIME = 100;

            progressInfo.Initialize("Loading Reference F", MAX_TIME);
            for (int i = 0; i < MAX_TIME; i++)
            {
                if (progressInfo.CancelRequested)
                {
                    m_writeLock.Dispose();
                    m_writeLock      = null;
                    textBox.Text     = "";
                    textBox.ReadOnly = true;
                }
                Thread.Sleep(20);
                progressInfo.Value = i;
            }
        }
コード例 #13
0
ファイル: DialectBase.cs プロジェクト: janproch/datadmin
        public virtual DbTypeBase MigrateDataType(IColumnStructure owningColumn, DbTypeBase type, IMigrationProfile profile, IProgressInfo progress)
        {
            ISpecificType spectype = GenericTypeToSpecific(type, profile, progress);

            //if (!DialectCaps.Arrays && type.ArraySpec.IsArray)
            //{
            //    return new DbTypeText(); // migrate arrays as text blob
            //}
            return(spectype.ToGenericType());
        }
コード例 #14
0
ファイル: DialectBase.cs プロジェクト: janproch/datadmin
 protected virtual Constraint MigrateConstraintOrIndex(Constraint cnt, IMigrationProfile profile, IProgressInfo progress)
 {
     if (cnt is IPrimaryKey)
     {
         if (DialectCaps.AnonymousPrimaryKey)
         {
             PrimaryKey pk = (PrimaryKey)cnt;
             pk.Name = DbObjectNameTool.PkName(pk.Table.FullName);
         }
     }
     return(cnt);
 }
コード例 #15
0
ファイル: DialectBase.cs プロジェクト: janproch/datadmin
 public virtual void MigrateDatabase(DatabaseStructure db, IMigrationProfile profile, IProgressInfo progress)
 {
     if (db.Dialect.SameDialect(this))
     {
         return;
     }
     foreach (TableStructure table in db.Tables)
     {
         MigrateTable(table, profile, progress);
     }
     db.Dialect = this;
 }
コード例 #16
0
 public static IEnumerable <T> ToProgressEnumerator <T>(this IEnumerable <T> source, out IProgressInfo pi)
 {
     pi = new ProgressEnumerator <T>(source, source.Count());
     return((IEnumerable <T>)pi);
 }
コード例 #17
0
        public override ISpecificType GenericTypeToSpecific(DbTypeBase type, IMigrationProfile profile, IProgressInfo progress)
        {
            switch (type.Code)
            {
            case DbTypeCode.Int:
                return(GetEfzTypeInt((DbTypeInt)type));

            case DbTypeCode.String:
                return(GetEfzTypeString((DbTypeString)type));

            case DbTypeCode.Logical:
                return(new EfzTypeBoolean());

            case DbTypeCode.Datetime:
            {
                string attr  = type.GetSpecificAttribute("effiproz", "subtype");
                var    dtype = type as DbTypeDatetime;
                if (attr == "timestamp")
                {
                    var res = new EfzTypeTimestamp();
                    res.Precision = Int32.Parse(type.GetSpecificAttribute("effiproz", "precision"));
                    return(res);
                }
                if (attr == "yeartomonth")
                {
                    var res = new EfzTypeIntervalYearToMonth();
                    //res.Precision = Int32.Parse(type.GetSpecificAttribute("effiproz", "precision"));
                    return(res);
                }
                if (attr == "daytosecond")
                {
                    var res = new EfzTypeIntervalDayToSecond();
                    //res.Precision = Int32.Parse(type.GetSpecificAttribute("effiproz", "precision"));
                    return(res);
                }
                if (attr == "date")
                {
                    var res = new EfzTypeDate();
                    return(res);
                }

                switch (dtype.SubType)
                {
                case DbDatetimeSubType.Date:
                    return(new EfzTypeDate());

                case DbDatetimeSubType.Datetime:
                    if (dtype.HasTimeZone)
                    {
                        return(new EfzTypeTimestampTz());
                    }
                    else
                    {
                        return(new EfzTypeTimestamp());
                    }

                case DbDatetimeSubType.Interval:
                    return(new EfzTypeIntervalDayToSecond());

                case DbDatetimeSubType.Time:
                    return(new EfzTypeTimestamp());

                case DbDatetimeSubType.Year:
                    return(new EfzTypeDate());
                }
                return(new EfzTypeTimestamp());
            }

            case DbTypeCode.Numeric:
            {
                var res = new EfzTypeNumber();
                res.Precision  = ((DbTypeNumeric)type).Precision;
                res.Scale      = ((DbTypeNumeric)type).Scale;
                res.IsIdentity = ((DbTypeNumeric)type).Autoincrement;

                int increment;
                if (Int32.TryParse(type.GetSpecificAttribute("effiproz", "identity_increment"), out increment))
                {
                    res.IdentityIncrement = increment;
                    res.IdentitySeed      = Int32.Parse(type.GetSpecificAttribute("effiproz", "identity_seed"));
                }
                return(res);
            }

            case DbTypeCode.Blob:
            {
                var    res  = new EfzTypeBlob();
                string size = type.GetSpecificAttribute("effiproz", "maxbytes");
                if (size != null)
                {
                    res.MaxBytes = Int32.Parse(size);
                }
                return(res);
            }

            case DbTypeCode.Text:
            {
                var    res  = new EfzTypeClob();
                string size = type.GetSpecificAttribute("effiproz", "maxbytes");
                if (size != null)
                {
                    res.MaxBytes = Int32.Parse(size);
                }
                return(res);
            }

            case DbTypeCode.Array:
                return(new EfzTypeClob());

            case DbTypeCode.Float:
                return(new EfzTypeDouble());

            case DbTypeCode.Xml:
                return(new EfzTypeClob());

            case DbTypeCode.Generic:
                return(new EfzTypeGeneric {
                    Sql = ((DbTypeGeneric)type).Sql
                });
            }
            throw new Exception("DAE-00323 unknown type");
        }
コード例 #18
0
 public static void InvokeScript(this IDatabaseSource db, Action <ISqlDumper> script, IProgressInfo progress)
 {
     db.InvokeScript(script, progress, false);
 }
コード例 #19
0
        public static IDatabaseStructure InvokeLoadStructure(this IDatabaseSource db, DatabaseStructureMembers members, IProgressInfo progress)
        {
            if (db.Connection == null)
            {
                return(db.LoadDatabaseStructure(members, progress));
            }
            IAsyncResult async = db.Connection.BeginInvoke(
                (Func <IDatabaseStructure>) delegate() { return(db.LoadDatabaseStructure(members, progress)); },
                null);

            Async.WaitFor(async);
            return((IDatabaseStructure)db.Connection.EndInvoke(async));
        }
コード例 #20
0
 public void RegistFiles(string[] files, IProgressInfo progressInfo)
 {
     var registFiles = files.SelectMany(x => Directory.Exists(x) ? GetSupportFiles(x) : new[] {x});
     _movselexLibrary.Regist(registFiles, progressInfo);
 }
コード例 #21
0
ファイル: MainModel.cs プロジェクト: PureDeep/EatEat_New
 void OnUpdatedOperationProgress(IProgressInfo progressInfo)
 {
     OperationProgressChange?.Invoke(progressInfo);
 }
コード例 #22
0
        //public static List<NameWithSchema> InvokeLoadFullTableNames(this IPhysicalConnection conn, string dbname)
        //{
        //    DatabaseStructureMembers dbmem = new DatabaseStructureMembers { TableList = true };
        //    IDatabaseStructure dbs = conn.InvokeLoadStructure(dbname, dbmem);
        //    return dbs.GetTableNames();
        //}

        public static IDatabaseStructure InvokeLoadStructure(this IPhysicalConnection conn, string dbname, DatabaseStructureMembers members, IProgressInfo progress)
        {
            IAsyncResult async = conn.BeginInvoke(
                (Func <IDatabaseStructure>) delegate() { return(conn.Dialect.AnalyseDatabase(conn, dbname, members, progress)); },
                null);

            Async.WaitFor(async);
            return((IDatabaseStructure)conn.EndInvoke(async));
        }
コード例 #23
0
        public static void RunScript(this IPhysicalConnection conn, Action <ISqlDumper> script, DbTransaction trans, IProgressInfo progress)
        {
            ConnectionSqlOutputStream sqlo = new ConnectionSqlOutputStream(conn.SystemConnection, trans, conn.Dialect);
            ISqlDumper fmt = conn.Dialect.CreateDumper(sqlo, SqlFormatProperties.Default);

            fmt.ProgressInfo = progress;
            script(fmt);
        }
コード例 #24
0
        //public override bool IsSystemTable(string schema, string table)
        //{
        //    return table.Contains("$") || table == "HELP";
        //}

        public override ISpecificType GenericTypeToSpecific(DbTypeBase type, IMigrationProfile profile, IProgressInfo progress)
        {
            switch (type.Code)
            {
            case DbTypeCode.Array:
                return(new OracleTypeClob());

            case DbTypeCode.Blob:
                if (type.GetSpecificAttribute("oracle", "subtype") == "longraw")
                {
                    return(new OracleTypeLongRaw());
                }
                return(new OracleTypeBlob());

            case DbTypeCode.Datetime:
            {
                var    dtype   = (DbTypeDatetime)type;
                string subtype = type.GetSpecificAttribute("oracle", "subtype");
                if (subtype == "timestamp")
                {
                    var res = new OracleTypeTimestamp();
                    try { res.TimeZone = (TimeZoneType)Enum.Parse(typeof(TimeZoneType), type.GetSpecificAttribute("oracle", "timezone"), true); }
                    catch { res.TimeZone = TimeZoneType.None; }
                    string fprec = type.GetSpecificAttribute("oracle", "fractionalprecision");
                    if (fprec != null)
                    {
                        res.FractionalPrecision = Int32.Parse(fprec);
                    }
                    return(res);
                }
                if (subtype == "yeartomonth")
                {
                    var    res   = new OracleTypeIntervalYearToMonth();
                    string yprec = type.GetSpecificAttribute("oracle", "yearprecision");
                    if (yprec != null)
                    {
                        res.YearPrecision = Int32.Parse(yprec);
                    }
                    return(res);
                }
                if (subtype == "daytosecond")
                {
                    var    res   = new OracleTypeIntervalDayToSecond();
                    string dprec = type.GetSpecificAttribute("oracle", "dayprecision");
                    string fprec = type.GetSpecificAttribute("oracle", "fractionalprecision");
                    if (dprec != null)
                    {
                        res.DayPrecision = Int32.Parse(dprec);
                    }
                    if (fprec != null)
                    {
                        res.FractionalPrecision = Int32.Parse(fprec);
                    }
                    return(res);
                }
                if (dtype.SubType == DbDatetimeSubType.Interval)
                {
                    return(new OracleTypeIntervalDayToSecond());
                }
                return(new OracleTypeDate());
            }

            case DbTypeCode.Float:
                if (type.GetSpecificAttribute("oracle", "subtype") == "number")
                {
                    return(new OracleTypeNumber());
                }
                if (((DbTypeFloat)type).Bytes == 4)
                {
                    return(new OracleTypeBinaryFloat());
                }
                return(new OracleTypeBinaryDouble());

            case DbTypeCode.Generic:
                return(new OracleTypeGeneric {
                    Sql = ((DbTypeGeneric)type).Sql
                });

            case DbTypeCode.Int:
            {
                string ilen = type.GetSpecificAttribute("oracle", "length");
                if (ilen != null)
                {
                    return new OracleTypeNumber
                           {
                               Precision = Int32.Parse(ilen)
                           }
                }
                ;
            }
                return(new OracleTypeInteger());

            case DbTypeCode.Logical:
                return(new OracleTypeInteger());

            case DbTypeCode.Numeric:
            {
                var ntype = (DbTypeNumeric)type;
                if (type.GetSpecificAttribute("oracle", "noprec") == "1")
                {
                    return new OracleTypeNumber
                           {
                               Scale = ntype.Scale
                           }
                }
                ;
                return(new OracleTypeNumber
                    {
                        Precision = ntype.Precision,
                        Scale = ntype.Scale
                    });
            }

            case DbTypeCode.String:
            {
                string subtype = type.GetSpecificAttribute("oracle", "subtype");
                if (subtype != null)
                {
                    switch (subtype)
                    {
                    case "rowid": return(new OracleTypeRowId());

                    case "urowid": return(new OracleTypeURowId());

                    case "mlslabel": return(new OracleTypeMlsLabel());

                    case "bfile": return(new OracleTypeBFile());
                    }
                }
                var stype = (DbTypeString)type;
                if (stype.IsBinary)
                {
                    return new OracleTypeRaw {
                               Length = stype.Length
                    }
                }
                ;
                if (stype.IsVarLength)
                {
                    if (stype.IsUnicode)
                    {
                        return new OracleTypeNVarChar2 {
                                   Length = stype.Length
                        }
                    }
                    ;
                    else
                    {
                        return new OracleTypeVarChar2 {
                                   Length = stype.Length
                        }
                    };
                }
                else
                {
                    if (stype.IsUnicode)
                    {
                        return new OracleTypeNChar {
                                   Length = stype.Length
                        }
                    }
                    ;
                    else
                    {
                        return new OracleTypeChar {
                                   Length = stype.Length
                        }
                    };
                }
            }

            case DbTypeCode.Text:
                if (type.GetSpecificAttribute("oracle", "subtype") == "long")
                {
                    return(new OracleTypeLong());
                }
                if (((DbTypeText)type).IsUnicode)
                {
                    return(new OracleTypeNClob());
                }
                else
                {
                    return(new OracleTypeClob());
                }

            case DbTypeCode.Xml:
                return(new OracleTypeXml());
            }
            throw new Exception("DAE-00342 unknown type");
        }
コード例 #25
0
ファイル: DialectBase.cs プロジェクト: janproch/datadmin
        public IDatabaseStructure AnalyseDatabase(IPhysicalConnection conn, string dbname, DatabaseStructureMembers members, IProgressInfo progress)
        {
            DatabaseAnalyser analyser = CreateAnalyser();

            try
            {
                return(analyser.Run(this, conn, dbname, members, progress));
            }
            catch (Exception err)
            {
                conn.FillInfo(err.Data);
                err.Data["analyse_dbname"] = dbname;
                throw;
            }
        }
コード例 #26
0
 public static void InvokeScript(this IDatabaseSource db, Action <ISqlDumper> script, IProgressInfo progress, bool denyTransaction)
 {
     db.Connection.Invoke(
         (Action) delegate()
     {
         db.Connection.SystemConnection.SafeChangeDatabase(db.DatabaseName);
         DbTransaction tran = null;
         if (db.Dialect.DialectCaps.NestedTransactions && !denyTransaction)
         {
             tran = db.Connection.SystemConnection.BeginTransaction();
         }
         try
         {
             db.Connection.RunScript(script, tran, progress);
         }
         catch
         {
             if (tran != null)
             {
                 tran.Rollback();
             }
             throw;
         }
         if (tran != null)
         {
             tran.Commit();
         }
     });
 }
コード例 #27
0
ファイル: DialectBase.cs プロジェクト: janproch/datadmin
 public virtual ISpecificType GenericTypeToSpecific(DbTypeBase generic, IMigrationProfile profile, IProgressInfo progress)
 {
     return(generic);
 }
コード例 #28
0
 public override void DoLoad(IProgressInfo progressInfo)
 {
     // Since DoLoad is done on a different thread than what was used
     // to create the control, we need to use the Invoke method.
     Invoke((Action)(() => ShowScripture()));
 }
コード例 #29
0
ファイル: DialectBase.cs プロジェクト: janproch/datadmin
        //public virtual string Symbols { get { return "()=+-<>*/"; } }

        public virtual string GetSpecificExpression(SqlSpecialConstant specConst, DbTypeBase type, IProgressInfo progress)
        {
            return(null);
        }
コード例 #30
0
 public IDatabaseStructure LoadDatabaseStructure(DatabaseStructureMembers members, IProgressInfo progress)
 {
     return(Conn.GetStructure());
 }
コード例 #31
0
ファイル: DialectBase.cs プロジェクト: janproch/datadmin
        public virtual void MigrateTable(TableStructure table, IMigrationProfile profile, IProgressInfo progress)
        {
            foreach (ColumnStructure col in table.Columns)
            {
                // character and collation is not portable
                col.Collation    = "";
                col.CharacterSet = "";
                col.DataType     = MigrateDataType(col, col.DataType, profile, progress);
                List <string> todel = new List <string>();
                foreach (string attr in col.SpecificData.Keys)
                {
                    if (!attr.StartsWith(DialectName + "."))
                    {
                        todel.Add(attr);
                    }
                }
                foreach (string d in todel)
                {
                    col.SpecificData.Remove(d);
                }
            }
            var newConstraints = new List <Constraint>();

            foreach (Constraint cnt in table.Constraints)
            {
                var newcnt = MigrateConstraintOrIndex(cnt, profile, progress);
                if (newcnt != null)
                {
                    newConstraints.Add(newcnt);
                }
            }
            table._Constraints.Clear();
            foreach (var cnt in newConstraints)
            {
                table._Constraints.Add(cnt);
            }
        }
コード例 #32
0
 public override void DoLoad(IProgressInfo progressInfo)
 {
 }
コード例 #33
0
        /// <summary>
        /// ライブラリにファイルを登録します。
        /// </summary>
        /// <param name="registFiles"></param>
        /// <param name="progressInfo"></param>
        public void Regist(IEnumerable<string> registFiles, IProgressInfo progressInfo)
        {
            
            using (var tran = _databaseAccessor.BeginTransaction())
            {
                var existsFiles = _databaseAccessor.SelectAllLibraryFilePaths().ToList();

                var i = 1;
                var regfiles = registFiles.ToArray();
                foreach (var registFile in regfiles)
                {
                    progressInfo.UpdateProgressMessage("Regist Files", Path.GetFileName(registFile), i++, regfiles.Length);
                    if (!existsFiles.Contains(registFile))
                    {

                        // 未登録の場合のみ登録する
                        var mediaFile = new MediaFile(registFile);
                        if (mediaFile.Duration == TimeSpan.Zero) continue; // 不完全ファイルは追加しない。
                        _movselexGroup.SetMovGroup(mediaFile);
                        var isSuccess = _databaseAccessor.InsertMediaFile(mediaFile);
                        if (isSuccess)
                        {
                            _log.Info("Registed Media File. Id:{0} Title:{1} Group:{2}", mediaFile.Id, mediaFile.MovieTitle, mediaFile.GroupName);
                            mediaFile.DebugWriteJson("RegistMedia");
                            existsFiles.Add(registFile);
                        }
                        else
                        {
                            _log.Error("Fail Regist Media File. Id:{0} Title:{1} Group:{2} Detail:{3}", mediaFile.Id, mediaFile.MovieTitle, mediaFile.GroupName, mediaFile.ToJson());
                        }
                    }
                    else
                    {
                        // TODO: 同じものがあればファイルパス更新
                    }
                }
                tran.Commit();
            }


        }