//Methods #region StartSyncProcess public static void StartSyncProcess(SyncTypes sync) { ProcessStartInfo info = new ProcessStartInfo(); info.Arguments = sync.ToString(); info.FileName = ShopperConfiguration.Default.Locations.SyncerApplicationExe.FullName; Process.Start(info); System.Threading.Thread.Sleep(1000); }
public CSyncFile(string[] aFullPathSrc, string RootFolderSrc, CFtpInfoSync[] aFtpInfo, SyncTypes SyncType, bool MinifyJs, string[] aFullPathReferencingJs, string[] aJsFullPathRefered, DateTime DateTimeAfter, string LogFolder) { this._aFullPathSrc = aFullPathSrc; this._RootFolderSrc = RootFolderSrc; this._aFtpInfoDest = aFtpInfo; this._SyncType = SyncType; this._MinifyJs = MinifyJs; if (aFullPathReferencingJs.Length > 0) { this._aFullPathReferencingJs = aFullPathReferencingJs; } if (aJsFullPathRefered.Length > 0) { this._aJsFullPathRefered = aJsFullPathRefered; } this._DateTimeAfter = DateTimeAfter; this._LogFolder = LogFolder; //{ this.mWatcher.IncludeSubdirectories = true; this.mWatcher.EnableRaisingEvents = this.mEnableWatcher; this.mWatcher.NotifyFilter = NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.CreationTime | NotifyFilters.LastWrite; this.mWatcher.Path = RootFolderSrc; this.mWatcher.Changed += new FileSystemEventHandler(mWatcher_Changed); this.mWatcher.Created += new FileSystemEventHandler(mWatcher_Created); this.mWatcher.Renamed += new RenamedEventHandler(mWatcher_Renamed); this.mWatcher.Deleted += new FileSystemEventHandler(mWatcher_Deleted); //} _aFtp = new CFtp2[aFtpInfo.Length]; for (int i = 0; i < _aFtp.Length; i++) { _aFtp[i] = new CFtp2(aFtpInfo[i]); _aFtp[i].BeforeDirectoryUpload += new EventHandler <CBeforeDirectoryUploadEventArgs>(ftp_BeforeDirectoryUpload); _aFtp[i].BeforeFileUpload += new EventHandler <CBeforeFileUploadEventArgs>(ftp_BeforeFileUpload); _aFtp[i].AfterFileUpload += new EventHandler <CAfterFileUploadEventArgs>(ftp_AfterFileUpload); _aFtp[i].FileUploadFailed += new EventHandler <CFileUploadFailedEventArgs>(ftp_FileUploadFailed); } _DestType = DestTypes.Ftp; }
public CSyncFile(string[] aFullPathSrc, string RootFolderSrc, string[] aRootFolderDest, SyncTypes SyncType, bool MinifyJs, string[] aFullPathReferencingJs, string[] aJsFullPathRefered, DateTime DateTimeAfter, string LogFolder) { this._aFullPathSrc = aFullPathSrc; this._RootFolderSrc = RootFolderSrc; this._aRootFolderDest = aRootFolderDest; this._SyncType = SyncType; this._MinifyJs = MinifyJs; if (aFullPathReferencingJs.Length > 0) { this._aFullPathReferencingJs = aFullPathReferencingJs; } if (aJsFullPathRefered.Length > 0) { this._aJsFullPathRefered = aJsFullPathRefered; } this._DateTimeAfter = DateTimeAfter; this._LogFolder = LogFolder; //{ this.mWatcher.IncludeSubdirectories = true; this.mWatcher.EnableRaisingEvents = this.mEnableWatcher; this.mWatcher.NotifyFilter = NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.CreationTime | NotifyFilters.LastWrite; this.mWatcher.Path = RootFolderSrc; this.mWatcher.Changed += new FileSystemEventHandler(mWatcher_Changed); this.mWatcher.Created += new FileSystemEventHandler(mWatcher_Created); this.mWatcher.Renamed += new RenamedEventHandler(mWatcher_Renamed); this.mWatcher.Deleted += new FileSystemEventHandler(mWatcher_Deleted); //} _File.BeforeDirectoryCopy += new EventHandler <CBeforeDirectoryCopyEventArgs>(_File_BeforeDirectoryCopy); _File.BeforeFileCopy += new EventHandler <CBeforeFileCopyEventArgs>(f_BeforeFileCopy); _File.AfterFileCopy += new EventHandler <CAfterFileCopyEventArgs>(f_AfterFileCopy); _DestType = DestTypes.FileSystem; }
private static SyncTarget GetSyncTargetFromJson(SyncTypes syncType, JObject jsonTarget) { SyncTarget st = null; switch (syncType) { case SyncTypes.SyncDown: st = SyncDownTarget.FromJson(jsonTarget); break; case SyncTypes.SyncDownAttachment: st = AttachmentSyncDownTarget.FromJson(jsonTarget); break; case SyncTypes.SyncUp: st = SyncUpTarget.FromJSON(jsonTarget); break; } return(st); }
public CSyncFile(string RootFolderSrc, CFtpInfoSync[] aFtpInfo, SyncTypes SyncType, bool MinifyJs, string[] aFullPathReferencingJs, string[] aJsFullPathRefered, DateTime DateTimeAfter, string LogFolder) : this(null, RootFolderSrc, aFtpInfo, SyncType, MinifyJs, aFullPathReferencingJs, aJsFullPathRefered, DateTimeAfter, LogFolder) { }
public override void OnInspectorGUI() { UdonBehaviour udonTarget = (UdonBehaviour)target; using (new EditorGUI.DisabledScope(Application.isPlaying)) { bool dirty = false; EditorGUILayout.BeginVertical(new GUIStyle(EditorStyles.helpBox)); { SyncTypes selected = (SyncTypes)EditorGUILayout.EnumPopup("Sync Method", udonTarget.Reliable ? SyncTypes.Manual : SyncTypes.Continuous); bool shouldBeReliable = selected == SyncTypes.Manual; if (udonTarget.Reliable != shouldBeReliable) { udonTarget.Reliable = shouldBeReliable; dirty = true; } if (udonTarget.Reliable) { EditorGUILayout.LabelField("Manual replication is intended for infrequently-updated variables of small or large size, and will not be tweened.", EditorStyles.wordWrappedMiniLabel); } else { EditorGUILayout.LabelField("Continuous replication is intended for frequently-updated variable of small size, and will be tweened.", EditorStyles.wordWrappedMiniLabel); } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Udon"); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); _programSourceProperty.objectReferenceValue = EditorGUILayout.ObjectField( "Program Source", _programSourceProperty.objectReferenceValue, typeof(AbstractUdonProgramSource), false ); if (EditorGUI.EndChangeCheck()) { dirty = true; serializedObject.ApplyModifiedProperties(); } if (_programSourceProperty.objectReferenceValue == null) { if (_serializedProgramAssetProperty.objectReferenceValue != null) { _serializedProgramAssetProperty.objectReferenceValue = null; serializedObject.ApplyModifiedPropertiesWithoutUndo(); } List <(string displayName, Type newProgramType)> programSourceTypesForNewMenu = GetProgramSourceTypesForNewMenu(); if (GUILayout.Button("New Program")) { (string displayName, Type newProgramType) = programSourceTypesForNewMenu.ElementAt(_newProgramType); string udonBehaviourName = udonTarget.name; Scene scene = udonTarget.gameObject.scene; if (string.IsNullOrEmpty(scene.path)) { Debug.LogError("You need to save the scene before you can create new Udon program assets!"); } else { AbstractUdonProgramSource newProgramSource = CreateUdonProgramSourceAsset(newProgramType, displayName, scene, udonBehaviourName); _programSourceProperty.objectReferenceValue = newProgramSource; _serializedProgramAssetProperty.objectReferenceValue = newProgramSource.SerializedProgramAsset; serializedObject.ApplyModifiedProperties(); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); _newProgramType = EditorGUILayout.Popup( "", Mathf.Clamp(_newProgramType, 0, programSourceTypesForNewMenu.Count), programSourceTypesForNewMenu.Select(t => t.displayName).ToArray(), GUILayout.ExpandWidth(false) ); if (EditorGUI.EndChangeCheck()) { EditorPrefs.SetInt(VRC_UDON_NEW_PROGRAM_TYPE_PREF_KEY, _newProgramType); } } else { EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); using (new EditorGUI.DisabledScope(true)) { EditorGUI.indentLevel++; EditorGUILayout.ObjectField( "Serialized Udon Program Asset ID: ", _serializedProgramAssetProperty.objectReferenceValue, typeof(AbstractSerializedUdonProgramAsset), false ); EditorGUI.indentLevel--; } AbstractUdonProgramSource programSource = (AbstractUdonProgramSource)_programSourceProperty.objectReferenceValue; AbstractSerializedUdonProgramAsset serializedUdonProgramAsset = programSource.SerializedProgramAsset; if (_serializedProgramAssetProperty.objectReferenceValue != serializedUdonProgramAsset) { _serializedProgramAssetProperty.objectReferenceValue = serializedUdonProgramAsset; serializedObject.ApplyModifiedPropertiesWithoutUndo(); } } EditorGUILayout.EndHorizontal(); udonTarget.RunEditorUpdate(ref dirty); if (dirty && !Application.isPlaying) { EditorSceneManager.MarkSceneDirty(udonTarget.gameObject.scene); } } }
public static bool CanSync(System.Type type) => SyncTypes.Contains(type);
private static void GenerateDeprecatedColumns(Table Table, SyncTypes SyncType, Column[] OldColumns, Index[] OldIndecies, StringBuilder Builder, StringBuilder KeepSyncTypeBuilder = null) { List <Index> toModifyIndecies = new List <Index>(); for (int i = 0; i < OldColumns.Length; ++i) { Column oldColumn = OldColumns[i]; if (SyncType == SyncTypes.Keep && oldColumn.Name.EndsWith(DEPRECATED_POST_FIX)) { continue; } bool contains = false; for (int j = 0; j < Table.Columns.Length; ++j) { Column newColumn = Table.Columns[j]; if (newColumn.Name != oldColumn.Name) { continue; } contains = true; break; } if (contains) { continue; } for (int j = 0; j < OldIndecies.Length; ++j) { Index index = OldIndecies[j]; if (Array.IndexOf(index.Columns, oldColumn.Name) == -1) { continue; } index.RemmoveColumn(oldColumn.Name); if (SyncType == SyncTypes.Keep) { index.AddColumn(GetDeprecatedColumnName(oldColumn.Name)); } toModifyIndecies.Add(index); GenerateDropInex(Table, index, Builder); } switch (SyncType) { case SyncTypes.Delete: GenerateDropColumn(Table, oldColumn, Builder); Builder.AppendLine(); break; case SyncTypes.Keep: GenerateDeprecatedColumn(Table, oldColumn, Builder, KeepSyncTypeBuilder); Builder.AppendLine(); break; } } if (Table.IndexGroup != null) { for (int i = 0; i < Table.IndexGroup.Indecies.Length; ++i) { Index index = Table.IndexGroup.Indecies[i]; bool found = false; for (int j = 0; j < OldIndecies.Length; ++j) { if (index.Name != OldIndecies[j].Name) { continue; } found = true; break; } if (found) { continue; } toModifyIndecies.Add(index); } } for (int i = 0; i < toModifyIndecies.Count; ++i) { Index index = toModifyIndecies[i]; if (index.Columns.Length == 0) { continue; } GenerateCreateIndex(Table, index, Builder); } }
public static void GenerateCreateTable(Database Database, Table Table, SyncTypes SyncType, StringBuilder Builder, StringBuilder KeepSyncTypeBuilder = null) { if (!IsTableExists(Database, Table)) { Builder.Append("CREATE TABLE `"); Builder.Append(Table.Name); Builder.Append('`'); Builder.AppendLine(); Builder.Append("("); string primaryKey = ""; for (int i = 0; i < Table.Columns.Length; ++i) { if (i != 0) { Builder.Append(','); Builder.AppendLine(); } Column column = Table.Columns[i]; Builder.Append("`"); Builder.Append(column.Name); Builder.Append("` "); GenerateDataType(column.DataType, Builder); GeneratePreFlags(column.FlagMask, Builder); GenerateDefaultValue(column, Builder); if (MaskContainsFlag(column.FlagMask, Flags.PrimaryKey)) { primaryKey = column.Name; } } if (!string.IsNullOrEmpty(primaryKey)) { Builder.Append(','); Builder.AppendLine(); Builder.Append("PRIMARY KEY(`"); Builder.Append(primaryKey); Builder.Append("`)"); Builder.AppendLine(); } GenerateCreateIndexGroup(Table.IndexGroup, Builder); Builder.Append(')'); Builder.Append("ENGINE="); Builder.Append(Table.Engine); Builder.Append(' '); GenerateCollate(Table.Collate, Builder); Builder.Append(';'); Builder.AppendLine(); return; } Column[] oldColumns = GetColumns(Database, Table.Name); Index[] oldIndecies = GetIndecies(Database, Table.Name); GenerateNewColumnsAdd(Database, Table, oldColumns, Builder); GenerateDeprecatedColumns(Table, SyncType, oldColumns, oldIndecies, Builder, KeepSyncTypeBuilder); }
public static void GenerateCreateCatalog(Database Database, Catalog Catalog, SyncTypes SyncType, StringBuilder Builder, StringBuilder KeepSyncTypeBuilder = null) { if (!IsCatalogExists(Database, Catalog)) { Builder.Append("CREATE DATABASE "); Builder.Append(Catalog.Name); Builder.Append(';'); Builder.AppendLine(); } Builder.Append("USE "); Builder.Append(Catalog.Name); Builder.Append(';'); Builder.AppendLine(); for (int i = 0; i < Catalog.Tables.Length; ++i) { GenerateCreateTable(Database, Catalog.Tables[i], SyncType, Builder, KeepSyncTypeBuilder); } }